mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add option to search for exact name matches only (fixes FS#23556).
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
8cd2aef50d
commit
1c55e6b40c
2 changed files with 7 additions and 2 deletions
|
@ -341,6 +341,7 @@ function package_details($id=0, $SID="") {
|
||||||
* SeB- property that search string (K) represents
|
* SeB- property that search string (K) represents
|
||||||
* values: n - package name
|
* values: n - package name
|
||||||
* nd - package name & description
|
* nd - package name & description
|
||||||
|
* x - package name (exact match)
|
||||||
* m - package maintainer's username
|
* m - package maintainer's username
|
||||||
* s - package submitter's username
|
* s - package submitter's username
|
||||||
* do_Orphans - boolean. whether to search packages
|
* do_Orphans - boolean. whether to search packages
|
||||||
|
@ -440,11 +441,15 @@ function pkg_search_page($SID="") {
|
||||||
# Search by submitter
|
# Search by submitter
|
||||||
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "s") {
|
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "s") {
|
||||||
$q_where .= "AND SubmitterUID = ".uid_from_username($_GET['K'])." ";
|
$q_where .= "AND SubmitterUID = ".uid_from_username($_GET['K'])." ";
|
||||||
# Search by name
|
|
||||||
}
|
}
|
||||||
|
# Search by name
|
||||||
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "n") {
|
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "n") {
|
||||||
$q_where .= "AND (Name LIKE '%".$_GET['K']."%') ";
|
$q_where .= "AND (Name LIKE '%".$_GET['K']."%') ";
|
||||||
}
|
}
|
||||||
|
# Search by name (exact match)
|
||||||
|
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "x") {
|
||||||
|
$q_where .= "AND (Name = '".$_GET['K']."') ";
|
||||||
|
}
|
||||||
# Search by name and description (Default)
|
# Search by name and description (Default)
|
||||||
else {
|
else {
|
||||||
$q_where .= "AND (Name LIKE '%".$_GET['K']."%' OR ";
|
$q_where .= "AND (Name LIKE '%".$_GET['K']."%' OR ";
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<label><?php print __("Search by"); ?></label>
|
<label><?php print __("Search by"); ?></label>
|
||||||
<select name='SeB'>
|
<select name='SeB'>
|
||||||
<?php
|
<?php
|
||||||
$searchby = array('nd' => __('Name, Description'), 'n' => __('Name Only'), 'm' => __('Maintainer'), 's' => __('Submitter'));
|
$searchby = array('nd' => __('Name, Description'), 'n' => __('Name Only'), 'x' => ('Exact name'), 'm' => __('Maintainer'), 's' => __('Submitter'));
|
||||||
foreach ($searchby as $k => $v):
|
foreach ($searchby as $k => $v):
|
||||||
if (isset($_REQUEST['SeB']) && $_REQUEST['SeB'] == $k):
|
if (isset($_REQUEST['SeB']) && $_REQUEST['SeB'] == $k):
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue