diff options
Diffstat (limited to 'app.php')
-rw-r--r-- | app.php | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,7 +1,10 @@ <?php +ob_start(); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/language.inc"; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); @@ -18,7 +21,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $toplevel . "/" . $filename)) { header("Location: /assets/" . $toplevel . "/" . $filename) and die(); } else { - header("Location: /?error=" . $lang["app"]["file"]) and die(); + peh_error("File not found", 404); } } elseif ($toplevel === "") { $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc"; @@ -32,7 +35,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc"; } else { - header("Location: /?error=" . $lang["app"]["page"] . " " . strip_tags($pagename)) and die(); + peh_error("Page not found: " . strip_tags($pagename), 404); } } else if ($toplevel === "api") { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) { |