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 /includes/system/subsystem.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 'includes/system/subsystem.inc')
-rw-r--r-- | includes/system/subsystem.inc | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/includes/system/subsystem.inc b/includes/system/subsystem.inc deleted file mode 100644 index 3269df7..0000000 --- a/includes/system/subsystem.inc +++ /dev/null @@ -1,100 +0,0 @@ -<?php global $system; global $systemCommonName; global $lang; global $pages; global $parts; global $systemID; - -if (str_ends_with($_GET['_'], "/subsystem")) header("Location: /?error=Invalid subsystem ID") and die(); - -$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); - -$subsystemID = $parts[3]; - -$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? []; - -function getMember(string $id) { - global $systemID; - global $members; - - $member = null; - - foreach ($members as $m) { - if ($m["id"] === $id) $member = $m; - } - - return $member; -} - -function memberHasSubsystem(array $member) { - global $subsystems; - $has = false; - - foreach ($subsystems as $subsystem) { - if ($subsystem["source_type"] === "member" && $subsystem["source"] === $member["id"]) { - $has = true; - } - } - - return $has; -} - -function memberPartOfSubsystem(array $member) { - global $subsystems; - $is = false; - - foreach ($subsystems as $subsystem) { - if (in_array($member["id"], $subsystem["members"])) { - $is = true; - } - } - - return $is; -} - -function getMemberSubsystem(array $member) { - global $subsystems; - $subsystem = null; - - foreach ($subsystems as $ss) { - if ($ss["source_type"] === "member" && $ss["source"] === $member["id"]) { - $subsystem = $ss; - } - } - - return $subsystem; -} - -function getSubsystemByID(string $id) { - global $subsystems; - $subsystem = null; - - foreach ($subsystems as $ss) { - if ($ss["source"] === $id) { - $subsystem = $ss; - } - } - - return $subsystem; -} - -if (getSubsystemByID($subsystemID) === null) header("Location: /?error=Invalid subsystem ID") and die(); -$subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystemID.json"), true); - -global $subsystem; -$subsystem = getSubsystemByID($subsystemID); - -$title = $subsystemData["name"] . " ยท " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; - -?> - - <br> - <div class="container"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/subsysbanner.inc"; ?> - <br> - - <div id="page-content"> - <?php global $isLoggedIn; if ($isLoggedIn): ?> - <small style="opacity:.5;display:block;">(<a href="/-/edit/<?= $system ?>/<?= $subsystemID ?>">edit</a>)</small> - <?php endif; ?> - <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystemID.html") ?> - </div> - <?php showSubsystem(getSubsystemByID($subsystemID), $systemID); ?> - </div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file |