diff options
author | Minteck <contact@minteck.org> | 2022-08-10 00:04:25 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-10 00:04:25 +0200 |
commit | 0417260bf158c5d7b62888dae2e202b0de115a05 (patch) | |
tree | 7f54ee56da118813f2d1b3a324d322d0c74fa51b /pages/page.php | |
download | pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.gz pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.bz2 pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.zip |
Initial commit
Diffstat (limited to 'pages/page.php')
-rw-r--r-- | pages/page.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/pages/page.php b/pages/page.php new file mode 100644 index 0000000..58f40eb --- /dev/null +++ b/pages/page.php @@ -0,0 +1,40 @@ +<?php + +if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); + +$parts = explode("/", $_GET['_']); +$system = $parts[0]; +$member = ($parts[1] ?? null) === "" ? null : $parts[1]; + +if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?error=Invalid system ID") and die(); +$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; +$systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; + +if ($member === null) { + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system.php'; +} else if ($member === "-" && isset($parts[2])) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.php')) { + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.php'; + } else { + header("Location: /?error=Page not found") and die(); + } +} else { + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-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']; + } + } + + if ($memberData === null) header("Location: /?error=System member not found") and die(); + + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member.php'; +} + +exit;
\ No newline at end of file |