summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-07-23 15:37:31 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-07-23 17:53:28 +0200
commit48ae736068f9953ba69c91190ef7eb7b056c2b50 (patch)
tree67520237779498ac88abcffe5ed3695d65c1a774 /web/lib
parent446d4537d4caab1bb76a9612c1a16f5060618673 (diff)
downloadaurweb-48ae736068f9953ba69c91190ef7eb7b056c2b50.tar.xz
Prevent merging a package base with itself
Instead of deleting the package, show an error message if a user tries to merge a package base with itself. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/pkgreqfuncs.inc.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php
index 41d1515..8fba838 100644
--- a/web/lib/pkgreqfuncs.inc.php
+++ b/web/lib/pkgreqfuncs.inc.php
@@ -110,6 +110,10 @@ function pkgreq_file($ids, $type, $merge_into, $comments) {
$base_id = intval($ids[0]);
$pkgbase_name = pkgbase_name_from_id($base_id);
+ if ($merge_into == $pkgbase_name) {
+ return array(false, __("Cannot merge a package base with itself."));
+ }
+
$q = "SELECT ID FROM RequestTypes WHERE Name = " . $dbh->quote($type);
$result = $dbh->query($q);
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {