summaryrefslogtreecommitdiff
path: root/pages/page.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
committerMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
commit108525534c28013cfe1897c30e4565f9893f3766 (patch)
treedd3e5132971f96ab5f05e7f3f8f6dbbf379a19bd /pages/page.php
parent2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff)
downloadpluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip
Update
Diffstat (limited to 'pages/page.php')
-rw-r--r--pages/page.php102
1 files changed, 0 insertions, 102 deletions
diff --git a/pages/page.php b/pages/page.php
deleted file mode 100644
index cab5dcd..0000000
--- a/pages/page.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true);
-if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die();
-
-$parts = explode("/", $_GET['_']);
-
-if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops") && (!(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"];
-
- $parts = explode("/", $_GET['_']);
- array_unshift($parts, "");
- $parts = array_values($parts);
-
- if (in_array($parts[1], $namesCloudburst)) {
- $parts[0] = "cloudburst";
- } else if (in_array($parts[1], $namesRaindrops)) {
- $parts[0] = "raindrops";
- }
-
- if ($parts[1] === "unknown-rd" || $parts[1] === "unknown-cb") $parts[1] = "unknown";
-}
-
-$system = $parts[0];
-$member = (isset($parts[1]) ? $parts[1] : null) === "" ? null : (isset($parts[1]) ? $parts[1] : null);
-
-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) {
- global $_SystemName;
- $_SystemName = $system;
- 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')) {
- global $_SystemPage;
- $_SystemPage = $parts[2];
- require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.php';
- } else {
- header("Location: /?error=Page not found: " . $parts[2]) and die();
- }
-} else {
- $memberFoundInAnotherSystem = false;
- $traveller = false;
-
- $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-members.json"), true);
- $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "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 && $travelling[$m['id']]['travelling']) {
- $traveller = true;
- $memberData = $m;
- $memberCommonName = $m['display_name'] ?? $m['name'];
- $memberID = $m['id'];
- $system = $systemID === "gdapd" ? "cloudburst" : "raindrops";
- $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd";
- } else 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] . '.php')) {
- global $_MemberPage;
- $_MemberPage = $parts[3];
- require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.php';
- } else {
- header("Location: /?error=Page not found: " . $parts[3]) and die();
- }
- die();
- }
-
- global $_MemberName;
- $_MemberName = $member;
- require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member.php';
-}
-
-exit; \ No newline at end of file