summaryrefslogtreecommitdiff
path: root/pages/edit.inc
diff options
context:
space:
mode:
Diffstat (limited to 'pages/edit.inc')
-rw-r--r--pages/edit.inc14
1 files changed, 9 insertions, 5 deletions
diff --git a/pages/edit.inc b/pages/edit.inc
index 021ae4b..afaddd3 100644
--- a/pages/edit.inc
+++ b/pages/edit.inc
@@ -13,7 +13,7 @@ function getSubsystemByID(string $id) {
return $subsystem;
}
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $isLowerLoggedIn; global $title; global $isLoggedIn; global $lang; global $pages; global $app;
if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die();
@@ -23,12 +23,16 @@ array_shift($parts);
$system = $parts[0];
$member = !isset($parts[1]) || $parts[1] === "" ? null : $parts[1];
-if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?error=Invalid system name: " . $system) and die();
-$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System";
-$systemID = $system === "cloudburst" ? "ynmuc" : "gdapd";
+if ($system !== "cloudburst" && $system !== "raindrops" && $system !== $app["other"]["slug"]) header("Location: /?error=Invalid system name: " . $system) and die();
+$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === "raindrops" ? "Raindrops System" : $app["other"]["name"]);
+$systemID = $system === "cloudburst" ? "ynmuc" : ($system === "raindrops" ? "gdapd" : $app["other"]["id"]);
$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? [];
+if ($isLowerLoggedIn && $systemID !== $app["other"]["id"]) {
+ header("Location: /") and die();
+}
+
if ($member === null) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.inc';
} else {
@@ -58,7 +62,7 @@ if ($member === null) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.inc';
} else {
- header("Location: /?error=System member or subsystem not found: " . $subsystemID) and die();
+ header("Location: /?error=System member or subsystem not found") and die();
}
}