summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-06-25 20:10:39 +0200
committerRaindropsSys <contact@minteck.org>2023-06-25 20:10:39 +0200
commit5adf2b8517c21845dd0b406dee910514ff78640d (patch)
tree433c26dd202a8e201cef5b2ea7786e038ffd84d7
parent395cc068abf1aadb34be8b03e5567e24aa8a898d (diff)
downloadpluralconnect-5adf2b8517c21845dd0b406dee910514ff78640d.tar.gz
pluralconnect-5adf2b8517c21845dd0b406dee910514ff78640d.tar.bz2
pluralconnect-5adf2b8517c21845dd0b406dee910514ff78640d.zip
Updated 6 files and added 2 files (automated)
-rw-r--r--.idea/deployment.xml6
-rw-r--r--app.php4
-rw-r--r--includes/components/sysbanner.inc88
-rw-r--r--includes/components/timeline.inc112
-rw-r--r--includes/system/history.inc28
-rw-r--r--includes/util/functions.inc2
-rw-r--r--pages/api/timeline.php12
-rw-r--r--pages/home.inc23
8 files changed, 202 insertions, 73 deletions
diff --git a/.idea/deployment.xml b/.idea/deployment.xml
index a20124a..05a71fc 100644
--- a/.idea/deployment.xml
+++ b/.idea/deployment.xml
@@ -7,12 +7,6 @@
<mappings>
<mapping deploy="/opt/peh" local="$PROJECT_DIR$" web="/" />
</mappings>
- <excludedPaths>
- <excludedPath local="true" path="$PROJECT_DIR$/_archive" />
- <excludedPath path="/opt/peh/includes/tokens" />
- <excludedPath path="/opt/peh/includes/lowertokens" />
- <excludedPath local="true" path="$PROJECT_DIR$/Icon&#13;" />
- </excludedPaths>
</serverdata>
</paths>
</serverData>
diff --git a/app.php b/app.php
index 2568d06..eb35cd2 100644
--- a/app.php
+++ b/app.php
@@ -2,8 +2,8 @@
ob_start();
-//if (false) {
-if (!str_starts_with($_SERVER['REQUEST_URI'], "/api")) {
+if (false) {
+//if (!str_starts_with($_SERVER['REQUEST_URI'], "/api")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/error.php";
set_error_handler("ch_error");
}
diff --git a/includes/components/sysbanner.inc b/includes/components/sysbanner.inc
index a650cd0..26a049e 100644
--- a/includes/components/sysbanner.inc
+++ b/includes/components/sysbanner.inc
@@ -13,49 +13,12 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa
?>
-<div id="system-info" style="display:grid;grid-template-columns: 128px 1fr;background-color:rgba(255, 255, 255, .05);margin-left: -20px; margin-right: -20px;margin-top:-20px;padding: 20px 20px 10px;">
- <div style="display: flex; align-items: center; justify-content: center;">
- <img src="<?= getAsset($systemID) ?>" alt="" style="width:128px;max-height:128px;border-radius:10px;">
- </div>
+<div id="system-info" style="background-color:rgba(255, 255, 255, .05);margin-left: -20px; margin-right: -20px;margin-top:-20px;padding: 0 20px 10px; <?php if ($systemID === $app["other"]["id"]): ?>padding-top: 15px;<?php endif; ?>">
<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;">
+ <div>
+ <img src="<?= getAsset($systemID) ?>" alt="" style="margin-right: auto; margin-left: auto; display: block; width:128px;max-height:128px;border-radius:10px;">
<h3 style="height:max-content;"><?= $systemCommonName ?></h3>
- <div style="height:max-content;display:grid;grid-template-columns: repeat(4, 1fr);" id="member-card">
- <span>
- <?php $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true); ?>
- <b><?= $lang["system"]["fronter"] ?> </b>
- <?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>" . $lang["system"]["more"] . "</peh-muted>" : $member["name"])) ?></a>
- <?php if (count($fronters["members"]) > 1): ?>
- <br>and
- <?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>" . $lang["system"]["more"] . "</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>" . $lang["system"]["more"] . "</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>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php endif; ?>
- <?php else: ?>-<?php endif; ?>
- </span>
- <span>
- <b><?= $lang["system"]["last"] ?> </b>
- <?php
-
- $previous = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/switches.json"), true)[1]["members"];
-
- if (isset($previous[0])):
- $previousID = $previous[0];
- $member = null;
-
- foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true) as $members) {
- if ($members["id"] === $previousID) {
- $member = $members;
- break;
- }
- }
-
- ?>
- <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>" . $lang["system"]["more"] . "</peh-muted>" : $member["name"])) ?></a>
- <?php if (count($previous) > 1): ?>
- <br>and <?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>" . $lang["system"]["more"] . "</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>" . $lang["system"]["more"] . "</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>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?>
- <?php endif; ?>
- <?php else: ?>-<?php endif; ?>
- </span>
+ <div style="height:max-content;" id="member-card">
<span>
<?php
@@ -68,27 +31,50 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa
}
?>
- <b><?= $lang["system"]["members"] ?> </b><?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?><?php
+ <?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?> members<?php
if (count($travellers) > 0) {
- echo("<br>+ " . count($travellers) . " " . (count($travellers) > 1 ? $lang["system"]["traveller"] : $lang["system"]["travellers"]));
+ echo(" (+ " . count($travellers) . " " . (count($travellers) > 1 ? $lang["system"]["traveller"] : $lang["system"]["travellers"]) . ")");
}
?>
</span>
<span>
- <b><?= $lang["system"]["switch"] ?> </b><span data-bs-toggle="tooltip" title="<?= date("D j M Y, G:i:s (e)", strtotime(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"])) ?>"><?= timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"]) ?></span>
+
</span>
</div>
</div>
</div>
</div>
-<div id="system-actions" style="padding:5px 30px;display:grid;grid-template-columns: 0.5fr 1fr 0.5fr;background-color:rgba(255, 255, 255, .025);margin-left: -20px; margin-right: -20px;">
- <div></div>
- <a title="<?= $pages["s:history"]["name"][$lang["_name"]] ?>" 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"><?= $pages["s:history"]["name"][$lang["_name"]] ?></span>
- </a>
- <div></div>
+<div id="system-actions" style="padding:5px 30px;background-color:rgba(255, 255, 255, .025);margin-left: -20px; margin-right: -20px;">
+ <div id="timeline"></div>
+ <script>
+ async function refreshTimeline() {
+ document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?<?= $systemID ?>")).text();
+
+ Array.from(document.getElementsByClassName("dynamic-time")).forEach((el) => {
+ let time = el.getAttribute("data-time");
+ el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":").splice(0, 2).join(":");
+ });
+
+ Array.from(document.getElementsByClassName("dynamic-time-mobile")).forEach((el) => {
+ let time = el.getAttribute("data-time");
+ el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":")[0] + ":";
+ });
+ }
+
+ setInterval(refreshTimeline, 10000);
+ refreshTimeline();
+ </script>
+ <div style="display:grid;grid-template-columns: repeat(2, 1fr);">
+ <div style="display: flex; align-items: center; justify-content: center; text-align: center;">
+ Last switch&nbsp;<span data-bs-toggle="tooltip" title="<?= date("D j M Y, G:i:s (e)", strtotime(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"])) ?>"><?= timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"]) ?></span>
+ </div>
+ <a title="<?= $pages["s:history"]["name"][$lang["_name"]] ?>" 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"><?= $pages["s:history"]["name"][$lang["_name"]] ?></span>
+ </a>
+ <div></div>
+ </div>
</div> \ No newline at end of file
diff --git a/includes/components/timeline.inc b/includes/components/timeline.inc
new file mode 100644
index 0000000..6c85472
--- /dev/null
+++ b/includes/components/timeline.inc
@@ -0,0 +1,112 @@
+<?php
+
+
+function displayTimeline($systems) { global $app; $showIcons = count($systems) > 1; ?>
+ <table style="margin-top: 10px; width: 100%; margin-bottom: 10px;table-layout:fixed;">
+ <thead>
+ <tr class="row-desktop">
+ <?php if ($showIcons): ?><th colspan="20"></th><?php endif; ?>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 6 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 6) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 5 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 5) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 4 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 4) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 3 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 3) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 2 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 2) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 1 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 1) ?></th>
+ <th class="dynamic-time" data-time="<?= time() ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time()) ?></th>
+ </tr>
+ <tr class="row-mobile">
+ <?php if ($showIcons): ?><th colspan="20"></th><?php endif; ?>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 6 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 6) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 5 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 5) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 4 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 4) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 3 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 3) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 2 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 2) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 1 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 1) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time()) ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($systems as $system): ?>
+ <tr style="height: <?= count($systems) === 1 ? 50 : 30 ?>px;">
+ <?php if ($showIcons): ?><td colspan="20">
+ <a href="/<?= $system === "gdapd" ? "raindrops" : ($system === "ynmuc" ? "cloudburst" : $app["other"]["slug"]) ?>" style="width: 100%; height: 30px; display: flex; align-items: center; justify-content: center;">
+ <img alt="" style="border-radius: 5px; height: 24px; text-align: center;" src="<?= getAsset($system) ?>">
+ </a>
+ </td><?php endif; ?>
+ <?php
+
+ $leftCols = 420;
+
+ $time = time() - 3600 * 7;
+ $switches = [
+ ...array_reverse(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true)),
+ [
+ 'id' => '00000000-0000-0000-0000-000000000000',
+ 'timestamp' => date('c', time() + 60),
+ 'members' => []
+ ]
+ ];
+
+ foreach ($switches as $index => $switch) {
+ if (strtotime($switch["timestamp"]) >= $time) {
+ $correct = $switches[$index - 1];
+ $v = floor((strtotime($switch["timestamp"]) - $time) / 60);
+
+ echo('<td style="max-width: 100%; overflow: hidden; text-align: center; height: ' . 50 / count($systems) . 'px; background-color: #' . (getMemberWithoutSystem($correct["members"][0])["color"] ?? "000000") . '80;" colspan="' . ($v > $leftCols ? $leftCols : $v) . '"><a style="color: white; cursor: pointer; text-decoration: none; width: 100%; display: flex; height: ' . 50 / count($systems) . 'px; align-items: center; justify-content: center;" href="/' . getMemberWithoutSystem($correct["members"][0])["name"] . '">' . implode(", ", array_map(function ($i) {
+ return getMemberWithoutSystem($i)["display_name"] ?? getMemberWithoutSystem($i)["name"] ?? $i;
+ }, $correct["members"])) . '</a></td>');
+
+ $leftCols -= $v; if ($leftCols < 0) $leftCols = 0;
+ $time = strtotime($switch["timestamp"]);
+ }
+ }
+
+ ?>
+ </tr>
+ <?php endforeach; ?>
+ <tr class="row-desktop">
+ <?php if ($showIcons): ?><td colspan="20"></td><?php endif; ?>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">6 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">5 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">4 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">3 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">2 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">1 hour ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">Now</td>
+ </tr>
+ <tr class="row-mobile">
+ <?php if ($showIcons): ?><td colspan="20"></td><?php endif; ?>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-6h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-5h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-4h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-3h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-2</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-1</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">Now</td>
+ </tr>
+ <tr>
+ <?php for ($i = 0; $i < 420; $i++): ?><td></td><?php endfor; ?>
+ </tr>
+ </tbody>
+ </table>
+
+ <style>
+ .row-mobile {
+ display: none !important;
+ }
+
+ .row-desktop {
+ display: table-row !important;
+ }
+
+ @media (max-width: 991px) {
+ .row-desktop {
+ display: none !important;
+ }
+
+ .row-mobile {
+ display: table-row !important;
+ }
+ }
+ </style>
+<?php } \ No newline at end of file
diff --git a/includes/system/history.inc b/includes/system/history.inc
index 963e124..b879f6e 100644
--- a/includes/system/history.inc
+++ b/includes/system/history.inc
@@ -55,7 +55,7 @@ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/history.json"
$cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/history.json"), true);
-function page() { global $lang; global $systemCommonName; global $systemID; global $app; global $switches; ?>
+function page() { global $lang; global $systemCommonName; global $systemID; global $app; global $switches; global $isLoggedIn; global $isLowerLoggedIn; ?>
<br>
<div class="container" id="page-content">
<?php
@@ -107,7 +107,7 @@ function page() { global $lang; global $systemCommonName; global $systemID; glob
<?= isNotToday($switch["timestamp"], $day[1]) ? "00:00" : date('H:i', $switch["timestamp"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
- <a class="member-link" href="/<?= $member["name"] === "unknown" ? ($systemID === "gdapd" ? "unknown-rd" : ($systemID === "ynmuc" ? "unknown-cb" : $app["other"]["unknown"])) : $member["name"] ?>">
+ <a class="member-link" href="/<?= (isset($member) && $member["name"] === "unknown") ? ($systemID === "gdapd" ? "unknown-rd" : ($systemID === "ynmuc" ? "unknown-cb" : $app["other"]["unknown"])) : $member["name"] ?>">
<img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
</a>
<?php if (count($switch["members"]) > 1): ?>
@@ -153,16 +153,20 @@ if (!isset($cache[$systemID]["private"]) || !isset($cache[$systemID]["public"]))
$cache[$systemID]["private"] = ob_get_contents();
ob_end_clean();
- ob_start();
- $isLoggedInOldState = $isLoggedIn;
- $isLowerLoggedInOldState = $isLowerLoggedIn;
- $isLoggedIn = false;
- $isLowerLoggedIn = false;
- page();
- $isLoggedIn = $isLoggedInOldState;
- $isLowerLoggedIn = $isLowerLoggedInOldState;
- $cache[$systemID]["public"] = ob_get_contents();
- ob_end_clean();
+ if ($systemID !== $app["other"]["id"]) {
+ ob_start();
+ $isLoggedInOldState = $isLoggedIn;
+ $isLowerLoggedInOldState = $isLowerLoggedIn;
+ $isLoggedIn = false;
+ $isLowerLoggedIn = false;
+ page();
+ $isLoggedIn = $isLoggedInOldState;
+ $isLowerLoggedIn = $isLowerLoggedInOldState;
+ $cache[$systemID]["public"] = ob_get_contents();
+ ob_end_clean();
+ } else {
+ $cache[$systemID]["public"] = "";
+ }
}
echo($isLoggedIn ? $cache[$systemID]["private"] : $cache[$systemID]["public"]); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/history.json", json_encode($cache)); ?>
diff --git a/includes/util/functions.inc b/includes/util/functions.inc
index ad54706..9b6f356 100644
--- a/includes/util/functions.inc
+++ b/includes/util/functions.inc
@@ -91,7 +91,7 @@ if (!function_exists("getAsset")) {
}
if ($type === "bodies" || $type === "heads") {
- if (in_array("human", getSystemMember($systemID, $memberID)["_metadata"]["species"])) {
+ if (getSystemMember($systemID, $memberID) !== null && getSystemMember($systemID, $memberID)["_metadata"] !== null && getSystemMember($systemID, $memberID)["_metadata"]["species"] !== null && in_array("human", getSystemMember($systemID, $memberID)["_metadata"]["species"])) {
$type = "avatars";
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".webp")) {
diff --git a/pages/api/timeline.php b/pages/api/timeline.php
new file mode 100644
index 0000000..392d5de
--- /dev/null
+++ b/pages/api/timeline.php
@@ -0,0 +1,12 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; global $app;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE;
+
+$systems = array_filter(array_keys($_GET), function ($i) {
+ global $isLowerLoggedIn; global $isLoggedIn; global $app;
+ return $i === "gdapd" || $i === "ynmuc" || (($isLowerLoggedIn || $isLoggedIn) && $i === $app["other"]["id"]);
+});
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/timeline.inc";
+displayTimeline($systems); \ No newline at end of file
diff --git a/pages/home.inc b/pages/home.inc
index 62474d3..6e2c073 100644
--- a/pages/home.inc
+++ b/pages/home.inc
@@ -17,7 +17,7 @@ function banner() { global $isLoggedIn; global $isLowerLoggedIn; $byColor = getM
<span style="display: inline-block;background: transparent;position:absolute;width: 0;height: 0;margin-top: 17px;box-shadow: 0 6px 20px 20px #<?= $member["color"] ?>;z-index: 9;margin-left: 8px;opacity: .75;"></span>
</div><?php endforeach; ?>
</div>
- <div style="padding:5px 10px;background:#3332328a;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;position:relative;z-index: 999;backdrop-filter: blur(30px);">
+ <div style="padding:5px 10px;background:#3332328a;position:relative;z-index: 999;backdrop-filter: blur(30px);">
<h2 style="margin-top: 20px;">Cold Haze</h2>
<?php if ($isLoggedIn || $isLowerLoggedIn): ?>
<p><?= count($byColor) ?> ponies in 3 plural systems</p>
@@ -156,6 +156,27 @@ function members() { global $isLoggedIn; global $isLowerLoggedIn; global $app; ?
}
?>
+ <div style="background: #3332328a;padding: 5px 10px;border-top:1px solid rgba(255,255,255,.1);border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;">
+ <div id="timeline"></div>
+ <script>
+ async function refreshTimeline() {
+ document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&ynmuc<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>")).text();
+
+ Array.from(document.getElementsByClassName("dynamic-time")).forEach((el) => {
+ let time = el.getAttribute("data-time");
+ el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":").splice(0, 2).join(":");
+ });
+
+ Array.from(document.getElementsByClassName("dynamic-time-mobile")).forEach((el) => {
+ let time = el.getAttribute("data-time");
+ el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":")[0] + ":";
+ });
+ }
+
+ setInterval(refreshTimeline, 10000);
+ refreshTimeline();
+ </script>
+ </div>
<!--<div class="alert alert-warning" style="margin-top:20px;">
<b>Notice:</b> The administrators are currently trying a new optimisation technique based on a virtual file system (chvfs). Data loss, corruption or inconsistency may happen and should be reported on <a href="https://bugs.equestria.dev/issues/CH" target="_blank">bugs.equestria.dev</a>.