diff options
65 files changed, 102 insertions, 2012 deletions
@@ -61,16 +61,12 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000; require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc"; } - } else if ($toplevel === "cloudburst" || $toplevel === "raindrops" || $toplevel === "moonglow" || (($isLoggedIn || $isLowerLoggedIn) && $toplevel === $app["other"]["slug"])) { + } else if ($toplevel === "raindrops" || $toplevel === "moonglow" || (($isLoggedIn || $isLowerLoggedIn) && $toplevel === $app["other"]["slug"])) { $parts = explode("/", $_GET['_']); if (isset($parts[1]) && $parts[1] !== "-") { if ($parts[1] === "unknown") { - if ($parts[0] === "cloudburst") { - header("Location: /unknown-cb"); - } else { - header("Location: /unknown-rd"); - } + header("Location: /unknown-rd"); } else { header("Location: /" . $parts[1]); } @@ -85,11 +81,6 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) { header("Location: /-/" . $toplevel); } else { - $namesCloudburst = [...array_map(function ($i) { - return $i['name']; - }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true), function ($i) { - return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json"); - })), "unknown-cb"]; $namesRaindrops = [...array_map(function ($i) { return $i['name']; }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), function ($i) { @@ -110,7 +101,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { })), $app["other"]["unknown"]]; } - if ((in_array($toplevel, $namesCloudburst) || in_array($toplevel, $namesRaindrops) || in_array($toplevel, $namesOther) || in_array($toplevel, $namesMoonglow)) && $toplevel !== "unknown") { + if ((in_array($toplevel, $namesRaindrops) || in_array($toplevel, $namesOther) || in_array($toplevel, $namesMoonglow)) && $toplevel !== "unknown") { $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc"; $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000; require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc"; diff --git a/assets/logo/custom-2023.css b/assets/logo/custom-2023.css index 4d296f5..0f8c75b 100644 --- a/assets/logo/custom-2023.css +++ b/assets/logo/custom-2023.css @@ -83,7 +83,7 @@ nav.navbar { } @media (max-width: 991px) { - #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { + #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { grid-template-columns: repeat(3, 1fr) !important; } @@ -97,13 +97,13 @@ nav.navbar { } @media (max-width: 768px) { - #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > 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-other > div { + #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { grid-template-columns: repeat(1, 1fr) !important; } @@ -114,7 +114,7 @@ nav.navbar { width: 32px !important; } - #hpd-cloudburst > div, #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { + #hpd-raindrops > div, #hpd-legacy > div, #hpd-other > div { grid-gap: 5px !important; } @@ -612,7 +612,7 @@ dd { #new-homepage-systems { display: grid; - grid-template-columns: repeat(3, 1fr); + grid-template-columns: repeat(2, 1fr); grid-gap: 20px; } diff --git a/includes/components/2023ui.inc b/includes/components/2023ui.inc index 40c2d00..7b74395 100644 --- a/includes/components/2023ui.inc +++ b/includes/components/2023ui.inc @@ -152,9 +152,9 @@ <div style="height: 52px; display: flex; align-items: center;"> <?php global $isLowerLoggedIn; global $isLoggedIn; global $_PROFILE; if ($isLoggedIn || $isLowerLoggedIn): ?> <a href="https://account.equestria.dev/hub/users/<?= $_PROFILE["id"] ?>" target="_blank" style="color: inherit; text-decoration: inherit;"> - <?php $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "raindrops" ? "gdapd" : ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : ($_PROFILE["login"] === "Moonwind" ? "hrbom" : "other"))) . "/fronters.json"), true); if (isset($fronters["members"][0])): ?> + <?php $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "raindrops" ? "gdapd" : ($_PROFILE["login"] === "Moonglow" ? "hrbom" : "other")) . "/fronters.json"), true); if (isset($fronters["members"][0])): ?> <span class="mobile-hide" style="margin-right: 5px; vertical-align: middle; margin-top: -2px;"><?= $fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"] ?></span> - <img src="<?= getAsset(($_PROFILE["login"] === "raindrops" ? "gdapd" : ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : ($_PROFILE["login"] === "Moonwind" ? "hrbom" : "other"))), $fronters["members"][0]["id"]) ?>" style="width: 32px; height: 32px; border-radius: 999px; background-color: var(--palette-2);"> + <img src="<?= getAsset(($_PROFILE["login"] === "raindrops" ? "gdapd" : ($_PROFILE["login"] === "Moonglow" ? "hrbom" : "other")), $fronters["members"][0]["id"]) ?>" style="width: 32px; height: 32px; border-radius: 999px; background-color: var(--palette-2);"> <?php else: ?> <span class="mobile-hide" style="margin-right: 5px; vertical-align: middle; margin-top: -2px;"><?= $_PROFILE["name"] ?></span> <img class="antialias" src="https://account.equestria.dev/hub/api/rest/avatar/<?= $_PROFILE["id"] ?>?dpr=2&size=32" style="width: 32px; height: 32px; border-radius: 999px; background-color: var(--palette-2);"> @@ -188,10 +188,7 @@ <div id="side-bar" style="position: fixed; top: 62px; bottom: 20px; left: 0; width: 64px; display: flex; justify-content: center;"> <div> <div id="side-bar-systems" style="background-color: var(--palette-4); height: max-content; border-radius: 999px;"> - <a data-bs-toggle="tooltip" data-bs-placement="right" title="Cloudburst System" class="ui2023-side-bar-system" href="/cloudburst" style="padding: 8px; height: 48px; width: 48px; display: block; border-top-left-radius: 999px; border-top-right-radius: 999px;"> - <img class="antialias" src="<?= getAsset("ynmuc") ?>" style="max-width: 32px; max-height: 32px;"> - </a> - <a data-bs-toggle="tooltip" data-bs-placement="right" title="Raindrops System" class="ui2023-side-bar-system" href="/raindrops" style="padding: 8px; height: 48px; width: 48px; display: block;"> + <a data-bs-toggle="tooltip" data-bs-placement="right" title="Raindrops System" class="ui2023-side-bar-system" href="/raindrops" style="padding: 8px; height: 48px; width: 48px; display: block; border-top-left-radius: 999px; border-top-right-radius: 999px;"> <img class="antialias" class="antialias" src="<?= getAsset("gdapd") ?>" style="max-width: 32px; max-height: 32px;"> </a> <?php global $app; if ($isLoggedIn || $isLowerLoggedIn): ?> @@ -208,15 +205,6 @@ <a data-bs-toggle="tooltip" data-bs-placement="right" title="Relations" class="ui2023-side-bar-item" href="/-/relations" style="padding: 10px; height: 48px; width: 48px; display: block; border-radius: 999px;"> <img src="<?= icon("relations") ?>" style="max-width: 28px; max-height: 28px;"> </a> - - <?php if ($isLoggedIn): ?> - <a data-bs-toggle="tooltip" data-bs-placement="right" title="Money tracker" class="ui2023-side-bar-item" href="/-/money" style="padding: 10px; height: 48px; width: 48px; display: block; border-radius: 999px;"> - <img src="<?= icon("money") ?>" style="max-width: 28px; max-height: 28px;"> - </a> - <a data-bs-toggle="tooltip" data-bs-placement="right" title="System travelling" class="ui2023-side-bar-item" href="/-/travelling" style="padding: 10px; height: 48px; width: 48px; display: block; border-radius: 999px;"> - <img src="<?= icon("travelling") ?>" style="max-width: 28px; max-height: 28px;"> - </a> - <?php endif; ?> </div> </div> </div>
\ No newline at end of file diff --git a/includes/components/emergency.inc b/includes/components/emergency.inc index 03d468c..8ebd65e 100644 --- a/includes/components/emergency.inc +++ b/includes/components/emergency.inc @@ -7,7 +7,7 @@ <span data-bs-toggle="modal" data-bs-target="#turn-on" id="btn-on" style="background: #7f0000;font-size: 48px;padding: 10px 50px;border-radius: 10px;width: max-content;display: block;margin-left: auto;margin-right: auto;cursor: pointer;">Turn <b>ON</b></span> <span data-bs-toggle="modal" onclick="disableAlert();" id="btn-off" style="display:none;background: #007f0b;font-size: 48px;padding: 10px 50px;border-radius: 10px;width: max-content;margin-left: auto;margin-right: auto;cursor: pointer;">Turn <b>OFF</b></span> -<p style="text-align:center;margin-top:10px;">Sending next notification <b><span id="next-notification">never</span></b></p> +<p style="text-align:center;margin-top:10px;">Sending the next notification <b><span id="next-notification">never</span></b></p> <hr> @@ -24,6 +24,9 @@ <label style="display: block; margin-left: 10px;"> <input type="checkbox" id="enable-moonglow"> Moonglow </label> +<!--<label style="display: block; margin-left: 10px;"> + <input type="checkbox" id="enable-hailstorm"> Hailstorm +</label>--> <style> <?php global $use2023UI; if (!$use2023UI): ?> @@ -82,6 +85,7 @@ document.getElementById("enable-<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>").checked ? "<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>" : null, document.getElementById("enable-raindrops").checked ? "raindrops" : null, document.getElementById("enable-moonglow").checked ? "moonglow" : null, + document.getElementById("enable-hailstorm").checked ? "hailstorm" : null, ].filter(i => i); return "?" + targets.join("&"); } @@ -123,6 +127,7 @@ document.getElementById("enable-<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>").disabled = true; document.getElementById("enable-raindrops").disabled = true; document.getElementById("enable-moonglow").disabled = true; + document.getElementById("enable-hailstorm").disabled = true; window.alertInterval = setInterval(() => { window.alertIntervalCounter--; @@ -146,5 +151,6 @@ document.getElementById("enable-<?= $GLOBALS["ColdHazeApp"]["other"]["slug"] ?>").disabled = false; document.getElementById("enable-raindrops").disabled = false; document.getElementById("enable-moonglow").disabled = false; + document.getElementById("enable-hailstorm").disabled = false; } </script>
\ No newline at end of file diff --git a/includes/components/fullbanner.inc b/includes/components/fullbanner.inc index 960ae0a..07dfa59 100644 --- a/includes/components/fullbanner.inc +++ b/includes/components/fullbanner.inc @@ -4,16 +4,4 @@ </script> <div id="member-banner"></div> -<script src="/assets/logo/banner.js?_=<?= sha1_file($_SERVER['DOCUMENT_ROOT'] . "/assets/logo/banner.js") ?>"></script><script>refreshBanner(false, <?= $lang["_french"] ? "true" : "false" ?>)</script> - -<?php if (isset($travelling[$memberID]) && $travelling[$memberID]['travelling'] && !$travelling[$memberID]['equestria']): ?> - <br> - <div class="alert alert-primary" style="margin-bottom: 0 !important;"> - <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> <?= $lang["fullbanner"]["visit"][0] ?> <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?><?= str_replace("%1", getMemberPronouns($memberData["pronouns"])["subjective"], str_replace("%2", getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are", $lang["fullbanner"]["visit"][1])) ?><?= $systemCommonName ?>. - </div> -<?php elseif (isset($travelling[$memberID]) && $travelling[$memberID]['travelling'] && $travelling[$memberID]['equestria']): ?> - <br> - <div class="alert alert-primary" style="margin-bottom: 0 !important;"> - <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> is on a trip to <?= $metadata["fictive"] ? "Equestria" : "Celeste" ?>. <?= str_replace("%1", getMemberPronouns($memberData["pronouns"])["subjective"], str_replace("%2", getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are", "Therefore %1 %2 currently not in the ")) ?><?= $systemCommonName ?>. - </div> -<?php endif; ?>
\ No newline at end of file +<script src="/assets/logo/banner.js?_=<?= sha1_file($_SERVER['DOCUMENT_ROOT'] . "/assets/logo/banner.js") ?>"></script><script>refreshBanner(false, <?= $lang["_french"] ? "true" : "false" ?>)</script>
\ No newline at end of file diff --git a/includes/components/header.inc b/includes/components/header.inc index 9409917..bd85761 100644 --- a/includes/components/header.inc +++ b/includes/components/header.inc @@ -72,9 +72,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; echo("Color: #" . $member["color"] . "\n\n"); } - $sr = hexdec(substr($member["color"], 0, 2)); - $sg = hexdec(substr($member["color"], 2, 2)); - $sb = hexdec(substr($member["color"], 4, 2)); + $sr = hexdec(substr($color, 0, 2)); + $sg = hexdec(substr($color, 2, 2)); + $sb = hexdec(substr($color, 4, 2)); $differencesAll = []; @@ -432,7 +432,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; opacity: 1 !important; } - .antialias, #new-homepage img, #hpd-other img, #hpd-raindrops img, #hpd-cloudburst img, .ck img, #system-info img, #member-card img { + .antialias, #new-homepage img, #hpd-other img, #hpd-raindrops img, .ck img, #system-info img, #member-card img { image-rendering: auto !important; } diff --git a/includes/components/pleasure.inc b/includes/components/pleasure.inc index 9d2825c..6d5f4b1 100644 --- a/includes/components/pleasure.inc +++ b/includes/components/pleasure.inc @@ -7,12 +7,6 @@ </details> </h2> -<?php if ($_PROFILE["login"] === "cloudburst"): ?> -<div class="alert alert-danger"> - <b>Notice:</b> Only <?= $app["other"]["name"] ?> can use the pleasure alert. If you wish to wake somepony up, use the <a href="/-/wakeup" style="filter: invert(1) hue-rotate(180deg);">wake-up alert</a> instead. -</div> -<?php endif; ?> - <?php if (isset($front[0])): ?> <?php if (!parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0]["id"] . ".json"), true))["other"] && !parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0]["id"] . ".json"), true))["other2"]): ?> <div class="alert alert-warning"> @@ -45,9 +39,9 @@ <?php endif; ?> <?php endif; ?> -<span data-bs-toggle="modal" <?php if ($_PROFILE["login"] === "cloudburst"): ?>class="disabled"<?php endif; ?> data-bs-target="#turn-on" id="btn-on" style="background: #7f0000;font-size: 48px;padding: 10px 50px;border-radius: 10px;width: max-content;display: block;margin-left: auto;margin-right: auto;cursor: pointer;">Turn <b>ON</b></span> +<span data-bs-toggle="modal" data-bs-target="#turn-on" id="btn-on" style="background: #7f0000;font-size: 48px;padding: 10px 50px;border-radius: 10px;width: max-content;display: block;margin-left: auto;margin-right: auto;cursor: pointer;">Turn <b>ON</b></span> <span onclick="disableAlert()" id="btn-off" style="display:none;background: #007f0b;font-size: 48px;padding: 10px 50px;border-radius: 10px;width: max-content;margin-left: auto;margin-right: auto;cursor: pointer;">Turn <b>OFF</b></span> -<p style="text-align:center;margin-top:10px;">Sending next notification <b><span id="next-notification">never</span></b> · Local time for Raindrops: <span id="raindrops-time">--:--</span></p> +<p style="text-align:center;margin-top:10px;">Sending the next notification <b><span id="next-notification">never</span></b> · Local time for Raindrops: <span id="raindrops-time">--:--</span></p> <hr> diff --git a/includes/components/sysbanner.inc b/includes/components/sysbanner.inc index a97169a..6a66ab4 100644 --- a/includes/components/sysbanner.inc +++ b/includes/components/sysbanner.inc @@ -20,23 +20,8 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa <h3 style="height:max-content;"><?= $systemCommonName ?></h3> <div style="height:max-content;" id="member-card"> <span> - <?php - - 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']; - }); - } - - ?> <?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?> members<?php - if (count($travellers) > 0) { - echo(" (+ " . count($travellers) . " " . (count($travellers) > 1 ? $lang["system"]["travellers"] : $lang["system"]["traveller"]) . ")"); - } - ?><br><?php $leaders = array_filter(scoreOrderGlobal(), function ($i) use ($systemID) { return $i["_system"] === $systemID && isset($i["_metadata"]["leader2"]) && $i["_metadata"]["leader2"]; }); if (count($leaders) > 0): ?><span style="vertical-align: middle; height: 24px;">Leader<?= count($leaders) > 1 ? "s" : "" ?>: </span><?php foreach ($leaders as $index => $leader): ?><a href="/<?= $leader["name"] ?>" class="member-link"><img src="<?= getAsset($leader["_system"], $leader["id"], "heads") ?>"><span style="vertical-align: middle;"> <?= $leader["display_name"] ?? $leader["name"] ?></span></a><?= $index <= count($leaders) - 1 ? ", " : "" ?><?php endforeach; ?><?php endif; ?> diff --git a/includes/components/timeline.inc b/includes/components/timeline.inc index 95b413b..21e82a2 100644 --- a/includes/components/timeline.inc +++ b/includes/components/timeline.inc @@ -29,7 +29,7 @@ function displayTimeline($systems) { global $app; $showIcons = count($systems) > <?php foreach ($systems as $system): ?> <tr style="height: <?= count($systems) === 1 ? 50 : 30 ?>px;"> <?php if ($showIcons): ?><td colspan="20"> - <a href="/<?= $system === "gdapd" ? "raindrops" : ($system === "ynmuc" ? "cloudburst" : ($system === "hrbom" ? "moonglow" : $app["other"]["slug"])) ?>" style="width: 100%; height: 30px; display: flex; align-items: center; justify-content: center;"> + <a href="/<?= $system === "gdapd" ? "raindrops" : ($system === "hrbom" ? "moonglow" : $app["other"]["slug"]) ?>" style="width: 100%; height: 30px; display: flex; align-items: center; justify-content: center;"> <img alt="" style="border-radius: 5px; height: 24px; text-align: center;" src="<?= getAsset($system) ?>"> </a> </td><?php endif; ?> diff --git a/includes/external/signal/index.js b/includes/external/signal/index.js index 7531fb5..31de8a7 100644 --- a/includes/external/signal/index.js +++ b/includes/external/signal/index.js @@ -10,9 +10,9 @@ const child_process = require("child_process"); (async () => { console.log("Ready"); - let system = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "cloudburst" ? "ynmuc" : "other")) + "/general.json"); - let fronters = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "cloudburst" ? "ynmuc" : "other")) + "/fronters.json"); - let members = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "cloudburst" ? "ynmuc" : "other")) + "/members.json"); + let system = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "Moonglow" ? "hrbom" : "other")) + "/general.json"); + let fronters = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "Moonglow" ? "hrbom" : "other")) + "/fronters.json"); + let members = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "Moonglow" ? "hrbom" : "other")) + "/members.json"); console.log(system.name); console.log(fronters.members.length + " member(s) at front"); diff --git a/includes/fragments/dashboard.inc b/includes/fragments/dashboard.inc index bb58df1..f25fba1 100644 --- a/includes/fragments/dashboard.inc +++ b/includes/fragments/dashboard.inc @@ -48,8 +48,8 @@ global $use2023UI; <h2> <span id="greeting">Hi</span> <span><?php - $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "raindrops" ? "gdapd" : ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : ($_PROFILE["login"] === "Moonwind" ? "hrbom" : "other"))) . "/fronters.json"), true); - $name = ($_PROFILE["login"] === "raindrops" ? "Raindrops System" : ($_PROFILE["login"] === "cloudburst" ? "Cloudburst System" : ($_PROFILE["login"] === "Moonwind" ? "Moonglow" : $app["other"]["name"]))); + $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "raindrops" ? "gdapd" : ($_PROFILE["login"] === "Moonglow" ? "hrbom" : "other")) . "/fronters.json"), true); + $name = ($_PROFILE["login"] === "raindrops" ? "Raindrops System" : ($_PROFILE["login"] === "Moonglow" ? "Moonglow" : $app["other"]["name"])); if (isset($fronters["members"][0])) { $name = implode(" and ", array_map(function ($i) { @@ -62,7 +62,7 @@ global $use2023UI; ?>!</span> </h2> - <div id="schedules" style="margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 20px;"> + <div id="schedules" style="margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;"> <div> <div id="live-time-other-outer" class="day-gradient" style="text-align: center; background-color: rgba(255, 255, 255, .1); padding: 20px 0; border-radius: 10px;"> <b><?= $app["other"]["name"] ?></b><br> @@ -73,15 +73,6 @@ global $use2023UI; </div> <div> - <div id="live-time-cloudburst-outer" class="day-gradient" style="text-align: center; background-color: rgba(255, 255, 255, .1); padding: 20px 0; border-radius: 10px;"> - <b>Cloudburst System</b><br> - <h3 id="live-time-cloudburst">--:--</h3> - </div> - - <hr style="display: none;" class="schedules-separator"> - </div> - - <div> <div id="live-time-raindrops-outer" class="day-gradient" style="text-align: center; background-color: rgba(255, 255, 255, .1); padding: 20px 0; border-radius: 10px;"> <b>Raindrops System</b><br> <h3 id="live-time-raindrops">--:--</h3> @@ -133,16 +124,6 @@ global $use2023UI; document.getElementById("live-time-moonwind").innerText = time4.replace("24:", "00:"); document.getElementById("live-time-moonwind-outer").style.backgroundPositionY = getDayPercentage(time4) + "%"; - let time2 = (new Intl.DateTimeFormat('en-US', { - timeZone: 'Europe/London', - hour: 'numeric', - minute: '2-digit', - hour12: false - })).format(new Date()); - - document.getElementById("live-time-cloudburst").innerText = time2.replace("24:", "00:"); - document.getElementById("live-time-cloudburst-outer").style.backgroundPositionY = getDayPercentage(time2) + "%"; - let time3 = (new Intl.DateTimeFormat('en-US', { timeZone: 'America/Chicago', hour: 'numeric', @@ -207,7 +188,7 @@ global $use2023UI; <div id="timeline"></div> <script> async function refreshTimeline() { - document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&ynmuc<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text(); + document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text(); Array.from(document.getElementsByClassName("dynamic-time")).forEach((el) => { let time = el.getAttribute("data-time"); @@ -228,9 +209,6 @@ global $use2023UI; <div style="display: grid; grid-template-columns: 1fr 2fr; grid-gap: 20px;" id="home-parts"> <div style="background-color: var(--palette-2) !important; margin-top: 20px; border-radius: 10px;"> <div class="list-group"> - <a href="/cloudburst" class="list-group-item list-group-item-action" style="display: flex; align-items: center;"> - <img src="/assets/avatars/ade46823206b4b0cad3ccaae934a5f3b.webp" style="margin-right: 5px; width: 24px;"><div style="vertical-align: middle; display: flex; align-items: center; color: var(--bs-body-color);">Cloudburst System</div> - </a> <a href="/raindrops" class="list-group-item list-group-item-action" style="display: flex; align-items: center;"> <img src="/assets/avatars/7d9f543ef74240f69d0786c3f2983124.webp" style="margin-right: 5px; width: 24px;"><div style="vertical-align: middle; display: flex; align-items: center; color: var(--bs-body-color);">Raindrops System</div> </a> @@ -246,8 +224,8 @@ global $use2023UI; <a href="/-/byfront" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> <img src="/assets/icons/new/front.svg?color=474747" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">By last fronted date</div> </a> - <a href="https://countdown.equestria.horse" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> - <img src="/assets/icons/new/schedule.svg?color=474747" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Meet-up countdown</div> + <a href="/-/schedule" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> + <img src="/assets/icons/new/schedule.svg?color=474747" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Raindrops schedule</div> </a> <a href="https://plex.equestria.horse" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> <img src="https://plex.equestria.horse/web/favicon.ico" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Plex</div> @@ -255,9 +233,6 @@ global $use2023UI; <a href="https://live.equestria.dev" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> <img src="https://avatars.githubusercontent.com/u/8463692?s=128" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Streaming server</div> </a> - <a href="https://mist.equestria.horse" target="_blank" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> - <img src="https://mist.equestria.horse/icons/normal_128x128.png" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Mist</div> - </a> </div> </div> <div style="background-color: var(--palette-2) !important; text-align: center; margin-top: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center;"> diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc index 8b153fa..0b1ce03 100644 --- a/includes/fragments/member.inc +++ b/includes/fragments/member.inc @@ -29,27 +29,8 @@ if ($memberData["name"] !== "unknown" && $memberData["name"] !== "fusion") { 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; - -if ($memberData["name"] === "fusion") { - if (in_array("fusion", array_map(function ($i) { - return $i["name"]; - }, $frontersRaindrops["members"]))) { - $fusionRaindrops = true; - - $memberData = array_values(array_filter($frontersRaindrops["members"], function ($i) { - return $i["name"] === "fusion"; - }))[0]; - $memberCommonName = $memberData['display_name'] ?? $memberData['name']; - $memberID = $memberData['id']; - $system = $systemID === "gdapd" ? "cloudburst" : "raindrops"; - $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; - } -} - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json", json_encode([ "_main" => [ "name" => "Main", @@ -113,22 +94,6 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".pn <span>In all cases, feel free to ask!</span> </div> <br> - <?php elseif ($memberData["name"] === "fusion"): ?> - <br> - <div class="alert alert-secondary" style="margin-bottom: 0 !important;"> - <p><?= $lang["member"]["fusion"][0] ?></p> - <p><?= $lang["member"]["fusion"][1] ?></p> - <p><?= $lang["member"]["fusion"][2] ?></p> - <div class="list-group"> - <?php $foundFusion = false; $fusionOn = false; foreach ($fusionRaindrops ? $frontersRaindrops['members'] : $frontersCloudburst['members'] as $fronter): if ($fronter["name"] !== "fusion"): if ($fusionOn): $foundFusion = true; $name = str_ends_with($fronter['name'], "-travelling") ? substr($fronter['name'], 0, strlen($fronter['name']) - 11) : $fronter['name'] ?> - <a class="list-group-item list-group-item-action text-black" href="/<?= $name ?>"><img src="<?= getAsset($system, $fronter["id"], "heads") ?>" style="filter:invert(1) hue-rotate(180deg);width:24px;"> <?= $fronter["display_name"] ?? $name ?></a> - <?php endif; else: $fusionOn = true; endif; endforeach; ?> - </div> - <?php if (!$foundFusion): ?> - <i><?= $lang["member"]["no_fusion"] ?></i> - <?php endif; ?> - </div> - <br> <?php else: ?><?php endif; ?> </div> </div> diff --git a/includes/fragments/system.inc b/includes/fragments/system.inc index bc1b0df..717efee 100644 --- a/includes/fragments/system.inc +++ b/includes/fragments/system.inc @@ -17,7 +17,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/sysbanner.inc"; ?> <br> - <?php if ($system === "cloudburst") cloudburst(true); elseif ($system === "raindrops") raindrops(true); elseif ($system === "moonglow") moonglow(true); elseif ($isLoggedIn || $isLowerLoggedIn) other(true); ?> + <?php if ($system === "raindrops") raindrops(true); elseif ($system === "moonglow") moonglow(true); elseif ($isLoggedIn || $isLowerLoggedIn) other(true); ?> </div> </div> @@ -26,7 +26,7 @@ </div> <style> - #hpd-cloudburst, #hpd-raindrops, #hpd-cloudburst, #hpd-other { + #hpd-raindrops, #hpd-moonglow, #hpd-other { background: transparent !important; padding: 0 !important; margin-bottom: 0 !important; diff --git a/includes/jobs/FrontersNotification.php b/includes/jobs/FrontersNotification.php index 04fff9b..85a3216 100644 --- a/includes/jobs/FrontersNotification.php +++ b/includes/jobs/FrontersNotification.php @@ -20,8 +20,6 @@ echo("Processing for system $system\n"); if ($system === "gdapd") { $name = "Raindrops System"; -} elseif ($system === "ynmuc") { - $name = "Cloudburst System"; } elseif ($system === "hrbom") { $name = "Moonglow"; } elseif (isset($app["other"]) && $system === $app["other"]["id"]) { @@ -112,8 +110,6 @@ if ($system !== $app["other"]["id"] || !isset($app["other"])) { if ($system === "gdapd") { $topic = "public-switches-raindrops"; -} else if ($system === "ynmuc") { - $topic = "public-switches-cloudburst"; } else { $topic = "main"; } diff --git a/includes/jobs/PKFronters.php b/includes/jobs/PKFronters.php index 4dd31f9..2dfac45 100644 --- a/includes/jobs/PKFronters.php +++ b/includes/jobs/PKFronters.php @@ -41,12 +41,8 @@ if (trim($data) !== "" && $data !== false && json_last_error() === JSON_ERROR_NO echo("Data is invalid: " . json_last_error_msg() . ": " . $data . "\n"); } -echo("Running Matrix integration...\n"); -chdir($_SERVER['DOCUMENT_ROOT'] . "/includes/external/matrix"); -exec("nice -n 19 node index.js " . ($system === "gdapd" ? "raindrops" : ($system === "ynmuc" ? "cloudburst" : "other"))); - echo("Running Signal integration...\n"); chdir("/opt/peh/includes/external/signal"); exec("nice -n 19 node index.js raindrops"); -exec("nice -n 19 node index.js cloudburst"); +exec("nice -n 19 node index.js moonglow"); exec("nice -n 19 node index.js other");
\ No newline at end of file diff --git a/includes/jobs/RefreshCache.php b/includes/jobs/RefreshCache.php index cac61a6..35e724a 100644 --- a/includes/jobs/RefreshCache.php +++ b/includes/jobs/RefreshCache.php @@ -15,8 +15,8 @@ $urls = [ "/-/alphabet", "/-/byspecies", "/-/relations", - "/cloudburst/-/history", "/raindrops/-/history", + "/moonglow/-/history", "/" . $app["other"]["slug"] . "/-/history" ]; diff --git a/includes/jobs/UpdateAssets.php b/includes/jobs/UpdateAssets.php index ee94537..5c5c288 100644 --- a/includes/jobs/UpdateAssets.php +++ b/includes/jobs/UpdateAssets.php @@ -99,9 +99,6 @@ function downloadAssets($system, $path = null) { echo("Downloading for gdapd\n"); downloadAssets("gdapd"); -echo("Downloading for ynmuc\n"); -downloadAssets("ynmuc"); - echo("Downloading for hrbom\n"); downloadAssets("hrbom"); diff --git a/includes/maintenance/deleteUnusedAssets.php b/includes/maintenance/deleteUnusedAssets.php index 780c80f..bd7cd38 100644 --- a/includes/maintenance/deleteUnusedAssets.php +++ b/includes/maintenance/deleteUnusedAssets.php @@ -14,14 +14,14 @@ if (isset($_SERVER["argv"][1])) { $list = [ str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/general.json"), true)["uuid"]), - str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/general.json"), true)["uuid"]), + str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/general.json"), true)["uuid"]), str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/general.json"), true)["uuid"]), ...array_map(function ($i) { return str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/general.json"), true)["uuid"]) . str_replace("-", "", $i["uuid"]); }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)), ...array_map(function ($i) { - return str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/general.json"), true)["uuid"]) . str_replace("-", "", $i["uuid"]); - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true)), + return str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/general.json"), true)["uuid"]) . str_replace("-", "", $i["uuid"]); + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/members.json"), true)), ...array_map(function ($i) { return str_replace("-", "", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/general.json"), true)["uuid"]) . str_replace("-", "", $i["uuid"]); }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true)) diff --git a/includes/reminder.php b/includes/reminder.php index 05b7bd5..e69de29 100644 --- a/includes/reminder.php +++ b/includes/reminder.php @@ -1,21 +0,0 @@ -<?php - -; -$_SERVER['DOCUMENT_ROOT'] = ".."; -require_once './util/functions.inc'; - -$app = json_decode(file_get_contents("./app.json"), true); -$ntfy = $app["ntfy"]; - -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("🔔 Did you update the money tracker?") . "\r\n" . - "Tags: reminder\r\n" . - "Actions: view, Open money tracker, https://ponies.equestria.horse/-/money, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("Make sure the money tracker is up to date. Any transaction you have made must be added now, NOT TOMORROW.") - ] -]));
\ No newline at end of file diff --git a/includes/system/history.inc b/includes/system/history.inc index b879f6e..ddf49bb 100644 --- a/includes/system/history.inc +++ b/includes/system/history.inc @@ -107,7 +107,7 @@ function page() { global $lang; global $systemCommonName; global $systemID; glob <?= isNotToday($switch["timestamp"], $day[1]) ? "00:00" : date('H:i', $switch["timestamp"]) ?> </span> <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= (isset($member) && $member["name"] === "unknown") ? ($systemID === "gdapd" ? "unknown-rd" : ($systemID === "ynmuc" ? "unknown-cb" : $app["other"]["unknown"])) : $member["name"] ?>"> + <a class="member-link" href="/<?= (isset($member) && $member["name"] === "unknown") ? ($systemID === "gdapd" ? "unknown-rd" : $app["other"]["unknown"]) : $member["name"] ?>"> <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (count($switch["members"]) > 1): ?> diff --git a/includes/util/agewarning.inc b/includes/util/agewarning.inc index 66a163c..8f3753c 100644 --- a/includes/util/agewarning.inc +++ b/includes/util/agewarning.inc @@ -12,7 +12,7 @@ function showWarning($name, $id, $system) { "Title: " . formatPonypush("⚠️ $name does not have an age or birth year set") . "\r\n" . "Priority: max\r\n" . "Tags: switch\r\n" . - "Actions: view, Edit on Ponycule, https://ponies.equestria.horse/-/metadata/" . ($system === "gdapd" ? "raindrops" : "cloudburst") . "/" . $id . "/, clear=true\r\n" . + "Actions: view, Edit on Ponycule, https://ponies.equestria.horse/-/metadata/" . ($system === "gdapd" ? "raindrops" : ($system === "hrbom" ? "moonglow" : $GLOBALS["ColdHazeApp"]["other"]["slug"])) . "/" . $id . "/, clear=true\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), 'content' => formatPonypush("To make sure they appear on the fronting schedule (and to make sure they can front again), they need to set an age or birth year now.") ] @@ -26,7 +26,7 @@ function showWarning($name, $id, $system) { "Title: " . formatPonypush("⚠️ $name does not have an age or birth year set") . "\r\n" . "Priority: max\r\n" . "Tags: switch\r\n" . - "Actions: view, Edit on Ponycule, https://ponies.equestria.horse/-/metadata/" . ($system === "gdapd" ? "raindrops" : "cloudburst") . "/" . $id . "/, clear=true\r\n" . + "Actions: view, Edit on Ponycule, https://ponies.equestria.horse/-/metadata/" . ($system === "gdapd" ? "raindrops" : ($system === "hrbom" ? "moonglow" : $GLOBALS["ColdHazeApp"]["other"]["slug"])) . "/" . $id . "/, clear=true\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), 'content' => formatPonypush("To make sure they still appear on the fronting schedule after March 1st, they need to set an age or birth year now.") ] diff --git a/includes/util/banner.inc b/includes/util/banner.inc index 955b93d..ea8a1eb 100644 --- a/includes/util/banner.inc +++ b/includes/util/banner.inc @@ -187,28 +187,12 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { $app = $GLOBALS["ColdHazeApp"]; $systemData = []; - $systemData['page'] = "/" . ($system === "gdapd" ? "raindrops" : ($system === $app["other"]["id"] ? $app["other"]["slug"] : ($system === "hrbom" ? "moonglow" : "cloudburst"))); + $systemData['page'] = "/" . ($system === "gdapd" ? "raindrops" : ($system === $app["other"]["id"] ? $app["other"]["slug"] : "moonglow")); $systemData['icon'] = getAsset($system); - $systemData['name'] = $system === "gdapd" ? "Raindrops" : ($system === $app["other"]["id"] ? $app["other"]["short"] : ($system === "hrbom" ? "Moonglow" : "Cloudburst")); - $systemData['full_name'] = $system === "gdapd" ? "Raindrops System" : ($system === $app["other"]["id"] ? $app["other"]["name"] : ($system === "hrbom" ? "Moonglow" : "Cloudburst System")); + $systemData['name'] = $system === "gdapd" ? "Raindrops" : ($system === $app["other"]["id"] ? $app["other"]["short"] : "Moonglow"); + $systemData['full_name'] = $system === "gdapd" ? "Raindrops System" : ($system === $app["other"]["id"] ? $app["other"]["name"] : "Moonglow"); $systemData['temporary'] = false; - if (isset($travelling[$member['id']]) && $travelling[$member['id']]["travelling"] && !$travelling[$member['id']]["equestria"]) { - $systemData['page'] = "/" . ($system === "gdapd" ? "cloudburst" : "raindrops"); - $systemData['icon'] = getAsset($system === "gdapd" ? "ynmuc" : "gdapd"); - $systemData['name'] = $system === "gdapd" ? "Cloudburst" : "Raindrops"; - $systemData['full_name'] = $system === "gdapd" ? "Cloudburst System" : "Raindrops System"; - $systemData['temporary'] = true; - } - - if (isset($travelling[$member['id']]) && $travelling[$member['id']]["travelling"] && $travelling[$member['id']]["equestria"]) { - $systemData['page'] = null; - $systemData['icon'] = "/assets/logo/equestria.png"; - $systemData['name'] = "Equestria"; - $systemData['full_name'] = "Equestria"; - $systemData['temporary'] = true; - } - $marefriends = []; foreach ($metadata["marefriends"] as $marefriend) { $mfSystem = explode("/", $marefriend)[0]; diff --git a/includes/util/functions.inc b/includes/util/functions.inc index 67b1786..87954ea 100644 --- a/includes/util/functions.inc +++ b/includes/util/functions.inc @@ -127,9 +127,9 @@ if (!function_exists("getAsset")) { $id = $id1 . $id2; if (str_ends_with((getMemberWithoutSystem($memberID) ?? ['name' => ''])["name"], "-travelling")) { - $id1 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/general.json"), true)["uuid"]); + $id1 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "hrbom" : "gdapd") . "/general.json"), true)["uuid"]); - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "hrbom" : "gdapd") . "/members.json"), true); $list = array_map(function ($i) { return $i["name"]; }, $members); @@ -322,13 +322,6 @@ if (!function_exists("getMemberWithoutSystem")) { global $isLowerLoggedIn; global $isLoggedIn; $member = null; - $members1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true); - foreach ($members1 as $m) { - $m["_system"] = "ynmuc"; - $m["system"] = "ynmuc"; - if ($m["id"] === $id) $member = $m; - } - $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true); foreach ($members2 as $m) { $m["_system"] = "gdapd"; @@ -345,9 +338,9 @@ if (!function_exists("getMemberWithoutSystem")) { if ($isLowerLoggedIn || $isLoggedIn) { $app = $GLOBALS["ColdHazeApp"] ?? 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); + $members4 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true); - foreach ($members3 as $m) { + foreach ($members4 as $m) { $m["_system"] = $app["other"]["id"]; $m["system"] = $app["other"]["id"]; if ($m["id"] === $id) $member = $m; @@ -396,11 +389,11 @@ if (!function_exists("showSystem")) { $global = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . (isset($app["other"]) && $id === $app["other"]["id"] ? "other" : $id) . "/general.json"), true); if ($hideTitle) { - echo('<div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "ynmuc" ? "cloudburst" : "other")) . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px;display:grid;grid-template-columns: 1fr;margin-bottom:10px;">'); + echo('<div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "hrbom" ? "moonglow" : "other")) . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px;display:grid;grid-template-columns: 1fr;margin-bottom:10px;">'); } else { - echo('<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;">'); + echo('<div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "hrbom" ? "moonglow" : "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('<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"> + if (!$hideTitle) echo('<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"] : "moonglow")) . '" class="hpd-system"> <div style="text-align:center;"><img src="' . getAsset($id) . '" style="width:64px;"><br>' . $name . '</div> </a>'); @@ -410,29 +403,12 @@ if (!function_exists("showSystem")) { echo(' <div style="display:grid;grid-template-columns:repeat(6, 1fr);padding-left:10px;grid-gap:10px;">'); } - 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; - if (isset($travelling[$i['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)); - } + 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)); echo('</div> @@ -440,12 +416,6 @@ if (!function_exists("showSystem")) { } } -if (!function_exists("cloudburst")) { - function cloudburst(bool $hideTitle): void { - showSystem("ynmuc", "Cloudburst System", "#5f08a9a6", $hideTitle); - } -} - if (!function_exists("raindrops")) { function raindrops(bool $hideTitle): void { showSystem("gdapd", "Raindrops System", "#a95f08a6", $hideTitle); @@ -647,7 +617,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), ...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/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/hrbom/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/util/homepage.inc b/includes/util/homepage.inc index a78c28d..45f91b6 100644 --- a/includes/util/homepage.inc +++ b/includes/util/homepage.inc @@ -20,15 +20,8 @@ function newHomepage($id, $page, $title) { <div class="new-homepage-system-list" id="new-homepage-system-<?= $id ?>-list"> <?php $list = array_values(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $id . "/members.json"), true), $id), $id)); foreach ($list as $index => $member): ?> <a href="/<?= $member["name"] ?>" class="new-homepage-link <?= $index === count($list) - 1 ? "new-homepage-link-last" : "" ?>" style="color: white; text-decoration: none !important; display: block; background-color: #<?= $member["color"] ?>22; padding: 5px 10px;"> - <img src="<?= getAsset(isset($travelling[$member["id"]]) && ($travelling[$member["id"]]["travelling"] && !$travelling[$member["id"]]["equestria"]) ? ($id === "gdapd" ? "ynmuc" : "gdapd") : $id, $member["id"]) ?>" style="width: 32px; height: 32px; vertical-align: middle; background-color: rgba(0, 0, 0, .25); border-radius: 999px;"> + <img src="<?= getAsset($id, $member["id"]) ?>" style="width: 32px; height: 32px; vertical-align: middle; background-color: rgba(0, 0, 0, .25); border-radius: 999px;"> <span style="width: calc(100% - 37px); vertical-align: middle; margin-left: 5px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;"><?= $member["display_name"] ?? $member["name"] ?></span> - <span style="vertical-align: middle; float:right;"> - <?php if (isset($travelling[$member["id"]]) && $travelling[$member["id"]]["travelling"] && $travelling[$member["id"]]["equestria"]): ?> - <img src="/assets/logo/<?= $member["_metadata"]["fictive"] ? "equestria" : ($member["_metadata"]["fictive2"] ? "celeste" : "") ?>.png" style="width: 24px; height: 24px; margin-top: 5px;"> - <?php elseif (isset($travelling[$member["id"]]) && $travelling[$member["id"]]["travelling"]): ?> - <img src="<?= getAsset($id === "gdapd" ? "ynmuc" : "gdapd") ?>" style="width: 24px; height: 24px; margin-top: 5px;"> - <?php endif; ?> - </span> </a> <?php endforeach; ?> </div> diff --git a/includes/util/rainbow.inc b/includes/util/rainbow.inc index 3dc9480..027c771 100644 --- a/includes/util/rainbow.inc +++ b/includes/util/rainbow.inc @@ -3,15 +3,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; -function rainbow($hideCloudburst = false): array { +function rainbow(): array { $members = scoreOrderGlobal(); - if ($hideCloudburst) { - $members = array_filter($members, function ($i) { - return $i["_system"] === "gdapd"; - }); - } - $data = []; foreach ($members as $member) { @@ -39,8 +33,8 @@ function rainbow($hideCloudburst = false): array { return $data; } -function getMembersByColor($hideCloudburst = false, $ignoreHumans = false): array { - $members = rainbow($hideCloudburst); +function getMembersByColor($_ = false, $ignoreHumans = false): array { + $members = rainbow(); uasort($members, function ($a, $b) { return $a['hsl'][0] - $b['hsl'][0]; diff --git a/includes/util/score.inc b/includes/util/score.inc index b70f866..622f057 100644 --- a/includes/util/score.inc +++ b/includes/util/score.inc @@ -113,34 +113,6 @@ function scoreOrderGlobal() { } } - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/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")) { - if (isset($member["color"])) { - $rgb = [ - hexdec(substr($member["color"], 0, 2)), - hexdec(substr($member["color"], 2, 2)), - hexdec(substr($member["color"], 4, 2)) - ]; - $hsl = rgbToHsl( - $rgb[0], - $rgb[1], - $rgb[2] - ); - } else { - $rgb = [255, 255, 255]; - $hsl = rgbToHsl(255, 255, 255); - } - $member["_score"] = $hsl[0]; - $member["_system"] = "ynmuc"; - $member["system"] = "ynmuc"; - $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); - - if (!isset($member["_metadata"]["private"]) || !$member["_metadata"]["private"] || $isLoggedIn || $isLowerLoggedIn) { - $ordered[] = $member; - } - } - } - if ($isLowerLoggedIn || $isLoggedIn) { $app = $GLOBALS["ColdHazeApp"] ?? 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) { diff --git a/includes/util/session.inc b/includes/util/session.inc index 6449ee9..867b306 100644 --- a/includes/util/session.inc +++ b/includes/util/session.inc @@ -66,11 +66,6 @@ if (isset($token)) { $_PROFILE = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token)), true); } - if (isset($_GET['invert'])) { - $_PROFILE["login"] = $_PROFILE["login"] === "raindrops" ? "cloudburst" : "raindrops"; - $_PROFILE["name"] = $_PROFILE["name"] === "Raindrops System" ? "Cloudburst System" : "Raindrops System"; - } - $isLoggedIn = true; } elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . str_replace("/", "", $token))) { $data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/sessions/" . str_replace("/", "", $token))), true); diff --git a/includes/util/short.inc b/includes/util/short.inc index 81c389d..1654d93 100644 --- a/includes/util/short.inc +++ b/includes/util/short.inc @@ -9,11 +9,8 @@ header("Content-Type: text/plain"); $members = scoreOrderGlobal(); $list = [ "rd" => "/raindrops", - "cb" => "/cloudburst", "minty" => "/cloudydreams", "violetdawn" => "/sandydawn", - "twilight" => "/twi", - "luna" => "/princessluna", "cloudy" => "/cloudydreams", "zipp" => "/zippstorm", "babs" => "/fleurheartseed", diff --git a/includes/util/travelling.inc b/includes/util/travelling.inc index eced4f2..b1479fb 100644 --- a/includes/util/travelling.inc +++ b/includes/util/travelling.inc @@ -1,62 +1,5 @@ <?php -$app = $GLOBALS["ColdHazeApp"] ?? 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"; - return $i; -}, $json_cloudburst), ...array_map(function ($i) { - $i["_system"] = "gdapd"; - return $i; -}, $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"]])) { - $travelling[$member["id"]] = [ - "travelling" => false, - "history" => [] - ]; - - @file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); - } - - if (!isset($travelling[$member["id"]]["equestria"])) { - $travelling[$member["id"]]["equestria"] = false; - } -} - -function withTravelers(array $members, string $system): array { - global $travelling; - global $app; - - if ($system === $app["other"]["id"]) { - return $members; - } else { - return [ - ...array_map(function ($i) use ($system) { - $i['system'] = $system; - return $i; - }, array_filter($members, function ($i) use ($travelling) { - return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria'])); - })), - ...array_filter(array_map(function ($i) use ($system) { - $i['system'] = $system === "gdapd" ? "ynmuc" : "gdapd"; - return $i; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($system === "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']); - }) - ]; - } +function withTravelers(array $members): array { + return $members; }
\ No newline at end of file diff --git a/pages/alerts.inc b/pages/alerts.inc index 46d514d..a47c84f 100644 --- a/pages/alerts.inc +++ b/pages/alerts.inc @@ -1,8 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; global $isLowerLoggedIn; - -if ($_PROFILE["login"] === "cloudburst") die(); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> <br> diff --git a/pages/api/cloudburst-img-round.php b/pages/api/cloudburst-img-round.php deleted file mode 100644 index 3238696..0000000 --- a/pages/api/cloudburst-img-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ?? "/assets/uploads/cloudburst.png") : "/assets/uploads/cloudburst.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/cloudburst-img.php b/pages/api/cloudburst-img.php deleted file mode 100644 index 7d22aad..0000000 --- a/pages/api/cloudburst-img.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ? $_SERVER['DOCUMENT_ROOT'] . getAsset("ynmuc", $fronters['members'][0]["id"]) : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png") : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); -header("Content-Type: " . mime_content_type("/tmp/temp")); -unlink("/tmp/temp"); - -echo(file_get_contents($url));
\ No newline at end of file diff --git a/pages/api/cloudburst-img2-round.php b/pages/api/cloudburst-img2-round.php deleted file mode 100644 index 5f4f0dc..0000000 --- a/pages/api/cloudburst-img2-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? ($fronters['members'][1]["avatar_url"] ?? "/assets/uploads/cloudburst.png") : "/assets/uploads/cloudburst.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/cloudburst-two.php b/pages/api/cloudburst-two.php deleted file mode 100644 index 8272d81..0000000 --- a/pages/api/cloudburst-two.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); -echo(json_encode([ - "multiple" => count($fronters["members"]) > 1 -]));
\ No newline at end of file diff --git a/pages/api/cloudburst.php b/pages/api/cloudburst.php deleted file mode 100644 index 2750a98..0000000 --- a/pages/api/cloudburst.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); -echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']);
\ No newline at end of file diff --git a/pages/api/emergency-real.php b/pages/api/emergency-real.php index 700a6a7..04fd56e 100644 --- a/pages/api/emergency-real.php +++ b/pages/api/emergency-real.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -15,6 +14,7 @@ $channels = []; if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET["hailstorm"])) $channels[] = "emergency-hailstorm"; if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; $context = stream_context_create([ diff --git a/pages/api/emergency.php b/pages/api/emergency.php index a8a6e20..e682598 100644 --- a/pages/api/emergency.php +++ b/pages/api/emergency.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -15,6 +14,7 @@ $channels = []; if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET["hailstorm"])) $channels[] = "emergency-hailstorm"; if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; $context = stream_context_create([ diff --git a/pages/api/me.php b/pages/api/me.php index 5b13208..0e91189 100644 --- a/pages/api/me.php +++ b/pages/api/me.php @@ -18,13 +18,13 @@ if ($_PROFILE['login'] === "raindrops") { "avatar" => getAsset("gdapd"), "email" => $_PROFILE["profile"]["email"]["email"] ])); -} else if ($_PROFILE["login"] === "cloudburst") { +} else if ($_PROFILE["login"] === "Moonglow") { die(json_encode([ "valid" => true, - "name" => "Cloudburst System", - "id" => "cloudburst", - "pluralkit" => "ynmuc", - "avatar" => getAsset("ynmuc"), + "name" => "Moonglow", + "id" => "moonglow", + "pluralkit" => "hrbom", + "avatar" => getAsset("hrbom"), "email" => $_PROFILE["profile"]["email"]["email"] ])); } else { diff --git a/pages/api/money/account.php b/pages/api/money/account.php deleted file mode 100644 index 1801b28..0000000 --- a/pages/api/money/account.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); -$obj = []; - -if (!isset($_GET["id"])) { - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -foreach ($accounts as $account) { - if ($account["_name"] === $_GET["id"]) { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - $acc["transactions"] = []; - - foreach ($account["transactions"] as $index => $transaction) { - $member = getMemberWithoutSystem($transaction["author"]) ?? getMemberWithoutSystem("zdtsg"); - $trans = [ - "id" => $index, - "author" => [ - "avatar" => getAsset($member["_system"], $member["id"]), - "name" => $member["display_name"] ?? $member["name"] - ], - "type" => $transaction["amount"] < 0 ? "REMOVE" : "ADD", - "amount" => round(abs($transaction["amount"]), 2), - "date" => [ - "ts" => strtotime($transaction["date"]), - "iso" => date('c', strtotime($transaction["date"])), - "relative" => timeAgo($transaction["date"]) - ], - "description" => (isset($transaction["description"]) && trim($transaction["description"]) !== "") ? trim($transaction["description"]) : null - ]; - - $acc["transactions"][] = $trans; - } - - $obj = $acc; - } -} - -/* ------------------- */ - -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/money/accounts.php b/pages/api/money/accounts.php deleted file mode 100644 index 9f85323..0000000 --- a/pages/api/money/accounts.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); -$obj = [ - "total" => 0, - "exchange_rate" => $rate, - "users" => [ - "cloudburst" => [ - "total" => 0, - "accounts" => [] - ], - "raindrops" => [ - "total" => 0, - "accounts" => [] - ] - ] -]; - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, $accounts), function ($a, $b) { - return $a + $b; -}); -$obj["total"] = [ - "gbp" => round($allAccounts, 2), - "eur" => round($allAccounts * (1 / $rate), 2) -]; - -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["cloudburst"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "cloudburst") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - - $obj["users"]["cloudburst"]["accounts"][] = $acc; - } -} -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["raindrops"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "raindrops") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - $acc["transactions"] = null; - - $obj["users"]["raindrops"]["accounts"][] = $acc; - } -} - -/* ------------------- */ - -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/money/create.php b/pages/api/money/create.php deleted file mode 100644 index 12cc7c9..0000000 --- a/pages/api/money/create.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$app = $GLOBALS["ColdHazeApp"] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$request_raw = file_get_contents('php://input'); -$json_object = $data = json_decode($request_raw, true); - -$systemID = $_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd") . "/fronters.json"), true)["members"]; - -if (count($fronters) > 0) { - $myId = $fronters[0]["id"]; -} else { - $myId = "zdtsg"; -} - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); - -$obj = [ - "success" => false, - "error" => null -]; - -if ($_SERVER["REQUEST_METHOD"] !== "POST") { - $obj["success"] = false; - $obj["error"] = "INVALID_METHOD"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if (!isset($data["amount"]) || !isset($data["id"]) || !isset($data["description"])) { - $obj["success"] = false; - $obj["error"] = "MISSING_OPERAND"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -$account = array_values(array_filter($accounts, function ($i) use ($data) { return $i["_name"] === $data["id"]; }))[0] ?? null; - -if (!isset($account)) { - $obj["success"] = false; - $obj["error"] = "ACCOUNT_NOT_FOUND"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if (!(isset($data["amount"]) && is_numeric($data["amount"]) && (float)$data["amount"] < 9999 && (float)$data["amount"] > -9999)) { - $obj["success"] = false; - $obj["error"] = "INVALID_AMOUNT"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} -if (!isset($data["description"])) $data["description"] = ""; - -if (strlen($data["description"]) > 150) { - $obj["success"] = false; - $obj["error"] = "DESCRIPTION_TOO_LONG"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if ($data["amount"] === 0) { - $obj["success"] = false; - $obj["error"] = "AMOUNT_IS_ZERO"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush((getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " created a transaction to " . $account["name"] . " (" . ucfirst($account["owner"]) . ")") . "\r\n" . - "Tags: bits\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush(($account["currency"] === "gbp" ? "£" : "€") . abs((float)$data["amount"]) . " were " . ((float)$data["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($data["description"]) !== "" ? ": " . $data["description"] : "")) - ] -])); - -array_unshift($account["transactions"], [ - "author" => $myId, - "description" => $data["description"], - "amount" => (float)$data["amount"], - "date" => date('c') -]); - -$name = $account["_name"]; -unset($account["_name"]); - -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); - -$obj["success"] = true; -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/pleasure-real.php b/pages/api/pleasure-real.php index adfe732..c1cbd59 100644 --- a/pages/api/pleasure-real.php +++ b/pages/api/pleasure-real.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -16,9 +15,9 @@ $frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/inc if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { +} else if ($_PROFILE["login"] === "Moonglow" && isset($frontMoonglow[0])) { $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonglow" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; diff --git a/pages/api/pleasure.php b/pages/api/pleasure.php index 7d331ce..7b268cb 100644 --- a/pages/api/pleasure.php +++ b/pages/api/pleasure.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -16,9 +15,9 @@ $frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/inc if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { +} else if ($_PROFILE["login"] === "Moonglow" && isset($frontMoonglow[0])) { $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonglow" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; diff --git a/pages/api/pluralkit-integration.php b/pages/api/pluralkit-integration.php index 7d7c641..a3faa6f 100644 --- a/pages/api/pluralkit-integration.php +++ b/pages/api/pluralkit-integration.php @@ -23,9 +23,6 @@ if ($input["signing_token"] !== $data[$user]) { if ($input['system_id'] === "7d9f543e-f742-40f6-9d07-86c3f2983124") { $system = "gdapd"; $name = "Raindrops System"; -} elseif ($input['system_id'] === "ade46823-206b-4b0c-ad3c-caae934a5f3b") { - $system = "ynmuc"; - $name = "Cloudburst System"; } elseif ($input['system_id'] === "d1cd97eb-9c92-4e42-94cd-4397a5074ff9") { $system = "hrbom"; $name = "Moonglow"; diff --git a/pages/api/raindrops-img-round.php b/pages/api/raindrops-img-round.php deleted file mode 100644 index 5e80bd0..0000000 --- a/pages/api/raindrops-img-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img-round2.php b/pages/api/raindrops-img-round2.php deleted file mode 100644 index 2560ed0..0000000 --- a/pages/api/raindrops-img-round2.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? (getAsset("gdapd", $fronters["members"][0]["id"], "avatars") ?? "/assets/uploads/pt.png") : "/assets/uploads/pt.png"; -file_put_contents("/tmp/temp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . $url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 256x128 xc:none -draw "roundrectangle 0,0,256,128,128,128" -chop 128x0 -resize 64x128\! /tmp/' . $id . '-mask.png', $out); -exec('convert /tmp/' . $id . '-mask.png -gravity West -background black -splice 64x0 -distort SRT 90 /tmp/' . $id . '-mask2.png', $out); - -exec('convert -resize 128x128 -filter Point -background transparent -gravity center -extent 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask2.png -compose DstIn -composite -gravity East /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img.php b/pages/api/raindrops-img.php deleted file mode 100644 index fcf1ae6..0000000 --- a/pages/api/raindrops-img.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ? $_SERVER['DOCUMENT_ROOT'] . getAsset("gdapd", $fronters['members'][0]["id"]) : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png") : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); -header("Content-Type: " . mime_content_type("/tmp/temp")); -unlink("/tmp/temp"); - -echo(file_get_contents($url));
\ No newline at end of file diff --git a/pages/api/raindrops-img2-round.php b/pages/api/raindrops-img2-round.php deleted file mode 100644 index 1b0d320..0000000 --- a/pages/api/raindrops-img2-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? ($fronters['members'][1]["avatar_url"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img2-round2.php b/pages/api/raindrops-img2-round2.php deleted file mode 100644 index 5eb7e3f..0000000 --- a/pages/api/raindrops-img2-round2.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? (getAsset("gdapd", $fronters["members"][1]["id"], "avatars") ?? "/assets/uploads/pt.png") : "/assets/uploads/pt.png"; -file_put_contents("/tmp/temp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . $url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 256x128 xc:none -draw "roundrectangle 0,0,256,128,128,128" -chop 128x0 -resize 64x128\! /tmp/' . $id . '-mask.png', $out); -exec('convert /tmp/' . $id . '-mask.png -gravity West -background black -splice 64x0 -distort SRT 90 /tmp/' . $id . '-mask2.png', $out); - -exec('convert -resize 128x128 -filter Point -background transparent -gravity center -extent 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask2.png -compose DstIn -composite -gravity East /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-two.php b/pages/api/raindrops-two.php deleted file mode 100644 index 2fa09f2..0000000 --- a/pages/api/raindrops-two.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); -echo(json_encode([ - "multiple" => count($fronters["members"]) > 1 -]));
\ No newline at end of file diff --git a/pages/api/raindrops.php b/pages/api/raindrops.php deleted file mode 100644 index c44faa6..0000000 --- a/pages/api/raindrops.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); -echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']);
\ No newline at end of file diff --git a/pages/api/timeline.php b/pages/api/timeline.php index ccd19f9..8271b7a 100644 --- a/pages/api/timeline.php +++ b/pages/api/timeline.php @@ -5,7 +5,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $i $systems = array_filter(array_keys($_GET), function ($i) { global $isLowerLoggedIn; global $isLoggedIn; global $app; - return $i === "gdapd" || $i === "ynmuc" || $i === "hrbom" || (($isLowerLoggedIn || $isLoggedIn) && $i === $app["other"]["id"]); + return $i === "gdapd" || $i === "hrbom" || (($isLowerLoggedIn || $isLoggedIn) && $i === $app["other"]["id"]); }); require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/timeline.inc"; diff --git a/pages/api/wakeup-real.php b/pages/api/wakeup-real.php deleted file mode 100644 index f00d5ea..0000000 --- a/pages/api/wakeup-real.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; - -if (!$isLoggedIn) { - header("Location: /-/login"); - die(); -} - -global $_PROFILE; - -$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"]; -$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; - -$pony = "somepony"; -if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("🥱 Wake up!") . "\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("Hey, $pony wants you to wake up!") - ] -])); - -die();
\ No newline at end of file diff --git a/pages/api/wakeup.php b/pages/api/wakeup.php deleted file mode 100644 index a5d2b9f..0000000 --- a/pages/api/wakeup.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; - -if (!$isLoggedIn) { - header("Location: /-/login"); - die(); -} - -global $_PROFILE; - -$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"]; -$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; - -$pony = "somepony"; -if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("[Test] 🥱 Wake up!") . "\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("[This notification is test] Hey, $pony wants you to wake up! [This notification is test]") - ] -])); - -die();
\ No newline at end of file diff --git a/pages/byfront.inc b/pages/byfront.inc index beb9275..0974091 100644 --- a/pages/byfront.inc +++ b/pages/byfront.inc @@ -12,52 +12,13 @@ global $app; global $_PROFILE; <h2>Members by last fronted</h2> <select id="selected-system" class="form-select" style="margin-bottom: 20px;" onchange="refreshList()"> <option value="gdapd" <?= $_PROFILE["login"] === "raindrops" ? "select" : "" ?>>Raindrops System</option> - <option value="hrbom" <?= $_PROFILE["login"] === "Moonwind" ? "select" : "" ?>>Moonglow</option> - <option value="<?= $app["other"]["id"] ?>" <?= $_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "cloudburst" && $_PROFILE["login"] !== "Moonwind" ? "select" : "" ?>><?= $app["other"]["name"] ?></option> - <option value="ynmuc" <?= $_PROFILE["login"] === "cloudburst" ? "select" : "" ?>>Cloudburst System</option> + <option value="hrbom" <?= $_PROFILE["login"] === "Moonglow" ? "select" : "" ?>>Moonglow</option> + <option value="<?= $app["other"]["id"] ?>" <?= $_PROFILE["login"] === $app["other"]["user"] ? "select" : "" ?>><?= $app["other"]["name"] ?></option> <option value="">(all systems)</option> </select> <?php $members = [ ...array_map(function ($i) { - $system = "ynmuc"; - $i["_lastFronted"] = -1; - $id = $i["id"]; - $memberData = $i; - - $fronters = array_map(function ($item) { - return $item["id"]; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true)["members"]); - - if (in_array($id, $fronters)) { - $i["_lastFronted"] = time(); - } else { - $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true); - - $thisMember = array_filter($switches, function ($item) use ($memberData) { - return in_array($memberData["id"], $item["members"]); - }); - - $thisMember = array_values($thisMember); - $frontingEnd = null; - - if (count($thisMember) > 0) { - $thisIndex = array_search($thisMember[0], $switches); - - $frontingStart = $thisMember[0]; - $frontingEnd = $switches[$thisIndex - 1]; - } - - if ($frontingEnd !== null && isset($frontingStart)) { - $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); - } - } - - return $i; - }, array_values(array_filter(scoreOrderGlobal(), function ($i) { - return $i["_system"] === "ynmuc"; - }))), - ...array_map(function ($i) { $system = "gdapd"; $i["_lastFronted"] = -1; $id = $i["id"]; diff --git a/pages/emergency.inc b/pages/emergency.inc index e51b410..d57269a 100644 --- a/pages/emergency.inc +++ b/pages/emergency.inc @@ -1,8 +1,6 @@ <?php $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; - -if ($_PROFILE["login"] === "cloudburst") die(); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> diff --git a/pages/front.inc b/pages/front.inc index 73f193c..ad38a14 100644 --- a/pages/front.inc +++ b/pages/front.inc @@ -3,8 +3,8 @@ $parts = explode("/", $_GET["_"]); if (isset($parts[2])) { - if ($parts[2] === "cloudburst") { - $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); + if ($parts[2] === "moonglow") { + $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/fronters.json"), true); } elseif ($parts[2] === "raindrops") { $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); } else { @@ -16,8 +16,8 @@ if (isset($parts[2])) { header("Location: /" . $fronters["members"][0]["name"]); die(); } else { - if ($parts[2] === "cloudburst") { - header("Location: /cloudburst"); + if ($parts[2] === "moonglow") { + header("Location: /moonglow"); } else { header("Location: /raindrops"); } diff --git a/pages/metadata.inc b/pages/metadata.inc index 0c02398..53d5c05 100644 --- a/pages/metadata.inc +++ b/pages/metadata.inc @@ -11,9 +11,9 @@ array_shift($parts); $system = $parts[0]; $member = !isset($parts[1]) || $parts[1] === "" ? null : $parts[1]; -if ($system !== "cloudburst" && $system !== "raindrops" && $system !== "moonglow" && $system !== $app["other"]["slug"]) peh_error("Invalid system name: " . $system, 400); -$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System")); -$systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd")); +if ($system !== "raindrops" && $system !== "moonglow" && $system !== $app["other"]["slug"]) peh_error("Invalid system name: " . $system, 400); +$systemCommonName = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System"); +$systemID = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd"); if ($isLowerLoggedIn && $systemID !== $app["other"]["id"] && $systemID !== "hrbom") { header("Location: /"); @@ -94,7 +94,7 @@ if ($member === null) { $toUpdate["gender"] = strip_tags($_GET["gender"]); } - $regex = "/^(ynmuc|gdapd|" . $app["other"]["id"] . ")\/[a-z]{5}$/m"; + $regex = "/^(hrbom|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) use ($regex) { diff --git a/pages/money.inc b/pages/money.inc deleted file mode 100644 index 881c618..0000000 --- a/pages/money.inc +++ /dev/null @@ -1,822 +0,0 @@ -<?php - -$minimumRaindrops = 100; -//$minimumCloudburst = 2762.89; -//$minimumCloudburst = 700; -$minimumCloudburst = 0; - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; -$parts = explode("/", $_GET["_"]); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; - -global $parts; -if (isset($parts[2])) { - if (str_contains($parts[2], "/") || !file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $parts[2] . ".json")) { - header("Location: /-/money"); - die(); - } -} - -$systemID = $_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd") . "/fronters.json"), true)["members"]; - -if (!isset($parts[2])) { - unset($systemID); -} else { - $systemID = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $parts[2] . ".json"), true)["owner"] === "cloudburst" ? "ynmuc" : "gdapd"; -} - -if (count($fronters) > 0) { - $myId = $fronters[0]["id"]; -} else { - $myId = "zdtsg"; -} - -if ((isset($_GET["create"]) || isset($_GET["delete"])) && isset($parts[2])) { - $account = array_values(array_filter($accounts, function ($i) use ($parts) { return $i["_name"] === $parts[2]; }))[0]; - - header("Content-Type: text/plain"); - - if (isset($_GET["create"])) { - if (!(isset($_GET["amount"]) && is_numeric($_GET["amount"]) && (float)$_GET["amount"] < 9999 && (float)$_GET["amount"] > -9999)) { - header("Location: /-/money/" . $parts[2]); - die(); - } - if (!isset($_GET["description"])) $_GET["description"] = ""; - $_GET["description"] = substr($_GET["description"], 0, 150); - - $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush((getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " created a transaction to " . $account["name"] . " (" . ucfirst($account["owner"]) . ")") . "\r\n" . - "Tags: bits\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush(($account["currency"] === "gbp" ? "£" : "€") . abs((float)$_GET["amount"]) . " were " . ((float)$_GET["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($_GET["description"]) !== "" ? ": " . $_GET["description"] : "")) - ] - ])); - - if ((float)$_GET["amount"] !== 0.0) array_unshift($account["transactions"], [ - "author" => $myId, - "description" => $_GET["description"], - "amount" => (float)$_GET["amount"], - "date" => date('c') - ]); - - $name = $account["_name"]; - unset($account["_name"]); - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); - } else { - if (isset($_GET["id"]) && is_numeric($_GET["id"]) && isset($account["transactions"][(int)$_GET["id"]])) { - $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush((getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " deleted a transaction from " . $account["name"] . " (" . ucfirst($account["owner"]) . ")") . "\r\n" . - "Tags: bits\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush(($account["currency"] === "gbp" ? "£" : "€") . abs((float)$account["transactions"][(int)$_GET["id"]]["amount"]) . " " . ((float)$account["transactions"][(int)$_GET["id"]]["amount"] >= 0 ? "advance" : "withdrawal") . " created by " . (getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["display_name"] ?? getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["name"]) . " " . timeAgo($account["transactions"][(int)$_GET["id"]]["date"])) - ] - ])); - - unset($account["transactions"][(int)$_GET["id"]]); - - $name = $account["_name"]; - unset($account["_name"]); - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); - } - } - - header("Location: /-/money/" . $parts[2]); - die(); -} - -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); - -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; -$transactionMonths = []; - -foreach ($accounts as $account) { - array_push($transactionMonths, ...array_map(function ($i) { return date('Y-m', strtotime($i["date"])); }, array_filter($account["transactions"], function ($i) { return !isset($i["initial"]) || !$i["initial"]; }))); -} - -$months = [ - ...[ - "2022-12", "2022-11", "2022-10", "2022-09", - "2022-08", "2022-07", "2022-06" - ], - ...array_values(array_filter(array_unique(array_reduce($transactionMonths, function ($a, $b) { - return [...$a, $b]; - }, [])), function ($i) { - return $i !== date('Y-m'); - })) -]; - -$monthlyCloudburst = []; -$monthlyRaindrops = []; - -$bits = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/bits.json"), true); -$projects = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/projects.json"), true); - -foreach ($bits["cloudburst"] as $month => $value) { - $monthlyCloudburst[$month] = $value; -} - -foreach ($bits["raindrops"] as $month => $value) { - $monthlyRaindrops[$month] = $value; -} - -foreach ($months as $month) { - $gainedCloudburst = $monthlyCloudburst[$month] ?? 0; - $gainedRaindrops = $monthlyRaindrops[$month] ?? 0; - - foreach ($accounts as $account) { - foreach ($account["transactions"] as $transaction) { - if (isset($transaction["initial"]) && $transaction["initial"]) continue; - if (date('Y-m', strtotime($transaction["date"])) !== $month) continue; - - if ($account["owner"] === "raindrops") { - $gainedRaindrops += $transaction["amount"]; - } else { - $gainedCloudburst += $transaction["amount"]; - } - } - } - - $monthlyCloudburst[$month] = $gainedCloudburst; - $monthlyRaindrops[$month] = $gainedRaindrops; -} - -uksort($monthlyCloudburst, function ($k1, $k2) { - return strtotime($k2) - strtotime($k1); -}); - -uksort($monthlyRaindrops, function ($k1, $k2) { - return strtotime($k2) - strtotime($k1); -}); - -function getMonthlyEarnings(): array { - global $monthlyRaindrops; - global $monthlyCloudburst; - - return [ - "cloudburst" => array_sum(array_values($monthlyCloudburst)) / count($monthlyCloudburst), - "raindrops" => array_sum(array_values($monthlyRaindrops)) / count($monthlyRaindrops) - ]; -} - -?> - -<script src="/assets/editor/chart.js"></script> - -<style> - a:hover > .card { - opacity: .75; - } - - a:active > .card, a:focus > .card { - opacity: .5; - } - - <?php global $use2023UI; if (!$use2023UI): ?> - .list-group-item { - color: #fff; - background-color: #222; - border: 1px solid rgba(255, 255, 255, .125); - } - - .list-group-item.disabled { - color: #fff; - background-color: #222; - border-color: rgba(255, 255, 255, .125); - opacity: .75; - } - - .list-group-item-action:hover { - background-color: #252525; - color: #ddd; - } - - .list-group-item-action:active, .list-group-item-action:focus { - background-color: #272727; - color: #bbb; - } - - .modal-header { - border-bottom: 1px solid #353738; - } - - .modal-content { - border: 1px solid rgba(255, 255, 255, .2); - background-color: #111; - } - <?php endif; ?> - - .btn-close { - filter: invert(1); - } - - .text-danger, .text-success { - filter: invert(1) brightness(150%) hue-rotate(180deg); - } -</style> - -<br> -<div class="container"> - <?php if (count($parts) < 3): ?> - <div> - <h2>Money tracker</h2> - - <div class="alert alert-danger"> - <b>The Ponycule money tracker is deprecated and will be removed.</b> Data currently in the money tracker will be moved to individual accounts on a dedicated money tracking application that Equestria.dev will not have control over. - </div> - - <hr> - - <?php - - $allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); - }, $accounts), function ($a, $b) { - return $a + $b; - }); - - ?> - <h2>£<?= number_format($allAccounts, 2, '.', ',') ?> · €<?= number_format($allAccounts * (1 / $rate), 2, '.', ',') ?></h2> - <p>As of <?= date('j F Y') ?> · €1.00 = £<?= number_format($rate, 2, '.', ',') ?></p> - - <canvas id="history" style="margin-top: 10px; width: 100%; height: 400px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions1 = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - - $transactions2 = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - $transactions2 = array_map(function ($i) use ($rate) { - $i["amount"] = $i["amount"] * (1/$rate); - return $i; - }, $transactions2); - - $transactions = [...$transactions1, ...$transactions2]; - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - global $palette; - - ?> - <script> - const ctx3 = document.getElementById('history').getContext('2d'); - const graph3 = new Chart(ctx3, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : "b9f1ef" ?>', - backgroundColor: '#<?= $use2023UI ? $palette[9] : "b9f1ef77" ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '€' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '€' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - - <hr> - - <h4>Cloudburst System (<?php - - $allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); - }, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; }))), function ($a, $b) { - return $a + $b; - }); - - ?>£<?= number_format($allAccounts, 2, '.', ',') ?>, earning £<?= number_format(getMonthlyEarnings()["cloudburst"], 2, '.', ',') ?>/month)</h4> - <div class="list-group"> - <details class="list-group-item list-group-item-action" style="margin-bottom: 10px;"> - <summary>Show monthly earnings</summary> - - <table style="margin-top: 10px;"> - <?php foreach ($monthlyCloudburst as $month => $value): ?> - <tr> - <td style="padding-right: 20px;"><b><?= date('F Y', strtotime($month)) ?>:</b></td> - <td class="text-<?= $value > 0 ? "success" : ($value === 0 ? "warning" : "danger") ?>">£<?= number_format($value, 2, '.', ',') ?></td> - </tr> - <?php endforeach; ?> - </table> - </details> - </div> - <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;"> - <?php foreach ($accounts as $index => $account): if ($account["owner"] === "cloudburst"): ?> - <a style="color: white; text-decoration: none;" href="/-/money/<?= $account["_name"] ?>"> - <div class="card"> - <div class="card-body"> - <h4 class="card-title"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= calculateFullAmount($account); ?></h4> - <?= $account["name"] ?><?php if ($account["default"]): ?> <span class="badge bg-success rounded-pill">Default</span><?php endif; ?><?php if (isset($account["interests"])): ?> · <?= $account["interests"] * 100 ?>% interests<?php endif; ?> - <?php if (isset($account["max"])): ?><br><span class="text-muted">Max balance: <?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format($account["max"], 2, '.', ',') ?> (<?= round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) ?>% used)</span><?php else: ?><br><span class="text-muted">No maximum balance</span><?php endif; ?> - </div> - </div> - </a> - <?php endif; endforeach; ?> - </div> - - <div class="progress" style="margin-top: 20px;"> - <?php - - $part1 = 0; - $part2 = 1; - $difference = 0; - - if ($allAccounts > $minimumCloudburst) { - $part2 = ($allAccounts - $minimumCloudburst) / $allAccounts; - $part1 = 1 - $part2; - $difference = $allAccounts - $minimumCloudburst; - } else { - $part1 = 1; - $part2 = 0; - $difference = $minimumCloudburst - $allAccounts; - } - - ?> - <div class="progress-bar bg-danger" style="width:<?= $part1 * 100 ?>%"></div> - <div class="progress-bar bg-success" style="width:<?= $part2 * 100 ?>%"></div> - </div> - <p style="text-align: center; margin-top: 5px;" class="<?= $allAccounts > $minimumCloudburst ? "" : "bold text-danger" ?>">£<?= number_format($difference, 2, '.', ',') ?><?php if ($allAccounts > $minimumCloudburst): ?> (<?= round($part2 * 100, 2) ?>%)<?php endif; ?> <?= $allAccounts > $minimumCloudburst ? "over" : "under" ?> the minimum</p> - - <?php if (isset($projects["cloudburst"]) && $projects["cloudburst"]["enable"]): ?> - <div class="grid" style="margin-bottom: 10px; display: grid; grid-template-columns: 25% 1fr; grid-gap: 20px;"> - <div style="width: 100%; display: flex; align-items: center; justify-content: center;"> - <img src="<?= $projects["cloudburst"]["image"] ?>" style="width: 100%;"> - </div> - <div style="display: flex; align-items: center;"> - <div style="width: 100%;"> - <h2><?= strip_tags($projects["cloudburst"]["name"]) ?></h2> - <div class="progress" style="margin-top: 20px; margin-bottom: 20px; width: 100%; background-color: #222;"> - <div class="progress-bar bg-success" style="width: <?= ($allAccounts - $minimumRaindrops >= 0) ? (($allAccounts - $minimumRaindrops) / $projects["raindrops"]["cost"]) * 100 : 0 ?>%"></div> - </div> - <?php $missing = $projects["cloudburst"]["cost"] - ($allAccounts - $minimumCloudburst); if ($missing > 0): $months = ceil($missing / getMonthlyEarnings()["cloudburst"]); ?> - <div>Costs £<?= number_format($projects["cloudburst"]["cost"], 2, '.', ',') ?> · Missing £<?= number_format($missing, 2, '.', ',') ?> · Can afford it in <?= date('F Y', time() + ($months * 2678400)) ?> (in <?= $months ?> month<?= $months > 1 ? "s" : "" ?>)</div> - <?php elseif ($missing === 0): ?><div>You can afford it now, this will take you to the minimum.</div> - <?php else: ?><div>You can afford it now, this will take you £<?= -$missing ?> above the minimum.</div><?php endif; ?> - </div> - </div> - </div> - <?php endif; ?> - - <canvas id="history-cloudburst" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - ?> - <script> - const ctx = document.getElementById('history-cloudburst').getContext('2d'); - const graph = new Chart(ctx, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : "ff6ae6" ?>', - backgroundColor: '#<?= $use2023UI ? $palette[9] : "ff6ae677" ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '£' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '£' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - - <h4 style="margin-top: 20px;">Raindrops System (<?php - - $allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true); - }, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; }))), function ($a, $b) { - return $a + $b; - }); - - ?>€<?= number_format($allAccounts, 2, '.', ',') ?>, earning €<?= number_format(getMonthlyEarnings()["raindrops"], 2, '.', ',') ?>/month)</h4> - <div class="list-group"> - <details class="list-group-item list-group-item-action" style="margin-bottom: 10px;"> - <summary>Show monthly earnings</summary> - - <table style="margin-top: 10px;"> - <?php foreach ($monthlyRaindrops as $month => $value): ?> - <tr> - <td style="padding-right: 20px;"><b><?= date('F Y', strtotime($month)) ?>:</b></td> - <td class="text-<?= $value > 0 ? "success" : ($value === 0 ? "warning" : "danger") ?>">€<?= number_format($value, 2, '.', ',') ?></td> - </tr> - <?php endforeach; ?> - </table> - </details> - </div> - <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;"> - <?php foreach ($accounts as $index => $account): if ($account["owner"] === "raindrops"): ?> - <a style="color: white; text-decoration: none;" href="/-/money/<?= $account["_name"] ?>"> - <div class="card"> - <div class="card-body"> - <h4 class="card-title"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= calculateFullAmount($account); ?></h4> - <?= $account["name"] ?><?php if ($account["default"]): ?> <span class="badge bg-success rounded-pill">Default</span><?php endif; ?><?php if (isset($account["interests"])): ?> · <?= $account["interests"] * 100 ?>% interests<?php endif; ?> - <?php if (isset($account["max"])): ?><br><span class="text-muted">Max balance: <?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format($account["max"], 2, '.', ',') ?> (<?= round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) ?>% used)</span><?php else: ?><br><span class="text-muted">No maximum balance</span><?php endif; ?> - </div> - </div> - </a> - <?php endif; endforeach; ?> - </div> - - <div class="progress" style="margin-top: 20px;"> - <?php - - $part1 = 0; - $part2 = 1; - $difference = 0; - - if ($allAccounts > $minimumRaindrops) { - $part2 = ($allAccounts - $minimumRaindrops) / $allAccounts; - $part1 = 1 - $part2; - $difference = $allAccounts - $minimumRaindrops; - } else { - $part1 = 1; - $part2 = 0; - $difference = $minimumRaindrops - $allAccounts; - } - - ?> - <div class="progress-bar bg-danger" style="width:<?= $part1 * 100 ?>%"></div> - <div class="progress-bar bg-success" style="width:<?= $part2 * 100 ?>%"></div> - </div> - <p style="text-align: center; margin-top: 5px;" class="<?= $allAccounts > $minimumRaindrops ? "" : "bold text-danger" ?>">€<?= number_format($difference, 2, '.', ',') ?><?php if ($allAccounts > $minimumRaindrops): ?> (<?= round($part2 * 100, 2) ?>%)<?php endif; ?> <?= $allAccounts > $minimumRaindrops ? "over" : "under" ?> the minimum</p> - - <?php if (isset($projects["raindrops"]) && $projects["raindrops"]["enable"]): ?> - <div class="grid" style="margin-bottom: 10px; display: grid; grid-template-columns: 25% 1fr; grid-gap: 20px;"> - <div style="width: 100%; display: flex; align-items: center; justify-content: center;"> - <img src="<?= $projects["raindrops"]["image"] ?>" style="width: 100%;"> - </div> - <div style="display: flex; align-items: center;"> - <div style="width: 100%;"> - <h2><?= strip_tags($projects["raindrops"]["name"]) ?></h2> - <div class="progress" style="margin-top: 20px; margin-bottom: 20px; width: 100%; background-color: #222;"> - <div class="progress-bar bg-success" style="width: <?= ($allAccounts - $minimumRaindrops >= 0) ? (($allAccounts - $minimumRaindrops) / $projects["raindrops"]["cost"]) * 100 : 0 ?>%"></div> - </div> - <?php $missing = $projects["raindrops"]["cost"] - ($allAccounts - $minimumRaindrops); if ($missing > 0): $months = ceil($missing / getMonthlyEarnings()["raindrops"]); ?> - <div>Costs €<?= number_format($projects["raindrops"]["cost"], 2, '.', ',') ?> · Missing €<?= number_format($missing, 2, '.', ',') ?> · Can afford it in <?= date('F Y', time() + ($months * 2678400)) ?> (in <?= $months ?> month<?= $months > 1 ? "s" : "" ?>)</div> - <?php elseif ($missing === 0): ?><div>You can afford it now, this will take you to the minimum.</div> - <?php else: ?><div>You can afford it now, this will take you €<?= -$missing ?> above the minimum.</div><?php endif; ?> - </div> - </div> - </div> - <?php endif; ?> - - <canvas id="history-raindrops" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - ?> - <script> - const ctx2 = document.getElementById('history-raindrops').getContext('2d'); - const graph2 = new Chart(ctx2, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : "d7e1ff" ?>', - backgroundColor: '#<?= $use2023UI ? $palette[9] : "d7e1ff77" ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '€' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '€' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - </div> - <?php else: $account = array_values(array_filter($accounts, function ($i) use ($parts) { return $i["_name"] === $parts[2]; }))[0]; ?> - <h2> - <?= $account["owner"] === "cloudburst" ? "Cloudburst System" : "Raindrops System" ?> · <?= $account["name"] ?><?php if ($account["default"]): ?><span class="text-muted"> (default)</span><?php endif; ?> - <a href="/-/money" class="small btn btn-outline-<?= $use2023UI ? "primary" : "light" ?>" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; <?= $use2023UI ? "" : "color: white;" ?>">Back</a> - </h2> - <div style="display: grid; grid-template-columns: max-content 1fr; grid-gap: 15px;"> - <h3 style="margin-bottom: 0; display: flex; align-items: center; justify-content: center;"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= calculateFullAmount($account) ?></h3> - <div> - <div><b>Maximum balance:</b> <?php if (isset($account["max"])): ?><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format($account["max"], 2, '.', ',') ?> (<?= round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) ?>% used)<?php else: ?>No maximum balance<?php endif; ?></div> - <div><b>Interests:</b> <?php if (isset($account["interests"])): ?><?= $account["interests"] * 100 ?>% interests<?php else: ?>None<?php endif; ?></div> - </div> - </div> - <canvas id="history" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions = $account["transactions"]; - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - global $palette; - - ?> - <script> - const ctx = document.getElementById('history').getContext('2d'); - const graph = new Chart(ctx, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : ($account["owner"] === "cloudburst" ? "ff6ae6" : "d7e1ff") ?>', - backgroundColor: '#<?=$use2023UI ? $palette[9] : ($account["owner"] === "cloudburst" ? "ff6ae677" : "d7e1ff77") ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '<?= $account["currency"] === "gbp" ? "£" : "€" ?>' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '<?= $account["currency"] === "gbp" ? "£" : "€" ?>' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - - <hr> - - <div class="list-group"> - <a href="#" data-bs-toggle="modal" data-bs-target="#create" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"><img src="<?= $use2023UI ? icon('add', null, true) : "/assets/icons/add.svg" ?>" style="filter: invert(1); margin-right: 10px; height: 32px; width: 32px;"><div style="display: flex; align-items: center;"><b>Add new transaction</b></div></a> - <?php foreach ($account["transactions"] as $index => $transaction): $member = getMemberWithoutSystem($transaction["author"]) ?? getMemberWithoutSystem("zdtsg"); ?> - <a id="transaction-<?= $index ?>" onclick="deleteTransaction(<?= $index ?>)" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;cursor:pointer;"><div style="display: flex; align-items: center;"><img src="<?= getAsset($member["_system"], $member["id"]) ?>" style="border-radius: 999px; width: 32px; height: 32px; margin-right: 10px;"></div><div style="display: flex; align-items: center;"><div><b><?= $member["display_name"] ?? $member["name"] ?></b><?= $transaction["amount"] < 0 ? " removed" : " added" ?> <span class="<?= $transaction["amount"] < 0 ? "text-danger" : "text-success" ?>"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format(abs($transaction["amount"]), 2, '.', ',') ?> </span><?= timeAgo($transaction["date"]) ?><?php if (isset($transaction["description"]) && trim($transaction["description"]) !== "" && (!isset($transaction["initial"]) || !$transaction["initial"])): ?>: <?= strip_tags(trim($transaction["description"])) ?><?php endif; ?><?php if (isset($transaction["initial"]) && $transaction["initial"]): ?> <span class="badge bg-<?= $use2023UI ? "success" : "secondary" ?> rounded-pill">Initial amount</span><?php endif; ?></div></div></a> - <?php endforeach; ?> - </div> - - <script> - window.transactions = JSON.parse(atob("<?= base64_encode(json_encode($account["transactions"])) ?>")); - - function deleteTransaction(index) { - document.getElementById("delete-item").innerHTML = document.getElementById("transaction-" + index).innerHTML; - document.getElementById("delete-link").href = location.pathname + "/?delete&id=" + index; - new bootstrap.Modal(document.getElementById("delete")).show(); - } - </script> - - <div class="modal fade" id="delete"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title">Delete transaction?</h4> - <button type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <p>Are you sure you want to delete the following transaction?</p> - - <p> - <div class="list-group"> - <div class="list-group-item" id="delete-item" style="display: grid; grid-template-columns: max-content 1fr;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab eum facere minima officiis quas. Architecto ea eius impedit incidunt ipsa itaque laudantium pariatur quae repudiandae sunt unde vel, veritatis, voluptates.</div> - </div> - </p> - - <p>Deleting a transaction takes effect immediately and cannot be undone.</p> - <a href="#" id="delete-link" class="btn btn-<?= $use2023UI ? "primary" : "danger" ?>">Delete</a> - </div> - </div> - </div> - </div> - - <div class="modal fade" id="create"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title">Create new transaction</h4> - <button type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <form> - <input type="hidden" name="create"> - - <label style="display: grid; grid-template-columns: 1fr 1fr; grid-gap: 20px;"> - <span style="align-items: center; justify-content: right; display: flex;">Amount (<?= $account["currency"] === "gbp" ? "£" : "€" ?>):</span> - <input required type="text" pattern="^(-|)\d{1,4}([,.]\d{0,2}|)$" name="amount" class="form-control" placeholder="Amount" style="filter: invert(1) hue-rotate(180deg);" maxlength="7" minlength="1"> - </label> - - <label style="margin-top: 10px;display: grid; grid-template-columns: 1fr 1fr; grid-gap: 20px;"> - <span style="align-items: center; justify-content: right; display: flex;">Description:</span> - <input maxlength="150" type="text" name="description" class="form-control" placeholder="Description" style="filter: invert(1) hue-rotate(180deg);"> - </label> - - <p> - <label style="margin-top: 10px;display: grid; grid-template-columns: 1fr 1fr; grid-gap: 20px;"> - <span style="align-items: center; justify-content: right; display: flex;">Author:</span> - <input type="text" disabled class="form-control" placeholder="Description" style="filter: invert(1) hue-rotate(180deg);" value="<?= getMemberWithoutSystem($myId)["display_name"] ?? getMemberWithoutSystem($myId)["name"] ?>"> - </label> - </p> - - <p>Adding a transaction takes effect immediately and cannot be modified afterward.</p> - <button id="delete-link" class="btn btn-<?= $use2023UI ? "primary" : "success" ?>">Create</button> - </form> - </div> - </div> - </div> - </div> - <?php endif; ?> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/page.inc b/pages/page.inc index fb63383..fa82a10 100644 --- a/pages/page.inc +++ b/pages/page.inc @@ -9,10 +9,7 @@ if (!isset($_GET['_']) || trim($_GET['_']) === "") peh_error("Invalid request", $parts = explode("/", $_GET['_']); -if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== "moonglow" && $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"]; +if (($parts[0] !== "raindrops" && $parts[0] !== "moonglow" && $parts[0] !== $app["other"]["slug"]) && (!(count($parts) > 2) || $parts[1] === "-")) { $namesRaindrops = [...array_map(function ($i) { return $i['name']; }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)), "unknown-rd"]; @@ -33,9 +30,7 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== "m array_unshift($parts, ""); $parts = array_values($parts); - if (in_array($parts[1], $namesCloudburst)) { - $parts[0] = "cloudburst"; - } else if (in_array($parts[1], $namesRaindrops)) { + if (in_array($parts[1], $namesRaindrops)) { $parts[0] = "raindrops"; } else if (in_array($parts[1], $namesMoonglow)) { $parts[0] = "moonglow"; @@ -49,9 +44,9 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== "m $system = $parts[0]; $member = ($parts[1] ?? null) === "" ? null : ($parts[1] ?? null); -if ($system !== "cloudburst" && $system !== "raindrops" && $system !== "moonglow" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) peh_error("System not found", 404); -$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System")); -$systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd")); +if ($system !== "raindrops" && $system !== "moonglow" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) peh_error("System not found", 404); +$systemCommonName = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System"); +$systemID = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd"); if ($member === null) { global $_SystemName; @@ -72,13 +67,12 @@ if ($member === null) { $traveller = false; $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); + $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "hrbom" : "gdapd") . "/members.json"), true); $memberData = null; $memberCommonName = null; $memberID = null; - foreach ($members as $m) { - if ($m['name'] === $member) { + foreach ($members as $m) {if ($m['name'] === $member) { $memberData = $m; $memberCommonName = $m['display_name'] ?? $m['name']; $memberID = $m['id']; @@ -86,14 +80,7 @@ if ($member === null) { } foreach ($members2 as $m) { - if ($m['name'] === $member && $travelling[$m['id']]['travelling']) { - $traveller = true; - $memberData = $m; - $memberCommonName = $m['display_name'] ?? $m['name']; - $memberID = $m['id']; - $system = $systemID === "gdapd" ? "cloudburst" : "raindrops"; - $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; - } else if ($m['name'] === $member) { + if ($m['name'] === $member) { $memberFoundInAnotherSystem = true; } } diff --git a/pages/pleasure.inc b/pages/pleasure.inc index 1a6e50a..5435bd1 100644 --- a/pages/pleasure.inc +++ b/pages/pleasure.inc @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $_PROFILE; global $pages; -if ($_PROFILE["login"] === "cloudburst") die(); $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; diff --git a/pages/public.inc b/pages/public.inc index b29d626..f87256b 100644 --- a/pages/public.inc +++ b/pages/public.inc @@ -41,8 +41,7 @@ function banner() { $isLoggedIn = false; $isLowerLoggedIn = false; $byColor = ge function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; ?> <div id="new-homepage" style="margin-top:20px;"> - <div id="new-homepage-systems" <?php if ($isLoggedIn || $isLowerLoggedIn): ?>style="grid-template-columns: repeat(4, 1fr);"<?php endif; ?>> - <?php newHomepage("ynmuc", "cloudburst", true); ?> + <div id="new-homepage-systems" <?php if ($isLoggedIn || $isLowerLoggedIn): ?>style="grid-template-columns: repeat(3, 1fr);"<?php endif; ?>> <?php newHomepage("gdapd", "raindrops", true); ?> <?php if ($isLoggedIn || $isLowerLoggedIn) newHomepage($app["other"]["id"], $app["other"]["slug"], true); ?> <?php newHomepage("hrbom", "moonglow", true); ?> @@ -74,7 +73,7 @@ function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; <?php - //file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}"); + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}"); $cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json"), true); if (!isset($cache["banner"])) $cache["banner"] = []; if (!isset($cache["members"])) $cache["members"] = []; @@ -150,7 +149,7 @@ function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; <div id="timeline"></div> <script> async function refreshTimeline() { - document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&ynmuc<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text(); + document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&hrbom<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text(); Array.from(document.getElementsByClassName("dynamic-time")).forEach((el) => { let time = el.getAttribute("data-time"); @@ -168,12 +167,6 @@ function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; </script> </div> - <?php if ($isLoggedIn || $isLowerLoggedIn): ?> - <div class="alert alert-warning" style="margin-top: 20px;"> - <b>Ponycule Documents is now deprecated.</b> Ponycule's Documents feature is now deprecated in favor of Google Docs and will be removed in the future. Please migrate your documents to Google Drive as soon as possible. - </div> - <?php endif; ?> - <!--<div class="alert alert-warning" style="margin-top:20px;"> <b>Notice:</b> The administrators are currently trying a new optimisation technique based on a virtual file system (chvfs). Data loss, corruption or inconsistency may happen and should be reported on <a href="https://bugs.equestria.dev/issues/CH" target="_blank">bugs.equestria.dev</a>. </div>--> diff --git a/pages/relations.inc b/pages/relations.inc index 1c5a878..5d3f7ef 100644 --- a/pages/relations.inc +++ b/pages/relations.inc @@ -11,7 +11,7 @@ function page() { global $isLoggedIn; global $isLowerLoggedIn; global $pages; gl <div id="page-content"> <h2><?= $pages["relations"]["name"][$lang["_name"]] ?></h2> <?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): ?> - <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr 2.25fr;"> + <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;" href="/<?= $member["name"] ?>"> <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> @@ -66,23 +66,6 @@ function page() { global $isLoggedIn; global $isLowerLoggedIn; global $pages; gl </td> </tr></tbody> </table> - - <table class="relation-item relation-item-friends" style="padding:0 20px;"> - <tbody><tr> - <td style="width: 50%;text-align:right;"> - <b style="padding-right:5px;">Friends:</b><span class="list-separator-mobile"><br></span> - </td> - <td style="width: 50%;text-align:left;"> - <?php if (!isset($member["_metadata"]["friends"]) || count($member["_metadata"]["friends"]) === 0): ?> - <span class="text-muted"><?= $lang["relations"]["no"] ?></span> - <?php else: ?> - <?php foreach ($member["_metadata"]["friends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> - <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> - <?php endif; endforeach; ?> - <?php endif; ?> - </td> - </tr></tbody> - </table> </div> <?php endforeach; ?> </div> diff --git a/pages/sessions.inc b/pages/sessions.inc index 7e6f328..444e981 100644 --- a/pages/sessions.inc +++ b/pages/sessions.inc @@ -7,7 +7,6 @@ $verified = [ dns_get_record("zephyrheights.equestria.dev", DNS_A)[0]["ip"], dns_get_record("maretimebay.equestria.dev", DNS_A)[0]["ip"], dns_get_record("bridlewood.equestria.dev", DNS_A)[0]["ip"], - dns_get_record("cloudsdale.equestria.dev", DNS_A)[0]["ip"], dns_get_record("manehattan.equestria.dev", DNS_A)[0]["ip"], dns_get_record("everfree.equestria.dev", DNS_A)[0]["ip"], ]; @@ -16,7 +15,6 @@ $verifiedNames = [ "Raindrops System", "Raindrops System", "Equestria.dev bridlewood", - "Cloudburst System", "Equestria.dev manehattan", $app["other"]["name"] ]; diff --git a/pages/travelling.inc b/pages/travelling.inc deleted file mode 100644 index c7eaadf..0000000 --- a/pages/travelling.inc +++ /dev/null @@ -1,223 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $isLowerLoggedIn; -$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); -$app = $GLOBALS["ColdHazeApp"]; - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; - -if (isset($_GET['toggleTravel']) && $isLoggedIn) { - if (isset($travelling[$_GET['member']])) { - $id = $_GET['member']; - $equestria = isset($_GET['equestria']); - $member = getSystemMember(getMemberSystem($id), $id); - $system = getMemberSystem($id); - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$id.json"), true)); - $travellingSystem = $system === "gdapd" ? "ynmuc" : "gdapd"; - - if ($travelling[$_GET['member']]["travelling"]) { - - $travelling[$_GET['member']]["travelling"] = false; - $travelling[$_GET['member']]["history"][count($travelling[$_GET['member']]["history"]) - 1]["end"] = date("c"); - - // Insert code here to run after a travelling member is DELETED. - // $id is the member ID (e.g. rirgf) - // $member is the member object - // $system is the ID of the system the member comes from - // $travellingSystem is the ID of the system the member visits - // $metadata is the ponies.equestria.horse metadata object - // $travellingMember is the member ID from the other system - if (isset($travelling[$_GET['member']]["pluralkit"])) { - $travellingMember = $travelling[$_GET['member']]["pluralkit"]; - $reqOptions = [ - 'http' => [ - 'method' => "DELETE", - 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] - ] - ]; - - $reqContext = stream_context_create($reqOptions); - - // No actual data is received on DELETE, so we don't even bother trying to collect req response; if it fails it will put a warning in the logs anyway. - //sleep(1); - //file_get_contents("https://api.pluralkit.me/v2/members/$travellingMember", false, $reqContext); - } - } else { - $travelling[$_GET['member']]["travelling"] = true; - $travelling[$_GET['member']]["equestria"] = $equestria; - $travelling[$_GET['member']]["pluralkit"] = null; - $travelling[$_GET['member']]["history"][] = [ - "start" => date("c"), - "end" => null, - "equestria" => $equestria - ]; - - if (!$equestria) { - // Insert code here to run after a travelling member is ADDED. - // $id is the member ID (e.g. rirgf) - // $member is the member - // $system is the system the member comes from - // $metadata is the ponies.equestria.horse metadata - // $travellingMember is unset here - // Store the travelling member ID in $travelling[$id]['pluralkit'] - $reqOptions = [ - 'http' => [ - 'method' => "POST", - 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] . "\r\n" . - "Content-Type: application/json", - 'content' => json_encode([ - 'name' => "$member[name]-travelling", - 'display_name' => $member["display_name"], - 'color' => $member["color"], - 'birthday' => $member["birthday"], - 'created' => $member["created"], - 'pronouns' => $member["pronouns"], - 'avatar_url' => $member["avatar_url"], - 'banner' => $member["banner"], - 'description' => "**This pony is visiting this system from the " . ($system === "gdapd" ? "Raindrops System" : "Cloudburst System") . ". They are not a permanent member of this system**\n\n$member[description]", - 'proxy_tags' => array_map(function ($i) { - $i["prefix"] = "+" . $i['prefix']; - return $i; - }, $member["proxy_tags"]), - 'privacy' => $member["privacy"] - ]) - ] - ]; - - $reqContext = stream_context_create($reqOptions); - - //sleep(1); - //$member = json_decode(file_get_contents("https://api.pluralkit.me/v2/members", false, $reqContext), true); - - // Member exists? - //if (isset($member)) { - //$travelling[$id]['pluralkit'] = $member["id"]; - //} - } - } - } - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/navigation.json", "{}"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}"); - createJob("RefreshCache", []); - - header("Location: /-/travelling"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); - die(); -} - -global $use2023UI; - -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; -global $travelling; - -?> - -<style> - .member-link:hover, .relation-intro:hover { - opacity: .75; - } - - .member-link:active, .relation-intro:active { - opacity: .5; - } -</style> - -<br> -<div class="container"> - <div> - <h2>System travelling</h2> - <?php foreach ([ - ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { - return $travelling[$i['id']]["travelling"] && ($i["_system"] === "gdapd" || $i["_system"] === "ynmuc"); - })), - "SEPARATOR", - ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { - return !$travelling[$i['id']]["travelling"] && ($i["_system"] === "gdapd" || $i["_system"] === "ynmuc"); - })) - ] as $member): if (is_string($member)): ?> - <hr> - <?php else: ?> - <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> - <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - - <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;"> - <div> - <b style="padding-right:5px;">Current location:</b><span class="list-separator-mobile"><br></span> - <?php $system = $member['_system'] === "gdapd" ? ($travelling[$member['id']]["travelling"] ? "ynmuc" : "gdapd") : ($travelling[$member['id']]["travelling"] ? "gdapd" : "ynmuc"); ?> - <?php if ($travelling[$member['id']]["travelling"] && $travelling[$member['id']]["equestria"]): ?> - <?php if ($member["_metadata"]["fictive"]): ?> - <img style="width:24px;" src="/assets/logo/equestria.png"> Equestria - <?php else: ?> - <img style="width:24px;" src="/assets/logo/celeste.png"> Celeste - <?php endif; ?> - <?php else: ?> - <a class="member-link" href="/<?= $system === "gdapd" ? "raindrops" : "cloudburst" ?>"><img style="width:24px;border-radius:5px;" src="<?= getAsset($system) ?>"> <?= $system === "gdapd" ? "Raindrops" : "Cloudburst" ?> System</a> - <?php endif; ?> - <?php if ($travelling[$member['id']]["travelling"]): ?> - <span class="text-muted">(<?= timeAgo($travelling[$member['id']]["history"][count($travelling[$member['id']]["history"]) - 1]["start"]) ?>)</span> - <?php endif; ?> - </div> - </div> - - <div> - <?php if ($travelling[$member['id']]["travelling"]): ?> - <div class="dropdown"> - <button type="button" class="btn btn-outline-<?= $use2023UI ? "primary" : "danger" ?> dropdown-toggle" data-bs-toggle="dropdown" <?= $isLowerLoggedIn ? "disabled" : "" ?>> - Stop travelling - </button> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="?toggleTravel&member=<?= $member['id'] ?>">Stop travelling</a></li> - </ul> - </div> - <?php else: ?> - <div class="dropdown"> - <button type="button" class="btn btn-outline-<?= $use2023UI ? "primary" : "success" ?> dropdown-toggle" data-bs-toggle="dropdown" <?= $isLowerLoggedIn ? "disabled" : "" ?>> - Start travelling - </button> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="?toggleTravel&member=<?= $member['id'] ?>"><img style="width:24px;border-radius:5px;" src="<?= getAsset($system === "gdapd" ? "ynmuc" : "gdapd") ?>"> <?= $system === "gdapd" ? "Cloudburst" : "Raindrops" ?> System</a></li> - <?php if ($member["_metadata"]["fictive"]): ?> - <li><a class="dropdown-item" href="?toggleTravel&equestria&member=<?= $member['id'] ?>"><img style="width:24px;" src="/assets/logo/equestria.png"> Equestria</a></li> - <?php endif; if (isset($member["_metadata"]["fictive2"]) && $member["_metadata"]["fictive2"]): ?> - <li><a class="dropdown-item" href="?toggleTravel&equestria&member=<?= $member['id'] ?>"><img style="width:24px;" src="/assets/logo/celeste.png"> Celeste</a></li> - <?php endif; ?> - </ul> - </div> - <?php endif; ?> - </div> - </div> - <?php endif; endforeach; ?> - </div> - - <style> - @media (max-width: 991px) { - .relation { - grid-template-columns: 1fr !important; - } - - .relation-intro { - text-align: center; - border-bottom-left-radius: 0 !important; - border-top-right-radius: 10px; - border-right: none !important; - border-bottom: 1px solid rgba(255, 255, 255, .1); - } - - .relation-item-marefriends { - margin-top: 20px !important; - } - - .relation-item { - margin-top: 10px; - margin-left: 0 !important; - padding: 10px 0 !important; - text-align: center; - } - } - </style> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> |