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/lang/en/pkgfuncs_po.inc | 2 ++ web/lib/pkgfuncs.inc | 55 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/web/lang/en/pkgfuncs_po.inc b/web/lang/en/pkgfuncs_po.inc index f2faa7e5..61a3fa71 100644 --- a/web/lang/en/pkgfuncs_po.inc +++ b/web/lang/en/pkgfuncs_po.inc @@ -135,4 +135,6 @@ $_t["en"]["First Submitted"] = "First Submitted"; $_t["en"]["Last Updated"] = "Last Updated"; +$_t["en"]["Search by"] = "Search by"; + ?> \ No newline at end of file diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index b633a1fb..19d205d4 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-24-g4f1b