Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-05-22 13:19:25 +0200
committerErich Eckner <git@eckner.net>2019-05-22 13:19:25 +0200
commit4b88074bdae7985c1a984dbc1cbef6c3eab9debe (patch)
tree48c350e8b30b968311b5f7edc09c3f4ed154750a
parenta81b7c142b680d5d5526a6e4c1865dcad245600f (diff)
groups.php: change parsing of url
-rw-r--r--groups.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/groups.php b/groups.php
index b372712..cbcb4a9 100644
--- a/groups.php
+++ b/groups.php
@@ -5,21 +5,19 @@ require_once "init.php";
require_once BASE . "/lib/style.php";
require_once BASE . "/lib/mysql.php";
-$uri_parts = explode('/', $_SERVER['REQUEST_URI']);
+$options = explode('?', $_SERVER['REQUEST_URI'], 2);
+
+$uri_parts = explode('/', $options[0]);
+if (count($options) == 2)
+ $options = $options[1];
+else
+ $options = '';
+if ($uri_parts[count($uri_parts)-1] == '')
+ array_pop($uri_parts);
if ($uri_parts[0] != '' || $uri_parts[1] != 'groups')
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);
-
array_splice(
$uri_parts,
0, 2