summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2017-02-07 08:16:08 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2017-02-08 19:18:27 +0100
commit880d25e98c3efd406532a1b460e32b6350c9e39c (patch)
tree00298e2afee003ed65dc4227991ca97962ddcb31
parent1613bd2f2980d5da7f2d3e0a0113f126b6deb155 (diff)
downloadaur-880d25e98c3efd406532a1b460e32b6350c9e39c.tar.gz
aur-880d25e98c3efd406532a1b460e32b6350c9e39c.tar.xz
Allow to search for both maintainer and co-maintainer
As a follow-up to commit 6cb8c04 (Implement co-maintainer search, 2017-01-26), add an option to search for both maintainers and co-maintainers at the same time. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r--web/lib/pkgfuncs.inc.php8
-rw-r--r--web/template/pkg_search_form.php1
2 files changed, 9 insertions, 0 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index 063cc935..030ec9a1 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -717,6 +717,14 @@ function pkg_search_page($params, $show_headers=true, $SID="") {
$q_where .= "WHERE PackageComaintainers.PackageBaseID = PackageBases.ID ";
$q_where .= "AND Users.Username = " . $dbh->quote($params['K']) . ")";
}
+ elseif (isset($params["SeB"]) && $params["SeB"] == "M") {
+ /* Search by maintainer and co-maintainer. */
+ $q_where .= "AND (Users.Username = " . $dbh->quote($params['K']) . " ";
+ $q_where .= "OR EXISTS (SELECT * FROM PackageComaintainers ";
+ $q_where .= "INNER JOIN Users ON Users.ID = PackageComaintainers.UsersID ";
+ $q_where .= "WHERE PackageComaintainers.PackageBaseID = PackageBases.ID ";
+ $q_where .= "AND Users.Username = " . $dbh->quote($params['K']) . "))";
+ }
elseif (isset($params["SeB"]) && $params["SeB"] == "s") {
/* Search by submitter. */
$q_where .= "AND SubmitterUID = " . intval(uid_from_username($params['K'])) . " ";
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 688cfcce..3d0cde6c 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -10,6 +10,7 @@ $searchby = array(
'k' => __('Keywords'),
'm' => __('Maintainer'),
'c' => __('Co-maintainer'),
+ 'M' => __('Maintainer, Co-maintainer'),
's' => __('Submitter')
);