diff options
Diffstat (limited to 'pages/api.inc')
-rw-r--r-- | pages/api.inc | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/pages/api.inc b/pages/api.inc deleted file mode 100644 index 8bcea02..0000000 --- a/pages/api.inc +++ /dev/null @@ -1,23 +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 (isset($middlelevel) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/api/" . $toplevel . "/" . $middlelevel . ".php") && is_file($_SERVER['DOCUMENT_ROOT'] . "/pages/api/" . $toplevel . "/" . $middlelevel . ".php")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/api/" . $toplevel . "/" . $middlelevel . ".php"; -} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/api/" . $toplevel . ".php") && is_file($_SERVER['DOCUMENT_ROOT'] . "/pages/api/" . $toplevel . ".php")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/api/" . $toplevel . ".php"; - } else { - header("HTTP/1.1 500 Internal Server Error"); - header("Content-Type: text/plain"); - echo("Endpoint not found"); - die(); - } -}
\ No newline at end of file |