From 8b49b26f2481c3cd00c6a661f17140ab021c19e4 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 1 Jun 2022 12:37:09 +0200 Subject: [PATCH] Added important 418 teapot error --- core/constants.php | 1 + index.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/constants.php b/core/constants.php index 48d5e24..fa49bcf 100644 --- a/core/constants.php +++ b/core/constants.php @@ -54,6 +54,7 @@ const HTTP_STATUS_DESCRIPTIONS = [ 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', + 418 => 'I\'m a teapot', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', diff --git a/index.php b/index.php index 87e7e55..b0efd3b 100644 --- a/index.php +++ b/index.php @@ -60,8 +60,8 @@ if ($installation) { } if ($router !== null) { - if (!isset($_GET["site"]) && isset($_GET["error"]) && - is_string($_GET["error"]) && preg_match("^\d+$", $_GET["error"])) { + if ((!isset($_GET["site"]) || $_GET["site"] === "/") && isset($_GET["error"]) && + is_string($_GET["error"]) && preg_match("/^\d+$/", $_GET["error"])) { $response = $router->returnStatusCode(intval($_GET["error"])); } else { $response = $router->run($requestedUri);