Allow for searching by package base name

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-04-05 13:32:43 +02:00
parent 68d99df781
commit c1c77836a8
2 changed files with 13 additions and 2 deletions

View file

@ -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'], '%_') . "%";

View file

@ -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')
);