On 25.06.2014 11:44, Lukas Fleischer wrote:
This allows Trusted Users to close package requests via the request list. Also, entries are now sorted such that open requests are shown before closed requests.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- UPGRADING | 1 + schema/aur-schema.sql | 1 + web/html/css/aur.css | 30 ++++++++++++++++-------------- web/html/pkgbase.php | 8 +++++++- web/lib/pkgbasefuncs.inc.php | 26 ++++++++++++++++++++++++-- web/lib/routing.inc.php | 6 ++++++ web/template/pkgreq_results.php | 18 ++++++++++++++++++ 7 files changed, 73 insertions(+), 17 deletions(-)
[...]
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 505bb51..a039f83 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -1070,3 +1072,23 @@ function pkgbase_file_request($ids, $type, $comments) {
return array(true, __("Added request successfully.")); } + +/** + * Close a deletion/orphan request + * + * @param int $id The package request to close + * + * @return void
You return an array, not void.
+ */ +function pkgbase_close_request($id) { + $dbh = DB::connect(); + + if (!check_user_privileges()) { + return array(false, __("Only TUs and developers can close requests.")); + } + + $q = "UPDATE PackageRequests SET Status = 1 WHERE ID = " . intval($id); + $dbh->exec($q); + + return array(true, __("Request closed successfully.")); +}