mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 09:43:03 +00:00
Do not set GET parameters in the routing framework
Setting GET parameters manually is bad style and causes some strange side effects when using virtual URLs and mkurl(). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
20704e9053
commit
2e552cbcad
2 changed files with 19 additions and 13 deletions
|
@ -9,8 +9,11 @@ $tokens = explode('/', $path);
|
||||||
|
|
||||||
if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
|
if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
|
||||||
if (isset($tokens[2])) {
|
if (isset($tokens[2])) {
|
||||||
unset($_GET['ID']);
|
/* TODO: Create a proper data structure to pass variables from
|
||||||
$_GET['N'] = $tokens[2];
|
* the routing framework to the individual pages instead of
|
||||||
|
* initializing arbitrary variables here. */
|
||||||
|
$pkgname = $tokens[2];
|
||||||
|
$pkgid = pkgid_from_name($pkgname);
|
||||||
|
|
||||||
if (isset($tokens[3])) {
|
if (isset($tokens[3])) {
|
||||||
if ($tokens[3] == 'voters') {
|
if ($tokens[3] == 'voters') {
|
||||||
|
|
|
@ -7,11 +7,22 @@ set_lang(); # this sets up the visitor's language
|
||||||
include_once('pkgfuncs.inc.php'); # package specific functions
|
include_once('pkgfuncs.inc.php'); # package specific functions
|
||||||
check_sid(); # see if they're still logged in
|
check_sid(); # see if they're still logged in
|
||||||
|
|
||||||
|
# Retrieve package ID and name, unless initialized by the routing framework
|
||||||
|
if (!isset($pkgid) || !isset($pkgname)) {
|
||||||
|
if (isset($_GET['ID'])) {
|
||||||
|
$pkgid = intval($_GET['ID']);
|
||||||
|
$pkgname = pkgname_from_id($_GET['ID']);
|
||||||
|
} else if (isset($_GET['N'])) {
|
||||||
|
$pkgid = pkgid_from_name($_GET['N']);
|
||||||
|
$pkgname = $_GET['N'];
|
||||||
|
} else {
|
||||||
|
unset($pkgid, $pkgname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Set the title to the current query if required
|
# Set the title to the current query if required
|
||||||
if (isset($_GET['ID']) && ($pkgname = pkgname_from_id($_GET['ID']))) {
|
if (isset($pkgname)) {
|
||||||
$title = $pkgname;
|
$title = $pkgname;
|
||||||
} else if (isset($_GET['N'])) {
|
|
||||||
$title = $pkgname = $_GET['N'];
|
|
||||||
} else if (!empty($_GET['K'])) {
|
} else if (!empty($_GET['K'])) {
|
||||||
$title = __("Search Criteria") . ": " . $_GET['K'];
|
$title = __("Search Criteria") . ": " . $_GET['K'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -90,14 +101,6 @@ html_header($title);
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (isset($_GET['ID'])) {
|
|
||||||
$pkgid = intval($_GET['ID']);
|
|
||||||
} else if (isset($_GET['N'])) {
|
|
||||||
$pkgid = pkgid_from_name($_GET['N']);
|
|
||||||
} else {
|
|
||||||
unset($pkgid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($pkgid)) {
|
if (isset($pkgid)) {
|
||||||
include('pkg_search_form.php');
|
include('pkg_search_form.php');
|
||||||
if ($pkgid) {
|
if ($pkgid) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue