diff --git a/2012-prosinec/index.php b/2012-prosinec/index.php index 4b1bfa7..9d5af68 100644 --- a/2012-prosinec/index.php +++ b/2012-prosinec/index.php @@ -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'; diff --git a/2014/index.php b/2014/index.php index 01fef6a..8e38f16 100644 --- a/2014/index.php +++ b/2014/index.php @@ -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'; diff --git a/2015-prosinec/index.php b/2015-prosinec/index.php index 7aeea43..4ea5dfa 100644 --- a/2015-prosinec/index.php +++ b/2015-prosinec/index.php @@ -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'; diff --git a/2015/index.php b/2015/index.php index 343082d..0ba55eb 100644 --- a/2015/index.php +++ b/2015/index.php @@ -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';