diff options
Diffstat (limited to 'pages/page.inc')
-rw-r--r-- | pages/page.inc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pages/page.inc b/pages/page.inc index 931e6e5..fb63383 100644 --- a/pages/page.inc +++ b/pages/page.inc @@ -9,13 +9,18 @@ if (!isset($_GET['_']) || trim($_GET['_']) === "") peh_error("Invalid request", $parts = explode("/", $_GET['_']); -if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== $app["other"]["slug"]) && (!(count($parts) > 2) || $parts[1] === "-")) { +if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== "moonglow" && $parts[0] !== $app["other"]["slug"]) && (!(count($parts) > 2) || $parts[1] === "-")) { $namesCloudburst = [...array_map(function ($i) { return $i['name']; }, 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)), "unknown-rd"]; + $namesMoonglow = array_map(function ($i) { + return $i['name']; + }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/members.json"), true), function ($i) { + return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json"); + })); $namesOther = []; if ($isLoggedIn || $isLowerLoggedIn) { @@ -32,6 +37,8 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== $a $parts[0] = "cloudburst"; } else if (in_array($parts[1], $namesRaindrops)) { $parts[0] = "raindrops"; + } else if (in_array($parts[1], $namesMoonglow)) { + $parts[0] = "moonglow"; } else if (in_array($parts[1], $namesOther) && ($isLoggedIn || $isLowerLoggedIn)) { $parts[0] = $app["other"]["slug"]; } @@ -40,11 +47,11 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== $a } $system = $parts[0]; -$member = (isset($parts[1]) ? $parts[1] : null) === "" ? null : (isset($parts[1]) ? $parts[1] : null); +$member = ($parts[1] ?? null) === "" ? null : ($parts[1] ?? null); -if ($system !== "cloudburst" && $system !== "raindrops" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) peh_error("System not found", 404); -$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : "Raindrops System"); -$systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : "gdapd"); +if ($system !== "cloudburst" && $system !== "raindrops" && $system !== "moonglow" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) peh_error("System not found", 404); +$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System")); +$systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd")); if ($member === null) { global $_SystemName; |