summaryrefslogtreecommitdiff
path: root/pages/page.inc
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-23 14:20:13 +0100
committerMinteck <contact@minteck.org>2023-02-23 14:20:13 +0100
commit8cc1f13c17fa2fb5a4410542d39e650e02945634 (patch)
treee3f668e635253310b97fb379d71318dc96d1dd2d /pages/page.inc
parent6563d542af0930ebb6b2f9b71f2b7538d7467665 (diff)
downloadpluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.tar.gz
pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.tar.bz2
pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.zip
Updated 27 files, added assets/uploads/pt-twilightsparkle.png and deleted 3 files (automated)
Diffstat (limited to 'pages/page.inc')
-rw-r--r--pages/page.inc25
1 files changed, 18 insertions, 7 deletions
diff --git a/pages/page.inc b/pages/page.inc
index f3859d3..3bdeb2e 100644
--- a/pages/page.inc
+++ b/pages/page.inc
@@ -1,19 +1,28 @@
<?php
-global $lang; global $pages;
+global $lang; global $pages; global $isLoggedIn; global $isLowerLoggedIn;
+
+$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/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] === "-")) {
+if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $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"];
+ $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, "");
@@ -23,17 +32,19 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops") && (!(count($parts
$parts[0] = "cloudburst";
} else if (in_array($parts[1], $namesRaindrops)) {
$parts[0] = "raindrops";
+ } else if (in_array($parts[1], $namesOther) && ($isLoggedIn || $isLowerLoggedIn)) {
+ $parts[0] = $app["other"]["slug"];
}
- if ($parts[1] === "unknown-rd" || $parts[1] === "unknown-cb") $parts[1] = "unknown";
+ if ($parts[1] === "unknown-rd" || $parts[1] === "unknown-cb" || (($isLoggedIn || $isLowerLoggedIn) && $parts[1] === $app["other"]["slug"])) $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=" . $lang["page"]["system"]) and die();
-$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System";
-$systemID = $system === "cloudburst" ? "ynmuc" : "gdapd";
+if ($system !== "cloudburst" && $system !== "raindrops" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) header("Location: /?error=" . $lang["page"]["system"]) and die();
+$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 ($member === null) {
global $_SystemName;
@@ -53,7 +64,7 @@ if ($member === null) {
$memberFoundInAnotherSystem = false;
$traveller = false;
- $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true);
+ $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" ? "ynmuc" : "gdapd") . "/members.json"), true);
$memberData = null;
$memberCommonName = null;