diff options
author | Minteck <contact@minteck.org> | 2022-08-26 22:29:23 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-26 22:29:23 +0200 |
commit | 09bd0164ebc020a54b944b7326dcba496fb5d82c (patch) | |
tree | 0c5e765e627ecc94e534ccb6e2bc83917d58dc4c /app.php | |
parent | a2df9a69dcc14cb70118cda2ded499055e7ee358 (diff) | |
download | pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.gz pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.bz2 pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.zip |
idk when was the last commit so I'm making a new one - Violet Dawn
Diffstat (limited to 'app.php')
-rw-r--r-- | app.php | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -24,30 +24,47 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php"; + } else { + header("Location: /?error=Page not found: " . strip_tags($pagename)) and die(); } } else if ($toplevel === "api") { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php"; } } else if ($toplevel === "cloudburst" || $toplevel === "raindrops") { + $parts = explode("/", $_GET['_']); + + if (isset($parts[1]) && $parts[1] !== "-") { + if ($parts[1] === "unknown") { + if ($parts[0] === "cloudburst") { + header("Location: /unknown-cb"); + } else { + header("Location: /unknown-rd"); + } + } else { + header("Location: /" . $parts[1]); + } + + die(); + } + require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.php"; } else { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php")) { header("Location: /-/" . $toplevel); } else { - $namesCloudburst = array_map(function ($i) { + $namesCloudburst = [...array_map(function ($i) { return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true)); - $namesRaindrops = array_map(function ($i) { + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true)), "unknown-cb"]; + $namesRaindrops = [...array_map(function ($i) { return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)); + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)), "unknown-rd"]; - if (in_array($pagename, $namesCloudburst)) { - header("Location: /cloudburst/" . $pagename) and die(); - } else if (in_array($pagename, $namesRaindrops)) { - header("Location: /raindrops/" . $pagename) and die(); + if ((in_array($toplevel, $namesCloudburst) || in_array($toplevel, $namesRaindrops)) && $toplevel !== "unknown") { + require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.php"; } else { - header("Location: /?error=Page not found: " . strip_tags($pagename)) and die(); + global $toplevel; + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/short.php"; } } } |