[aur-dev] [PATCH 12/13] Allow for searching by package base name

Lukas Fleischer archlinux at cryptocrack.de
Sat Apr 5 07:59:52 EDT 2014


Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 web/lib/pkgfuncs.inc.php         | 11 ++++++++++-
 web/template/pkg_search_form.php |  4 +++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index b92eb9c..a63ee6f 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -681,10 +681,19 @@ function pkg_search_page($SID="") {
 			$K = "%" . addcslashes($_GET['K'], '%_') . "%";
 			$q_where .= "AND (Packages.Name LIKE " . $dbh->quote($K) . ") ";
 		}
-		elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "x") {
+		elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "b") {
+			/* Search by package base name. */
+			$K = "%" . addcslashes($_GET['K'], '%_') . "%";
+			$q_where .= "AND (PackageBases.Name LIKE " . $dbh->quote($K) . ") ";
+		}
+		elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "N") {
 			/* Search by name (exact match). */
 			$q_where .= "AND (Packages.Name = " . $dbh->quote($_GET['K']) . ") ";
 		}
+		elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "B") {
+			/* Search by package base name (exact match). */
+			$q_where .= "AND (PackageBases.Name = " . $dbh->quote($_GET['K']) . ") ";
+		}
 		else {
 			/* Search by name and description (default). */
 			$K = "%" . addcslashes($_GET['K'], '%_') . "%";
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 588b4d4..ececf06 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -4,7 +4,9 @@ include_once('pkgfuncs.inc.php');
 $searchby = array(
 	'nd' => __('Name, Description'),
 	'n' => __('Name Only'),
-	'x' => __('Exact name'),
+	'b' => __('Package Base'),
+	'N' => __('Exact Name'),
+	'B' => __('Exact Package Base'),
 	'm'  => __('Maintainer'),
 	's'  => __('Submitter')
 );
-- 
1.9.1



More information about the aur-dev mailing list