[aur-dev] [PATCH 1/4] Fix title in package requests list
Use "Requests" instead of "File Request" as title for the package request list. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgreq.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/html/pkgreq.php b/web/html/pkgreq.php index 401b60c..674f1c1 100644 --- a/web/html/pkgreq.php +++ b/web/html/pkgreq.php @@ -8,8 +8,6 @@ include_once("pkgfuncs.inc.php"); set_lang(); check_sid(); -html_header(__("File Request")); - if (!isset($base_id)) { if (!check_user_privileges()) { header('Location: /'); @@ -62,8 +60,11 @@ if (!isset($base_id)) { } $SID = $_COOKIE['AURSID']; + + html_header(__("Requests")); include('pkgreq_results.php'); } else { + html_header(__("File Request")); include('pkgreq_form.php'); } -- 2.0.1
Make sure that the package base to merge into does not contain any invalid characters. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgbase.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php index adc6118..c246b6f 100644 --- a/web/html/pkgbase.php +++ b/web/html/pkgbase.php @@ -97,7 +97,12 @@ if (check_token()) { } elseif (current_action("do_ChangeCategory")) { list($ret, $output) = pkgbase_change_category($base_id, $atype); } elseif (current_action("do_FileRequest")) { - list($ret, $output) = pkgreq_file($ids, $_POST['type'], $_POST['merge_into'], $_POST['comments']); + if (empty($_POST['merge_into']) || preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/", $_POST['merge_into'])) { + list($ret, $output) = pkgreq_file($ids, $_POST['type'], $_POST['merge_into'], $_POST['comments']); + } else { + $output = __("Invalid name: only lowercase letters are allowed."); + $ret = false; + } } elseif (current_action("do_CloseRequest")) { list($ret, $output) = pkgreq_close($_POST['reqid'], false); } -- 2.0.1
Make sure that error messages above the package list are actually visible to the user. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgbase.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php index c246b6f..5e27e4e 100644 --- a/web/html/pkgbase.php +++ b/web/html/pkgbase.php @@ -79,14 +79,15 @@ if (check_token()) { if ($merge_base_id) { list($ret, $output) = pkgbase_delete($atype, $ids, $merge_base_id, $via); unset($_GET['ID']); - } - else { + } else { $output = __("Cannot find package to merge votes and comments into."); + $ret = false; } } } else { $output = __("The selected packages have not been deleted, check the confirmation checkbox."); + $ret = false; } } elseif (current_action("do_Notify")) { list($ret, $output) = pkgbase_notify($atype, $ids); @@ -145,7 +146,11 @@ html_header($title, $details); ?> <?php if ($output): ?> +<?php if ($ret): ?> <p class="pkgoutput"><?= $output ?></p> +<?php else: ?> +<ul class="errorlist"><li><?= $output ?></li></ul> +<?php endif; ?> <?php endif; ?> <?php -- 2.0.1
This was not implemented properly in commit 8260111 (Add a package request list, 2014-06-24). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgreq.php | 6 +++--- web/lib/pkgreqfuncs.inc.php | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/web/html/pkgreq.php b/web/html/pkgreq.php index 674f1c1..4b7d6cf 100644 --- a/web/html/pkgreq.php +++ b/web/html/pkgreq.php @@ -14,9 +14,6 @@ if (!isset($base_id)) { exit(); } - $results = pkgreq_list(); - $total = count($results); - /* Sanitize paging variables. */ if (isset($_GET['O'])) { $_GET['O'] = max(intval($_GET['O']), 0); @@ -30,6 +27,9 @@ if (!isset($base_id)) { $_GET["PP"] = 50; } + $results = pkgreq_list($_GET['O'], $_GET['PP']); + $total = pkgreq_count(); + /* Calculate the results to use. */ $first = $_GET['O'] + 1; diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php index 852554b..a79677e 100644 --- a/web/lib/pkgreqfuncs.inc.php +++ b/web/lib/pkgreqfuncs.inc.php @@ -3,11 +3,25 @@ include_once("config.inc.php"); include_once("pkgbasefuncs.inc.php"); /** + * Get the number of package requests + * + * @return int The total number of package requests + */ +function pkgreq_count() { + $dbh = DB::connect(); + $q = "SELECT COUNT(*) FROM PackageRequests"; + return $dbh->query($q)->fetchColumn(); +} + +/** * Get a list of all package requests * + * @param int $offset The index of the first request to return + * @param int $limit The maximum number of requests to return + * * @return array List of pacakge requests with details */ -function pkgreq_list() { +function pkgreq_list($offset, $limit) { $dbh = DB::connect(); $q = "SELECT PackageRequests.ID, "; @@ -20,7 +34,8 @@ function pkgreq_list() { $q.= "FROM PackageRequests INNER JOIN RequestTypes ON "; $q.= "RequestTypes.ID = PackageRequests.ReqTypeID "; $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID "; - $q.= "ORDER BY Status ASC, RequestTS DESC"; + $q.= "ORDER BY Status ASC, RequestTS DESC "; + $q.= "LIMIT " . $limit . " OFFSET " . $offset; return $dbh->query($q)->fetchAll(); } -- 2.0.1
participants (1)
-
Lukas Fleischer