diff options
author | Minteck <contact@minteck.org> | 2023-02-23 14:20:13 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-23 14:20:13 +0100 |
commit | 8cc1f13c17fa2fb5a4410542d39e650e02945634 (patch) | |
tree | e3f668e635253310b97fb379d71318dc96d1dd2d | |
parent | 6563d542af0930ebb6b2f9b71f2b7538d7467665 (diff) | |
download | pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.tar.gz pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.tar.bz2 pluralconnect-8cc1f13c17fa2fb5a4410542d39e650e02945634.zip |
Updated 27 files, added assets/uploads/pt-twilightsparkle.png and deleted 3 files (automated)
31 files changed, 421 insertions, 181 deletions
diff --git a/api/save.php b/api/save.php index 52cdebe..864f86e 100644 --- a/api/save.php +++ b/api/save.php @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $app; +if (!$isLoggedIn && !$isLowerLoggedIn) header("Location: /-/login") and die(); $request_raw = file_get_contents('php://input'); $json_object = json_decode($request_raw, true); @@ -20,6 +20,8 @@ if (!isset($member) || trim($member) === "" || strlen($member) !== 5 || !preg_ma if (!isset($subsystem) || trim($subsystem) === "" || !preg_match("/[a-z\d]/i", $subsystem)) if ($subsystem !== null && $subsystem !== "null") header("Location: /?error=Subsystem not found") and die(); +if ($isLowerLoggedIn && $system !== $app["other"]["id"]) die(); + if (!isset($content)) header("Location: /?error=No content") and die(); @@ -1,6 +1,9 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/language.inc"; global $lang; global $pages; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; + +$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); if (str_ends_with($_GET['_'], "/")) { $pagename = substr($_GET['_'], 0, strlen($_GET['_']) - 1); @@ -36,7 +39,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc"; } - } else if ($toplevel === "cloudburst" || $toplevel === "raindrops") { + } else if ($toplevel === "cloudburst" || $toplevel === "raindrops" || (($isLoggedIn || $isLowerLoggedIn) && $toplevel === $app["other"]["slug"])) { $parts = explode("/", $_GET['_']); if (isset($parts[1]) && $parts[1] !== "-") { @@ -65,8 +68,15 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { $namesRaindrops = [...array_map(function ($i) { return $i['name']; }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)), "unknown-rd"]; + $namesOther = []; + + if ($isLoggedIn || $isLowerLoggedIn) { + $namesOther = [...array_map(function ($i) { + return $i['name']; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true)), $app["other"]["unknown"]]; + } - if ((in_array($toplevel, $namesCloudburst) || in_array($toplevel, $namesRaindrops)) && $toplevel !== "unknown") { + if ((in_array($toplevel, $namesCloudburst) || in_array($toplevel, $namesRaindrops) || in_array($toplevel, $namesOther)) && $toplevel !== "unknown") { $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc"; } else { diff --git a/assets/logo/banner.js b/assets/logo/banner.js index da54b4d..382686e 100644 --- a/assets/logo/banner.js +++ b/assets/logo/banner.js @@ -141,7 +141,7 @@ async function refreshBanner(_, french) { ${data['id'] !== "fusion" ? ` <span> <span class="member-small-only"><b>${french ? "Position :" : "Location:"} </b></span> - ${data['system']['page'] ? `<a class="member-link" href="${data['system']['page']}"><img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `/assets/uploads/${data['system']['icon']}`}"> ${data['system']['name']}</a>` : `<img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `/assets/uploads/${data['system']['icon']}`}"> ${data['system']['name']}`} + ${data['system']['page'] ? `<a class="member-link" href="${data['system']['page']}"><img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}</a>` : `<img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}`} ${data['system']['subsystem'] ? ` <br><span class="member-small-only"><b>${french ? "Sous-système :" : "Subsystem:"} </b></span><a class="member-link" href="${data['system']['subsystem']['page']}"><img style="width:24px;border-radius:5px;" src="/assets/uploads/${data['system']['subsystem']['icon']}"> ${data['system']['subsystem']['name']}</a> ` : data['system']['temporary'] ? (french ? '<br>(temporaire)' : '<br>(temporary)') : ''} diff --git a/assets/logo/custom.css b/assets/logo/custom.css index 2673b91..dccb432 100644 --- a/assets/logo/custom.css +++ b/assets/logo/custom.css @@ -68,7 +68,7 @@ body { } @media (max-width: 991px) { - #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div { + #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { grid-template-columns: repeat(3, 1fr) !important; } @@ -82,13 +82,13 @@ body { } @media (max-width: 768px) { - #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div { + #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { grid-template-columns: repeat(2, 1fr) !important; } } @media (max-width: 575px) { - #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div { + #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { grid-template-columns: repeat(1, 1fr) !important; } @@ -96,9 +96,10 @@ body { display: inline-block !important; margin-right: 5px !important; height: 32px !important; + width: 32px !important; } - #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div { + #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { grid-gap: 5px !important; } diff --git a/assets/uploads/banner-cloudburst.jpg b/assets/uploads/banner-cloudburst.jpg Binary files differdeleted file mode 100644 index 6692739..0000000 --- a/assets/uploads/banner-cloudburst.jpg +++ /dev/null diff --git a/assets/uploads/banner-raindrops.jpg b/assets/uploads/banner-raindrops.jpg Binary files differdeleted file mode 100644 index f4edfa2..0000000 --- a/assets/uploads/banner-raindrops.jpg +++ /dev/null diff --git a/assets/uploads/pt-nightmaremoon.png b/assets/uploads/pt-nightmaremoon.png Binary files differdeleted file mode 100644 index c6ffb3f..0000000 --- a/assets/uploads/pt-nightmaremoon.png +++ /dev/null diff --git a/assets/uploads/pt-twilightsparkle.png b/assets/uploads/pt-twilightsparkle.png Binary files differnew file mode 100644 index 0000000..e996c8d --- /dev/null +++ b/assets/uploads/pt-twilightsparkle.png diff --git a/includes/banner.inc b/includes/banner.inc index c96bedd..888cc95 100644 --- a/includes/banner.inc +++ b/includes/banner.inc @@ -181,11 +181,13 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } + $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); + $systemData = []; - $systemData['page'] = "/" . ($system === "gdapd" ? "raindrops" : "cloudburst"); - $systemData['icon'] = ($system === "gdapd" ? "raindrops" : "cloudburst") . ".png"; - $systemData['name'] = $system === "gdapd" ? "Raindrops" : "Cloudburst"; - $systemData['full_name'] = $system === "gdapd" ? "Raindrops System" : "Cloudburst System"; + $systemData['page'] = "/" . ($system === "gdapd" ? "raindrops" : ($system === $app["other"]["id"] ? $app["other"]["slug"] : "cloudburst")); + $systemData['icon'] = getAsset($system); + $systemData['name'] = $system === "gdapd" ? "Raindrops" : ($system === $app["other"]["id"] ? $app["other"]["short"] : "Cloudburst"); + $systemData['full_name'] = $system === "gdapd" ? "Raindrops System" : ($system === $app["other"]["id"] ? $app["other"]["name"] : "Cloudburst System"); $systemData['subsystem'] = null; $systemData['temporary'] = false; @@ -207,7 +209,6 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { $systemData['temporary'] = true; } - if ($travelling[$member['id']]["travelling"] && $travelling[$member['id']]["equestria"]) { $systemData['page'] = null; $systemData['icon'] = "../logo/equestria.png"; diff --git a/includes/details.inc b/includes/details.inc index 323352d..ce1add6 100644 --- a/includes/details.inc +++ b/includes/details.inc @@ -1,5 +1,5 @@ -<?php global $isLoggedIn; global $metadata; global $memberData; global $isLowerLoggedIn; global $lang; global $pages; $pronouns = getMemberPronouns($memberData['pronouns']); ?> -<div id="member-details" class="<?= ($isLoggedIn || $isLowerLoggedIn) ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn && !$isLowerLoggedIn): ?>grid-template-columns: repeat(4, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> +<?php global $isLoggedIn; global $metadata; global $memberData; global $isLowerLoggedIn; global $systemID; global $app; global $lang; global $pages; $pronouns = getMemberPronouns($memberData['pronouns']); ?> +<div id="member-details" class="<?= (($isLoggedIn || $isLowerLoggedIn) && $systemID !== $app["other"]["id"]) ? 'member-details-loggedIn' : '' ?>" style="<?php if ((!$isLoggedIn && !$isLowerLoggedIn) || $systemID === $app["other"]["id"]): ?>grid-template-columns: repeat(4, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> <div> <b><?= $lang["details"]["food"] ?></b><span class="member-small-separator"><br></span> <?= match ($metadata["food"]) { @@ -17,6 +17,7 @@ 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst($pronouns["subjective"])) . ($pronouns["third"] ? " shares" : " share") . " all memories with " . str_replace("'", "'", $pronouns["possessive_det"]) . " headmates.'>" . $lang["details"]["memory_states"][2] . "</span>", } ?> </div> + <?php if ($systemID !== $app["other"]["id"]): ?> <?php if ($isLoggedIn || $isLowerLoggedIn): ?> <div> <b>Age:</b><span class="member-small-separator"><br></span> @@ -69,11 +70,16 @@ - <?php endif; ?> </div> + <?php endif; ?> +<?php if ($systemID !== $app["other"]["id"]): ?> </div> +<?php endif; ?> <?php if ($isLoggedIn || $isLowerLoggedIn): ?> +<?php if ($systemID !== $app["other"]["id"]): ?> <div id="member-details-2" style="background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;<?php if ($isLowerLoggedIn): ?>grid-template-columns: repeat(3, 1fr);<?php endif; ?>"> +<?php endif; ?> <?php if (((isset($age) && $age >= 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?> - <?php if ($isLoggedIn): ?> + <?php if ($isLoggedIn && $systemID !== $app["other"]["id"]): ?> <div> <span style="vertical-align: middle;"> <b>Sexual consent:</b><span class="member-small-separator"><br></span> @@ -138,6 +144,7 @@ break; } ?><?php if ($metadata["polyamorous"]["romantic"]): ?> (poly)<?php endif; ?> </div> + <?php if ($systemID !== $app["other"]["id"]): ?> <div> <b>Birthday:</b><span class="member-small-separator"><br></span> <?php if (isset($metadata["birth"]["date"]) && trim($metadata["birth"]["date"]) !== "" && $metadata["birth"]["date"] !== "01-01"): ?> @@ -146,13 +153,6 @@ - <?php endif; ?> </div> - <!--<div> - <b>Item 4:</b><span class="member-small-separator"><br></span> - Value 4 - </div> - <div> - <b>Item 5:</b><span class="member-small-separator"><br></span> - Value 5 - </div>--> + <?php endif; ?> </div> <?php endif; ?> diff --git a/includes/flags.json b/includes/flags.json index 5bb9a91..d05292c 100644 --- a/includes/flags.json +++ b/includes/flags.json @@ -6,15 +6,15 @@ "median": null, "protector": "!!Protector", - "leader": "!!Leader", + "leader": "Leader", "fictive": "!!Fictive", "sexual_features": "Enable sexual features (for ponies below 16)", "sexually_active": "Preemptive sexual consent", "robot": "!!Robot", "plush": "!!Plush", "polyamorous": { - "romantic": "Polyamorous (romantic)", - "sexual": "Polyamorous (sexual)" + "romantic": "!!Polyamorous (romantic)", + "sexual": "!!Polyamorous (sexual)" }, "non_verbal": "!!Non verbal in real life", "less_frequent": "!!Fronts less frequently", diff --git a/includes/functions.inc b/includes/functions.inc index 9bc9ba6..d0f8568 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -181,7 +181,7 @@ if (!function_exists("getMiniName")) { function getMiniName(string $name) { $parts = explode(" ", $name); - if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly" && $parts[0] !== "Windy" && (isset($parts[1]) && $parts[1] !== "Brightdawn" && $parts[1] !== "Fizz")) { + if (strlen($parts[0]) > 3 && $parts[0] !== "Sweetie" && $parts[0] !== "Filly" && $parts[0] !== "Windy" && (isset($parts[1]) && $parts[1] !== "Brightdawn" && $parts[1] !== "Fizz")) { if ($parts[0] === "Princess") { array_shift($parts); } @@ -205,9 +205,10 @@ if (!function_exists("withCaretakersDown")) { if (!function_exists("getSystemMember")) { function getSystemMember(string $system, string $id) { + $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); $systemID = $system; - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === $app["other"]["id"] ? "other" : $systemID) . "/members.json"), true); $member = null; foreach ($members as $m) { @@ -222,6 +223,7 @@ if (!function_exists("getSystemMember")) { if (!function_exists("getMemberWithoutSystem")) { function getMemberWithoutSystem(string $id) { + global $isLowerLoggedIn; global $isLoggedIn; $member = null; $members1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true); @@ -238,6 +240,17 @@ if (!function_exists("getMemberWithoutSystem")) { if ($m["id"] === $id) $member = $m; } + if ($isLowerLoggedIn || $isLoggedIn) { + $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); + $members3 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true); + + foreach ($members3 as $m) { + $m["_system"] = $app["other"]["id"]; + $m["system"] = $app["other"]["id"]; + if ($m["id"] === $id) $member = $m; + } + } + return $member; } } @@ -247,7 +260,7 @@ if (!function_exists("showMembersFromList")) { foreach ($list as $member) { if ($member['name'] !== "unknown" && $member['name'] !== "fusion") { echo('<!-- ' . ($member['display_name'] ?? $member['name']) . ' --> <a href="/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border:1px solid ' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';outline-color:' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;' . (isset($member["equestria"]) && $member["equestria"] ? 'opacity:.5;' : '') . '"><div> -<img alt="" src="' . getAsset($member["system"], $member["id"]) . '" style="border-radius:999px;background-color:rgba(0, 0, 0, .25);height:48px;display:block;margin-left:auto;margin-right:auto;"> +<img alt="" src="' . getAsset($member["system"], $member["id"]) . '" style="border-radius:999px;background-color:rgba(0, 0, 0, .25);height:48px;width:48px;display:block;margin-left:auto;margin-right:auto;"> <div style="text-decoration:none;color:white;margin-top:5px;">' . ($member['display_name'] ?? $member['name']) . '</div> <div style="text-decoration:none !important;color:black !important;"><code style="text-decoration:none !important;color:white !important;">' . (isset($member['travelling']) && $member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? " ") : ($member['proxy_tags'][0]['prefix'] ?? " ")) . '</code></div> </div></div></a>'); @@ -273,6 +286,24 @@ if (!function_exists("showSubsystem")) { } } +if (!function_exists("prettySize")) { + function prettySize($bytes) { + if ($bytes > 1024) { + if ($bytes > 1024**2) { + if ($bytes > 1024**3) { + return round($bytes / 1024**3, 1) . " GB"; + } else { + return round($bytes / 1024**2, 1) . " MB"; + } + } else { + return round($bytes / 1024, 1) . " KB"; + } + } else { + return $bytes . " B"; + } + } +} + if (!function_exists("showSystem")) { function showSystem(string $id, string $name, string $color, bool $hideTitle) { $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); @@ -288,7 +319,7 @@ if (!function_exists("showSystem")) { <div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "ynmuc" ? "cloudburst" : "other")) . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px 10px 10px 20px;display:grid;grid-template-columns: 128px 1fr;margin-bottom:10px;">'); } if (!$hideTitle) echo('<!-- System Name --> -<a style="display:flex;margin: -10px -20px;align-items:center;justify-content:center;text-align:center;padding: 10px 20px;border-radius: 10px;background: #' . $global['color'] . '55;width: 148px;text-decoration:none;color:white;filter:none !important;" href="/' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '" class="hpd-system"> +<a style="display:flex;margin: -10px -20px;align-items:center;justify-content:center;text-align:center;padding: 10px 20px;border-radius: 10px;background: #' . $global['color'] . '55;width: 148px;text-decoration:none;color:white;filter:none !important;" href="/' . ($id === "gdapd" ? "raindrops" : ($id === $app["other"]["id"] ? $app["other"]["slug"] : "cloudburst")) . '" class="hpd-system"> <div style="text-align:center;"><img src="' . getAsset($id) . '" style="width:64px;"><br>' . $name . '</div> </a>'); @@ -298,20 +329,29 @@ if (!function_exists("showSystem")) { echo(' <div style="display:grid;grid-template-columns:repeat(6, 1fr);padding-left:10px;grid-gap:10px;">'); } - showMembersFromList(scoreOrder([...array_map(function ($i) use ($id, $travelling) { - $i["travelling"] = false; - $i["system"] = $id; - $i["equestria"] = $travelling[$i['id']]['travelling'] && $travelling[$i['id']]['equestria']; - return $i; - }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . (isset($app["other"]) && $id === $app["other"]["id"] ? "other" : $id) . "/members.json"), true), function ($i) use ($travelling) { - return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria'])); - })), ...array_map(function ($i) use ($id) { - $i["travelling"] = true; - $i["system"] = ($id === "gdapd" ? "ynmuc" : "gdapd"); - return $i; - }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($id === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), function ($i) use ($travelling) { - return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']); - }))], $id)); + if ($id === $app["other"]["id"]) { + showMembersFromList(scoreOrder([...array_map(function ($i) use ($id, $travelling) { + $i["travelling"] = false; + $i["system"] = $id; + $i["equestria"] = false; + return $i; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . (isset($app["other"]) && $id === $app["other"]["id"] ? "other" : $id) . "/members.json"), true))], $id)); + } else { + showMembersFromList(scoreOrder([...array_map(function ($i) use ($id, $travelling) { + $i["travelling"] = false; + $i["system"] = $id; + $i["equestria"] = $travelling[$i['id']]['travelling'] && $travelling[$i['id']]['equestria']; + return $i; + }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . (isset($app["other"]) && $id === $app["other"]["id"] ? "other" : $id) . "/members.json"), true), function ($i) use ($travelling) { + return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria'])); + })), ...array_map(function ($i) use ($id) { + $i["travelling"] = true; + $i["system"] = ($id === "gdapd" ? "ynmuc" : "gdapd"); + return $i; + }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($id === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), function ($i) use ($travelling) { + return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']); + }))], $id)); + } echo('</div> @@ -504,7 +544,7 @@ if (!function_exists("getMemberSystem")) { if (!function_exists("getMemberFromName")) { function getMemberFromName(string $name) { - $list = [...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), ...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true)]; + $list = [...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), ...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true), ...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true)]; foreach ($list as $item) { if ($item["name"] === $name) return getMemberWithoutSystem($item["id"]); diff --git a/includes/member.inc b/includes/member.inc index 488ff7f..66d0798 100644 --- a/includes/member.inc +++ b/includes/member.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; global $lang; global $pages; +<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; global $lang; global $pages; global $app; if ($memberData["name"] === "fusion") { $title = ($memberCommonName === "fusion" ? $lang["member"]["merge"] : $memberCommonName); @@ -18,6 +18,7 @@ global $isLoggedIn; $frontersRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); $frontersCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); +$frontersOther = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/fronters.json"), true); $fusionRaindrops = false; @@ -100,7 +101,11 @@ if ($memberData["name"] === "fusion") { <details> <summary style="list-style: none;"> + <?php if ($systemID === $app["other"]["id"]): ?> + <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">page</a>)</small> + <?php else: ?> <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small> + <?php endif; ?> </summary> <div class="alert alert-dark"> <ul style="margin-bottom:0;"> diff --git a/includes/metadata.inc b/includes/metadata.inc index 2e009cd..10a87ab 100644 --- a/includes/metadata.inc +++ b/includes/metadata.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing metadata for " . $memberCommonName . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $app; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing metadata for " . $memberCommonName . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json")) { $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json"), true)); @@ -86,10 +86,12 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <h3>Relationships</h3> + <?php if ($systemID !== $app["other"]["id"]): ?> <p> <b>Sexfriends (full IDs, comma-separated)</b><br> <input name="sexfriends" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["sexfriends"]) ?>"> </p> + <?php endif; ?> <p> <b>Marefriends (full IDs, comma-separated)</b><br> <input name="marefriends" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["marefriends"]) ?>"> @@ -102,11 +104,8 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <b>Caretakers (full IDs, comma-separated)</b><br> <input name="caretakers" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["caretakers"]) ?>"> </p> - <p> - <b>Age regressed version (local ID)</b><br> - <input name="regressed" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["regressed"] ?? "" ?>"> - </p> + <?php if ($systemID !== $app["other"]["id"]): ?> <hr> <h3>Technical details</h3> @@ -132,6 +131,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <b>Age (for ponies with fixed age)</b><br> <input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="number" value="<?= $metadata["birth"]["age"] ?? "" ?>"> </p> + <?php endif; ?> <hr> @@ -141,7 +141,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member $flags = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/flags.json"), true); - foreach ($flags as $id => $name): if (!is_array($name) && !is_null($name)): ?> + foreach ($flags as $id => $name): if (!is_array($name) && !is_null($name)): if (($systemID === $app["other"]["id"] && str_starts_with($name, "!!")) || $systemID !== $app["other"]["id"]): ?> <label style="margin-bottom:5px;"> <input <?= $metadata[$id] ? "checked" : "" ?> class="form-check-input" type="checkbox" name="flags[<?= $id ?>]"> <?= str_starts_with($name, "!!") ? substr($name, 2) : $name ?> @@ -151,11 +151,11 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <input <?= $metadata[$id][$id2] ? "checked" : "" ?> class="form-check-input" type="checkbox" name="flags[<?= $id ?>][<?= $id2 ?>]"> <?= str_starts_with($name2, "!!") ? substr($name2, 2) : $name2 ?> </label><br> - <?php endforeach; endif; endforeach; ?> + <?php endforeach; endif; endif; endforeach; ?> <hr> - <input name="submit" class="btn btn-outline-primary" value="Save and quit" type="submit"> + <input name="submit" class="btn btn-outline-primary" value="Save and refresh" type="submit"> </form> <?php else: ?> <div class="alert alert-warning"> diff --git a/includes/navigation.inc b/includes/navigation.inc index ac40ae6..b888fed 100644 --- a/includes/navigation.inc +++ b/includes/navigation.inc @@ -319,6 +319,75 @@ $navigation_cloudburst = [ ] ] ]; +$navigation_other = [ + "admin" => true, + "name" => $app["other"]["name"], + "icon" => getAsset($app["other"]["id"]), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => $lang["navigation"]["about"], + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/" . $app["other"]["slug"], + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:history"]["name"][$lang["_name"]], + "icon" => "/assets/icons/history.svg", + "invert" => true, + "link" => "/" . $app["other"]["slug"] . "/-/history", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:compare"]["name"][$lang["_name"]], + "icon" => "/assets/icons/compare.svg", + "invert" => true, + "link" => "/" . $app["other"]["slug"] . "/-/compare", + "stepped" => null, + "private" => false + ] + ] + ], + /*"subsystems" => [ + "name" => $lang["navigation"]["subsystems"], + "minimal" => false, + "items" => array_map(function ($subsystem) { + $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc-" . $subsystem['source'] . ".json"), true); + + return [ + "name" => $ssData['name'] ?? $subsystem['source'], + "icon" => "/assets/uploads/ss-$subsystem[source].png", + "invert" => false, + "link" => "/cloudburst/-/subsystem/$subsystem[source]", + "stepped" => null + ]; + }, $cloudburst_subsystemsNotMember) + ],*/ + "members" => [ + "name" => $lang["navigation"]["members"], + "minimal" => false, + "items" => array_map(function ($member) { + return [ + "name" => $member['display_name'] ?? $member['name'], + "icon" => getAsset($member["system"], $member["id"], "heads"), + "invert" => false, + "link" => "/$member[name]", + "stepped" => null, + "private" => false + ]; + }, array_filter(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true), $app["other"]["id"]), function ($member) { + return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; + })) + ] + ] +]; $navigation_raindrops = [ "admin" => false, "name" => "Raindrops System", @@ -391,10 +460,19 @@ $navigation_raindrops = [ global $parts; -if (isset($parts) && isset($parts[0]) && $parts[0] === "cloudburst") { +if (isset($parts) && isset($parts[0]) && $parts[0] === $app["other"]["slug"]) { + $navigation = [ + "other" => $navigation_other, + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} elseif (isset($parts) && isset($parts[0]) && $parts[0] === "cloudburst") { $navigation = [ "cloudburst" => $navigation_cloudburst, "raindrops" => $navigation_raindrops, + "other" => $navigation_other, "admin" => $navigation_admin, "global" => $navigation_global ]; @@ -402,6 +480,7 @@ if (isset($parts) && isset($parts[0]) && $parts[0] === "cloudburst") { $navigation = [ "raindrops" => $navigation_raindrops, "cloudburst" => $navigation_cloudburst, + "other" => $navigation_other, "admin" => $navigation_admin, "global" => $navigation_global ]; @@ -410,6 +489,7 @@ if (isset($parts) && isset($parts[0]) && $parts[0] === "cloudburst") { "admin" => $navigation_admin, "global" => $navigation_global, "cloudburst" => $navigation_cloudburst, - "raindrops" => $navigation_raindrops + "raindrops" => $navigation_raindrops, + "other" => $navigation_other, ]; }
\ No newline at end of file diff --git a/includes/pages.json b/includes/pages.json index eca0fe4..f2326c0 100644 --- a/includes/pages.json +++ b/includes/pages.json @@ -85,8 +85,8 @@ "fr": "Débogage des mises à jour" }, "short": null, - "admin": false, - "limited": false, + "admin": true, + "limited": true, "rail": true }, "docs": { @@ -116,7 +116,7 @@ }, "short": null, "admin": true, - "limited": false, + "limited": true, "rail": false }, "edit-private": { diff --git a/includes/refresh.php b/includes/refresh.php index c4eac83..922e708 100644 --- a/includes/refresh.php +++ b/includes/refresh.php @@ -243,6 +243,10 @@ if (isset($app["other"]) && isset($app["other"]["id"]) && isset($app["other"]["t getSystem($app["other"]["id"], "other", $app["other"]["token"]); } +if (!is_link($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $app["other"]["id"])) { + link($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $app["other"]["id"]); +} + echo("Calendar\n"); $currentOpStart = microtime(true); file_put_contents("./data/calendar/calendar.ics", file_get_contents($app["calendar"])); diff --git a/includes/score.inc b/includes/score.inc index 96925bf..991c132 100644 --- a/includes/score.inc +++ b/includes/score.inc @@ -60,6 +60,9 @@ function scoreOrder($members, $system) { } function scoreOrderGlobal() { + global $isLowerLoggedIn; + global $isLoggedIn; + $ordered = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json")) { @@ -81,6 +84,19 @@ function scoreOrderGlobal() { } } + if ($isLowerLoggedIn || $isLoggedIn) { + $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true) as $member) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json")) { + $member["_system"] = $app["other"]["id"]; + $member["system"] = $app["other"]["id"]; + $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); + $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)), $member["display_name"] ?? $member["name"]); + $ordered[] = $member; + } + } + } + uasort($ordered, function($a, $b) { return $b["_score"]["total"] - $a["_score"]["total"]; }); diff --git a/includes/sysbanner.inc b/includes/sysbanner.inc index d240869..2ca3ee8 100644 --- a/includes/sysbanner.inc +++ b/includes/sysbanner.inc @@ -6,7 +6,7 @@ global $memberID; global $systemCommonName; global $systemID; global $system; -global $lang; global $pages; +global $lang; global $pages; global $app; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); @@ -14,7 +14,9 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa ?> <div id="system-info" style="display:grid;grid-template-columns: 128px 1fr;background-color:rgba(255, 255, 255, .05);margin-left: -20px; margin-right: -20px;margin-top:-20px;padding: 20px 20px 10px;"> - <img src="/assets/uploads/<?= $system ?>.png" alt="" style="height:128px;border-top-left-radius:10px;border-bottom-left-radius:10px;"> + <div style="display: flex; align-items: center; justify-content: center;"> + <img src="<?= getAsset($systemID) ?>" alt="" style="width:128px;max-height:128px;border-top-left-radius:10px;border-bottom-left-radius:10px;"> + </div> <div style="padding:10px 10px 10px 20px;text-align:center;"> <div style="display: grid; grid-template-columns: 1fr;height:100%;grid-template-rows: max-content max-content 1fr;"> <h3 style="height:max-content;"><?= $systemCommonName ?></h3> @@ -81,9 +83,13 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa <span> <?php - $travellers = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), function ($i) use ($travelling) { - return $travelling[$i['id']]['travelling'] && !$travelling[$i['id']]['equestria']; - }); + if ($systemID === $app["other"]["id"]) { + $travellers = []; + } else { + $travellers = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), function ($i) use ($travelling) { + return $travelling[$i['id']]['travelling'] && !$travelling[$i['id']]['equestria']; + }); + } ?> <b><?= $lang["system"]["members"] ?> </b><?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?><?php diff --git a/includes/sysedit.inc b/includes/sysedit.inc index bfff61b..22ec670 100644 --- a/includes/sysedit.inc +++ b/includes/sysedit.inc @@ -2,7 +2,7 @@ ?> -<div id="system-banner-container" style="width: 100%;height: 65vh;position: fixed;background-image: url('/assets/uploads/banner-<?= $system ?>.jpg');background-size: cover;background-position: center; top: 0;"> +<div id="system-banner-container" style="width: 100%;height: 65vh;position: fixed;background-image: url('<?= getAsset($systemID, null, "banners") ?>');background-size: cover;background-position: center; top: 0;"> <div id="system-banner-inner" style="height: 100%;width: 100%;background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%);"></div> </div> diff --git a/includes/system.inc b/includes/system.inc index 85b8a9c..ae624f9 100644 --- a/includes/system.inc +++ b/includes/system.inc @@ -1,8 +1,8 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $isLowerLoggedIn; global $systemCommonName; global $systemID; $title = $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $app; global $isLoggedIn; ?> -<div id="system-banner-container" style="width: calc(100% - 300px);height: 65vh;position: fixed;background-image: url('/assets/uploads/banner-<?= $system ?>.jpg');background-size: cover;background-position: center; top: 0;"> +<div id="system-banner-container" style="width: calc(100% - 300px);height: 65vh;position: fixed;background-image: url('<?= getAsset($systemID, null, "banners") ?>');background-size: cover;background-position: center; top: 0;"> <div id="system-banner-inner" style="height: 100%;width: 100%;background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.25) 50%, rgba(0,0,0,1) 100%);"></div> </div> @@ -20,17 +20,21 @@ <br> <div id="page-content"> - <?php global $isLoggedIn; if ($isLoggedIn): ?> - <small style="opacity:.5;display:block;">(<a href="/-/edit/<?= $system ?>">edit</a>)</small> - <?php endif; ?> <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/content.html") ?> </div> - <?php if ($system === "cloudburst") cloudburst(true); else raindrops(true); ?> + <?php if ($system === "cloudburst") cloudburst(true); elseif ($system === "raindrops") raindrops(true); elseif ($isLoggedIn || $isLowerLoggedIn) other(true); ?> </div> </div> +<div class="container"> + <hr> + <?php global $isLoggedIn; if ($isLoggedIn): ?> + <small style="opacity:.5;display:block;">(edit: <a href="/-/edit/<?= $system ?>"><?= $systemID === $app["other"]["id"] ? "page" : "public" ?></a>)</small> + <?php endif; ?> +</div> + <style> - #hpd-cloudburst, #hpd-raindrops { + #hpd-cloudburst, #hpd-raindrops, #hpd-cloudburst, #hpd-other { background: transparent !important; padding: 0 !important; margin-bottom: 0 !important; diff --git a/includes/system/compare.inc b/includes/system/compare.inc index dbcbfe4..2accb8a 100644 --- a/includes/system/compare.inc +++ b/includes/system/compare.inc @@ -1,4 +1,4 @@ -<?php global $system; global $lang; global $pages; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:compare"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; +<?php global $system; global $lang; global $pages; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:compare"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; global $app; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); @@ -20,7 +20,7 @@ function getMember(string $id) { <br> <div class="container"> <h2><?= $lang["compare"]["title"] ?> <?= $systemCommonName ?></h2> - <div class="comparison"> + <div class="comparison" style="<?php if ($systemID === $app["other"]["id"]): ?>grid-template-columns: 3fr 1.5fr 2fr repeat(4, 1fr);<?php endif; ?>"> <span class="comparison-header comparison-item"> <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][0] ?></abbr></span> <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][1] ?></abbr></span> @@ -37,6 +37,7 @@ function getMember(string $id) { <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][4] ?></abbr></span> <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][5] ?></abbr></span> </span> + <?php if ($systemID !== $app["other"]["id"]): ?> <span class="comparison-header comparison-item"> <span class="comparison-header-l0"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> <span class="comparison-header-l1"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> @@ -45,6 +46,7 @@ function getMember(string $id) { <span class="comparison-header-l4"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> <span class="comparison-header-l5"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> </span> + <?php endif; ?> <span class="comparison-header comparison-item"> <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][0] ?></abbr></span> <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][1] ?></abbr></span> @@ -128,11 +130,13 @@ function getMember(string $id) { } ?>" style="width:24px;vertical-align: middle;position:relative;top:-5px;" src="/assets/species/<?= $species ?><?= $metadata["robot"] ? "-robot" : ($metadata["plush"] ? "-plush" : "") ?>.png" alt="<?= $species ?>"> <?php endforeach; ?> </span> + <?php if ($systemID !== $app["other"]["id"]): ?> <span class="comparison-item"> <?php if (isset($metadata["code"]) && trim($metadata["code"]) !== ""): ?> <code style="color: white;"><?= strtoupper(substr($metadata["code"], 0, 3)) ?></code> <?php else: ?>-<?php endif; ?> </span> + <?php endif; ?> <span class="comparison-item"> <?= count($metadata["marefriends"]) + count($metadata["sisters"]) + count($metadata["caretakers"]) === 0 ? "-" : "" ?> <span class="comparison-relations-count"> diff --git a/includes/system/history.inc b/includes/system/history.inc index ee7f762..5905276 100644 --- a/includes/system/history.inc +++ b/includes/system/history.inc @@ -1,4 +1,4 @@ -<?php global $system; global $lang; global $pages; global $systemCommonName; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:history"]["name"][$lang["_name"]] . " · " . $systemCommonName; global $systemID; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $lang; global $pages; global $systemCommonName; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:history"]["name"][$lang["_name"]] . " · " . $systemCommonName; global $systemID; global $app; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; function getMember(string $id) { global $systemID; @@ -109,7 +109,7 @@ function getMember(string $id) { } ?> - <h2><?= $lang["history"]["title"] ?> <?= $systemCommonName ?></h2> + <h2><?= $systemID === $app["other"]["id"] ? "Front history in " . $app["other"]["name"] : $lang["history"]["title"] . " " . $systemCommonName ?></h2> <div class="alert alert-warning" id="timezone" style="display: none;"> <?= str_replace("%1", '<span id="timezone-name">-</span>', str_replace("%2", '<span id="day-start">-</span>', $lang["history"]["timezone"])) ?> <script> @@ -130,9 +130,14 @@ function getMember(string $id) { [ date('D j M', time() - (86400 * 9)), 9 ], ] as $day): $switchesDay = getSwitchesForDay($day[1]); - $switchesDay[] = getSwitchBefore($switchesDay[count($switchesDay) - 1]["id"]); + if (isset($switchesDay[count($switchesDay) - 1])) { + $switchesDay[] = getSwitchBefore($switchesDay[count($switchesDay) - 1]["id"]); + } ?> <h4 style="margin-top:15px;"><?= frenchIfRequired($day[0]) ?></h4> + <?php if (count($switchesDay) === 0): ?> + <p class="text-muted">No switches happened on that day</p> + <?php endif; ?> <?php foreach ($switchesDay as $switch): $switch["timestamp"] = strtotime($switch["timestamp"]); ?> <?php if (isset($switch["members"][0])): $member = getMemberWithoutSystem($switch["members"][0]); ?> <div class="fronter"> diff --git a/includes/titlebar.inc b/includes/titlebar.inc index c49f7b2..e3e6c0c 100644 --- a/includes/titlebar.inc +++ b/includes/titlebar.inc @@ -1,4 +1,4 @@ -<?php global $toplevel; global $system; global $isLoggedIn; global $lang; global $pages; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); global $lang; global $pages; ?> +<?php global $toplevel; global $system; global $isLoggedIn; global $lang; global $isLowerLoggedIn; global $pages; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); global $lang; global $pages; global $app; ?> <span> <?php @@ -66,18 +66,33 @@ if (isset($pages[$name])) { $actionsProfile = "system"; $part1 = "Raindrops System"; } +} elseif ($name === $app["other"]["slug"]) { + if (isset($parts[2])) { + $part2 = "<a class='title-bar-backlink' href='/" . $app["other"]["slug"] . "'>" . $app["other"]["name"] . "</a>"; + + $part1 = $pages["s:" . $parts[2]]['name'][$lang["_name"]] ?? $parts[2]; + } else { + $actionsProfile = "system"; + $part1 = $app["other"]["name"]; + } } else { $member = getMemberFromName($name); $actionsProfile = "member"; + if ($member["_system"] === $app["other"]["id"]) { + $actionsProfile = "member-other"; + } + if (isset($member)) { $memberName = $member["display_name"] ?? $member["name"]; $part1 = "$memberName"; if ($member["_system"] === "gdapd") { $part2 = "<a class='title-bar-backlink' href='/raindrops'>Raindrops System</a>"; - } else { + } elseif ($member["_system"] === "ynmuc") { $part2 = "<a class='title-bar-backlink' href='/cloudburst'>Cloudburst System</a>"; + } else { + $part2 = "<a class='title-bar-backlink' href='/" . $app["other"]["slug"] . "'>" . $app["other"]["name"] . "</a>"; } } else { $part1 = "$name"; @@ -167,24 +182,6 @@ $links = [ "invert" => true ], [ - "name" => "Screens", - "link" => [ - "type" => "url", - "text" => "#screens" - ], - "icon" => "/assets/icons/computers-screens.svg", - "invert" => true - ], - [ - "name" => "Windows", - "link" => [ - "type" => "url", - "text" => "#windows" - ], - "icon" => "/assets/icons/computers-windows.svg", - "invert" => true - ], - [ "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", @@ -323,6 +320,36 @@ $links = [ "invert" => true ] ], + "member-other" => [ + [ + "name" => $lang["titlebar"]["member"], + "link" => [ + "type" => "url", + "text" => "/$system" + ], + "icon" => "/assets/icons/parent.svg", + "invert" => true + ], + [ + "name" => $pages["edit"]["name"][$lang["_name"]], + "link" => [ + "type" => "url", + "text" => "/-/edit/$system/$name" + ], + "icon" => "/assets/icons/edit.svg", + "invert" => true, + "show" => $isLoggedIn + ], + [ + "name" => $lang["titlebar"]["top"], + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], "subsystem" => [ [ "name" => $lang["titlebar"]["subsystem"], @@ -551,24 +578,6 @@ $links = [ "invert" => true ], [ - "name" => $pages["s:tree"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/$name/-/tree" - ], - "icon" => "/assets/icons/tree.svg", - "invert" => true - ], - [ - "name" => $pages["s:species"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/$name/-/species" - ], - "icon" => "/assets/icons/species.svg", - "invert" => true - ], - [ "name" => $pages["edit"]["name"][$lang["_name"]], "link" => [ "type" => "url", @@ -602,11 +611,30 @@ if ($_SERVER['HTTP_HOST'] !== "fr.equestria.horse") { ]); } +if ($isLowerLoggedIn || $isLoggedIn) { + $links["home"][] = [ + "name" => $app["other"]["name"], + "link" => [ + "type" => "url", + "text" => "/" . $app["other"]["slug"] + ], + "icon" => "/assets/avatars/" . str_replace("-", "", $app["other"]["uuid"]) . ".webp", + "invert" => false + ]; + + $links["home"] = [ + array_values(array_filter($links["home"], function ($i) { return $i["name"] === "Cloudburst System"; }))[0], + array_values(array_filter($links["home"], function ($i) { return $i["name"] === "Raindrops System"; }))[0], + array_values(array_filter($links["home"], function ($i) use ($app) { return $i["name"] === $app["other"]["name"]; }))[0], + array_values(array_filter($links["home"], function ($i) { return $i["link"]["type"] === "js"; }))[0] + ]; +} + $linksList = $links[isset($links[$actionsProfile]) ? $actionsProfile : "default"]; ?><!-- (<code><?= $actionsProfile ?></code>)--><!--<pre><?php var_dump($parts); ?></pre>--> <span id="title-bar-actions"> - <?php foreach ($linksList as $index => $link): if (!(isset($link["show"]) && !$link["show"])): ?><a style="display: inline-block; padding: 4px;" id="title-bar-action-<?= $index ?>" <?php if ($link["link"]["type"] === "url"): ?>href<?php else: ?>onclick<?php endif; ?>="<?= $link["link"]["text"] ?>" title="<?= $link["name"] ?>" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"><img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"></a><?php endif; endforeach; ?> + <?php foreach ($linksList as $index => $link): if (!(isset($link["show"]) && !$link["show"])): ?><a style="height: 33px; display: inline-block; padding: 4px;" id="title-bar-action-<?= $index ?>" <?php if ($link["link"]["type"] === "url"): ?>href<?php else: ?>onclick<?php endif; ?>="<?= $link["link"]["text"] ?>" title="<?= $link["name"] ?>" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"><img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"></a><?php endif; endforeach; ?> </span> </span> diff --git a/includes/travelling.inc b/includes/travelling.inc index 18bf22e..4487956 100644 --- a/includes/travelling.inc +++ b/includes/travelling.inc @@ -1,12 +1,15 @@ <?php +$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); $json_cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true); $json_raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true); +$json_other = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true); if (!isset($json_cloudburst)) $json_cloudburst = []; if (!isset($json_raindrops)) $json_raindrops = []; +if (!isset($json_other)) $json_other = []; $members = [...array_map(function ($i) { $i["_system"] = "ynmuc"; @@ -14,7 +17,10 @@ $members = [...array_map(function ($i) { }, $json_cloudburst), ...array_map(function ($i) { $i["_system"] = "gdapd"; return $i; -}, $json_raindrops)]; +}, $json_raindrops), ...array_map(function ($i) use ($app) { + $i["_system"] = $app["other"]["id"]; + return $i; +}, $json_other)]; foreach ($members as $member) { if (!isset($travelling[$member["id"]])) { diff --git a/pages/about.inc b/pages/about.inc index 0e0857e..8a62d66 100644 --- a/pages/about.inc +++ b/pages/about.inc @@ -44,22 +44,6 @@ $sizeData = array_reduce(array_map(function ($i) { return $a + $b; }); -function prettySize($bytes) { - if ($bytes > 1024) { - if ($bytes > 1024**2) { - if ($bytes > 1024**3) { - return round($bytes / 1024**3, 1) . " GB"; - } else { - return round($bytes / 1024**2, 1) . " MB"; - } - } else { - return round($bytes / 1024, 1) . " KB"; - } - } else { - return $bytes . " B"; - } -} - ?> <br> diff --git a/pages/docs.inc b/pages/docs.inc index f4ffcc3..5e0ac65 100644 --- a/pages/docs.inc +++ b/pages/docs.inc @@ -34,6 +34,19 @@ if ($select === "add") { require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +function showDocument($item) { ?> + <div style="display: grid; grid-template-columns: 2fr repeat(3, 1fr);"> + <?= $item["name"] ?> + <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?> + <span class="badge bg-warning rounded-pill text-black" style="width: max-content;">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> + <?php else: ?> + <span class="text-muted"><?= prettySize(filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $item["id"] . ".json")) ?></span> + <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> + <span class="text-muted"><?= $item["last"]["author"] === "raindrops" ? "Raindrops System" : "Cloudburst System" ?></span> + <?php endif; ?> + </div> +<?php } + ?> <br> @@ -249,57 +262,67 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; } } + foreach ($categories as $category => $_) { + uasort($categories[$category], function ($a, $b) { + return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); + }); + } + + foreach ($categoryFirst as $category => $_) { + uasort($categoryFirst[$category], function ($a, $b) { + return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); + }); + } + uasort($unsorted, function ($a, $b) { - return $b["last"]["date"] - $a["last"]["date"]; + return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); }); uasort($deletable, function ($a, $b) { - return $b["last"]["date"] - $a["last"]["date"]; + return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); }); $fullList = [...$categoryFirst, ...$categories]; ?> - <?php foreach ($fullList as $category => $items): ?> + <?php foreach ($fullList as $category => $items): if ($category != "Archives"): ?> <h4><?= str_starts_with($category, ".") ? substr($category, 1) : $category ?></h4><div class="list-group"> <?php foreach ($items as $item): ?> <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> - <?= $item["name"] ?> - <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?> - <span class="badge bg-warning rounded-pill text-black">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> - <?php else: ?> - <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> - <?php endif; ?> + <?php showDocument($item) ?> </a> <?php endforeach; ?></div> <hr> - <?php endforeach; ?> + <?php endif; endforeach; ?> <h4>Unsorted</h4><div class="list-group"> <?php foreach ($unsorted as $item): ?> <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> - <?= $item["name"] ?> - <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?> - <span class="badge bg-warning rounded-pill text-black">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> - <?php else: ?> - <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> - <?php endif; ?> + <?php showDocument($item) ?> </a> <?php endforeach; ?></div> <hr> - <h4 id="deletable">Marked for deletion</h4><div class="list-group"> - <?php foreach ($deletable as $item): ?> - <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> - <?= $item["name"] ?> - <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?> - <span class="badge bg-warning rounded-pill text-black">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> - <?php else: ?> - <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> - <?php endif; ?> - </a> - <?php endforeach; ?></div> + <details> + <summary>Show archives and marked for deletion</summary> + + <h4 style="margin-top: 10px;">Archives</h4> + <div class="list-group"> + <?php foreach ($categories["Archives"] as $item): ?> + <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> + <?php showDocument($item) ?> + </a> + <?php endforeach; ?></div> + + <hr> + <h4 id="deletable">Marked for deletion</h4><div class="list-group"> + <?php foreach ($deletable as $item): ?> + <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> + <?php showDocument($item) ?> + </a> + <?php endforeach; ?></div> + </details> </div> <hr> 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(); } } diff --git a/pages/home.inc b/pages/home.inc index d476991..4dd838e 100644 --- a/pages/home.inc +++ b/pages/home.inc @@ -1,4 +1,4 @@ -<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $isLoggedIn; ?> +<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $app; global $isLoggedIn; ?> <br> <div class="container"> @@ -19,7 +19,7 @@ <div style="text-align: center;"> <img alt="" src="/assets/logo/newlogo<?php if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse"): ?>2<?php endif; ?>.png" style="width:128px;"> <p style="z-index:999;position:relative;background:black;margin: 20px -10px 0 -20px;padding-right:30px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> - <?php foreach ($byColor as $member): ?><a data-bs-html="true" class="rainbow-item tooltip-nohelp" title="<b><?= $member["display_name"] ?? $member["name"] ?></b><br><?= ($travelling[$member['id']]["travelling"] ? $member["_system"] === "ynmuc" : $member["_system"] === "gdapd") ? "Raindrops System" : "Cloudburst System" ?>" data-bs-toggle="tooltip" style="overflow: hidden;" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="height:32px;position:absolute;z-index:99;"></a><?php endforeach; ?> + <?php foreach ($byColor as $member): ?><a data-bs-html="true" class="rainbow-item tooltip-nohelp" title="<b><?= $member["display_name"] ?? $member["name"] ?></b><br><?= ($travelling[$member['id']]["travelling"] ? $member["_system"] === "ynmuc" : $member["_system"] === "gdapd") ? "Raindrops System" : ($member["_system"] === "ynmuc" ? "Cloudburst System" : $app["other"]["name"]) ?>" data-bs-toggle="tooltip" style="overflow: hidden;" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="height:32px;position:absolute;z-index:99;"></a><?php endforeach; ?> </p> <div style="margin-top:-33px;margin-bottom:0;margin-left:-20px;margin-right:20px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> <?php foreach ($byColor as $member): ?><div> diff --git a/pages/metadata.inc b/pages/metadata.inc index 5e2c452..0a987f3 100644 --- a/pages/metadata.inc +++ b/pages/metadata.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 $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"; @@ -25,14 +25,20 @@ 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 === $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(); +} + if ($member === null) { - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.inc'; + header("Location: /"); + die(); } else { $isSubsystem = false; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); diff --git a/pages/page.inc b/pages/page.inc index f3859d3..3bdeb2e 100644 --- a/pages/page.inc +++ b/pages/page.inc @@ -1,19 +1,28 @@ <?php -global $lang; global $pages; +global $lang; global $pages; global $isLoggedIn; global $isLowerLoggedIn; + +$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); $parts = explode("/", $_GET['_']); -if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops") && (!(count($parts) > 2) || $parts[1] === "-")) { +if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== $app["other"]["slug"]) && (!(count($parts) > 2) || $parts[1] === "-")) { $namesCloudburst = [...array_map(function ($i) { return $i['name']; }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true)), "unknown-cb"]; $namesRaindrops = [...array_map(function ($i) { return $i['name']; }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)), "unknown-rd"]; + $namesOther = []; + + if ($isLoggedIn || $isLowerLoggedIn) { + $namesOther = [...array_map(function ($i) { + return $i['name']; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true)), $app["other"]["unknown"]]; + } $parts = explode("/", $_GET['_']); array_unshift($parts, ""); @@ -23,17 +32,19 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops") && (!(count($parts $parts[0] = "cloudburst"; } else if (in_array($parts[1], $namesRaindrops)) { $parts[0] = "raindrops"; + } else if (in_array($parts[1], $namesOther) && ($isLoggedIn || $isLowerLoggedIn)) { + $parts[0] = $app["other"]["slug"]; } - if ($parts[1] === "unknown-rd" || $parts[1] === "unknown-cb") $parts[1] = "unknown"; + if ($parts[1] === "unknown-rd" || $parts[1] === "unknown-cb" || (($isLoggedIn || $isLowerLoggedIn) && $parts[1] === $app["other"]["slug"])) $parts[1] = "unknown"; } $system = $parts[0]; $member = (isset($parts[1]) ? $parts[1] : null) === "" ? null : (isset($parts[1]) ? $parts[1] : null); -if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?error=" . $lang["page"]["system"]) and die(); -$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; -$systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; +if ($system !== "cloudburst" && $system !== "raindrops" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) header("Location: /?error=" . $lang["page"]["system"]) and die(); +$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : "Raindrops System"); +$systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : "gdapd"); if ($member === null) { global $_SystemName; @@ -53,7 +64,7 @@ if ($member === null) { $memberFoundInAnotherSystem = false; $traveller = false; - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === $app["other"]["id"] ? "other" : $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; |