diff options
author | Minteck <contact@minteck.org> | 2022-08-21 17:31:56 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-21 17:31:56 +0200 |
commit | a2df9a69dcc14cb70118cda2ded499055e7ee358 (patch) | |
tree | 6dd283e4e9452d38bce81ddaaae49b5335755842 /app.php | |
parent | 84dd0735820b16b60f600284d35183d76547a71f (diff) | |
download | pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.gz pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.bz2 pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.zip |
m. update
Diffstat (limited to 'app.php')
-rw-r--r-- | app.php | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -18,11 +18,37 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { } elseif ($toplevel === "") { require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/home.php"; } else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php"; + if ($toplevel === "-") { + $pagename = substr($pagename, 2); + $toplevel = explode("/", $pagename)[0]; + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php")) { + require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php"; + } + } 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") { require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.php"; } else { - header("Location: /?error=Page not found: " . strip_tags($pagename)) and die(); + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php")) { + header("Location: /-/" . $toplevel); + } else { + $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) { + return $i['name']; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)); + + if (in_array($pagename, $namesCloudburst)) { + header("Location: /cloudburst/" . $pagename) and die(); + } else if (in_array($pagename, $namesRaindrops)) { + header("Location: /raindrops/" . $pagename) and die(); + } else { + header("Location: /?error=Page not found: " . strip_tags($pagename)) and die(); + } + } } }
\ No newline at end of file |