Change "File Request" to "Submit Request"
[aur.git] / web / html / pkgreq.php
blob8348a4f381d034b175f12b37f18ced4942f2b191
1 <?php
3 set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
5 include_once("aur.inc.php");
6 include_once("pkgfuncs.inc.php");
8 set_lang();
9 check_sid();
11 if (isset($base_id)) {
12 if (!has_credential(CRED_PKGREQ_FILE)) {
13 header('Location: /');
14 exit();
16 html_header(__("Submit Request"));
17 include('pkgreq_form.php');
18 } elseif (isset($pkgreq_id)) {
19 if (!has_credential(CRED_PKGREQ_CLOSE)) {
20 header('Location: /');
21 exit();
23 html_header(__("Close Request"));
24 $pkgbase_name = pkgreq_get_pkgbase_name($pkgreq_id);
25 include('pkgreq_close_form.php');
26 } else {
27 if (!has_credential(CRED_PKGREQ_LIST)) {
28 header('Location: /');
29 exit();
32 /* Sanitize paging variables. */
33 if (isset($_GET['O'])) {
34 $_GET['O'] = max(intval($_GET['O']), 0);
35 } else {
36 $_GET['O'] = 0;
39 if (isset($_GET["PP"])) {
40 $_GET["PP"] = bound(intval($_GET["PP"]), 50, 250);
41 } else {
42 $_GET["PP"] = 50;
45 $results = pkgreq_list($_GET['O'], $_GET['PP']);
46 $total = pkgreq_count();
48 /* Calculate the results to use. */
49 $first = $_GET['O'] + 1;
51 /* Calculation of pagination links. */
52 $per_page = ($_GET['PP'] > 0) ? $_GET['PP'] : 50;
53 $current = ceil($first / $per_page);
54 $pages = ceil($total / $per_page);
55 $templ_pages = array();
57 if ($current > 1) {
58 $templ_pages['&laquo; ' . __('First')] = 0;
59 $templ_pages['&lsaquo; ' . __('Previous')] = ($current - 2) * $per_page;
62 if ($current - 5 > 1)
63 $templ_pages["..."] = false;
65 for ($i = max($current - 5, 1); $i <= min($pages, $current + 5); $i++) {
66 $templ_pages[$i] = ($i - 1) * $per_page;
69 if ($current + 5 < $pages)
70 $templ_pages["... "] = false;
72 if ($current < $pages) {
73 $templ_pages[__('Next') . ' &rsaquo;'] = $current * $per_page;
74 $templ_pages[__('Last') . ' &raquo;'] = ($pages - 1) * $per_page;
77 $SID = $_COOKIE['AURSID'];
79 html_header(__("Requests"));
80 include('pkgreq_results.php');
83 html_footer(AURWEB_VERSION);