summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Scarpino <andrea@archlinux.org>2010-04-15 15:26:20 -0400
committerLoui Chang <louipc.ist@gmail.com>2010-04-15 15:26:20 -0400
commit24599ab6e321557192e078880c49a12867108e90 (patch)
tree06352edc0e3d3a20ba2c71dae7aa458aa937a9af
parent9444f924de465664a1bc8ecbd26bf1f8b05e9b7e (diff)
downloadaurweb-24599ab6e321557192e078880c49a12867108e90.tar.xz
add search only by name
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
-rw-r--r--web/lib/pkgfuncs.inc10
-rw-r--r--web/template/pkg_search_form.php2
2 files changed, 9 insertions, 3 deletions
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']."%') ";
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 567db5a..88cc698 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -39,7 +39,7 @@
<label><?php print __("Search by"); ?></label>
<select name='SeB'>
<?php
- $searchby = array('nd' => 'Name', 'm' => 'Maintainer', 's' => 'Submitter');
+ $searchby = array('nd' => 'Name & Desc', 'n' => 'Name Only', 'm' => 'Maintainer', 's' => 'Submitter');
foreach ($searchby as $k => $v):
if ($_REQUEST['SeB'] == $k):
?>