diff options
author | Minteck <contact@minteck.org> | 2023-02-23 19:34:56 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-23 19:34:56 +0100 |
commit | 3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch) | |
tree | 75be5fba4368472fb11c8015aee026b2b9a71888 /pages/edit.inc | |
parent | 8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff) | |
download | pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2 pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip |
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'pages/edit.inc')
-rw-r--r-- | pages/edit.inc | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/pages/edit.inc b/pages/edit.inc index afaddd3..e074087 100644 --- a/pages/edit.inc +++ b/pages/edit.inc @@ -1,21 +1,8 @@ <?php -function getSubsystemByID(string $id) { - global $subsystems; - $subsystem = null; - - foreach ($subsystems as $ss) { - if ($ss["source"] === $id) { - $subsystem = $ss; - } - } - - return $subsystem; -} - 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(); +if (!isset($_GET['_']) || trim($_GET['_']) === "") peh_error("Invalid request", 400); $parts = explode("/", $_GET['_']); array_shift($parts); @@ -23,12 +10,10 @@ array_shift($parts); $system = $parts[0]; $member = !isset($parts[1]) || $parts[1] === "" ? null : $parts[1]; -if ($system !== "cloudburst" && $system !== "raindrops" && $system !== $app["other"]["slug"]) header("Location: /?error=Invalid system name: " . $system) and die(); +if ($system !== "cloudburst" && $system !== "raindrops" && $system !== $app["other"]["slug"]) peh_error("Invalid system name: " . $system, 400); $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(); } @@ -36,7 +21,6 @@ if ($isLowerLoggedIn && $systemID !== $app["other"]["id"]) { if ($member === null) { require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.inc'; } else { - $isSubsystem = false; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); $memberData = null; $memberCommonName = null; @@ -51,19 +35,7 @@ if ($member === null) { } if ($memberData === null) { - if (in_array($member, array_map(function ($i) { - return $i["source"]; - }, $subsystems))) { - $isSubsystem = true; - $subsystemID = $member; - $subsystem = getSubsystemByID($subsystemID); - $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json"), true); - $subsystemCommonName = $subsystemData["name"] ?? $subsystemID; - - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.inc'; - } else { - header("Location: /?error=System member or subsystem not found") and die(); - } + peh_error("System member not found", 404); } require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit.inc'; |