From 4b88074bdae7985c1a984dbc1cbef6c3eab9debe Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 22 May 2019 13:19:25 +0200 Subject: groups.php: change parsing of url --- groups.php | 20 +++++++++----------- 1 file 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 -- cgit v1.2.3-70-g09d2