Fix some more undefined array key errors

This commit is contained in:
2022-01-14 04:09:16 +01:00
parent 0ab7835c3b
commit d56f33da7d
4 changed files with 8 additions and 8 deletions

View File

@@ -17,11 +17,11 @@ if ($uri == '') {
exit;
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
$lang = htmlspecialchars(substr($matches[1], 0, 2));
if (stringEndsWith($matches[2], 'main')) {
if (isset($matches[2]) && stringEndsWith($matches[2], 'main')) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $lang . '/' . substr($matches[2], 0, -4));
exit;
}
$_GET['page'] = $matches[2];
$_GET['page'] = $matches[2] ?? '';
} elseif (preg_match('/^([a-z]{2})\\/(?:(.*)\\/)?$/', $uri, $matches)) {
$lang = htmlspecialchars(substr($matches[1], 0, 2));
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';