diff options
Diffstat (limited to 'pages/api/_main.php')
-rw-r--r-- | pages/api/_main.php | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/pages/api/_main.php b/pages/api/_main.php deleted file mode 100644 index 215c1b2..0000000 --- a/pages/api/_main.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -if (str_ends_with($_GET['_'], "/")) { - $pagename = substr($_GET['_'], 0, strlen($_GET['_']) - 1); -} else { - $pagename = $_GET['_']; -} - -$toplevel = explode("/", $pagename)[1]; -$middlelevel = explode("/", $pagename)[2] ?? null; - -if ($toplevel === "_main" || $middlelevel === "_main") { - header("HTTP/1.1 404 Not Found"); - header("Content-Type: text/plain"); - echo("Endpoint not found"); - die(); -} - -if (isset($middlelevel) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . "/" . $middlelevel . ".php") && is_file($_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . "/" . $middlelevel . ".php")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . "/" . $middlelevel . ".php"; -} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . ".php") && is_file($_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . ".php")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . ".php"; - } else { - header("HTTP/1.1 404 Not Found"); - header("Content-Type: text/plain"); - echo("Endpoint not found"); - die(); - } -} |