summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/html/packages.php22
-rw-r--r--web/lib/pkgfuncs.inc5
2 files changed, 16 insertions, 11 deletions
diff --git a/web/html/packages.php b/web/html/packages.php
index f84a6c32..c8949a4a 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -38,19 +38,19 @@ if (isset($_POST['IDs'])) {
# Determine what action to do
$output = "";
-if ($_POST['action'] == "do_Flag" || isset($_POST['do_Flag'])) {
+if (current_action("do_Flag")) {
$output = pkg_flag($atype, $ids, True);
-} elseif ($_POST['action'] == "do_UnFlag" || isset($_POST['do_UnFlag'])) {
+} elseif (current_action("do_UnFlag")) {
$output = pkg_flag($atype, $ids, False);
-} elseif ($_POST['action'] == "do_Adopt" || isset($_POST['do_Adopt'])) {
+} elseif (current_action("do_Adopt")) {
$output = pkg_adopt($atype, $ids, True);
-} elseif ($_POST['action'] == "do_Disown" || isset($_POST['do_Disown'])) {
+} elseif (current_action("do_Disown")) {
$output = pkg_adopt($atype, $ids, False);
-} elseif ($_POST['action'] == "do_Vote" || isset($_POST['do_Vote'])) {
+} elseif (current_action("do_Vote")) {
$output = pkg_vote($atype, $ids, True);
-} elseif ($_POST['action'] == "do_UnVote" || isset($_POST['do_UnVote'])) {
+} elseif (current_action("do_UnVote")) {
$output = pkg_vote($atype, $ids, False);
-} elseif ($_POST['action'] == "do_Delete" || isset($_POST['do_Delete'])) {
+} elseif (current_action("do_Delete")) {
if (isset($_POST['confirm_Delete'])) {
$output = pkg_delete($atype, $ids);
unset($_GET['ID']);
@@ -58,13 +58,13 @@ if ($_POST['action'] == "do_Flag" || isset($_POST['do_Flag'])) {
else {
$output = __("The selected packages have not been deleted, check the confirmation checkbox.");
}
-} elseif ($_POST['action'] == "do_Notify" || isset($_POST['do_Notify'])) {
+} elseif (current_action("do_Notify")) {
$output = pkg_notify($atype, $ids);
-} elseif ($_POST['action'] == "do_UnNotify" || isset($_POST['do_UnNotify'])) {
+} elseif (current_action("do_UnNotify")) {
$output = pkg_notify($atype, $ids, False);
-} elseif ($_POST['action'] == "do_DeleteComment" || isset($_POST["do_DeleteComment"])) {
+} elseif (current_action("do_DeleteComment")) {
$output = pkg_delete_comment($atype);
-} elseif ($_POST['action'] == "do_ChangeCategory" || isset($_POST['do_ChangeCategory'])) {
+} elseif (current_action("do_ChangeCategory")) {
$output = pkg_change_category($atype);
}
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 1be503ae..ef8c20f3 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -605,6 +605,11 @@ function pkg_search_page($SID="") {
return;
}
+function current_action($action) {
+ return (isset($_POST['action']) && $_POST['action'] == $action) ||
+ isset($_POST[$action]);
+}
+
/**
* Flag and un-flag packages out-of-date
*