diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2017-02-15 07:13:01 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2017-02-15 07:13:01 +0100 |
commit | b3fdd3f80389e2708dc64414f0e48ef7120fd852 (patch) | |
tree | 58ab9bdad68869d1466c56ef564b2cad8c049118 /web/lib/pkgreqfuncs.inc.php | |
parent | f4176a8ce1e1b50e7f7d2ce660464caabbc6723f (diff) | |
download | aur-b3fdd3f80389e2708dc64414f0e48ef7120fd852.tar.gz aur-b3fdd3f80389e2708dc64414f0e48ef7120fd852.tar.xz |
Add a parameter to skip old requests to pkgreq_list()
Allow for hiding requests which were opened before a given time stamp.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/pkgreqfuncs.inc.php')
-rw-r--r-- | web/lib/pkgreqfuncs.inc.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php index 7dcab135..774ebe7e 100644 --- a/web/lib/pkgreqfuncs.inc.php +++ b/web/lib/pkgreqfuncs.inc.php @@ -20,10 +20,11 @@ function pkgreq_count() { * @param int $offset The index of the first request to return * @param int $limit The maximum number of requests to return * @param int $uid Only return packages affecting the given user + * @param int $from Do not return packages older than the given date * - * @return array List of pacakge requests with details + * @return array List of package requests with details */ -function pkgreq_list($offset, $limit, $uid=false) { +function pkgreq_list($offset, $limit, $uid=false, $from=false) { $dbh = DB::connect(); $q = "SELECT PackageRequests.ID, "; @@ -37,9 +38,15 @@ function pkgreq_list($offset, $limit, $uid=false) { $q.= "RequestTypes.ID = PackageRequests.ReqTypeID "; $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID "; - if ($uid) { - $q.= "WHERE PackageRequests.UsersID = " . intval($uid). " "; - $q.= "OR Users.ID = " . intval($uid) . " "; + if ($uid || $from) { + $q.= "WHERE "; + if ($uid) { + $q.= "(PackageRequests.UsersID = " . intval($uid). " "; + $q.= "OR Users.ID = " . intval($uid) . ") AND "; + } + if ($from) { + $q.= "RequestTS >= " . intval($from). " "; + } } $q.= "ORDER BY Open DESC, RequestTS DESC "; |