From 24599ab6e321557192e078880c49a12867108e90 Mon Sep 17 00:00:00 2001 From: Andrea Scarpino Date: Thu, 15 Apr 2010 15:26:20 -0400 Subject: add search only by name Signed-off-by: Loui Chang --- web/lib/pkgfuncs.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'web/lib') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index ed01941..0b65170 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -365,7 +365,8 @@ function package_details($id=0, $SID="") { * v - number of votes * m - maintainer username * SeB- property that search string (K) represents - * values: nd - package name&description + * values: n - package name + * nd - package name & description * m - package maintainer's username * s - package submitter's username * do_Orphans - boolean. whether to search packages @@ -466,12 +467,17 @@ function pkg_search_page($SID="") { if ($_GET["SeB"] == "m") { $q.= "AND Users.Username = '".$_GET['K']."' "; } + # Search by submitter elseif ($_GET["SeB"] == "s") { // FIXME: this shouldn't be making 2 queries // kill the call to uid_from_username $q.= "AND SubmitterUID = ".uid_from_username($_GET['K'])." "; - // the default behavior, query the name/description + # Search by name } + elseif ($_GET["SeB"] == "n") { + $q.= "AND (Name LIKE '%".$_GET['K']."%') "; + } + # Search by name and description (Default) else { $q.= "AND (Name LIKE '%".$_GET['K']."%' OR "; $q.= "Description LIKE '%".$_GET['K']."%') "; -- cgit v1.2.3-70-g09d2