Don't add %3F=yes to the url (#13041)

* Don't add %3F=yes to the url...

* introduce variable
This commit is contained in:
Tony Murray
2021-07-14 09:26:33 -05:00
committed by GitHub
parent 484bebfd66
commit 131f626815

View File

@ -14,11 +14,13 @@ foreach ($_GET as $key => $get_var) {
}
$base_url = parse_url(Config::get('base_url'));
$uri = explode('?', $_SERVER['REQUEST_URI'], 2)[0] ?? ''; // remove query, that is handled below with $_GET
// don't parse the subdirectory, if there is one in the path
if (isset($base_url['path']) && strlen($base_url['path']) > 1) {
$segments = explode('/', trim(str_replace($base_url['path'], '', $_SERVER['REQUEST_URI']), '/'));
$segments = explode('/', trim(str_replace($base_url['path'], '', $uri), '/'));
} else {
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
$segments = explode('/', trim($uri, '/'));
}
foreach ($segments as $pos => $segment) {
@ -49,4 +51,4 @@ foreach ($_POST as $name => $value) {
}
// don't leak login data
unset($vars['username'], $vars['password']);
unset($vars['username'], $vars['password'], $uri, $base_url);