diff options
author | Minteck <contact@minteck.org> | 2022-10-18 08:59:09 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-10-18 08:59:09 +0200 |
commit | 2c4ae43e688a9873e86211ea0e7aeb9ba770dd77 (patch) | |
tree | 17848d95522dab25d3cdeb9c4a6450e2a234861f /includes | |
parent | 108525534c28013cfe1897c30e4565f9893f3766 (diff) | |
download | pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.gz pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.bz2 pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.zip |
Update
Diffstat (limited to 'includes')
-rw-r--r-- | includes/banner.inc | 2 | ||||
-rw-r--r-- | includes/footer.inc | 4 | ||||
-rw-r--r-- | includes/functions.inc | 19 | ||||
-rw-r--r-- | includes/header.inc | 393 | ||||
-rw-r--r-- | includes/member.inc | 2 | ||||
-rw-r--r-- | includes/member/hierarchy.inc | 2 | ||||
-rw-r--r-- | includes/mobilenav.inc | 88 | ||||
-rw-r--r-- | includes/navbar.inc | 72 | ||||
-rw-r--r-- | includes/navigation.inc | 379 | ||||
-rw-r--r-- | includes/pages.json | 32 | ||||
-rw-r--r-- | includes/pane.inc | 129 | ||||
-rw-r--r-- | includes/planner.inc | 24 | ||||
-rw-r--r-- | includes/rail.inc | 9 | ||||
-rw-r--r-- | includes/refresh.php | 14 | ||||
-rw-r--r-- | includes/restore.php (renamed from includes/restore.inc) | 0 | ||||
-rw-r--r-- | includes/score.inc | 5 | ||||
-rw-r--r-- | includes/search.inc | 10 | ||||
-rw-r--r-- | includes/short.inc | 2 | ||||
-rw-r--r-- | includes/sysbanner.inc | 41 | ||||
-rw-r--r-- | includes/system.inc | 47 | ||||
-rw-r--r-- | includes/system/compare.inc | 2 | ||||
-rw-r--r-- | includes/system/history.inc | 477 | ||||
-rw-r--r-- | includes/system/history.old.inc | 528 | ||||
-rw-r--r-- | includes/system/species.inc | 2 | ||||
-rw-r--r-- | includes/system/tree.inc | 2 | ||||
-rw-r--r-- | includes/titlebar.inc | 182 | ||||
-rw-r--r-- | includes/travelling.inc | 6 |
27 files changed, 1697 insertions, 776 deletions
diff --git a/includes/banner.inc b/includes/banner.inc index a3c6f10..e1b06be 100644 --- a/includes/banner.inc +++ b/includes/banner.inc @@ -190,7 +190,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { if ($travelling[$member['id']]["travelling"]) { $systemData['page'] = "/" . ($system === "gdapd" ? "cloudburst" : "raindrops"); - $systemData['icon'] = getAsset($system); + $systemData['icon'] = ($system === "gdapd" ? "cloudburst" : "raindrops") . ".png"; $systemData['name'] = $system === "gdapd" ? "Cloudburst" : "Raindrops"; $systemData['full_name'] = $system === "gdapd" ? "Cloudburst System" : "Raindrops System"; $systemData['subsystem'] = null; diff --git a/includes/footer.inc b/includes/footer.inc index 303b6f0..6cf833c 100644 --- a/includes/footer.inc +++ b/includes/footer.inc @@ -13,8 +13,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; ?> © <?= date("Y") ?> <a href="https://equestria.horse" target="_blank" class="text-muted">Equestria.dev Developers</a> · version 2.<?= $version["build"] ?>.<?= hexdec(substr($version["hash"], 0, 4)) ?>.<?= $version["revision"] ?><br> - <a href="/-/debug" class="text-muted" style="text-decoration: none;">Data updated <?= trim(timeAgo($refresh["timestamp"])) ?> (<?php if (time() - $refresh["timestamp"] > 360): ?>not updating; <?php endif; ?><?= date('D j M, G:i:s T', $refresh["timestamp"]) ?>; took <?= round($refresh["duration"] * 1000) ?> ms, <?= count($refresh["restored"]) > 0 ? (count($refresh["restored"]) > 1 ? "reported " . count($refresh["restored"]) . " failures" : "reported 1 failure") : "no failures reported" ?>)</a> - <br><br><br> + <a href="/-/debug" class="text-muted" style="text-decoration: none;">Data updated <?= trim(timeAgo($refresh["timestamp"])) ?> (<?php if (time() - $refresh["timestamp"] > 360): ?>not updating; <?php endif; ?><?= date('D j M, G:i:s T', (int)$refresh["timestamp"]) ?>; took <?= round($refresh["duration"] * 1000) ?> ms, <?= count($refresh["restored"]) > 0 ? (count($refresh["restored"]) > 1 ? "reported " . count($refresh["restored"]) . " failures" : "reported 1 failure") : "no failures reported" ?>)</a> + <br><br><br><br><br> </div> <script> diff --git a/includes/functions.inc b/includes/functions.inc index 386d2b2..c3ec313 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -21,6 +21,23 @@ if (!function_exists("getAsset")) { } $id = $id1 . $id2; + + if (str_ends_with(getMemberWithoutSystem($memberID)["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"]); + + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true); + $list = array_map(function ($i) { + return $i["name"]; + }, $members); + + if (in_array(substr(getMemberWithoutSystem($memberID)["name"], 0, -11), $list)) { + $id2 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", getMemberFromName(substr(getMemberWithoutSystem($memberID)["name"], 0, -11))["uuid"]); + } else { + return "/error/nomember/?s=$systemID&m=$memberID&t=$type"; + } + + $id = $id1 . $id2; + } } else { $id = $id1; } @@ -457,7 +474,7 @@ if (!function_exists("getMemberFromName")) { $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)]; foreach ($list as $item) { - if ($item["name"] === $name) return $item; + if ($item["name"] === $name) return getMemberWithoutSystem($item["id"]); } } } diff --git a/includes/header.inc b/includes/header.inc index e851c85..c893cea 100644 --- a/includes/header.inc +++ b/includes/header.inc @@ -1,5 +1,6 @@ <?php global $title; global $pages; +$useNewUI = isset($_GET['new']) || isset($_COOKIE['new']); $readOnly = false; @file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test", "hello"); @@ -90,12 +91,15 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ical/main.php"; margin-left: 32px; } - #admin-page .navbar { - margin-left: -32px; + .modal { + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); } nav.navbar { - background-color: black !important; + background-color: rgba(0, 0, 0, .75) !important; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255, 255, 255, .25); } @@ -753,249 +757,146 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ical/main.php"; } </style> </head> -<body<?php if ($page["rail"] && $isLoggedIn): ?> id="admin-page"<?php endif; ?>> - <nav class="navbar navbar-expand-<?= $isLoggedIn ? 'xl' : 'lg' ?> bg-dark navbar-dark" style="height:60px;"> - <div class="container-fluid"> - <a class="navbar-brand" href="/"><img src="/assets/logo/newlogo.png" alt="" style="width:32px;vertical-align: middle;margin-right:5px;"> <span style="vertical-align: middle;">Cold Haze</span><a> - <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#collapsibleNavbar"> - <span class="navbar-toggler-icon"></span> - </button> - <div class="collapse navbar-collapse" id="collapsibleNavbar"> - <ul class="navbar-nav"> - <?php if (!isset($demoHeader) || !$demoHeader): ?> - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"> - <img src="/assets/icons/global.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">Global</span> - </a> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="/"> - <img src="/assets/icons/home.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["home"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/disclaimers"> - <img src="/assets/icons/disclaimers.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["disclaimers"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/relations"> - <img src="/assets/icons/relations.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["relations"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/government"> - <img src="/assets/icons/government.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["government"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/terminology"> - <img src="/assets/icons/terminology.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["terminology"]["name"] ?></span> - </a></li> - <li><hr class="dropdown-divider"></li> - <li><h5 class="dropdown-header">Tools</h5></li> - <li><a class="dropdown-item" href="/-/parser"> - <img src="/assets/icons/parser.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["parser"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/prefix"> - <img src="/assets/icons/prefix.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["prefix"]["name"] ?></span> - </a></li> - </ul> - </li> - <?php if ($isLoggedIn): ?> - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"> - <img src="/assets/icons/admin.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">Administrator</span> - </a> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="/-/emergency"> - <img src="/assets/icons/emergency.svg" alt="" style="width:24px;vertical-align: middle;"> - <span class="text-danger" style="vertical-align: middle;"><b><?= $pages["emergency"]["name"] ?></b></span> - </a></li> - <?php - - $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"]; - - if (isset($_GET['pleasure']) || (isset($frontRaindrops[0]) && isset($frontCloudburst[0]) && ( - ((int)date('H') >= 20 || (int)date('H') < 6) && - ($frontCloudburst[0]["id"] === "erknz" && - $frontRaindrops[0]["id"] === "qbzxm") || - ($frontCloudburst[0]["id"] === "zzise" && - $frontRaindrops[0]["id"] === "tfbob") || - ($frontCloudburst[0]["id"] === "vncoa" && - $frontRaindrops[0]["id"] === "qraku") - ))): ?> - <li><a class="dropdown-item" href="/-/pleasure" <?= isset($_GET['pleasure']) ? 'style="opacity: .5;"' : '' ?>> - <img src="/assets/icons/pleasure.svg" alt="" style="width:24px;vertical-align: middle;"> - <span class="text-success" style="vertical-align: middle;"><b><?= $pages["pleasure"]["name"] ?></b></span> - </a></li> - <?php endif; ?> - - <?php if (isset($_GET['wakeup']) || (int)date('H') >= 20 || (int)date('H') < 8): ?> - <li><a class="dropdown-item" href="/-/wakeup" <?= isset($_GET['wakeup']) ? 'style="opacity: .5;"' : '' ?>> - <img src="/assets/icons/wakeup.svg" alt="" style="width:24px;vertical-align: middle;"> - <span class="text-info" style="vertical-align: middle;"><b><?= $pages["wakeup"]["name"] ?></b></span> - </a></li> - <?php endif; ?> - <li><hr class="dropdown-divider"></li> - - <li><h5 class="dropdown-header">Applications</h5></li> - <li><a class="dropdown-item" href="/-/dashboard"> - <img src="/assets/icons/dashboard.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["dashboard"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/fronting"> - <img src="/assets/icons/fronting.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["fronting"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/docs"> - <img src="/assets/icons/docs.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["docs"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/travelling"> - <img src="/assets/icons/travel.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["travelling"]["name"] ?></span> - </a></li> - <li><hr class="dropdown-divider"></li> - - <li><h5 class="dropdown-header">Debugging</h5></li> - <li><a class="dropdown-item" href="/-/debug"> - <img src="/assets/icons/debug.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["debug"]["name"] ?></span> - </a></li> - <li><a class="dropdown-item" href="/-/score"> - <img src="/assets/icons/score.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["score"]["name"] ?></span> - </a></li> - <li><hr class="dropdown-divider"></li> - - <li><a class="dropdown-item" href="/-/logout"> - <img src="/assets/icons/logout.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $pages["logout"]["name"] ?></span> - </a></li> - </ul> - </li> - <?php endif; else: ?> - <li class="nav-item"> - <a class="nav-link" href="/" role="button"> - <img src="/assets/icons/right.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">Reste du site (en anglais)</span> - </a> - </li> - <?php endif; ?> - <?php if (!isset($emergencyHeader) || !$emergencyHeader): ?> - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="/cloudburst" role="button" data-bs-toggle="dropdown"> - <img src="/assets/uploads/cloudburst.png" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">Cloudburst System</span> - </a> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="/cloudburst"> - <img src="/assets/icons/about.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">About us</span> - </a></li> - <?php - - $subsystems1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc.json"), true); - $subsystemsNotMember = array_values(array_filter($subsystems1, function ($i) { - return $i["source_type"] !== "member"; - })); - - if (count($subsystemsNotMember) > 0): ?> - <li><hr class="dropdown-divider"></li> - <li><h5 class="dropdown-header">Subsystems</h5></li> - <?php foreach ($subsystemsNotMember as $subsystem): $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc-" . $subsystem['source'] . ".json"), true); ?> - <li><a class="dropdown-item" href="/cloudburst/-/subsystem/<?= $subsystem['source'] ?>"> - <img src="/assets/uploads/ss-<?= $subsystem['source'] ?>.png" alt="" style="border-radius:5px;width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $ssData['name'] ?? $subsystem['source'] ?></span> - </a></li> - <?php endforeach; ?> - <?php endif; ?> - <li><hr class="dropdown-divider"></li> - <li><h5 class="dropdown-header">Members</h5></li> - <?php foreach (scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true), "ynmuc"), "ynmuc") as $member): if ($member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"): ?> - <li><a class="dropdown-item" href="/<?= $member['name'] ?>"> - <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $member['display_name'] ?? $member['name'] ?></span> - </a></li> - <?php endif; endforeach; ?> - </ul> - </li> - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="/raindrops" role="button" data-bs-toggle="dropdown"> - <img src="/assets/uploads/raindrops.png" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">Raindrops System</span> - </a> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="/raindrops"> - <img src="/assets/icons/about.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">About us</span> - </a></li> - <?php - - $subsystems1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd.json"), true); - $subsystemsNotMember = array_values(array_filter($subsystems1, function ($i) { - return $i["source_type"] !== "member"; - })); - - if (count($subsystemsNotMember) > 0): ?> - <li><hr class="dropdown-divider"></li> - <li><h5 class="dropdown-header">Subsystems</h5></li> - <?php foreach ($subsystemsNotMember as $subsystem): $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd-" . $subsystem['source'] . ".json"), true); ?> - <li><a class="dropdown-item" href="/raindrops/-/subsystem/<?= $subsystem['source'] ?>"> - <img src="/assets/uploads/ss-<?= $subsystem['source'] ?>.png" alt="" style="border-radius:5px;width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $ssData['name'] ?? $subsystem['source'] ?></span> - </a></li> - <?php endforeach; ?> - <?php endif; ?> - <li><hr class="dropdown-divider"></li> - <li><h5 class="dropdown-header">Members</h5></li> - <?php foreach (scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd"), "gdapd") as $member): if ($member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"): ?> - <li><a class="dropdown-item" href="/<?= $member['name'] ?>"> - <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;"><?= $member['display_name'] ?? $member['name'] ?></span> - </a></li> - <?php endif; endforeach; ?> - </ul> - </li> - <?php if ($isLoggedIn): ?> - <li class="nav-item" style="margin-left: auto;"> - <a class="nav-link" href="/-/user"> - <?php global $_PROFILE; ?> - <span style="vertical-align: middle;"> - <?= $_PROFILE["name"] ?> - </span> - <img alt="" src="/assets/icons/shield.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> - </a> - </li> - <?php elseif ($isUserLoggedIn): ?> - <li class="nav-item" style="margin-left: auto;"> - <a class="nav-link" href="/-/user"> - <?php global $_PROFILE; ?> - <span style="vertical-align: middle;"> - <?= $_PROFILE["name"] ?> - </span> - <img alt="" src="/assets/icons/shield.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> - </a> - </li> - <?php else: ?> - <li class="nav-item" style="margin-left: auto;"> - <a class="nav-link" href="/-/login"> - <?php global $_PROFILE; ?> - <span style="vertical-align: middle;"> - Not logged in - </span> - <img alt="" src="/assets/icons/login.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> - </a> - </li> - <?php endif; ?> - <?php endif; ?> - </ul> - </div> - </div> - </nav> +<body<?php if ($page["rail"] && $isLoggedIn && !$useNewUI): ?> id="admin-page"<?php endif; ?>> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.inc"; global $navigation; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navbar.inc"; ?> + + <?php if (!$useNewUI): ?> + <div style="margin-top: 60px;" id="top-of-page"></div> + <?php endif; ?> + + <?php if ($useNewUI): ?> + <aside id="navigation-pane"> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/pane.inc"; ?> + </aside> + + <div id="title-bar"> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/titlebar.inc"; ?> + </div> + + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/mobilenav.inc"; ?> + + <div style="margin-top: 34px;"></div> + + <style> + body { + margin-left: 300px; + } + + .modal.show { + top: 34px; + left: 300px; + width: calc(100% - 300px); + } + + nav { + display: none !important; + } + + #navigation-pane { + z-index: 9999; + background: black; + position: fixed; + top: 0; + left: 0; + bottom: 0; + width: 300px; + border-right: 1px solid rgba(255, 255, 255, .25); + overflow: auto; + } + + #title-bar { + position: fixed; + top: 0; + left: 300px; + right: 0; + height: 34px; + background: rgba(0, 0, 0, .75); + z-index: 9999; + padding: 5px; + text-align: center; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-bottom: 1px solid rgba(255, 255, 255, .25); + } + + #mobile-navigation { + display: none; + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 48px; + background: rgba(0, 0, 0, .75); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-top: 1px solid rgba(255, 255, 255, .25); + z-index: 999999; + } + + @media (max-width: 1360px) { + .modal.show { + left: 250px !important; + width: calc(100% - 250px) !important; + } + + #title-bar { + left: 250px !important; + } + + #navigation-pane { + width: 250px !important; + } + + body { + margin-left: 250px !important; + } + } + + @media (max-width: 1300px) { + .modal.show { + left: 200px !important; + width: calc(100% - 200px) !important; + } + + #title-bar { + left: 200px !important; + } + + #navigation-pane { + width: 200px !important; + } + + body { + margin-left: 200px !important; + } + } + + @media (max-width: 1195px) { + .modal.show { + left: 0 !important; + width: 100% !important; + } + + #title-bar { + left: 0 !important; + } + + #navigation-pane { + display: none !important; + } + + body { + margin-left: 0 !important; + } + + #mobile-navigation { + display: block !important; + } + } + </style> + <?php endif; ?> -<?php if ($page["rail"] && $isLoggedIn): ?> +<?php if ($page["rail"] && $isLoggedIn && !$useNewUI): ?> <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/rail.inc"; ?> <?php endif; ?> diff --git a/includes/member.inc b/includes/member.inc index 2a0c346..6f36f75 100644 --- a/includes/member.inc +++ b/includes/member.inc @@ -211,7 +211,7 @@ if ($memberData["name"] === "fusion") { <?php endif; ?> <?php if ($travelling[$memberID]['travelling']): ?> <div class="alert alert-primary"> - <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> is visiting the <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?> since <?= timeAgo($travelling[$memberID]["history"][count($travelling[$memberID]["history"]) - 1]["start"]) ?>, therefore <?= getMemberPronouns($memberData["pronouns"])["subjective"] ?> <?= getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are" ?> currently not in the <?= $systemCommonName ?>. + <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> is visiting the <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?>, therefore <?= getMemberPronouns($memberData["pronouns"])["subjective"] ?> <?= getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are" ?> currently not in the <?= $systemCommonName ?>. </div> <?php endif; ?> <?php if ($memberData["name"] === "new"): ?> diff --git a/includes/member/hierarchy.inc b/includes/member/hierarchy.inc index dfb42c9..acf954b 100644 --- a/includes/member/hierarchy.inc +++ b/includes/member/hierarchy.inc @@ -27,6 +27,8 @@ if ($travelling[$memberID]["travelling"]) { $systemCommonName = $systemID === "gdapd" ? "Cloudburst System" : "Raindrops System"; } +$memberData["system"] = $memberData["_system"] = $systemID; + ?> <br> diff --git a/includes/mobilenav.inc b/includes/mobilenav.inc new file mode 100644 index 0000000..ed778ec --- /dev/null +++ b/includes/mobilenav.inc @@ -0,0 +1,88 @@ +<?php global $navigation; global $isLoggedIn; ?> +<div id="mobile-navigation"> + <div id="mobile-navigation-container" class="container" style="display: grid; grid-template-columns: repeat(<?= count(array_values(array_filter($navigation, function ($item) use ($isLoggedIn) { + return !$item["admin"] || $isLoggedIn; + }))) + 1 ?>, 1fr); height: 100%;"> + <a title="Cold Haze" data-bs-toggle="tooltip" href="/" id="mobile-navigation-item--logo" class="tooltip-nohelp mobile-navigation-item"> + <img src="/assets/logo/newlogo.png" alt="" style="width:24px;vertical-align: middle;"> + </a> + <?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?> + <a onclick="toggleMobileNavigation('<?= $id ?>');" title="<?= $item["name"] ?>" data-bs-toggle="tooltip" id="mobile-navigation-item-<?= $id ?>" class="tooltip-nohelp mobile-navigation-item"> + <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"> + </a> + <?php endif; endforeach; ?> + </div> +</div> + +<div id="mobile-navigation-box-container" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 48px; background-color: rgba(0, 0, 0, .75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 99999; overflow: auto;"> + <?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?> + <div id="mobile-navigation-box-<?= $id ?>" style="display: none; margin-top: 10px; margin-bottom: 10px;" class="mobile-navigation-box container"> + <div class="pane-group-title"> + <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;"><?= $item["name"] ?></span> + </div> + + <?php foreach ($item["items"] as $category): ?> + <div class="pane-group-category <?= $category["minimal"] ? "pane-group-category-minimal" : "" ?>" <?= $category["minimal"] ? 'style="display: grid; grid-template-columns: repeat(' . count($category["items"]) . ', 1fr); grid-gap: 10px;"' : "" ?>> + <?php if (isset($category["name"])): ?> + <div class="pane-group-category-title"><?= $category["name"] ?></div> + <?php endif; ?> + <?php foreach ($category["items"] as $link): ?> + <a class="pane-group-item" href="<?= $link["link"] ?>"> + <img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px; border-radius: 5px; vertical-align: middle;"> + <?php if (!$category["minimal"]): ?><span style="vertical-align: middle;<?= isset($link["stepped"]) ? "color: $link[stepped];" : "" ?>"><?= isset($link["stepped"]) ? "<b>$link[name]</b>" : $link["name"] ?></span><?php endif; ?> + </a> + <?php endforeach; ?> + </div> + <?php endforeach; ?> + </div> + <?php endif; endforeach; ?> +</div> + +<style> + .mobile-navigation-item { + display: flex; + cursor: pointer; + align-items: center; + justify-content: center; + } + + .mobile-navigation-item:hover { + background: rgba(255, 255, 255, .1); + } + + .mobile-navigation-item:active, .mobile-navigation-item:focus, .mobile-navigation-item.open { + background: rgba(255, 255, 255, .25); + } +</style> + +<script> + function closeMobileNavigation() { + document.getElementById("mobile-navigation-box-container").style.display = "none"; + document.body.style.overflow = ""; + + Array.from(document.getElementsByClassName("mobile-navigation-item")).forEach((i) => { + i.classList.remove("open"); + }); + + Array.from(document.getElementsByClassName("mobile-navigation-box")).forEach((i) => { + i.style.display = "none"; + }); + } + + function openMobileNavigation(id) { + document.getElementById("mobile-navigation-item-" + id).classList.add("open"); + document.body.style.overflow = "hidden"; + document.getElementById("mobile-navigation-box-container").style.display = "block"; + document.getElementById("mobile-navigation-box-" + id).style.display = "block"; + } + + function toggleMobileNavigation(id) { + if (document.getElementById("mobile-navigation-box-" + id).style.display !== "block") { + closeMobileNavigation(); + openMobileNavigation(id); + } else { + closeMobileNavigation(); + } + } +</script>
\ No newline at end of file diff --git a/includes/navbar.inc b/includes/navbar.inc new file mode 100644 index 0000000..379f102 --- /dev/null +++ b/includes/navbar.inc @@ -0,0 +1,72 @@ +<?php global $isLoggedIn; global $isUserLoggedIn; global $demoHeader; global $pages; global $useNewUI; global $navigation; ?> + +<?php if (!$useNewUI): ?> +<nav class="navbar navbar-expand-<?= $isLoggedIn ? 'xl' : 'lg' ?> bg-dark navbar-dark fixed-top" style="height:60px;"> + <div class="container-fluid"> + <a class="navbar-brand" href="/"><img src="/assets/logo/newlogo.png" alt="" style="width:32px;vertical-align: middle;margin-right:5px;"> + <span style="vertical-align: middle;">Cold Haze</span> + </a> + <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#collapsibleNavbar"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="collapsibleNavbar"> + <ul class="navbar-nav"> + <?php foreach ($navigation as $item): if (!$item["admin"] || $isLoggedIn): ?> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"> + <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;"><?= $item["name"] ?></span> + </a> + <ul class="dropdown-menu"> + <?php foreach ($item["items"] as $category): ?> + <?php if (isset($category["name"])): ?> + <li><hr class="dropdown-divider"></li> + <li><h5 class="dropdown-header"><?= $category["name"] ?></h5></li> + <?php endif; ?> + + <?php foreach ($category["items"] as $link): ?> + <li><a class="dropdown-item" href="<?= $link["link"] ?>"> + <img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px; border-radius: 5px; vertical-align: middle;"> + <span style="vertical-align: middle;<?= isset($link["stepped"]) ? "color: $link[stepped];" : "" ?>"><?= isset($link["stepped"]) ? "<b>$link[name]</b>" : $link["name"] ?></span> + </a></li> + <?php endforeach; ?> + <?php endforeach; ?> + </ul> + </li> + <?php endif; endforeach; ?> + <?php if ($isLoggedIn && !$useNewUI): ?> + <li class="nav-item" style="margin-left: auto;"> + <a class="nav-link" href="/-/user"> + <?php global $_PROFILE; ?> + <span style="vertical-align: middle;"> + <?= $_PROFILE["name"] ?> + </span> + <img alt="" src="/assets/icons/shield.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> + </a> + </li> + <?php elseif ($isUserLoggedIn && !$useNewUI): ?> + <li class="nav-item" style="margin-left: auto;"> + <a class="nav-link" href="/-/user"> + <?php global $_PROFILE; ?> + <span style="vertical-align: middle;"> + <?= $_PROFILE["name"] ?> + </span> + <img alt="" src="/assets/icons/shield.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> + </a> + </li> + <?php elseif (!$isLoggedIn && !$isUserLoggedIn): ?> + <li class="nav-item" style="<?php if (!$useNewUI): ?>margin-left: auto;<?php endif; ?>"> + <a class="nav-link" href="/-/login"> + <?php global $_PROFILE; ?> + <span style="vertical-align: middle;"> + Not logged in + </span> + <img alt="" src="/assets/icons/login.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> + </a> + </li> + <?php endif; ?> + </ul> + </div> + </div> +</nav> +<?php endif; ?>
\ No newline at end of file diff --git a/includes/navigation.inc b/includes/navigation.inc new file mode 100644 index 0000000..8ad019c --- /dev/null +++ b/includes/navigation.inc @@ -0,0 +1,379 @@ +<?php + +$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); + +$subsystems1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc.json"), true); +$cloudburst_subsystemsNotMember = array_values(array_filter($subsystems1, function ($i) { + return $i["source_type"] !== "member"; +})); + +$subsystems2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd.json"), true); +$raindrops_subsystemsNotMember = array_values(array_filter($subsystems2, function ($i) { + return $i["source_type"] !== "member"; +})); + +global $navigation; +global $toplevel; + +$navigation_admin = [ + "admin" => true, + "name" => "Administrator", + "icon" => "/assets/icons/admin.svg", + "invert" => true, + "items" => [ + "alerts" => [ + "name" => null, + "minimal" => true, + "items" => [ + [ + "name" => $pages["emergency"]["name"], + "icon" => "/assets/icons/emergency.svg", + "invert" => false, + "link" => "/-/emergency", + "stepped" => "rgb(220,53,69)" + ], + [ + "name" => $pages["wakeup"]["name"], + "icon" => "/assets/icons/wakeup.svg", + "invert" => false, + "link" => "/-/wakeup", + "stepped" => "rgb(13,202,240)" + ], + [ + "name" => $pages["pleasure"]["name"], + "icon" => "/assets/icons/pleasure.svg", + "invert" => false, + "link" => "/-/pleasure", + "stepped" => "rgb(25,135,84)" + ] + ] + ], + "apps" => [ + "name" => "Applications", + "minimal" => false, + "items" => [ + [ + "name" => $pages["dashboard"]["name"], + "icon" => "/assets/icons/dashboard.svg", + "invert" => true, + "link" => "/-/dashboard", + "stepped" => null + ], + [ + "name" => $pages["about"]["name"], + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/-/about", + "stepped" => null + ], + [ + "name" => $pages["fronting"]["name"], + "icon" => "/assets/icons/fronting.svg", + "invert" => true, + "link" => "/-/fronting", + "stepped" => null + ], + [ + "name" => $pages["actions"]["name"], + "icon" => "/assets/icons/actions.svg", + "invert" => true, + "link" => "/-/actions", + "stepped" => null + ], + [ + "name" => $pages["rules"]["name"], + "icon" => "/assets/icons/rules.svg", + "invert" => true, + "link" => "/-/rules", + "stepped" => null + ], + [ + "name" => $pages["docs"]["name"], + "icon" => "/assets/icons/docs.svg", + "invert" => true, + "link" => "/-/docs", + "stepped" => null + ], + [ + "name" => $pages["nicknames"]["name"], + "icon" => "/assets/icons/nicknames.svg", + "invert" => true, + "link" => "/-/nicknames", + "stepped" => null + ], + [ + "name" => $pages["together"]["name"], + "icon" => "/assets/icons/together.svg", + "invert" => true, + "link" => "/-/together", + "stepped" => null + ], + [ + "name" => $pages["splitting"]["name"], + "icon" => "/assets/icons/splitting.svg", + "invert" => true, + "link" => "/-/splitting", + "stepped" => null + ], + [ + "name" => $pages["byfront"]["name"], + "icon" => "/assets/icons/byfront.svg", + "invert" => true, + "link" => "/-/byfront", + "stepped" => null + ], + [ + "name" => $pages["travelling"]["name"], + "icon" => "/assets/icons/travelling.svg", + "invert" => true, + "link" => "/-/travelling", + "stepped" => null + ], + [ + "name" => $pages["stats"]["name"], + "icon" => "/assets/icons/stats.svg", + "invert" => true, + "link" => "/-/stats", + "stepped" => null + ], + [ + "name" => $pages["toys"]["name"], + "icon" => "/assets/icons/toys.svg", + "invert" => true, + "link" => "/-/toys", + "stepped" => null + ] + ] + ], + "debug" => [ + "name" => "Debugging", + "minimal" => false, + "items" => [ + [ + "name" => $pages["debug"]["name"], + "icon" => "/assets/icons/debug.svg", + "invert" => true, + "link" => "/-/debug", + "stepped" => null + ], + [ + "name" => $pages["bitset"]["name"], + "icon" => "/assets/icons/bitset.svg", + "invert" => true, + "link" => "/-/bitset", + "stepped" => null + ], + [ + "name" => $pages["score"]["name"], + "icon" => "/assets/icons/score.svg", + "invert" => true, + "link" => "/-/score", + "stepped" => null + ], + [ + "name" => $pages["logout"]["name"], + "icon" => "/assets/icons/logout.svg", + "invert" => true, + "link" => "/-/logout", + "stepped" => null + ] + ] + ] + ] +]; +$navigation_global = [ + "admin" => false, + "name" => "Global", + "icon" => "/assets/icons/global.svg", + "invert" => true, + "items" => [ + "main" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => $pages["home"]["name"], + "icon" => "/assets/icons/home.svg", + "invert" => true, + "link" => "/", + "stepped" => null + ], + [ + "name" => $pages["disclaimers"]["name"], + "icon" => "/assets/icons/disclaimers.svg", + "invert" => true, + "link" => "/-/disclaimers", + "stepped" => null + ], + [ + "name" => $pages["relations"]["name"], + "icon" => "/assets/icons/relations.svg", + "invert" => true, + "link" => "/-/relations", + "stepped" => null + ], + [ + "name" => $pages["government"]["name"], + "icon" => "/assets/icons/government.svg", + "invert" => true, + "link" => "/-/government", + "stepped" => null + ], + [ + "name" => $pages["terminology"]["name"], + "icon" => "/assets/icons/terminology.svg", + "invert" => true, + "link" => "/-/terminology", + "stepped" => null + ] + ] + ], + "tools" => [ + "name" => "Tools", + "minimal" => false, + "items" => [ + [ + "name" => $pages["parser"]["name"], + "icon" => "/assets/icons/parser.svg", + "invert" => true, + "link" => "/-/parser", + "stepped" => null + ], + [ + "name" => $pages["prefix"]["name"], + "icon" => "/assets/icons/prefix.svg", + "invert" => true, + "link" => "/-/prefix", + "stepped" => null + ] + ] + ] + ] +]; +$navigation_cloudburst = [ + "admin" => false, + "name" => "Cloudburst System", + "icon" => getAsset("ynmuc"), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => "About us", + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/cloudburst", + "stepped" => null + ] + ] + ], + "subsystems" => [ + "name" => "Subsystems", + "minimal" => false, + "items" => array_map(function ($subsystem) { + $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc-" . $subsystem['source'] . ".json"), true); + + return [ + "name" => $ssData['name'] ?? $subsystem['source'], + "icon" => "/assets/uploads/ss-$subsystem[source].png", + "invert" => false, + "link" => "/cloudburst/-/subsystem/$subsystem[source]", + "stepped" => null + ]; + }, $cloudburst_subsystemsNotMember) + ], + "members" => [ + "name" => "Members", + "minimal" => false, + "items" => array_map(function ($member) { + return [ + "name" => $member['display_name'] ?? $member['name'], + "icon" => getAsset($member["system"], $member["id"], "heads"), + "invert" => false, + "link" => "/$member[name]", + "stepped" => null + ]; + }, array_filter(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true), "ynmuc"), "ynmuc"), function ($member) { + return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; + })) + ] + ] +]; +$navigation_raindrops = [ + "admin" => false, + "name" => "Raindrops System", + "icon" => getAsset("gdapd"), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => "About us", + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/raindrops", + "stepped" => null + ] + ] + ], + "subsystems" => [ + "name" => "Subsystems", + "minimal" => false, + "items" => array_map(function ($subsystem) { + $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd-" . $subsystem['source'] . ".json"), true); + + return [ + "name" => $ssData['name'] ?? $subsystem['source'], + "icon" => "/assets/uploads/ss-$subsystem[source].png", + "invert" => false, + "link" => "/raindrops/-/subsystem/$subsystem[source]", + "stepped" => null + ]; + }, $raindrops_subsystemsNotMember) + ], + "members" => [ + "name" => "Members", + "minimal" => false, + "items" => array_map(function ($member) { + return [ + "name" => $member['display_name'] ?? $member['name'], + "icon" => getAsset($member["system"], $member["id"], "heads"), + "invert" => false, + "link" => "/$member[name]", + "stepped" => null + ]; + }, array_filter(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd"), "gdapd"), function ($member) { + return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; + })) + ] + ] +]; + +global $parts; + +if (isset($parts) && isset($parts[0]) && $parts[0] === "cloudburst") { + $navigation = [ + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} elseif (isset($parts) && isset($parts[0]) && $parts[0] === "raindrops") { + $navigation = [ + "raindrops" => $navigation_raindrops, + "cloudburst" => $navigation_cloudburst, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} else { + $navigation = [ + "admin" => $navigation_admin, + "global" => $navigation_global, + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops + ]; +}
\ No newline at end of file diff --git a/includes/pages.json b/includes/pages.json index 704fcbb..cb05739 100644 --- a/includes/pages.json +++ b/includes/pages.json @@ -11,6 +11,12 @@ "admin": true, "rail": true }, + "alphabet": { + "name": "Members by prefix letters", + "short": null, + "admin": false, + "rail": false + }, "api": { "name": "API", "short": null, @@ -155,6 +161,30 @@ "admin": true, "rail": true }, + "s:compare": { + "name": "Compare members", + "short": null, + "admin": false, + "rail": false + }, + "s:history": { + "name": "Front history", + "short": null, + "admin": false, + "rail": false + }, + "s:species": { + "name": "Members by species", + "short": null, + "admin": false, + "rail": false + }, + "s:tree": { + "name": "System tree", + "short": null, + "admin": false, + "rail": false + }, "score": { "name": "Score system testing", "short": null, @@ -183,7 +213,7 @@ "name": "Watch Together", "short": "Together", "admin": true, - "rail": true + "rail": false }, "together-dev": { "name": "Watch Together (dev)", diff --git a/includes/pane.inc b/includes/pane.inc new file mode 100644 index 0000000..6aa7f98 --- /dev/null +++ b/includes/pane.inc @@ -0,0 +1,129 @@ +<?php global $isLoggedIn; global $isUserLoggedIn; global $pages; global $navigation; $byColor = getMembersByColor(); ?> + +<div id="pane-header-background" style="background-image: linear-gradient(90deg, <?php + +$index = 0; +$list = array_map(function ($i) { return $i["color"]; }, $byColor); +$length = count($list); + +foreach ($list as $color) { + $perc = ($index / $length) * 100; + echo("#${color}33 $perc%"); + + $index++; + if ($index < $length) echo(", "); +} + +?>)"> + <a href="/" id="pane-header" class="login-link-clickable" style="color: white; text-decoration: none; padding: 20px; display: block; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, .25);"> + <img src="/assets/logo/newlogo.png" alt="" style="width:32px;vertical-align: middle;margin-right:5px;"> + <span style="vertical-align: middle; font-weight: bold;">Cold Haze</span> + </a> +</div> + +<?php if ($isLoggedIn || $isUserLoggedIn): ?> + <a onclick="toggleGlobalSearch();" id="login-link" class="login-link-clickable"> + Search in the website... + </a> +<?php elseif (!$isLoggedIn && !$isUserLoggedIn): ?> + <a href="/-/login" id="login-link" class="login-link-clickable"> + <?php global $_PROFILE; ?> + <img alt="" src="/assets/icons/login.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Not logged in</span> + </a> +<?php endif; ?> + +<?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?> + +<div class="pane-group" id="pane-group-<?= $id ?>"> + <div class="pane-group-title"> + <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;"><?= $item["name"] ?></span> + </div> + + <?php foreach ($item["items"] as $category): ?> + <div class="pane-group-category <?= $category["minimal"] ? "pane-group-category-minimal" : "" ?>" <?= $category["minimal"] ? 'style="display: grid; grid-template-columns: repeat(' . count($category["items"]) . ', 1fr); grid-gap: 10px;"' : "" ?>> + <?php if (isset($category["name"])): ?> + <div class="pane-group-category-title"><?= $category["name"] ?></div> + <?php endif; ?> + <?php foreach ($category["items"] as $link): ?> + <a class="pane-group-item" href="<?= $link["link"] ?>"> + <img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px; border-radius: 5px; vertical-align: middle;"> + <?php if (!$category["minimal"]): ?><span style="vertical-align: middle;<?= isset($link["stepped"]) ? "color: $link[stepped];" : "" ?>"><?= isset($link["stepped"]) ? "<b>$link[name]</b>" : $link["name"] ?></span><?php endif; ?> + </a> + <?php endforeach; ?> + </div> + <?php endforeach; ?> +</div> + +<?php endif; endforeach; ?> + +<style> + + .pane-group-category-title { + margin-bottom: 5px; + font-size: .8em; + opacity: .75; + padding: 0 5px; + } + + .pane-group-category-minimal .pane-group-item { + text-align: center; + } + + .pane-group-item { + display: block; + color: white !important; + text-decoration: none; + } + + .pane-group-category { + background: rgba(255, 255, 255, .075); + border: 1px solid rgba(255, 255, 255, .1); + border-radius: 10px; + padding: 10px; + margin-top: 10px; + margin-bottom: 10px; + } + + .pane-group-item { + padding: 5px; + border-radius: 10px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + + .pane-group-item:hover { + background-color: rgba(255, 255, 255, .1); + } + + .pane-group-title { + opacity: .75; + padding: 0 15px; + margin-top: 10px; + } + + .pane-group { + padding: 10px; + border-bottom: 1px solid rgba(255, 255, 255, .25); + } + + #login-link { + text-align: center; + padding: 10px; + display: block; + border-bottom: 1px solid rgba(255, 255, 255, .25); + } + + .login-link-clickable { + color: white !important; + cursor: pointer !important; + text-decoration: none !important; + } + + .login-link-clickable:hover { + background-color: rgba(255, 255, 255, .1); + } + +</style>
\ No newline at end of file diff --git a/includes/planner.inc b/includes/planner.inc index da25770..69e0331 100644 --- a/includes/planner.inc +++ b/includes/planner.inc @@ -194,24 +194,12 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis <?php day("Yesterday", -1) ?> <?php day("Today", 0) ?> <?php day("Tomorrow", 1) ?> - <?php - - $factor = 1; - $lastDay = time() + 86400; - $lastDayWeek = date('W', $lastDay); - $tomorrowWeek = date('W', time() + 86400); - - while ($lastDayWeek === $tomorrowWeek) { - $factor++; - $lastDay = time() + (86400 * $factor); - $lastDayWeek = date('W', $lastDay); - - if ($lastDayWeek === $tomorrowWeek) { - day(null, $factor); - } - } - - ?> + <?php day(date('l', time() + 86400 * 2), 2) ?> + <?php day(date('l', time() + 86400 * 3), 3) ?> + <?php day(date('l', time() + 86400 * 4), 4) ?> + <?php day(date('l', time() + 86400 * 5), 5) ?> + <?php day(date('l', time() + 86400 * 6), 6) ?> + <?php day(date('l', time() + 86400 * 7), 7) ?> </tbody> </table> diff --git a/includes/rail.inc b/includes/rail.inc index b2ed467..e78815e 100644 --- a/includes/rail.inc +++ b/includes/rail.inc @@ -164,13 +164,4 @@ document.getElementById("rail").onmouseleave = () => { document.getElementById("rail-text").style.opacity = "0"; } - - window.onscroll = () => { - let scroll = document.getElementsByTagName("html")[0].scrollTop; - let pos = 60 - scroll; - - if (pos <= 0) pos = 0; - document.getElementById("rail").style.top = pos + "px"; - document.getElementById("rail-text").style.top = pos + "px"; - } </script>
\ No newline at end of file diff --git a/includes/refresh.php b/includes/refresh.php index e8e12dd..ff8d1eb 100644 --- a/includes/refresh.php +++ b/includes/refresh.php @@ -223,20 +223,6 @@ foreach (json_decode(file_get_contents("./data/ynmuc/members.json"), true) as $m $times["images-ynmuc-" . $member['id']] = microtime(true) - $currentOpStart2; } -$currentOpStart = microtime(true); -function isJson($string): bool { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); -} - -foreach ($files as $file) { - if (trim(file_get_contents("./data/" . $file)) === "" || (isJson(trim(file_get_contents("./data/" . $file))) && isset(json_decode(trim(file_get_contents("./data/" . $file)), true)["message"])) && !str_ends_with($file, ".html")) { - $restored[] = $file; - copy("./data/backup/" . $file, "./data/" . $file); - } -} -$times["restore"] = microtime(true) - $currentOpStart; - echo("Backing up...\n"); if (date('i') === "00") { diff --git a/includes/restore.inc b/includes/restore.php index 72748ab..72748ab 100644 --- a/includes/restore.inc +++ b/includes/restore.php diff --git a/includes/score.inc b/includes/score.inc index c35e9bc..80a90d1 100644 --- a/includes/score.inc +++ b/includes/score.inc @@ -15,8 +15,8 @@ function calculateScore($metadata, $name) { $scoreAdd = 0; if ($name === "Cloudy Dreams") $scoreAdd += 250; - if ($name === "Zoom Zephyrwing") $scoreAdd += 250; - if ($name === "Thunder") $scoreAdd += 250; + if ($name === "Zoom Zephyrwing") $scoreAdd += 2500; + if ($name === "Thunder") $scoreAdd += 2500; if ($name === "Scoots/Mia") $scoreAdd -= 495; $score = $scoreHost + $scoreFictive + $scoreLittle + $scoreNotTalking + $scoreProtector + $scoreSharedMemory + $scoreRelations + $scoreSpecies + $scoreName + $scoreMedian + $scoreAdd; @@ -43,6 +43,7 @@ function scoreOrder($members, $system) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json")) { $systemID = $member["system"] ?? $system; + $member["_system"] = $member["system"] = $systemID; $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)), $member["display_name"] ?? $member["name"]); $ordered[] = $member; diff --git a/includes/search.inc b/includes/search.inc index d8e573f..f240363 100644 --- a/includes/search.inc +++ b/includes/search.inc @@ -1,7 +1,7 @@ -<div id="global-search-container" style="display: none; position: fixed; z-index: 99999999;background-color: rgba(0, 0, 0, .75); inset: 0; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); align-items: center; justify-content: center;"> - <div id="global-search-box" style="background: rgba(50, 50, 50, .5); color: white; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); border-radius: 15px; width: 768px; max-width: 90vw;"> +<div id="global-search-container" style="display: none; position: fixed; z-index: 99999999;background-color: rgba(0, 0, 0, .75); inset: 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); align-items: center; justify-content: center;"> + <div id="global-search-box" style="background: rgba(50, 50, 50, .5); color: white; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 15px; width: 768px; max-width: 90vw;"> <div id="global-search-input-container" onclick="document.getElementById('global-search-input').focus();" style="cursor:text;padding: 10px 50px; font-size: 22px; border: 1px solid rgba(100, 100, 100, .5); border-top-left-radius: 15px; border-top-right-radius: 15px; width: 768px; max-width: 90vw;"> - <span onchange="globalSearchPlaceholder(); globalSearch();" onkeyup="globalSearchPlaceholder(); globalSearch();" onkeydown="globalSearchPlaceholder(); globalSearch();" type="text" id="global-search-input" style="display:inline-block; background: transparent; color: white; border: none;" spellcheck="false" contenteditable="true"></span><span id="global-search-placeholder" style="opacity:.5;">Website Search</span><span id="global-search-autocomplete" style="opacity:.5;"></span><span id="global-search-action" style="opacity:.5;font-size:16px;"></span> + <span onchange="globalSearchPlaceholder(); globalSearch();" onkeyup="globalSearchPlaceholder(); globalSearch();" onkeydown="globalSearchPlaceholder(); globalSearch();" type="text" id="global-search-input" style="vertical-align: middle; display:inline-block; background: transparent; color: white; border: none;" spellcheck="false" contenteditable="true"></span><span id="global-search-placeholder" style="opacity:.5;">Website Search</span><span id="global-search-autocomplete" style="vertical-align: middle; opacity:.5;"></span><span id="global-search-action" style="vertical-align: middle; opacity:.5;font-size:16px;"></span> </div> <div id="global-search-results" style="border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; border-top-style: none; border-right: 1px solid rgba(100, 100, 100, .5); border-bottom: 1px solid rgba(100, 100, 100, .5); border-left: 1px solid rgba(100, 100, 100, .5); width: 768px; max-width: 90vw; height: 400px; max-height: calc(90vh - 60px);"> <div id="global-search-intro" style="display: flex; align-items: center; justify-content: center; height: 100%; text-align: center;"> @@ -22,7 +22,7 @@ const pages_list = JSON.parse(atob(`<?php $base = array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/pages"), function ($i) { - return !str_starts_with($i, ".") && $i !== "page.inc" && $i !== "api.inc" && $i !== "demo.inc" && $i !== "logout.inc" && $i !== "edit.inc" && $i !== "edit-private.inc" && $i !== "app.inc" && !str_ends_with($i, ".bak.php") && !str_ends_with($i, ".old.php") && !str_ends_with($i, "-dev.php"); + return !str_starts_with($i, ".") && $i !== "page.inc" && $i !== "api.inc" && $i !== "demo.inc" && $i !== "logout.inc" && $i !== "edit.inc" && $i !== "edit-private.inc" && $i !== "app.inc" && !str_ends_with($i, ".bak.php") && !str_ends_with($i, ".old.php") && !str_ends_with($i, "-dev.php") && !str_ends_with($i, ".bak.inc") && !str_ends_with($i, ".old.inc") && !str_ends_with($i, "-dev.inc"); })); $list = array_values(array_filter(array_map(function ($i) { global $pages; @@ -468,7 +468,7 @@ window.shiftPresses++; } - if ((event.code === "Space" && event.ctrlKey) || window.shiftPresses === 2) { + if ((event.code === "Space" && event.ctrlKey) || window.shiftPresses === 2 && document.getElementsByClassName("ck-focused").length === 0) { toggleGlobalSearch(); } } diff --git a/includes/short.inc b/includes/short.inc index 66d749d..6883cc7 100644 --- a/includes/short.inc +++ b/includes/short.inc @@ -39,7 +39,7 @@ foreach ($members as $member) { $list[$member["uuid"]] = "/" . $member["name"]; } -$list["minty"] = "/cloudy"; +$list["minty"] = "/cloudydreams"; if (in_array($toplevel, array_keys($list)) && $list[$toplevel]) { if ($toplevel !== "unknown") { diff --git a/includes/sysbanner.inc b/includes/sysbanner.inc index d3caecd..e1789f7 100644 --- a/includes/sysbanner.inc +++ b/includes/sysbanner.inc @@ -8,10 +8,11 @@ global $systemID; global $system; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); +$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); ?> -<div id="system-info" style="background:rgba(255, 255, 255, .1);border-radius:10px;display:grid;grid-template-columns: 128px 1fr;"> +<div id="system-info" style="display:grid;grid-template-columns: 128px 1fr;background-color:rgba(255, 255, 255, .05);margin-left: -20px; margin-right: -20px;margin-top:-20px;padding: 20px 20px 10px;"> <img src="/assets/uploads/<?= $system ?>.png" alt="" style="height:128px;border-top-left-radius:10px;border-bottom-left-radius:10px;"> <div style="padding:10px 10px 10px 20px;text-align:center;"> <div style="display: grid; grid-template-columns: 1fr;height:100%;grid-template-rows: max-content max-content 1fr;"> @@ -47,11 +48,9 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ <?php if (isset($fronters["members"][0])): ?> <?php $member = $fronters["members"][0]; ?> <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member["name"])) ?></a> - <?php if (isset($fronters["members"][1])): ?> - <?php $member2 = $fronters["members"][1]; ?> + <?php if (count($fronters["members"]) > 1): ?> <br>(with - <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a>) - <?php endif; ?> + <?php if (isset($fronters["members"][1])): ?><?php $member2 = $fronters["members"][1]; ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][2])): ?><?php $member2 = $fronters["members"][2]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][3])): ?><?php $member2 = $fronters["members"][3]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?>)<?php endif; ?> <?php else: ?>-<?php endif; ?> </span> <span> @@ -73,18 +72,8 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ ?> <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member["name"])) ?></a> - <?php if (isset($previous[1])): - $previousID = $previous[1]; - $member2 = null; - - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true) as $members) { - if ($members["id"] === $previousID) { - $member2 = $members; - break; - } - } ?> - <br>(with - <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a>) + <?php if (count($previous) > 1): ?> + <br>(with <?php if (isset($previous[1])): ?><?php $member2 = getMemberWithoutSystem($previous[1]); ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[2])): ?><?php $member2 = getMemberWithoutSystem($previous[2]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[3])): ?><?php $member2 = getMemberWithoutSystem($previous[3]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?>) <?php endif; ?> <?php else: ?>-<?php endif; ?> </span> @@ -112,21 +101,21 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ </div> </div> -<div id="system-actions" style="margin-top:10px;padding:5px 10px;background:rgba(255, 255, 255, .1);border-radius:10px;display:grid;grid-template-columns: 1fr 1fr 1fr 1fr;"> - <a title="Front history" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/history"> +<div id="system-actions" style="padding:5px 30px;display:grid;grid-template-columns: 1fr 1fr 1fr 1fr;background-color:rgba(255, 255, 255, .025);margin-left: -20px; margin-right: -20px;"> + <a title="Front history" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/history"> <img src="/assets/icons/history.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop">Front history</span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:history"]["name"] ?></span> </a> - <a title="Compare members" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/compare"> + <a title="Compare members" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/compare"> <img src="/assets/icons/compare.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop">Compare members</span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:compare"]["name"] ?></span> </a> - <a title="System tree" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/tree"> + <a title="System tree" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/tree"> <img src="/assets/icons/tree.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop">System tree</span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:tree"]["name"] ?></span> </a> - <a title="Members by species" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/species"> + <a title="Members by species" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/species"> <img src="/assets/icons/species.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop">Members by species</span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:species"]["name"] ?></span> </a> </div>
\ No newline at end of file diff --git a/includes/system.inc b/includes/system.inc index 099f522..ae6477c 100644 --- a/includes/system.inc +++ b/includes/system.inc @@ -2,18 +2,47 @@ ?> +<div id="system-banner-container" style="width: 100%;height: 65vh;position: fixed;background-image: url('/assets/uploads/banner-<?= $system ?>.jpg');background-size: cover;background-position: center; top: 0;"> + <div id="system-banner-inner" style="height: 100%;width: 100%;background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%);"></div> +</div> + +<script> + window.onscroll = () => { + document.getElementById("system-banner-container").style.height = (65 - ((window.scrollY / window.screen.availHeight) * 100)) + "vh"; + } +</script> + <br> <div class="container"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/sysbanner.inc"; ?> - <br> - - <div id="page-content"> - <?php global $isLoggedIn; if ($isLoggedIn): ?> - <small style="opacity:.5;display:block;">(<a href="/-/edit/<?= $system ?>">edit</a>)</small> - <?php endif; ?> - <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/content.html") ?> + + <div id="system-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:30vh;"> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/sysbanner.inc"; ?> + <br> + + <div id="page-content"> + <?php global $isLoggedIn; if ($isLoggedIn): ?> + <small style="opacity:.5;display:block;">(<a href="/-/edit/<?= $system ?>">edit</a>)</small> + <?php endif; ?> + <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/content.html") ?> + </div> + <?php if ($system === "cloudburst") cloudburst(true); else raindrops(true); ?> </div> - <?php if ($system === "cloudburst") cloudburst(true); else raindrops(true); ?> </div> +<style> + #hpd-cloudburst, #hpd-raindrops { + background: transparent !important; + padding: 0 !important; + margin-bottom: 0 !important; + } + + @media (max-width: 767px) { + #system-info > img { + display: block; + margin-left: auto; + margin-right: auto; + } + } +</style> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/compare.inc b/includes/system/compare.inc index de777aa..d2023e4 100644 --- a/includes/system/compare.inc +++ b/includes/system/compare.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "Compare members · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; +<?php global $system; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:compare"]["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); diff --git a/includes/system/history.inc b/includes/system/history.inc index ee687d7..31a7c73 100644 --- a/includes/system/history.inc +++ b/includes/system/history.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $systemCommonName; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:history"]["name"] . " · " . $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; function getMember(string $id) { global $systemID; @@ -75,17 +75,6 @@ function getMember(string $id) { } } - $switches1 = getSwitchesForDay(0); - $switches2 = getSwitchesForDay(1); - $switches3 = getSwitchesForDay(2); - $switches4 = getSwitchesForDay(3); - $switches5 = getSwitchesForDay(4); - $switches6 = getSwitchesForDay(5); - $switches7 = getSwitchesForDay(6); - $switches8 = getSwitchesForDay(7); - $switches9 = getSwitchesForDay(8); - $switches10 = getSwitchesForDay(9); - ?> <h2>Front history in the <?= $systemCommonName ?></h2> <div class="alert alert-warning" id="timezone" style="display: none;"> @@ -95,430 +84,50 @@ function getMember(string $id) { document.getElementById("timezone-name").innerText = new Date().toTimeString().split("(")[1].split(")")[0]; </script> </div> - <h4>Today</h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches1); - - $fronters[] = [ - "member" => isset($switches2[0]) ? (isset($switches2[0]["members"]) && isset($switches2[0]["members"][0]) ? $switches2[0]["members"][0] : null) : (isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][0]) ? $switches3[0]["members"][0] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][0]) ? $switches4[0]["members"][0] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]))))))), - "member2" => isset($switches2[0]) ? (isset($switches2[0]["members"]) && isset($switches2[0]["members"][1]) ? $switches2[0]["members"][1] : null) : (isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][1]) ? $switches3[0]["members"][1] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][1]) ? $switches4[0]["members"][1] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]))))))), - "date" => strtotime(isset($switches2[0]) ? $switches2[0]["timestamp"] : (isset($switches3[0]) ? $switches3[0]["timestamp"] : (isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))))) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + <?php foreach ([ + [ "Today", 0 ], + [ "Yesterday", 1 ], + [ date('D j M', time() - (86400 * 2)), 2 ], + [ date('D j M', time() - (86400 * 3)), 3 ], + [ date('D j M', time() - (86400 * 4)), 4 ], + [ date('D j M', time() - (86400 * 5)), 5 ], + [ date('D j M', time() - (86400 * 6)), 6 ], + [ date('D j M', time() - (86400 * 7)), 7 ], + [ date('D j M', time() - (86400 * 8)), 8 ], + [ date('D j M', time() - (86400 * 9)), 9 ], + ] as $day): + $switchesDay = getSwitchesForDay($day[1]); + $switchesDay[] = getSwitchBefore($switchesDay[count($switchesDay) - 1]["id"]); ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 0) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 0) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <h4 style="margin-top:15px;"><?= $day[0] ?></h4> + <?php foreach ($switchesDay as $switch): $switch["timestamp"] = strtotime($switch["timestamp"]); ?> + <?php if (isset($switch["members"][0])): $member = getMemberWithoutSystem($switch["members"][0]); ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($switch["timestamp"], $day[1]) ? strtotime(date('Y-m-d', $switch["timestamp"])) : $switch["timestamp"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= 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="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (count($switch["members"]) > 1): ?> + (with + <?php if (isset($switch["members"][1])): $member2 = getMember($switch["members"][1]); ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?><?php if (isset($switch["members"][2])): $member2 = getMember($switch["members"][2]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?><?php if (isset($switch["members"][3])): $member2 = getMember($switch["members"][3]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($switch["timestamp"], $day[1]) ? strtotime(date('Y-m-d', $switch["timestamp"])) : $switch["timestamp"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($switch["timestamp"], $day[1]) ? "00:00" : date('H:i', $switch["timestamp"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 0) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 0) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;">Yesterday</h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches2); - - $fronters[] = [ - "member" => isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][0]) ? $switches3[0]["members"][0] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][0]) ? $switches4[0]["members"][0] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0])))))), - "member2" => isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][1]) ? $switches3[0]["members"][1] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][1]) ? $switches4[0]["members"][1] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1])))))), - "date" => strtotime(isset($switches3[0]) ? $switches3[0]["timestamp"] : (isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))))) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 1) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 1) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 1) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 1) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 2)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches3); - - $fronters[] = [ - "member" => isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][0]) ? $switches4[0]["members"][0] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]))))), - "member2" => isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][1]) ? $switches4[0]["members"][1] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]))))), - "date" => strtotime(isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 2) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 2) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 2) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 2) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 3)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches4); - - $fronters[] = [ - "member" => isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0])))), - "member2" => isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1])))), - "date" => strtotime(isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 3) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 3) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 3) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 3) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 4)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches5); - - $fronters[] = [ - "member" => isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]))), - "member2" => isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]))), - "date" => strtotime(isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 4) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 4) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 4) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 4) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 5)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches6); - - $fronters[] = [ - "member" => isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0])), - "member2" => isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1])), - "date" => strtotime(isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 5) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 5) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 5) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 5) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 6)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches7); - - $fronters[] = [ - "member" => isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]), - "member2" => isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]), - "date" => strtotime(isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 6) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 6) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 6) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 6) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 7)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches8); - - $fronters[] = [ - "member" => isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0], - "member2" => isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1], - "date" => strtotime(isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 8)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches9); - - $fronters[] = [ - "member" => isset($switches10[0]) ? $switches10[0]["members"][0] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][0], - "member2" => isset($switches10[0]) && isset($switches10[0]["members"]) && isset($switches10[0]["members"][1]) ? $switches10[0]["members"][1] : (isset(getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1]) ? getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1] : null), - "date" => strtotime(isset($switches10[0]) ? $switches10[0]["timestamp"] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["timestamp"]) - ]; - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 8) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 8) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> - <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 9)) ?></h4> - <?php - - $fronters = array_map(function ($i) { - return [ - "member" => $i["members"][0] ?? null, - "member2" => $i["members"][1] ?? null, - "date" => strtotime($i["timestamp"]) - ]; - }, $switches10); - - foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); - ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 9) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 9) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> - (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) - <?php endif; ?> - </span> - </div> - <?php else: ?> - <div class="fronter"> - <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> - <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> - </span> - <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> - </span> - </div> - <?php endif; endforeach; ?> + <?php endforeach; ?> + <?php endforeach; ?> </div> <script> Array.from(document.getElementsByClassName("fronter-date")).forEach((i) => { i.innerText = new Date(parseInt(i.getAttribute("data-date-time").trim()) * 1000).toTimeString().split(" ")[0].substring(0, 5) + " " }); diff --git a/includes/system/history.old.inc b/includes/system/history.old.inc new file mode 100644 index 0000000..ee687d7 --- /dev/null +++ b/includes/system/history.old.inc @@ -0,0 +1,528 @@ +<?php global $system; global $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; + +function getMember(string $id) { + global $systemID; + + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); + $member = null; + + foreach ($members as $m) { + if ($m["id"] === $id) $member = $m; + } + + return $member; +} + +?> + + <br> + <div class="container" id="page-content"> + <?php + + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/switches.json"), true); + uksort($switches, function ($a, $b) { + if (isset($b["timestamp"]) && isset($a["timestamp"])) { + return strtotime($b["timestamp"]) - strtotime($a["timestamp"]); + } else { + return null; + } + }); + + function getSwitchesForDay(int $day) { + global $switches; + + $filtered = array_values(array_filter($switches, function ($i) use ($day) { + $diff = strtotime(date("Y-m-d")) - strtotime(explode("T", $i["timestamp"])[0]); + return $diff <= (86400 * $day) && $diff > (86400 * ($day - 1)); + })); + + uksort($filtered, function ($a, $b) { + if (isset($b["timestamp"]) && isset($a["timestamp"])) { + return strtotime($b["timestamp"]) - strtotime($a["timestamp"]); + } else { + return null; + } + }); + + return $filtered; + } + + function getSwitchBefore(string $id) { + global $switches; + + $currentPassed = false; + $before = null; + + foreach ($switches as $switch) { + if ($currentPassed) { + $before = $switch; + break; + } else { + if ($switch["id"] === $id) { + $currentPassed = true; + } + } + } + + return $before; + } + + function isNotToday(int $timestamp, int $offset) { + if (date('Y-m-d', $timestamp) !== date('Y-m-d', time() - (86400 * $offset))) { + return true; + } else { + return false; + } + } + + $switches1 = getSwitchesForDay(0); + $switches2 = getSwitchesForDay(1); + $switches3 = getSwitchesForDay(2); + $switches4 = getSwitchesForDay(3); + $switches5 = getSwitchesForDay(4); + $switches6 = getSwitchesForDay(5); + $switches7 = getSwitchesForDay(6); + $switches8 = getSwitchesForDay(7); + $switches9 = getSwitchesForDay(8); + $switches10 = getSwitchesForDay(9); + + ?> + <h2>Front history in the <?= $systemCommonName ?></h2> + <div class="alert alert-warning" id="timezone" style="display: none;"> + Times on this page are now shown using your local timezone (<span id="timezone-name">-</span>). Days start at <span id="day-start">-</span> (00:00 on UTC). + <script> + document.getElementById("day-start").innerText = new Date(<?= strtotime(date('Y-m-d')) ?> * 1000).toTimeString().substring(0, 5); + document.getElementById("timezone-name").innerText = new Date().toTimeString().split("(")[1].split(")")[0]; + </script> + </div> + <h4>Today</h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches1); + + $fronters[] = [ + "member" => isset($switches2[0]) ? (isset($switches2[0]["members"]) && isset($switches2[0]["members"][0]) ? $switches2[0]["members"][0] : null) : (isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][0]) ? $switches3[0]["members"][0] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][0]) ? $switches4[0]["members"][0] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]))))))), + "member2" => isset($switches2[0]) ? (isset($switches2[0]["members"]) && isset($switches2[0]["members"][1]) ? $switches2[0]["members"][1] : null) : (isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][1]) ? $switches3[0]["members"][1] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][1]) ? $switches4[0]["members"][1] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]))))))), + "date" => strtotime(isset($switches2[0]) ? $switches2[0]["timestamp"] : (isset($switches3[0]) ? $switches3[0]["timestamp"] : (isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))))) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 0) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 0) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 0) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 0) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;">Yesterday</h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches2); + + $fronters[] = [ + "member" => isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][0]) ? $switches3[0]["members"][0] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][0]) ? $switches4[0]["members"][0] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0])))))), + "member2" => isset($switches3[0]) ? (isset($switches3[0]["members"]) && isset($switches3[0]["members"][1]) ? $switches3[0]["members"][1] : null) : (isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][1]) ? $switches4[0]["members"][1] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1])))))), + "date" => strtotime(isset($switches3[0]) ? $switches3[0]["timestamp"] : (isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))))) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 1) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 1) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 1) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 1) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 2)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches3); + + $fronters[] = [ + "member" => isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][0]) ? $switches4[0]["members"][0] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]))))), + "member2" => isset($switches4[0]) ? (isset($switches4[0]["members"]) && isset($switches4[0]["members"][1]) ? $switches4[0]["members"][1] : null) : (isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]))))), + "date" => strtotime(isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 2) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 2) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 2) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 2) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 3)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches4); + + $fronters[] = [ + "member" => isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][0]) ? $switches5[0]["members"][0] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0])))), + "member2" => isset($switches5[0]) ? (isset($switches5[0]["members"]) && isset($switches5[0]["members"][1]) ? $switches5[0]["members"][1] : null) : (isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1])))), + "date" => strtotime(isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 3) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 3) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 3) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 3) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 4)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches5); + + $fronters[] = [ + "member" => isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][0]) ? $switches6[0]["members"][0] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]))), + "member2" => isset($switches6[0]) ? (isset($switches6[0]["members"]) && isset($switches6[0]["members"][1]) ? $switches6[0]["members"][1] : null) : (isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]))), + "date" => strtotime(isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 4) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 4) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 4) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 4) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 5)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches6); + + $fronters[] = [ + "member" => isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][0]) ? $switches7[0]["members"][0] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0])), + "member2" => isset($switches7[0]) ? (isset($switches7[0]["members"]) && isset($switches7[0]["members"][1]) ? $switches7[0]["members"][1] : null) : (isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1])), + "date" => strtotime(isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 5) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 5) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 5) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 5) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 6)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches7); + + $fronters[] = [ + "member" => isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]), + "member2" => isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]), + "date" => strtotime(isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 6) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 6) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 6) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 6) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 7)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches8); + + $fronters[] = [ + "member" => isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0], + "member2" => isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1], + "date" => strtotime(isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 8)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches9); + + $fronters[] = [ + "member" => isset($switches10[0]) ? $switches10[0]["members"][0] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][0], + "member2" => isset($switches10[0]) && isset($switches10[0]["members"]) && isset($switches10[0]["members"][1]) ? $switches10[0]["members"][1] : (isset(getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1]) ? getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1] : null), + "date" => strtotime(isset($switches10[0]) ? $switches10[0]["timestamp"] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["timestamp"]) + ]; + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 8) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 8) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 9)) ?></h4> + <?php + + $fronters = array_map(function ($i) { + return [ + "member" => $i["members"][0] ?? null, + "member2" => $i["members"][1] ?? null, + "date" => strtotime($i["timestamp"]) + ]; + }, $switches10); + + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); + ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 9) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 9) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <a class="member-link" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> + (with <a class="member-link" href="/<?= $member2["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <?php endif; ?> + </span> + </div> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> + <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?> + </span> + <span class="fronter-profile" style="vertical-align: middle;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> + </div> + <script> + Array.from(document.getElementsByClassName("fronter-date")).forEach((i) => { i.innerText = new Date(parseInt(i.getAttribute("data-date-time").trim()) * 1000).toTimeString().split(" ")[0].substring(0, 5) + " " }); + document.getElementById("timezone").style.display = ""; + </script> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/species.inc b/includes/system/species.inc index bd37d7b..cca1eb8 100644 --- a/includes/system/species.inc +++ b/includes/system/species.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "Members by species · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; +<?php global $system; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); $members = scoreOrder($members, $systemID); diff --git a/includes/system/tree.inc b/includes/system/tree.inc index c3cc5c4..92e7c08 100644 --- a/includes/system/tree.inc +++ b/includes/system/tree.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "System tree · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:tree"]["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); $members = scoreOrder($members, $systemID); diff --git a/includes/titlebar.inc b/includes/titlebar.inc new file mode 100644 index 0000000..de58549 --- /dev/null +++ b/includes/titlebar.inc @@ -0,0 +1,182 @@ +<?php global $toplevel; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); ?> +<span> + <?php + +$parts = explode("/", $_GET['_']); +$name = $toplevel === "" ? "home" : $toplevel; + +$actionsProfile = "default"; +$part1 = "<page>"; +$part2 = null; +$part3 = null; + +if (isset($pages[$name])) { + if (($name === "docs" || $name === "toys" || $name === "actions") && isset($parts[2])) { + $part3 = "<a class='title-bar-backlink' href='/-/dashboard'>Dashboard</a>"; + $part2 = "<a class='title-bar-backlink' href='/-/$name'>" . $pages[$name]['name'] . "</a>"; + + if ($name === "docs") { + $actionsProfile = "docs-item"; + $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $parts[2] . ".json"), true)["name"]; + } else { + $actionsProfile = "$name-item"; + $list = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($name === "toys" ? "toys/toys" : "actions/actions") . ".json"), true); + $part1 = array_values(array_filter($list, function ($i) use ($parts) { + return $i["id"] === $parts[2]; + }))[0]["name"]; + } + } else { + if ($pages[$name]["admin"]) { + $part1 = $pages[$name]['name']; + $part2 = "<a class='title-bar-backlink' href='/-/dashboard'>Dashboard</a>"; + } else { + $part1 = $pages[$name]['name']; + } + } +} elseif ($name === "cloudburst") { + if (isset($parts[2])) { + $part2 = "<a class='title-bar-backlink' href='/cloudburst'>Cloudburst System</a>"; + + if ($parts[2] === "subsystem") { + $actionsProfile = "subsystem"; + $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc-$parts[3].json"), true)["name"]; + } else { + $part1 = $pages["s:" . $parts[2]]['name'] ?? $parts[2]; + } + } else { + $actionsProfile = "system"; + $part1 = "Cloudburst System"; + } +} elseif ($name === "raindrops") { + if (isset($parts[2])) { + $part2 = "<a class='title-bar-backlink' href='/raindrops'>Raindrops System</a>"; + + if ($parts[2] === "subsystem") { + $actionsProfile = "subsystem"; + $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd-$parts[3].json"), true)["name"]; + } else { + $part1 = $pages["s:" . $parts[2]]['name'] ?? $parts[2]; + } + } else { + $actionsProfile = "system"; + $part1 = "Raindrops System"; + } +} else { + $member = getMemberFromName($name); + $actionsProfile = "member"; + + if (isset($member)) { + $memberName = $member["display_name"] ?? $member["name"]; + $part1 = "$memberName"; + + if ($member["_system"] === "gdapd") { + $part2 = "<a class='title-bar-backlink' href='/raindrops'>Raindrops System</a>"; + } else { + $part2 = "<a class='title-bar-backlink' href='/cloudburst'>Cloudburst System</a>"; + } + } else { + $part1 = "$name"; + } +} + +if ($actionsProfile === "default") { + switch ($name) { + case "home": + $actionsProfile = "home"; + break; + + case "emergency": + case "wakeup": + case "pleasure": + $actionsProfile = "alert"; + break; + + case "fronting": + $actionsProfile = "planner"; + break; + + case "actions": + case "toys": + $actionsProfile = "actions-or-toys"; + break; + + case "docs": + $actionsProfile = "docs"; + break; + + case "debug": + $actionsProfile = "debug"; + break; + + case "bitset": + $actionsProfile = "bitset"; + break; + + case "parser": + case "prefix": + $actionsProfile = "parser-prefix"; + break; + } +} + +if (isset($part3)) { + echo "$part3 > $part2 > <b>$part1</b>"; +} elseif (isset($part2)) { + echo "$part2 > <b>$part1</b>"; +} else { + echo "<b>$part1</b>"; +} + +$links = [ + "default" => [ + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ] +]; + +$linksList = $links[isset($links[$actionsProfile]) ? $actionsProfile : "default"]; + +?> (<code><?= $actionsProfile ?></code>)<!--<pre><?php var_dump($parts); ?></pre>--> + <span id="title-bar-actions"> + <?php foreach ($linksList as $index => $link): ?> + <a style="display: inline-block; padding: 4px;" id="title-bar-action-<?= $index ?>" <?php if ($link["link"]["type"] === "url"): ?>href<?php else: ?>onclick<?php endif; ?>="<?= $link["link"]["text"] ?>" title="<?= $link["name"] ?>" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"> + <img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"> + </a> + <?php endforeach; ?> + </span> +</span> + +<style> + .title-bar-backlink { + color: white !important; + text-decoration: none; + } + + .title-bar-backlink:hover { + opacity: .75; + } + + #title-bar-actions { + position: fixed; + right: 0; + height: 34px; + top: 0; + display: block; + border-left: 1px solid rgba(255, 255, 255, .25); + } + + .title-bar-action { + cursor: pointer; + } + + .title-bar-action:hover { + background-color: rgba(255, 255, 255, .1); + } +</style>
\ No newline at end of file diff --git a/includes/travelling.inc b/includes/travelling.inc index edcb267..b0b58f0 100644 --- a/includes/travelling.inc +++ b/includes/travelling.inc @@ -22,6 +22,8 @@ foreach ($members as $member) { "travelling" => false, "history" => [] ]; + + @file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); } } @@ -42,6 +44,4 @@ function withTravelers(array $members, string $system): array { return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling']; }) ]; -} - -@file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT)));
\ No newline at end of file +}
\ No newline at end of file |