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/metadata.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/metadata.inc')
-rw-r--r-- | pages/metadata.inc | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/pages/metadata.inc b/pages/metadata.inc index 0a987f3..db5589d 100644 --- a/pages/metadata.inc +++ b/pages/metadata.inc @@ -1,23 +1,10 @@ <?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 $title; global $isLowerLoggedIn; global $isLoggedIn; global $lang; global $pages; global $app; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; -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); @@ -25,12 +12,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 === $app["other"]["slug"] ? $app["other"]["name"] : "Raindrops System"); $systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] ? $app["other"]["id"] : "gdapd"); -$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? []; - if ($isLowerLoggedIn && $systemID !== $app["other"]["id"]) { header("Location: /"); die(); @@ -40,7 +25,6 @@ if ($member === null) { header("Location: /"); die(); } else { - $isSubsystem = false; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); $memberData = null; $memberCommonName = null; @@ -55,7 +39,7 @@ if ($member === null) { } if ($memberData === null) { - header("Location: /?error=Not found") and die(); + peh_error("Not found", 404); } if (isset($_GET["submit"])) { @@ -111,27 +95,29 @@ if ($member === null) { $toUpdate["interest"] = strip_tags($_GET["interest"]); } + $regex = "/^(ynmuc|gdapd|" . $app["other"]["id"] . ")\/[a-z]{5}$/m"; + if (isset($_GET["marefriends"])) { - $toUpdate["marefriends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["marefriends"])), function ($i) { - return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); + $toUpdate["marefriends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["marefriends"])), function ($i) use ($regex) { + return !!preg_match($regex, $i); })); } if (isset($_GET["sexfriends"])) { - $toUpdate["sexfriends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["sexfriends"])), function ($i) { - return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); + $toUpdate["sexfriends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["sexfriends"])), function ($i) use ($regex) { + return !!preg_match($regex, $i); })); } if (isset($_GET["sisters"])) { - $toUpdate["sisters"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["sisters"])), function ($i) { - return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); + $toUpdate["sisters"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["sisters"])), function ($i) use ($regex) { + return !!preg_match($regex, $i); })); } if (isset($_GET["caretakers"])) { - $toUpdate["caretakers"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["caretakers"])), function ($i) { - return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); + $toUpdate["caretakers"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["caretakers"])), function ($i) use ($regex) { + return !!preg_match($regex, $i); })); } |