[aur-dev] [PATCH] Add confirmation to package deletion from packages page
Callan Barrett
wizzomafizzo at gmail.com
Sat Jun 27 00:48:39 EDT 2009
Signed-off-by: Callan Barrett <wizzomafizzo at gmail.com>
---
web/lib/pkgfuncs.inc | 4 ++++
web/template/actions_form.php | 4 +++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index a4a2dfc..80775a2 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -649,6 +649,10 @@ function pkg_delete ($atype, $ids) {
return __("You must be logged in before you can disown packages.");
}
+ if ($_POST['form_type'] == 'bar' && empty($_POST['confirm_del'])) {
+ return __("You need to confirm the deletion of this package.");
+ }
+
if (empty($ids)) {
return __("You did not select any packages to delete.");
}
diff --git a/web/template/actions_form.php b/web/template/actions_form.php
index de77645..c8a9964 100644
--- a/web/template/actions_form.php
+++ b/web/template/actions_form.php
@@ -1,5 +1,6 @@
<div class="pgbox">
<form action="packages.php?ID=<?php echo $row['ID'] ?>" method="post">
+ <input type="hidden" name="form_type" value="bar">
<input type='hidden' name='IDs[<?php echo $row['ID'] ?>]' value='1'>
<input type='hidden' name='ID' value="<?php echo $row['ID'] ?>">
<?php
@@ -46,7 +47,8 @@ if ($row["MaintainerUID"] == 0) {
if ($atype == "Trusted User" || $atype == "Developer") {
echo "<input type='submit' class='button' name='do_Delete'";
- echo " value='".__("Delete Packages")."'>\n";
+ echo " value='".__("Delete Packages")."'>";
+ echo " <input type='checkbox' name='confirm_del'> <span class='f5'>" . __("Confirm delete?") . "</span>";
}
?>
--
1.6.0.4
More information about the aur-dev
mailing list