summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgbasefuncs.inc.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-06-25 10:43:41 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-06-25 11:36:15 +0200
commit959c61a77dd6a41bf82cc12b5eb873c9cfb0ffb8 (patch)
tree3c72832cba6fa9c1d715895f375a9645fc54b183 /web/lib/pkgbasefuncs.inc.php
parentd8dbad0c3ec28f531bb057fea8b76e3faa235da6 (diff)
downloadaur-959c61a77dd6a41bf82cc12b5eb873c9cfb0ffb8.tar.gz
aur-959c61a77dd6a41bf82cc12b5eb873c9cfb0ffb8.tar.xz
Add an accept button to the package request list
This button allows for accepting a request, disowning the affected package or redirecting to the package deletion page. The request is closed automatically when the action has been performed. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/pkgbasefuncs.inc.php')
-rw-r--r--web/lib/pkgbasefuncs.inc.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index a039f836..2444674f 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -438,10 +438,11 @@ function pkgbase_unflag($atype, $base_ids) {
* @param string $atype Account type, output of account_from_sid
* @param array $base_ids Array of package base IDs to delete
* @param int $merge_base_id Package base to merge the deleted ones into
+ * @param int $via Package request to close upon deletion
*
* @return array Tuple of success/failure indicator and error message
*/
-function pkgbase_delete ($atype, $base_ids, $merge_base_id) {
+function pkgbase_delete ($atype, $base_ids, $merge_base_id, $via) {
if (!$atype) {
return array(false, __("You must be logged in before you can delete packages."));
}
@@ -537,6 +538,10 @@ function pkgbase_delete ($atype, $base_ids, $merge_base_id) {
$q = "DELETE FROM PackageBases WHERE ID IN (" . implode(",", $base_ids) . ")";
$dbh->exec($q);
+ if ($via) {
+ pkgbase_close_request(intval($via));
+ }
+
return array(true, __("The selected packages have been deleted."));
}
@@ -546,10 +551,11 @@ function pkgbase_delete ($atype, $base_ids, $merge_base_id) {
* @param string $atype Account type, output of account_from_sid
* @param array $base_ids Array of package base IDs to adopt/disown
* @param bool $action Adopts if true, disowns if false. Adopts by default
+ * @param int $via Package request to close upon adoption
*
* @return array Tuple of success/failure indicator and error message
*/
-function pkgbase_adopt ($atype, $base_ids, $action=true) {
+function pkgbase_adopt ($atype, $base_ids, $action=true, $via) {
if (!$atype) {
if ($action) {
return array(false, __("You must be logged in before you can adopt packages."));
@@ -590,6 +596,10 @@ function pkgbase_adopt ($atype, $base_ids, $action=true) {
$dbh->exec($q);
+ if ($via) {
+ pkgbase_close_request(intval($via));
+ }
+
if ($action) {
pkgbase_notify(account_from_sid($_COOKIE["AURSID"]), $base_ids);
return array(true, __("The selected packages have been adopted."));