summaryrefslogtreecommitdiff
path: root/pages/page.inc
diff options
context:
space:
mode:
Diffstat (limited to 'pages/page.inc')
-rw-r--r--pages/page.inc113
1 files changed, 0 insertions, 113 deletions
diff --git a/pages/page.inc b/pages/page.inc
deleted file mode 100644
index 4de846b..0000000
--- a/pages/page.inc
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-global $lang; global $pages; global $isLoggedIn; global $isLowerLoggedIn;
-
-$app = $GLOBALS["ColdHazeApp"];
-
-$travelling = [];
-if (!isset($_GET['_']) || trim($_GET['_']) === "") peh_error("Invalid request", 400);
-
-$parts = explode("/", $_GET['_']);
-
-if (($parts[0] !== "raindrops" && $parts[0] !== "moonglow" && $parts[0] !== $app["other"]["slug"]) && (!(count($parts) > 2) || $parts[1] === "-")) {
- $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 true;
- }));
- $namesOther = [];
-
- if ($isLoggedIn || $isLowerLoggedIn) {
- $namesOther = [...array_map(function ($i) {
- return $i['name'];
- }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true)), $app["other"]["unknown"]];
- }
-
- $parts = explode("/", $_GET['_']);
- array_unshift($parts, "");
- $parts = array_values($parts);
-
- 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"];
- }
-
- if ($parts[1] === "unknown-rd" || $parts[1] === "unknown-cb" || (($isLoggedIn || $isLowerLoggedIn) && $parts[1] === $app["other"]["unknown"])) $parts[1] = "unknown";
-}
-
-$system = $parts[0];
-$member = ($parts[1] ?? null) === "" ? null : ($parts[1] ?? null);
-
-if ($system !== "raindrops" && $system !== "moonglow" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) peh_error("System not found", 404);
-$systemCommonName = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System");
-$systemID = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd");
-
-if ($member === null) {
- global $_SystemName;
- $_SystemName = $system;
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/system.inc';
- require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/system.inc';
-} else if ($member === "-" && isset($parts[2])) {
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.inc')) {
- global $_SystemPage;
- $_SystemPage = $parts[2];
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.inc';
- require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.inc';
- } else {
- peh_error("System page not found: " . strip_tags($parts[2]), 404);
- }
-} else {
- $memberFoundInAnotherSystem = false;
- $traveller = false;
-
- $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === $app["other"]["id"] ? "other" : $systemID) . "/members.json"), true);
- $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "hrbom" : "gdapd") . "/members.json"), true);
- $memberData = null;
- $memberCommonName = null;
- $memberID = null;
-
- foreach ($members as $m) {if ($m['name'] === $member) {
- $memberData = $m;
- $memberCommonName = $m['display_name'] ?? $m['name'];
- $memberID = $m['id'];
- }
- }
-
- foreach ($members2 as $m) {
- if ($m['name'] === $member) {
- $memberFoundInAnotherSystem = true;
- }
- }
-
- global $_SystemName;
- $_SystemName = $system;
-
- if (str_ends_with($member, "-travelling")) {
- header("Location: /" . substr($member, 0, strlen($member) - 11)) and die();
- }
-
- if (isset($parts[2]) && $parts[2] === "-" && isset($parts[3])) {
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.inc')) {
- global $_MemberPage;
- $_MemberPage = $parts[3];
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.inc';
- require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.inc';
- } else {
- peh_error("Member page not found: " . strip_tags($parts[3]), 404);
- }
- die();
- }
-
- global $_MemberName;
- $_MemberName = $member;
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/member.inc';
- require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/member.inc';
-}
-
-exit;