Kaynağa Gözat

Added important 418 teapot error

Roman 1 yıl önce
ebeveyn
işleme
8b49b26f24
2 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 1 0
      core/constants.php
  2. 2 2
      index.php

+ 1 - 0
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',

+ 2 - 2
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);