mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Instead of calling check_sid() from every single PHP script representing a web page, add the call to aur.inc.php which is sourced by all of them. Also, remove set_lang() calls from the scripts since these are also already included in aur.inc.php. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
84 lines
1.9 KiB
PHP
84 lines
1.9 KiB
PHP
<?php
|
|
|
|
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
|
|
|
|
include_once("aur.inc.php");
|
|
include_once("pkgfuncs.inc.php");
|
|
|
|
if (isset($base_id)) {
|
|
if (!has_credential(CRED_PKGREQ_FILE)) {
|
|
header('Location: /');
|
|
exit();
|
|
}
|
|
html_header(__("Submit Request"));
|
|
include('pkgreq_form.php');
|
|
} elseif (isset($pkgreq_id)) {
|
|
if (!has_credential(CRED_PKGREQ_CLOSE)) {
|
|
header('Location: /');
|
|
exit();
|
|
}
|
|
html_header(__("Close Request"));
|
|
$pkgbase_name = pkgreq_get_pkgbase_name($pkgreq_id);
|
|
include('pkgreq_close_form.php');
|
|
} else {
|
|
if (!has_credential(CRED_PKGREQ_LIST)) {
|
|
header('Location: /');
|
|
exit();
|
|
}
|
|
|
|
/* Sanitize paging variables. */
|
|
if (isset($_GET['O'])) {
|
|
$_GET['O'] = max(intval($_GET['O']), 0);
|
|
} else {
|
|
$_GET['O'] = 0;
|
|
}
|
|
|
|
if (isset($_GET["PP"])) {
|
|
$_GET["PP"] = bound(intval($_GET["PP"]), 50, 250);
|
|
} else {
|
|
$_GET["PP"] = 50;
|
|
}
|
|
|
|
$results = pkgreq_list($_GET['O'], $_GET['PP']);
|
|
$total = pkgreq_count();
|
|
|
|
/* Calculate the results to use. */
|
|
$first = $_GET['O'] + 1;
|
|
|
|
/* Calculation of pagination links. */
|
|
$per_page = ($_GET['PP'] > 0) ? $_GET['PP'] : 50;
|
|
$current = ceil($first / $per_page);
|
|
$pages = ceil($total / $per_page);
|
|
$templ_pages = array();
|
|
|
|
if ($current > 1) {
|
|
$templ_pages['« ' . __('First')] = 0;
|
|
$templ_pages['‹ ' . __('Previous')] = ($current - 2) * $per_page;
|
|
}
|
|
|
|
if ($current - 5 > 1)
|
|
$templ_pages["..."] = false;
|
|
|
|
for ($i = max($current - 5, 1); $i <= min($pages, $current + 5); $i++) {
|
|
$templ_pages[$i] = ($i - 1) * $per_page;
|
|
}
|
|
|
|
if ($current + 5 < $pages)
|
|
$templ_pages["... "] = false;
|
|
|
|
if ($current < $pages) {
|
|
$templ_pages[__('Next') . ' ›'] = $current * $per_page;
|
|
$templ_pages[__('Last') . ' »'] = ($pages - 1) * $per_page;
|
|
}
|
|
|
|
$SID = $_COOKIE['AURSID'];
|
|
|
|
html_header(__("Requests"));
|
|
echo '<div id="pkglist-results" class="box">';
|
|
$show_headers = true;
|
|
include('pkgreq_results.php');
|
|
echo '</div>';
|
|
}
|
|
|
|
html_footer(AURWEB_VERSION);
|
|
|