[aur-dev] [PATCH 1/2] Check comment length in the backend

Lukas Fleischer lfleischer at archlinux.org
Thu Oct 22 05:18:30 UTC 2015


Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 web/html/pkgbase.php         | 7 +------
 web/lib/pkgbasefuncs.inc.php | 4 ++++
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php
index b98dc64..cbbf3cc 100644
--- a/web/html/pkgbase.php
+++ b/web/html/pkgbase.php
@@ -49,12 +49,7 @@ $output = "";
 $fragment = "";
 if (check_token()) {
 	if (current_action("do_Flag")) {
-		if (strlen($_POST['comments']) >= 3) {
-			list($ret, $output) = pkgbase_flag($ids, $_POST['comments']);
-		} else {
-			$output = __("The selected packages have not been flagged, please enter a comment.");
-			$ret = false;
-		}
+		list($ret, $output) = pkgbase_flag($ids, $_POST['comments']);
 	} elseif (current_action("do_UnFlag")) {
 		list($ret, $output) = pkgbase_unflag($ids);
 	} elseif (current_action("do_Adopt")) {
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index aad9d14..afccc7d 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -330,6 +330,10 @@ function pkgbase_flag($base_ids, $comment) {
 		return array(false, __("You did not select any packages to flag."));
 	}
 
+	if (strlen($comment) < 3) {
+		return array(false, __("The selected packages have not been flagged, please enter a comment."));
+	}
+
 	$uid = uid_from_sid($_COOKIE['AURSID']);
 	$dbh = DB::connect();
 
-- 
2.6.1


More information about the aur-dev mailing list