summaryrefslogtreecommitdiff
path: root/pages/page.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/page.php')
-rw-r--r--pages/page.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/pages/page.php b/pages/page.php
index 58f40eb..00622b3 100644
--- a/pages/page.php
+++ b/pages/page.php
@@ -1,5 +1,6 @@
<?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['_']);
@@ -19,7 +20,11 @@ if ($member === null) {
header("Location: /?error=Page not found") 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;
@@ -32,7 +37,31 @@ if ($member === null) {
}
}
- if ($memberData === null) header("Location: /?error=System member not found") and die();
+ 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";
+ $systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System";
+ $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd";
+ } else if ($m['name'] === $member) {
+ $memberFoundInAnotherSystem = true;
+ }
+ }
+
+ if ($memberData === null) {
+ if ($memberFoundInAnotherSystem) {
+ header("Location: /" . ($systemID === "gdapd" ? "cloudburst" : "raindrops") . "/" . $member) and die();
+ } else {
+ header("Location: /?error=System member not found") and die();
+ }
+ }
+
+ if ($travelling[$memberID]['travelling'] && !$traveller) {
+ header("Location: /" . ($systemID === "gdapd" ? "cloudburst" : "raindrops") . "/" . $member) and die();
+ }
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member.php';
}