summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-19 14:11:25 +0100
committerErich Eckner <git@eckner.net>2019-02-19 14:11:25 +0100
commitcb8fd086de23e016a465870be8c2175c3f703334 (patch)
tree3c819aae716772506ee51b2c3cdafaf1d42162c6
parentb2732250e84a45fae1c13c93036630456cae5ac7 (diff)
downloadarchweb32-cb8fd086de23e016a465870be8c2175c3f703334.tar.xz
packages/differences.php: change uri-parsing to be hopefully more robust
-rw-r--r--packages/differences.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/differences.php b/packages/differences.php
index f12e0a2..f9b43af 100644
--- a/packages/differences.php
+++ b/packages/differences.php
@@ -5,18 +5,18 @@ require_once "../init.php";
require_once BASE . "/lib/style.php";
require_once BASE . "/lib/mysql.php";
-$uri_parts = explode('/', $_SERVER['REQUEST_URI']);
+$uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
+if (count($uri_parts) > 1)
+ $options = $uri_parts[1];
+else
+ $options = '';
+
+$uri_parts = explode('/', $uri_parts[0]);
if ($uri_parts[0] != '' || $uri_parts[1] != 'packages' || $uri_parts[2] != 'differences')
throw_http_error(422, 'Unprocessable Entity');
-$options = '';
-
$last = array_pop($uri_parts);
-if (substr($last, 0, 1) == '?') {
- $options = $last;
- $last = array_pop($uri_parts);
-}
if ($last != '')
array_push($uri_parts, $last);