summaryrefslogtreecommitdiff
path: root/web/html/packages.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2012-09-18 13:57:09 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2012-09-18 14:05:11 +0200
commit2e552cbcad8f4abd64041c793851b7420dd5361c (patch)
tree3c36cbf15d5073a04f548456ed6fe97f923a4aab /web/html/packages.php
parent20704e90534beeb0ce09276bd7954086c3b12d7a (diff)
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>
Diffstat (limited to 'web/html/packages.php')
-rw-r--r--web/html/packages.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/web/html/packages.php b/web/html/packages.php
index ec76e41..44f7671 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -7,11 +7,22 @@ set_lang(); # this sets up the visitor's language
include_once('pkgfuncs.inc.php'); # package specific functions
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
-if (isset($_GET['ID']) && ($pkgname = pkgname_from_id($_GET['ID']))) {
+if (isset($pkgname)) {
$title = $pkgname;
-} else if (isset($_GET['N'])) {
- $title = $pkgname = $_GET['N'];
} else if (!empty($_GET['K'])) {
$title = __("Search Criteria") . ": " . $_GET['K'];
} else {
@@ -90,14 +101,6 @@ html_header($title);
<?php endif; ?>
<?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)) {
include('pkg_search_form.php');
if ($pkgid) {