From 9d789fe82cd893a24635b00cb884ffee47af6564 Mon Sep 17 00:00:00 2001 From: simo Date: Mon, 17 Oct 2005 01:14:24 +0000 Subject: Added search by maintainer --- web/lib/pkgfuncs.inc | 55 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'web/lib') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index b633a1f..19d205d 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -3,7 +3,7 @@ include_once("pkgfuncs_po.inc"); # define variables used during pkgsearch # -$pkgsearch_vars = array("O", "L", "C", "K", "SB", "SO", "PP", "do_MyPackages", "do_Orphans"); +$pkgsearch_vars = array("O", "L", "C", "K", "SB", "SO", "PP", "do_MyPackages", "do_Orphans", "SeB"); # print out the 'return to package details' link @@ -663,7 +663,24 @@ function pkg_search_page($SID="") { # SQL trickery... print " value=\"".stripslashes($K)."\" maxlength='35'>\n"; print "\n"; + + print "\n"; + print " ".__("Search by"); + print "
\n"; + + print " \n"; + print "\n"; + /* print "\n"; print " ".__("Sort by"); print "
\n"; @@ -780,13 +797,25 @@ function pkg_search_page($SID="") { } } if ($K) { - if (!$has_where) { - $q.= "WHERE (Name LIKE '%".mysql_escape_string($K)."%' OR "; - $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; - $has_where = 1; - } else { - $q.= "AND (Name LIKE '%".mysql_escape_string($K)."%' OR "; - $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; + #search by maintainer + if ($_REQUEST["SeB"] == "m"){ + if (!$has_where) { + $q.= "WHERE Username = '".mysql_escape_string($K)."' "; + $has_where = 1; + } else { + $q.= "AND Username = '".mysql_escape_string($K)."' "; + } + } + # the default behaivior, query the name/description + else { + if (!$has_where) { + $q.= "WHERE (Name LIKE '%".mysql_escape_string($K)."%' OR "; + $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; + $has_where = 1; + } else { + $q.= "AND (Name LIKE '%".mysql_escape_string($K)."%' OR "; + $q.= "Description LIKE '%".mysql_escape_string($K)."%') "; + } } } if ($_REQUEST["do_MyPackages"] && $SID) { @@ -921,19 +950,19 @@ function pkg_search_page($SID="") { } print " "; - print "".__("Location").""; + print "".__("Location").""; print "\n"; print " "; - print "".__("Category").""; + print "".__("Category").""; print "\n"; print " "; - print "".__("Name").""; + print "".__("Name").""; print "\n"; print " "; - print "".__("Votes").""; + print "".__("Votes").""; print "\n"; if ($SID) { print " "; - print "".__("Maintainer").""; + print "".__("Maintainer").""; print "\n"; # REMOVED LINK TO 'pkgmgmnt.php' # if ($SID) { -- cgit v1.2.3-70-g09d2