summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-06-25 09:29:07 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-06-25 11:34:31 +0200
commitfc1db28c9b1b13c5b9e6baf6d24963081f18f017 (patch)
treed4adc2a358772396febfbc3a9f7c7e8a25536d20 /web/lib
parent8260111bcce49b73bd4973ae80296c913af2631d (diff)
downloadaur-fc1db28c9b1b13c5b9e6baf6d24963081f18f017.tar.gz
aur-fc1db28c9b1b13c5b9e6baf6d24963081f18f017.tar.xz
Allow for closing package requests
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>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/pkgbasefuncs.inc.php26
-rw-r--r--web/lib/routing.inc.php6
2 files changed, 30 insertions, 2 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 505bb511..a039f836 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -975,10 +975,12 @@ function pkgbase_request_list() {
$q.= "PackageRequests.PackageBaseID AS BaseID, ";
$q.= "PackageRequests.PackageBaseName AS Name, ";
$q.= "RequestTypes.Name AS Type, PackageRequests.Comments, ";
- $q.= "Users.Username AS User, PackageRequests.RequestTS ";
+ $q.= "Users.Username AS User, PackageRequests.RequestTS, ";
+ $q.= "PackageRequests.Status ";
$q.= "FROM PackageRequests INNER JOIN RequestTypes ON ";
$q.= "RequestTypes.ID = PackageRequests.ReqTypeID ";
- $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID";
+ $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID ";
+ $q.= "ORDER BY Status ASC, RequestTS DESC";
return $dbh->query($q)->fetchAll();
}
@@ -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
+ */
+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."));
+}
diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php
index 5836a137..2fa3e1f7 100644
--- a/web/lib/routing.inc.php
+++ b/web/lib/routing.inc.php
@@ -21,6 +21,7 @@ $ROUTES = array(
$PKG_PATH = '/packages';
$PKGBASE_PATH = '/pkgbase';
+$PKGREQ_PATH = '/requests';
$USER_PATH = '/account';
function get_route($path) {
@@ -55,6 +56,11 @@ function get_pkgbase_route() {
return $PKGBASE_PATH;
}
+function get_pkgreq_route() {
+ global $PKGREQ_PATH;
+ return $PKGREQ_PATH;
+}
+
function get_pkg_uri($pkgname) {
global $USE_VIRTUAL_URLS;
global $PKG_PATH;