diff options
author | Minteck <contact@minteck.org> | 2022-10-10 20:51:39 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-10-10 20:51:39 +0200 |
commit | 108525534c28013cfe1897c30e4565f9893f3766 (patch) | |
tree | dd3e5132971f96ab5f05e7f3f8f6dbbf379a19bd /pages | |
parent | 2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff) | |
download | pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2 pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip |
Update
Diffstat (limited to 'pages')
-rw-r--r-- | pages/about.inc | 96 | ||||
-rw-r--r-- | pages/actions.inc (renamed from pages/actions.php) | 110 | ||||
-rw-r--r-- | pages/alphabet.inc (renamed from pages/alphabet.php) | 14 | ||||
-rw-r--r-- | pages/api.inc (renamed from pages/api.php) | 0 | ||||
-rw-r--r-- | pages/app.inc (renamed from pages/app.php) | 0 | ||||
-rw-r--r-- | pages/bitset.inc (renamed from pages/bitset.php) | 6 | ||||
-rw-r--r-- | pages/byfront.inc (renamed from pages/byfront.php) | 20 | ||||
-rw-r--r-- | pages/dashboard.inc | 231 | ||||
-rw-r--r-- | pages/dashboard.php | 321 | ||||
-rw-r--r-- | pages/debug.inc (renamed from pages/debug.php) | 35 | ||||
-rw-r--r-- | pages/demo.inc (renamed from pages/demo.php) | 20 | ||||
-rw-r--r-- | pages/disclaimers.inc (renamed from pages/disclaimers.php) | 6 | ||||
-rw-r--r-- | pages/docs.inc (renamed from pages/docs.php) | 8 | ||||
-rw-r--r-- | pages/edit-private.inc (renamed from pages/edit-private.php) | 12 | ||||
-rw-r--r-- | pages/edit.inc (renamed from pages/edit.php) | 14 | ||||
-rw-r--r-- | pages/emergency.inc (renamed from pages/emergency.php) | 8 | ||||
-rw-r--r-- | pages/fronting.inc (renamed from pages/fronting.php) | 8 | ||||
-rw-r--r-- | pages/government.inc | 142 | ||||
-rw-r--r-- | pages/home.inc (renamed from pages/home.php) | 14 | ||||
-rw-r--r-- | pages/login.inc (renamed from pages/login.php) | 12 | ||||
-rw-r--r-- | pages/logout.inc (renamed from pages/logout.php) | 0 | ||||
-rw-r--r-- | pages/nicknames.inc (renamed from pages/nicknames.php) | 12 | ||||
-rw-r--r-- | pages/page.inc (renamed from pages/page.php) | 22 | ||||
-rw-r--r-- | pages/parser.inc (renamed from pages/parser.php) | 22 | ||||
-rw-r--r-- | pages/pleasure.inc (renamed from pages/pleasure.php) | 8 | ||||
-rw-r--r-- | pages/prefix.inc (renamed from pages/prefix.php) | 16 | ||||
-rw-r--r-- | pages/relations.inc (renamed from pages/relations.php) | 14 | ||||
-rw-r--r-- | pages/rules.inc (renamed from pages/rules.php) | 12 | ||||
-rw-r--r-- | pages/score.inc (renamed from pages/score.php) | 60 | ||||
-rw-r--r-- | pages/splitting.inc (renamed from pages/splitting.php) | 8 | ||||
-rw-r--r-- | pages/stats.inc | 441 | ||||
-rw-r--r-- | pages/terminology.inc (renamed from pages/terminology.php) | 6 | ||||
-rw-r--r-- | pages/together-dev.inc (renamed from pages/together-dev.php) | 2 | ||||
-rw-r--r-- | pages/together.inc (renamed from pages/together.php) | 4 | ||||
-rw-r--r-- | pages/toys.inc (renamed from pages/toys.php) | 69 | ||||
-rw-r--r-- | pages/travelling.inc (renamed from pages/travelling.php) | 16 | ||||
-rw-r--r-- | pages/wakeup.inc (renamed from pages/wakeup.php) | 8 |
37 files changed, 1195 insertions, 602 deletions
diff --git a/pages/about.inc b/pages/about.inc new file mode 100644 index 0000000..d6b0eeb --- /dev/null +++ b/pages/about.inc @@ -0,0 +1,96 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +$version = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/version.json"), true); + +$ignore = [ + $_SERVER['DOCUMENT_ROOT'] . "/Data", + $_SERVER['DOCUMENT_ROOT'] . "/bits/Data", + $_SERVER['DOCUMENT_ROOT'] . "/Private/Data", + $_SERVER['DOCUMENT_ROOT'] . "/bits/Private/Data", + $_SERVER['DOCUMENT_ROOT'] . "/includes/data", + $_SERVER['DOCUMENT_ROOT'] . "/includes/tokens", +]; + +function rscandir($dir, $inverseIgnore = false) { + global $ignore; + $files = []; + + foreach (array_filter(scandir($dir), function ($i) { + return !str_starts_with($i, "."); + }) as $file) { + if (!(($inverseIgnore && !in_array($dir . "/" . $file, $ignore)) || (!$inverseIgnore && in_array($dir . "/" . $file, $ignore)))) { + if (is_dir($dir . "/" . $file)) { + array_push($files, ...rscandir($dir . "/" . $file)); + } else { + $files[] = $dir . "/" . $file; + } + } + } + + return array_unique($files); +} + +$sizeSystem = array_reduce(array_map(function ($i) { + return filesize($i); +}, rscandir($_SERVER['DOCUMENT_ROOT'])), function ($a, $b) { + return $a + $b; +}); + +$sizeData = array_reduce(array_map(function ($i) { + return filesize($i); +}, rscandir($_SERVER['DOCUMENT_ROOT'], true)), function ($a, $b) { + return $a + $b; +}); + +function prettySize($bytes) { + if ($bytes > 1024) { + if ($bytes > 1024**2) { + if ($bytes > 1024**3) { + return round($bytes / 1024**3, 1) . " MB"; + } else { + return round($bytes / 1024**2, 1) . " MB"; + } + } else { + return round($bytes / 1024, 1) . " KB"; + } + } else { + return $bytes . " B"; + } +} + +?> + +<br> +<div class="container"> + <div id="page-content"> + <h2>About Cold Haze</h2> + <p> + <b>Cold Haze Engine version 2.<?= $version["build"] ?>.<?= hexdec(substr($version["hash"], 0, 4)) ?>.<?= $version["revision"] ?></b><br> + Version date: <?= date('D j M Y, G:i:s T', $version["timestamp"]) ?><br> + Version ID: <code style="color: white;"><?= $version["hash"] ?></code><br> + Install path: <?= $_SERVER['DOCUMENT_ROOT'] ?><br> + Server software: <?= $_SERVER['SERVER_SOFTWARE'] ?>, via <?= $_SERVER['GATEWAY_INTERFACE'] ?><br> + Transport protocol: <?= $_SERVER['SERVER_PROTOCOL'] ?> + </p> + + <p> + <b>PHP <?= PHP_VERSION ?></b><br> + Zend Engine: <?= zend_version() ?><br> + Server API: <?= php_sapi_name() ?><br> + Memory usage: <?= prettySize(memory_get_peak_usage()) ?><br> + Server OS: <?= php_uname("s") ?> <?= php_uname("r") ?><br> + Server domain name: <?= php_uname("n") ?><br> + Server architecture: <?= php_uname("m") ?> + </p> + + <p> + <b>Disk space usage</b><br> + Engine: <?= prettySize($sizeSystem) ?><br> + Database: <?= prettySize($sizeData) ?> + </p> + </div> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/actions.php b/pages/actions.inc index 939ed7e..527b336 100644 --- a/pages/actions.php +++ b/pages/actions.inc @@ -1,9 +1,9 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; if (isset($_POST['deleteAction'])) { - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); $selected = null; $selectedIndex = -1; @@ -23,15 +23,15 @@ if (isset($_POST['deleteAction'])) { } unset($data[$selectedIndex]); - @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions/" . date('c') . ".json", utf8_encode(json_encode($data))); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", utf8_encode(json_encode($data))); + @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/" . date('Y-m-d_H-i-s') . ".json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json", utf8_encode(json_encode($data))); header("Location: /-/actions/?d&id=" . $id); die(); } if (isset($_POST['updateAction'])) { - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); $selected = null; $selectedIndex = -1; @@ -97,17 +97,17 @@ if (isset($_POST['updateAction'])) { } $data[$selectedIndex] = $selected; - @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions/" . date('c') . ".json", utf8_encode(json_encode($data))); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", utf8_encode(json_encode($data))); + @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/" . date('Y-m-d_H-i-s') . ".json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json", utf8_encode(json_encode($data))); header("Location: /-/actions/" . $id); die(); } if (isset($_POST['createAction'])) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.php"; - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.inc"; + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); if (!isset($_POST["name"]) || !isset($_POST["type"])) { header("Location: /-/actions"); @@ -156,17 +156,17 @@ if (isset($_POST['createAction'])) { "consent" => $consent ]; - @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/oldactions/" . date('c') . ".json", utf8_encode(json_encode($data))); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", utf8_encode(json_encode($data))); + @mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions"); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/" . date('Y-m-d_H-i-s') . ".json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json", utf8_encode(json_encode($data))); header("Location: /-/actions/" . $id); die(); } global $pagename; $parts = explode("/", $pagename); -$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); -$toys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); +$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); +$toys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json"), true); $selected = null; @@ -188,10 +188,10 @@ if (isset($parts[1])) { } } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/keywords.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/keywords.inc'; -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json", "[]"); +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json", "[]"); global $_PROFILE; @@ -300,7 +300,7 @@ global $_PROFILE; </div> <?php endif; ?> - <hr> + <!--<hr> <b>Can be done by:</b> <?php @@ -336,8 +336,8 @@ global $_PROFILE; ?> <li> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member1["name"] ?>.png"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member2["name"] ?>.png"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($systemID, $member1["id"], "heads") ?>"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($systemID, $member2["id"], "heads") ?>"> <span style="vertical-align: middle;"><?= getMiniName($member1["display_name"] ?? $member1["name"]) ?> and <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span> </li> @@ -350,8 +350,8 @@ global $_PROFILE; ?> <li> <span style="opacity:.5;"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member1["name"] ?>.png"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member2["name"] ?>.png"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($systemID, $member1["id"], "heads") ?>"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($systemID, $member2["id"], "heads") ?>"> <span style="vertical-align: middle;"><?= getMiniName($member1["display_name"] ?? $member1["name"]) ?> and <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span> </span> @@ -370,8 +370,8 @@ global $_PROFILE; ?> <li> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member1["name"] ?>.png"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member2["name"] ?>.png"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member1["system"], $member1["id"], "heads") ?>"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member2["system"], $member2["id"], "heads") ?>"> <span style="vertical-align: middle;"><?= getMiniName($member1["display_name"] ?? $member1["name"]) ?> and <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span> </li> @@ -384,8 +384,8 @@ global $_PROFILE; ?> <li> <span style="opacity:.5;"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member1["name"] ?>.png"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member2["name"] ?>.png"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member1["system"], $member1["id"], "heads") ?>"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member2["system"], $member2["id"], "heads") ?>"> <span style="vertical-align: middle;"><?= getMiniName($member1["display_name"] ?? $member1["name"]) ?> and <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span> </span> @@ -404,8 +404,8 @@ global $_PROFILE; ?> <li> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member1["name"] ?>.png"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member2["name"] ?>.png"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member1["system"], $member1["id"], "heads") ?>"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member2["system"], $member2["id"], "heads") ?>"> <span style="vertical-align: middle;"><?= getMiniName($member1["display_name"] ?? $member1["name"]) ?> and <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span> </li> @@ -418,8 +418,8 @@ global $_PROFILE; ?> <li> <span style="opacity:.5;"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member1["name"] ?>.png"> - <img style="vertical-align: middle;width:24px;height:24px;" src="/assets/uploads/pt-<?= $member2["name"] ?>.png"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member1["system"], $member1["id"], "heads") ?>"> + <img style="vertical-align: middle;width:24px;height:24px;" src="<?= getAsset($member2["system"], $member2["id"], "heads") ?>"> <span style="vertical-align: middle;"><?= getMiniName($member1["display_name"] ?? $member1["name"]) ?> and <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span> </span> @@ -427,7 +427,7 @@ global $_PROFILE; </li> <?php endif; endforeach; ?> </ul> - <?php endif; ?> + <?php endif; ?>--> <div style="margin-top:10px;"></div> @@ -502,7 +502,7 @@ global $_PROFILE; <div class="card-body"> <h4 class="card-title"><?= $item["name"] ?></h4> <p class="card-text"> - <?php + <!--<?php $uniquePonies = []; @@ -518,14 +518,15 @@ global $_PROFILE; foreach ($uniquePonies as $name => $deprecated): if (!$deprecated): ?> <span data-bs-toggle="tooltip" title="<?= getMemberWithoutSystem($name)["display_name"] ?? getMemberWithoutSystem($name)["display_name"] ?>" style="display: inline-block;"> - <img src="/assets/uploads/pt-<?= getMemberWithoutSystem($name)["name"] ?>.png" style="width:32px;"> + <img src="<?= getAsset(getMemberWithoutSystem($name)["system"], getMemberWithoutSystem($name)["id"], "heads") ?>" style="width:32px;"> </span> <?php endif; endforeach; ?> <?php foreach ($uniquePonies as $name => $deprecated): if ($deprecated): ?> <span data-bs-toggle="tooltip" data-bs-html="true" title="<i><?= strip_tags(getMemberWithoutSystem($name)["display_name"] ?? getMemberWithoutSystem($name)["name"]) ?></i>" style="opacity:.5;display: inline-block;"> - <img src="/assets/uploads/pt-<?= getMemberWithoutSystem($name)["name"] ?>.png" style="width:32px;"> + <img src="<?= getAsset(getMemberWithoutSystem($name)["system"], getMemberWithoutSystem($name)["id"], "heads") ?>" style="width:32px;"> </span> - <?php endif; endforeach; ?> + <?php endif; endforeach; ?>--> + - </p> <?php if ($item["type"] === "affectionate"): ?> <span style="" class="badge rounded-pill bg-primary">Affectionate</span> @@ -584,6 +585,7 @@ global $_PROFILE; <input type="text" placeholder="Action example" name="example" class="form-control" style="color:white;background:#111;border-color:#222;margin-bottom:10px;" value="<?= str_replace('"', '"', $selected["example"] ?? "") ?>"> <input type="text" placeholder="IRL steps" name="irl" class="form-control" style="color:white;background:#111;border-color:#222;" value="<?= str_replace('"', '"', $selected["irl"] ?? "") ?>"> + <div style="display: none;"> <hr> <p>Select the groups of ponies who can do this action:</p> @@ -677,6 +679,7 @@ global $_PROFILE; </label> </label> <?php endforeach; ?> + </div> <br> <input type="hidden" name="updateAction"> @@ -706,7 +709,7 @@ global $_PROFILE; return (isset($i["description"]) && trim($i["description"]) === "") || !isset($i["description"]); })) ?> incomplete)</p> - <p>TODO: add ponies for all actions (+ keywords)</p> + <p>TODO: fill everything and add keywords</p> <input type="text" placeholder="Search for an action..." class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" onchange="search();" onkeydown="search();" onkeyup="search();" id="search"> @@ -722,33 +725,15 @@ global $_PROFILE; ksort($init); $sorted = array_values($init); - uasort($sorted, function ($a, $b) { - $uniquePonies1 = []; - - foreach ($a["ponies"] as $ponies) { - foreach ($ponies["members"] as $member) { - $uniquePonies1[$member] = true; - } - } - - $uniquePonies2 = []; - - foreach ($b["ponies"] as $ponies) { - foreach ($ponies["members"] as $member) { - $uniquePonies2[$member] = true; - } - } - - return count($uniquePonies2) - count($uniquePonies1); - }); foreach ($sorted as $item): ?> - <a href="/-/actions/<?= $item["id"] ?>" id="action-<?= $item["id"] ?>" style="display:grid;grid-template-columns: 1fr 1fr 0.2fr;" class="list-group-item list-group-item-action action-listing"> + <a href="/-/actions/<?= $item["id"] ?>" id="action-<?= $item["id"] ?>" style="display:grid;grid-template-columns: 1fr 0.2fr;" class="list-group-item list-group-item-action action-listing"> <div> <span class="<?= trim($item["description"]) === "" ? "text-danger" : "" ?>"><?= $item["name"] ?></span> <?php if (!isset($item["verified"])): ?><span class="badge bg-warning rounded-pill text-black">Unverified</span><?php endif; ?> <?php if (isset($item["untested"])): ?><span class="badge bg-info rounded-pill">Untested</span><?php endif; ?> </div> + <!-- <div> <?php @@ -771,7 +756,6 @@ global $_PROFILE; $index = 1; foreach ($uniquePonies as $name => $deprecated): if (!$deprecated): ?> - <!-- <?= $index ?> --> <span title="<?= getMemberWithoutSystem($name)["display_name"] ?? getMemberWithoutSystem($name)["display_name"] ?>" style="display: inline-block;<?= $longPonyList && $index % 2 === 0 ? "position:absolute;margin-left:-12px;z-index:" . (999 - $index) . ";" : "position:relative;z-index:" . (999 - $index) . ";" ?>"> <img src="/assets/uploads/pt-<?= getMemberWithoutSystem($name)["name"] ?>.png" style="width:24px;"> </span> @@ -782,6 +766,7 @@ global $_PROFILE; </span> <?php $index++; endif; endforeach; ?> </div> + --> <div style="text-align: right;"> <?php if ($item["type"] === "affectionate"): ?> <span style="" class="badge rounded-pill bg-primary">Affectionate</span> @@ -806,7 +791,7 @@ global $_PROFILE; </div> <script> - window.actions = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true)))) ?>`)); + window.actions = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true)))) ?>`)); </script> <div class="modal fade" id="creator"> @@ -840,6 +825,7 @@ global $_PROFILE; Requires consent </label> + <div style="display: none;"> <hr> <p>Select the groups of ponies who can do this action:</p> @@ -912,7 +898,7 @@ global $_PROFILE; "caretaking" => "Caretaker" } ?></span> </label> - <?php endforeach; ?> + <?php endforeach; ?></div> <p style="margin-top:10px;">You can add additional data (description, example, how to do the action IRL) after creating the action.</p> <input type="hidden" name="createAction"> @@ -1127,4 +1113,4 @@ global $_PROFILE; } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/alphabet.php b/pages/alphabet.inc index b59772d..167ba92 100644 --- a/pages/alphabet.php +++ b/pages/alphabet.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -12,20 +12,20 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <?php $members = scoreOrderGlobal(); ?> <div> - <?php foreach (str_split("abcdefgihjklmnopqrstuvwxyz") as $letter): ?> + <?php foreach (str_split("abcdefghijklmnopqrstuvwxyz") as $letter): ?> <div style="display:inline-grid;grid-template-columns: max-content 1fr;min-height:32px;"> <div style="display:flex;align-items:center;justify-content:center;font-weight: bold;margin-right:10px;" class="font-monospace"><?= $letter ?>.</div> <div> - <?php foreach ($members as $member): if (isset($member["proxy_tags"][0]) && isset($member["proxy_tags"][0]["prefix"]) && str_starts_with(strtolower($member["proxy_tags"][0]["prefix"]), strtolower($letter)) && strlen($member["proxy_tags"][0]["prefix"]) === 2): ?><a href="/<?= $member["name"] ?>" title="<b><?= $member["display_name"] ?></b> (<code class='text-white'><?= $member["proxy_tags"][0]["prefix"] ?></code>)" data-bs-toggle="tooltip" data-bs-html="true"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"></a><?php endif; endforeach; ?> + <?php foreach ($members as $member): if (isset($member["proxy_tags"][0]) && isset($member["proxy_tags"][0]["prefix"]) && str_starts_with(strtolower($member["proxy_tags"][0]["prefix"]), strtolower($letter)) && strlen($member["proxy_tags"][0]["prefix"]) === 2): ?><a href="/<?= $member["name"] ?>" title="<b><?= $member["display_name"] ?></b> (<code class='text-white'><?= $member["proxy_tags"][0]["prefix"] ?></code>)" data-bs-toggle="tooltip" data-bs-html="true"><img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;"></a><?php endif; endforeach; ?> </div> </div> - <?php foreach (str_split("abcdefgihjklmnopqrstuvwxyz") as $letter2): $list = array_filter($members, function ($member) use ($letter, $letter2) { + <?php foreach (str_split("abcdefghijklmnopqrstuvwxyz") as $letter2): $list = array_filter($members, function ($member) use ($letter, $letter2) { return isset($member["proxy_tags"][0]) && isset($member["proxy_tags"][0]["prefix"]) && str_starts_with(strtolower($member["proxy_tags"][0]["prefix"]), strtolower($letter . $letter2)) && strlen($member["proxy_tags"][0]["prefix"]) === 3; }); if (count($list) > 0): ?> (<div style="display:inline-grid;grid-template-columns: max-content 1fr;min-height:32px;"> <div style="display:flex;align-items:center;justify-content:center;" class="font-monospace"><?= $letter . $letter2 ?>.</div> <div> - <?php foreach ($list as $member): ?><a href="/<?= $member["name"] ?>" title="<b><?= $member["display_name"] ?></b> (<code class='text-white'><?= $member["proxy_tags"][0]["prefix"] ?></code>)" data-bs-toggle="tooltip" data-bs-html="true"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"></a><?php endforeach; ?> + <?php foreach ($list as $member): ?><a href="/<?= $member["name"] ?>" title="<b><?= $member["display_name"] ?></b> (<code class='text-white'><?= $member["proxy_tags"][0]["prefix"] ?></code>)" data-bs-toggle="tooltip" data-bs-html="true"><img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;"></a><?php endforeach; ?> </div> </div>) <?php endif; endforeach; ?> @@ -35,4 +35,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/api.php b/pages/api.inc index 1d83985..1d83985 100644 --- a/pages/api.php +++ b/pages/api.inc diff --git a/pages/app.php b/pages/app.inc index ceed71e..ceed71e 100644 --- a/pages/app.php +++ b/pages/app.inc diff --git a/pages/bitset.php b/pages/bitset.inc index 0d2d10e..b608c73 100644 --- a/pages/bitset.php +++ b/pages/bitset.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -406,4 +406,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </p> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/byfront.php b/pages/byfront.inc index eb9050c..280d981 100644 --- a/pages/byfront.php +++ b/pages/byfront.inc @@ -1,8 +1,8 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; -$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); ?> @@ -19,12 +19,12 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ $fronters = array_map(function ($item) { return $item["id"]; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-fronters.json"), true)["members"]); + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true)["members"]); if (in_array($id, $fronters)) { $i["_lastFronted"] = time(); } else { - $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-switches.json"), true); + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true); $thisMember = array_filter($switches, function ($item) use ($memberData) { return in_array($memberData["id"], $item["members"]); @@ -53,7 +53,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ }); foreach ($members as $member): ?> <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> <?php if ($member["_metadata"]["shared_memory"] !== 2): ?> <span class="badge text-black bg-warning rounded-pill">Not sharing memory</span> <?php endif; ?> @@ -78,12 +78,12 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ $fronters = array_map(function ($item) { return $item["id"]; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-fronters.json"), true)["members"]); + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true)["members"]); if (in_array($id, $fronters)) { $i["_lastFronted"] = time(); } else { - $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-switches.json"), true); + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true); $thisMember = array_filter($switches, function ($item) use ($memberData) { return in_array($memberData["id"], $item["members"]); @@ -112,7 +112,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ }); foreach ($members as $member): ?> <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> <?php if ($member["_metadata"]["shared_memory"] !== 2): ?> <span class="badge text-black bg-warning rounded-pill">Not sharing memory</span> <?php endif; ?> @@ -157,4 +157,4 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/dashboard.inc b/pages/dashboard.inc new file mode 100644 index 0000000..59396e5 --- /dev/null +++ b/pages/dashboard.inc @@ -0,0 +1,231 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $pages; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $_PROFILE; +use om\IcalParser; + +$poniesHavingSex = []; + +$actions = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); + +foreach ($actions as $action) { + if ($action["type"] !== "sexual") continue; + + foreach ($action["ponies"] as $ponies) { + $id = implode("", $ponies["members"]); + + $member = getMemberWithoutSystem($ponies["members"][0]); + $otherMember = getMemberWithoutSystem($ponies["members"][1]); + + $parts = [ + $member["id"], + $otherMember["id"] + ]; + + asort($parts); + $poniesHavingSex[] = $parts[0]; + $poniesHavingSex[] = $parts[1]; + } +} + +$fronter = array_map(function ($i) { + return $i["id"]; +}, ($_PROFILE["login"] === "raindrops" ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true))["members"])[0] ?? null; + +$viewingPonyHasSex = in_array($fronter, $poniesHavingSex) || isset($_GET['toys']); + +?> + +<br> +<div class="container"> + <div id="page-content"> + <h3 id="date" style="text-align: center;margin-bottom:20px;">Date</h3> + <script> + function _Date() { + let d = new Date(); + let m = d.getMonth(); + let w = d.getDay(); + + switch (m) { + case 0: m = "Jan"; break; + case 1: m = "Feb"; break; + case 2: m = "Mar"; break; + case 3: m = "Apr"; break; + case 4: m = "May"; break; + case 5: m = "Jun"; break; + case 6: m = "Jul"; break; + case 7: m = "Aug"; break; + case 8: m = "Sep"; break; + case 9: m = "Oct"; break; + case 10: m = "Nov"; break; + case 11: m = "Dec"; break; + } + + switch (w) { + case 0: w = "Sun"; break; + case 1: w = "Mon"; break; + case 2: w = "Tue"; break; + case 3: w = "Wed"; break; + case 4: w = "Thu"; break; + case 5: w = "Fri"; break; + case 6: w = "Sat"; break; + } + + function fixed(number) { + if (number < 10) { + return "0" + number; + } else { + return number.toString(); + } + } + + document.getElementById("date").innerText = `${w} ${d.getDate()} ${m} ${d.getHours()}:${fixed(d.getMinutes())}`; + } + + setInterval(_Date); + </script> + + <hr> + <h4>Next fronters <span class="small"><a href="/-/fronting">(edit)</a></span></h4> + <?php + + $scheduleCloudburstToday = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true)[date('Y-m-d')] ?? []; + $scheduleRaindropsToday = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true)[date('Y-m-d')] ?? []; + + $scheduleCloudburstTomorrow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true)[date('Y-m-d', time() + 86400)] ?? []; + $scheduleRaindropsTomorrow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true)[date('Y-m-d', time() + 86400)] ?? []; + + $scheduleCloudburstNextday = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true)[date('Y-m-d', time() + 172800)] ?? []; + $scheduleRaindropsNextday = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true)[date('Y-m-d', time() + 172800)] ?? []; + + $today1 = $_PROFILE["login"] === "raindrops" ? $scheduleRaindropsToday : $scheduleCloudburstToday; + $today2 = $_PROFILE["login"] === "raindrops" ? $scheduleCloudburstToday : $scheduleRaindropsToday; + $tomorrow1 = $_PROFILE["login"] === "raindrops" ? $scheduleRaindropsTomorrow : $scheduleCloudburstTomorrow; + $tomorrow2 = $_PROFILE["login"] === "raindrops" ? $scheduleCloudburstTomorrow : $scheduleRaindropsTomorrow; + $nextday1 = $_PROFILE["login"] === "raindrops" ? $scheduleRaindropsNextday : $scheduleCloudburstNextday; + $nextday2 = $_PROFILE["login"] === "raindrops" ? $scheduleCloudburstNextday : $scheduleRaindropsNextday; + + ?> + + <h5>Fronters today</h5> + <ul> + <?php foreach ($today1 as $index => $id): $member = getMemberWithoutSystem($id[0]); ?> + <li> + <?php if ($member["name"] === "fusion"): ?> + <img alt="" src="/assets/logo/logo.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;">Merged members</span> + <?php else: ?> + <img alt="" src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <b style="vertical-align: middle;"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> + <?php endif; ?> + <?php if (isset($id[1])): $member2 = getMemberWithoutSystem($id[1]); ?> + <b style="vertical-align: middle;">and <img alt="" src="<?= getAsset($member['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></b> + <?php endif; ?> + <?php if (isset($today2[$index])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $today2[$index][0]); ?><span style="vertical-align: middle;">with</span> <img alt="" src="<?= getAsset($member2['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;"><?= getMiniName($member2["display_name"] ?? $member2["name"]) ?><?php if (isset($today2[$index][1])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $today2[$index][1]); ?> + and <img alt="" src="<?= getAsset($member['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?> + <?php endif; ?></span><?php endif; ?> + </li> + <?php endforeach; ?> + </ul> + + <h5>Fronters tomorrow</h5> + <ul> + <?php foreach ($tomorrow1 as $index => $id): $member = getSystemMember($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc", $id[0]); ?> + <li> + <?php if ($member["name"] === "fusion"): ?> + <img alt="" src="/assets/logo/logo.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;">Merged members</span> + <?php else: ?> + <img alt="" src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <b style="vertical-align: middle;"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> + <?php endif; ?> + <?php if (isset($id[1])): $member2 = getMemberWithoutSystem($id[1]); ?> + <b style="vertical-align: middle;">and <img alt="" src="<?= getAsset($member['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></b> + <?php endif; ?> + <?php if (isset($tomorrow2[$index])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $tomorrow2[$index][0]); ?><span style="vertical-align: middle;">with</span> <img alt="" src="<?= getAsset($member2['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;"><?= getMiniName($member2["display_name"] ?? $member2["name"]) ?><?php if (isset($tomorrow2[$index][1])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $tomorrow2[$index][1]); ?> + and <img alt="" src="<?= getAsset($member['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?> + <?php endif; ?></span><?php endif; ?> + </li> + <?php endforeach; ?> + </ul> + + <h5>Fronters on <?= date('l', time() + 172800) ?></h5> + <ul> + <?php foreach ($nextday1 as $index => $id): $member = getSystemMember($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc", $id[0]); ?> + <li> + <?php if ($member["name"] === "fusion"): ?> + <img alt="" src="/assets/logo/logo.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;">Merged members</span> + <?php else: ?> + <img alt="" src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <b style="vertical-align: middle;"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> + <?php endif; ?> + <?php if (isset($id[1])): $member2 = getMemberWithoutSystem($id[1]); ?> + <b style="vertical-align: middle;">and <img alt="" src="<?= getAsset($member['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></b> + <?php endif; ?> + <?php if (isset($nextday2[$index])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $nextday2[$index][0]); ?><span style="vertical-align: middle;">with</span> <img alt="" src="<?= getAsset($member2['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;"><?= getMiniName($member2["display_name"] ?? $member2["name"]) ?><?php if (isset($nextday2[$index][1])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $nextday2[$index][1]); ?> + and <img alt="" src="<?= getAsset($member['system'], $member2["id"], "heads") ?>" style="width:24px; height: 24px; vertical-align: middle;"> <?= getMiniName($member2["display_name"] ?? $member2["name"]) ?> + <?php endif; ?></span><?php endif; ?> + </li> + <?php endforeach; ?> + </ul> + + <hr> + <h4>Next events</h4> + <?php + + $cal = new IcalParser(); + $results = $cal->parseFile($_SERVER['DOCUMENT_ROOT'] . "/includes/data/calendar/calendar.ics"); + $events = []; + + foreach ($cal->getEvents()->sorted() as $event) { + $events[] = [ + "id" => $event['UID'], + "date" => [ + "created" => $event['CREATED']->format('c'), + "modified" => $event['LAST-MODIFIED']->format('c'), + "start" => $event['DTSTART']->format('c'), + "end" => $event['DTEND']->format('c'), + "duration" => strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')), + "full_day" => strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')) >= 86400, + "days" => ( + strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')) >= 86400 ? + round((strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c'))) / 86400) : + null + ) + ], + "name" => $event['SUMMARY'], + "description" => $event['DESCRIPTION'] ?? "", + ]; + } + + $events = array_values(array_filter($events, function ($i) { + return ( + strtotime($i["date"]["end"]) > time() && + strtotime($i["date"]["start"]) < time() + 2629800 + ); + })); + + ?> + <ul> + <?php foreach ($events as $event): ?> + <li> + <?php if ($event["date"]["full_day"]): ?> + <b> + <?php if (strtotime($event["date"]["start"]) < time()): ?> + Started <?= timeAgo($event["date"]["start"]) ?>, ends <?= timeIn($event["date"]["end"]) ?> + <?php else: ?> + <?= ucfirst(relativeDate($event["date"]["start"], false)) ?> + <?php endif; ?> + · + </b> + <?php else: ?> + <b> + <?= ucfirst(relativeDate($event["date"]["start"])) ?> + · + </b> + <?php endif; ?> + for <?= duration($event["date"]["duration"]) ?> + · + <?= $event["name"] ?> + </li> + <?php endforeach; ?> + </ul> + </div> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/dashboard.php b/pages/dashboard.php deleted file mode 100644 index a861636..0000000 --- a/pages/dashboard.php +++ /dev/null @@ -1,321 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; global $_PROFILE; -use om\IcalParser; - -$poniesHavingSex = []; - -$actions = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); - -foreach ($actions as $action) { - if ($action["type"] !== "sexual") continue; - - foreach ($action["ponies"] as $ponies) { - $id = implode("", $ponies["members"]); - - $member = getMemberWithoutSystem($ponies["members"][0]); - $otherMember = getMemberWithoutSystem($ponies["members"][1]); - - $parts = [ - $member["id"], - $otherMember["id"] - ]; - - asort($parts); - $poniesHavingSex[] = $parts[0]; - $poniesHavingSex[] = $parts[1]; - } -} - -$fronter = array_map(function ($i) { - return $i["id"]; -}, ($_PROFILE["login"] === "raindrops" ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-fronters.json"), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-fronters.json"), true))["members"])[0] ?? null; - -$viewingPonyHasSex = in_array($fronter, $poniesHavingSex) || isset($_GET['toys']); - -?> - -<br> -<div class="container"> - <div id="page-content"> - <h3 id="date" style="text-align: center;margin-bottom:20px;">Date</h3> - <script> - function _Date() { - let d = new Date(); - let m = d.getMonth(); - let w = d.getDay(); - - switch (m) { - case 0: m = "Jan"; break; - case 1: m = "Feb"; break; - case 2: m = "Mar"; break; - case 3: m = "Apr"; break; - case 4: m = "May"; break; - case 5: m = "Jun"; break; - case 6: m = "Jul"; break; - case 7: m = "Aug"; break; - case 8: m = "Sep"; break; - case 9: m = "Oct"; break; - case 10: m = "Nov"; break; - case 11: m = "Dec"; break; - } - - switch (w) { - case 0: w = "Sun"; break; - case 1: w = "Mon"; break; - case 2: w = "Tue"; break; - case 3: w = "Wed"; break; - case 4: w = "Thu"; break; - case 5: w = "Fri"; break; - case 6: w = "Sat"; break; - } - - function fixed(number) { - if (number < 10) { - return "0" + number; - } else { - return number.toString(); - } - } - - document.getElementById("date").innerText = `${w} ${d.getDate()} ${m} ${d.getHours()}:${fixed(d.getMinutes())}`; - } - - setInterval(_Date); - </script> - - <div class="peh-row" style="<?php if (!$viewingPonyHasSex): ?>grid-template-columns: repeat(8, 1fr) !important;<?php endif; ?>"> - <div class="column"> - <div class="card" title="<?= $pages["actions"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/actions" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/actions.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["actions"]["short"] ?></h6> - </a> - </div> - </div> - <div class="column"> - <div class="card" title="<?= $pages["rules"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/rules" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/rules.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["rules"]["short"] ?></h6> - </a> - </div> - </div> - <div class="column"> - <div class="card" title="<?= $pages["docs"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/docs" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/docs.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["docs"]["short"] ?></h6> - </a> - </div> - </div> - <div class="column"> - <div class="card" title="<?= $pages["nicknames"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/nicknames" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/nicknames.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["nicknames"]["short"] ?></h6> - </a> - </div> - </div> - <div class="column"> - <div class="card" title="<?= $pages["together"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/together" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/together.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["together"]["short"] ?></h6> - </a> - </div> - </div> - <div class="column"> - <div class="card" title="<?= $pages["splitting"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/splitting" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/form.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["splitting"]["short"] ?></h6> - </a> - </div> - </div> - <div class="column"> - <div class="card" title="<?= $pages["byfront"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/byfront" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/byfront.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["byfront"]["short"] ?></h6> - </a> - </div> - </div> - <div class="column"> - <div class="card" title="<?= $pages["bitset"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/bitset" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/bitset.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["bitset"]["short"] ?></h6> - </a> - </div> - </div> - <?php if ($viewingPonyHasSex): ?> - <div class="column"> - <div class="card" title="<?= $pages["toys"]["name"] ?>" data-bs-toggle="tooltip"> - <a href="/-/toys" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> - <img src="/assets/icons/toys.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name"><?= $pages["toys"]["short"] ?></h6> - </a> - </div> - </div> - <?php endif; ?> - </div> - - <hr> - <h4>Next fronters <span class="small"><a href="/-/fronting">(edit)</a></span></h4> - <?php - - $scheduleCloudburstToday = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-planner.json"), true)[date('Y-m-d')] ?? []; - $scheduleRaindropsToday = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-planner.json"), true)[date('Y-m-d')] ?? []; - - $scheduleCloudburstTomorrow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-planner.json"), true)[date('Y-m-d', time() + 86400)] ?? []; - $scheduleRaindropsTomorrow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-planner.json"), true)[date('Y-m-d', time() + 86400)] ?? []; - - $today1 = $_PROFILE["login"] === "raindrops" ? $scheduleRaindropsToday : $scheduleCloudburstToday; - $today2 = $_PROFILE["login"] === "raindrops" ? $scheduleCloudburstToday : $scheduleRaindropsToday; - $tomorrow1 = $_PROFILE["login"] === "raindrops" ? $scheduleRaindropsTomorrow : $scheduleCloudburstTomorrow; - $tomorrow2 = $_PROFILE["login"] === "raindrops" ? $scheduleCloudburstTomorrow : $scheduleRaindropsTomorrow; - - ?> - - <h5>Fronters today</h5> - <ul> - <?php foreach ($today1 as $index => $id): $member = getMemberWithoutSystem($id); ?> - <li> - <?php if ($member["name"] === "fusion"): ?> - <img alt="" src="/assets/logo/logo.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;">Merged members</span> - <?php else: ?> - <img alt="" src="/assets/uploads/pt-<?= $member["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <b style="vertical-align: middle;"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> - <?php endif; ?> - <?php if (isset($today2[$index])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $today2[$index]); ?><span style="vertical-align: middle;">with</span> <img alt="" src="/assets/uploads/pt-<?= $member2["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;"><?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span><?php endif; ?> - </li> - <?php endforeach; ?> - </ul> - - <h5>Fronters tomorrow</h5> - <ul> - <?php foreach ($tomorrow1 as $index => $id): $member = getSystemMember($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc", $id); ?> - <li> - <?php if ($member["name"] === "fusion"): ?> - <img alt="" src="/assets/logo/logo.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;">Merged members</span> - <?php else: ?> - <img alt="" src="/assets/uploads/pt-<?= $member["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <b style="vertical-align: middle;"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> - <?php endif; ?> - <?php if (isset($tomorrow2[$index])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $tomorrow2[$index]); ?><span style="vertical-align: middle;">with</span> <img alt="" src="/assets/uploads/pt-<?= $member2["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;"><?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span><?php endif; ?> - </li> - <?php endforeach; ?> - </ul> - - <hr> - <h4>Next events</h4> - <?php - - $cal = new IcalParser(); - $results = $cal->parseFile($_SERVER['DOCUMENT_ROOT'] . "/includes/data/calendar.ics"); - $events = []; - - foreach ($cal->getEvents()->sorted() as $event) { - $events[] = [ - "id" => $event['UID'], - "date" => [ - "created" => $event['CREATED']->format('c'), - "modified" => $event['LAST-MODIFIED']->format('c'), - "start" => $event['DTSTART']->format('c'), - "end" => $event['DTEND']->format('c'), - "duration" => strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')), - "full_day" => strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')) >= 86400, - "days" => ( - strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c')) >= 86400 ? - round((strtotime($event['DTEND']->format('c')) - strtotime($event['DTSTART']->format('c'))) / 86400) : - null - ) - ], - "name" => $event['SUMMARY'], - "description" => $event['DESCRIPTION'], - ]; - } - - $events = array_values(array_filter($events, function ($i) { - return ( - strtotime($i["date"]["end"]) > time() && - strtotime($i["date"]["start"]) < time() + 2629800 - ); - })); - - ?> - <ul> - <?php foreach ($events as $event): ?> - <li> - <?php if ($event["date"]["full_day"]): ?> - <b> - <?php if (strtotime($event["date"]["start"]) < time()): ?> - Started <?= timeAgo($event["date"]["start"]) ?>, ends <?= timeIn($event["date"]["end"]) ?> - <?php else: ?> - <?= ucfirst(relativeDate($event["date"]["start"], false)) ?> - <?php endif; ?> - · - </b> - <?php else: ?> - <b> - <?= ucfirst(relativeDate($event["date"]["start"])) ?> - · - </b> - <?php endif; ?> - for <?= duration($event["date"]["duration"]) ?> - · - <?= $event["name"] ?> - </li> - <?php endforeach; ?> - </ul> - </div> -</div> - -<style> - .peh-row { - display: grid; - grid-template-columns: repeat(9, 1fr); - } - - .column .card { - border-right: none !important; - border-radius: 0 !important; - } - - .column:nth-child(1) .card { - border-bottom-left-radius: 0.25rem !important; - border-top-left-radius: 0.25rem !important; - } - - .column:nth-last-child(1) .card { - border-right: 1px solid rgba(255, 255, 255, .125) !important; - border-bottom-right-radius: 0.25rem !important; - border-top-right-radius: 0.25rem !important; - } - - @media (max-width: 1199px) { - .app-name { - display: none; - } - } - - @media (max-width: 991px) { - .column { - padding-right: calc(var(--bs-gutter-x) * .25); - padding-left: calc(var(--bs-gutter-x) * .25); - } - } - - @media (max-width: 576px) { - .card-body { - padding: 0.5rem 0.5rem !important; - } - - .column { - padding-right: calc(var(--bs-gutter-x) * .175) !important; - padding-left: calc(var(--bs-gutter-x) * .175) !important; - } - } -</style> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> diff --git a/pages/debug.php b/pages/debug.inc index fdd6fec..77001d0 100644 --- a/pages/debug.php +++ b/pages/debug.inc @@ -1,14 +1,18 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; function itemToName(string $item): string { - if ($item === "docs_cleanup") return "Deleting scheduled documents"; - if ($item === "important_backup") return "Differential backups"; - if ($item === "restore") return "Failure protection"; - if ($item === "backups") return "Encrypted off-site backups"; - if ($item === "calendar") return "Google Calendar integration"; + if ($item === "docs_cleanup") return "Deleting scheduled documents"; + if ($item === "important_backup") return "Differential backups"; + if ($item === "restore") return "Failure protection"; + if ($item === "backups") return "Encrypted off-site backups"; + if ($item === "calendar") return "Google Calendar integration"; + if ($item === "version") return "Version information"; + if ($item === "logo") return "Website logo processing"; + if ($item === "favicons") return "Favicons processing"; + if ($item === "assets") return "External assets download"; if (str_starts_with($item, "system-")) { $system = explode("-", $item)[2]; @@ -50,6 +54,21 @@ function itemToName(string $item): string { <h2>Data updater debugging</h2> <p>This page provides debugging information to troubleshoot unexpectedly long update times or reported failures.</p> + <?php if (time() - $data["timestamp"] > 360): ?> + <div class="alert alert-warning"> + <p> + <b>The data is not updated periodically anymore.</b> + </p> + This can be due to multiple things: + <ul> + <li>the data updater has been disabled temporarily for maintenance;</li> + <li>the data updater cannot start on the server;</li> + <li>the server was down for an extended period of time</li> + </ul> + If you are an administrator and think this is not normal, you may investigate the issue. + </div> + <?php endif; ?> + <h4>General information</h4> <ul> <li><b>Update date:</b> <?php $dt = DateTime::createFromFormat('U.u', $data["timestamp"]); echo($dt->format("l j F Y, G:i:s.u T")); ?></li> @@ -93,4 +112,4 @@ function itemToName(string $item): string { } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/demo.php b/pages/demo.inc index 381a7e4..d469908 100644 --- a/pages/demo.php +++ b/pages/demo.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -$demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +$demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -12,19 +12,17 @@ $demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROO <div id="header" style="text-align: center;"> <img alt="" src="/assets/uploads/raindrops.png" style="width:128px;"> <h3>Raindrops System</h3> - <p>Système plural de <?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)) - 1 ?> poneys</p> + <p>Système plural de <?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)) - 2 ?> poneys</p> <hr> </div> <div id="list"> - <p>Cliquez sur quelqu'un pour avoir plus d'information sur elle.</p> <div class="list-group"> - <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd") as $member): ?> + <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd") as $member): ?> <a onclick="showMember('<?= $member["id"] ?>');" class="list-group-item"> - <img src="/assets/uploads/pt-<?= $member["name"] ?>.png" style="width:32px;vertical-align: middle;"> + <img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:32px;vertical-align: middle;"> <span style="vertical-align: middle;margin-left: 5px;"> - <b><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> - <?= $member["_metadata"]["host"] ? "(hôte)" : "" ?><?= $member["_metadata"]["protector"] ? "(protectrice)" : "" ?><?= $member["_metadata"]["little"] === 2 ? (isset($member["_metadata"]["median"]) ? "(" . getMiniName(getSystemMember("gdapd", $member["_metadata"]["median"])["display_name"]) . " régressée en âge)" : "(petite)") : "" ?> + <b><?= $member["display_name"] ?? $member["name"] ?></b> </span> </a> <?php endforeach; ?> @@ -45,7 +43,7 @@ $demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROO </div> <div class="modal-body"> - <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd") as $member): ?> + <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd") as $member): ?> <div class="modal-member-content" id="modal-member-content-<?= $member["id"] ?>"> <script> <?php global $memberData; $memberData = $member; ?> @@ -106,7 +104,7 @@ $demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROO </style> <script> - window._phpMembers = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd")))) ?>`)); + window._phpMembers = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd")))) ?>`)); window.members = {}; for (let member of window._phpMembers) { @@ -128,4 +126,4 @@ $demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROO } </script> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/disclaimers.php b/pages/disclaimers.inc index b47e33a..ae3d04e 100644 --- a/pages/disclaimers.php +++ b/pages/disclaimers.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -12,4 +12,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/docs.php b/pages/docs.inc index bbc3054..f893e95 100644 --- a/pages/docs.php +++ b/pages/docs.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.php"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $_PROFILE; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.inc"; $parts = explode("/", $_GET['_']); $select = $parts[2] ?? null; @@ -32,7 +32,7 @@ if ($select === "add") { } } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -358,4 +358,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/edit-private.php b/pages/edit-private.inc index ac93e06..880effe 100644 --- a/pages/edit-private.php +++ b/pages/edit-private.inc @@ -13,7 +13,7 @@ function getSubsystemByID(string $id) { return $subsystem; } -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); @@ -27,13 +27,13 @@ if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?err $systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; -$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystems.json"), true) ?? []; +$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? []; if ($member === null) { header("Location: /?error=Unsupported target: system") and die(); } else { $isSubsystem = false; - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); $memberData = null; $memberCommonName = null; $memberID = null; @@ -53,16 +53,16 @@ if ($member === null) { $isSubsystem = true; $subsystemID = $member; $subsystem = getSubsystemByID($subsystemID); - $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystem[source].json"), true); + $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json"), true); $subsystemCommonName = $subsystemData["name"] ?? $subsystemID; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.inc'; } else { header("Location: /?error=System member or subsystem not found") and die(); } } - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit-private.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit-private.inc'; } exit;
\ No newline at end of file diff --git a/pages/edit.php b/pages/edit.inc index 8e6de91..8be6730 100644 --- a/pages/edit.php +++ b/pages/edit.inc @@ -13,7 +13,7 @@ function getSubsystemByID(string $id) { return $subsystem; } -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); @@ -27,13 +27,13 @@ if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?err $systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; -$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystems.json"), true) ?? []; +$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? []; if ($member === null) { - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.inc'; } else { $isSubsystem = false; - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); $memberData = null; $memberCommonName = null; $memberID = null; @@ -53,16 +53,16 @@ if ($member === null) { $isSubsystem = true; $subsystemID = $member; $subsystem = getSubsystemByID($subsystemID); - $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystem[source].json"), true); + $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json"), true); $subsystemCommonName = $subsystemData["name"] ?? $subsystemID; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.inc'; } else { header("Location: /?error=System member or subsystem not found: " . $subsystemID) and die(); } } - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit.inc'; } exit;
\ No newline at end of file diff --git a/pages/emergency.php b/pages/emergency.inc index 55ed49a..c13a62e 100644 --- a/pages/emergency.php +++ b/pages/emergency.inc @@ -1,15 +1,15 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> <br> <div class="container"> <div id="page-content"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/emergency.php"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/emergency.inc"; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/fronting.php b/pages/fronting.inc index 3e613c6..c1d8ead 100644 --- a/pages/fronting.php +++ b/pages/fronting.inc @@ -1,15 +1,15 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> <br> <div class="container"> <div> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/planner.php"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/planner.inc"; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/government.inc b/pages/government.inc new file mode 100644 index 0000000..4698c55 --- /dev/null +++ b/pages/government.inc @@ -0,0 +1,142 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; + +?> + +<br> +<div class="container"> + <div> + <h2>Cold Haze Government</h2> + <?php + + $members = scoreOrderGlobal(); + $zzise = getMemberWithoutSystem("zzise"); + $auvwc = getMemberWithoutSystem("auvwc"); + $qbzxm = getMemberWithoutSystem("qbzxm"); + $vncoa = getMemberWithoutSystem("vncoa"); + $qraku = getMemberWithoutSystem("qraku"); + $ghrby = getMemberWithoutSystem("ghrby"); + + ?> + + <div title="<b>System Council</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#222; padding: 10px; margin-top: 15px;"> + <b>Systems Council</b> + <div style="margin-top: 10px; display: flex; justify-content: center;"> + <a class="gov-link" href="/<?= $ghrby["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 10px;"> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "ghrby") ?>"><br> + <?= $ghrby["display_name"] ?> + </div></a> + <a class="gov-link" href="/<?= $auvwc["name"] ?>" style="color: white !important; text-decoration: none;"><div style=" margin-right: auto;"> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "auvwc") ?>"><br> + <?= $auvwc["display_name"] ?> + </div></a> + </div> + </div> + <div style="display: grid; grid-template-columns: 1fr 1px 1fr; grid-column-gap: 15px; margin-top: 15px;"> + <div> + <p style="text-align: center;"> + <img style="width: 24px; vertical-align: middle;" src="/assets/uploads/cloudburst.png"> + <b style="vertical-align: middle;">Cloudburst System</b> + </p> + <div style="display: grid; grid-template-columns: 1.5fr 1fr; grid-column-gap: 15px;"> + <div title="<b>Head of System Operations</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#023100; padding: 10px;"> + <b><span class="list-separator-mobile">H. S. O.</span><span class="list-separator-desktop">Head of System Operations</span></b> + <div style="margin-top: 10px; display: flex; justify-content: center;"> + <a class="gov-link" href="/<?= $ghrby["name"] ?>" style="color: white !important; text-decoration: none;"><div> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "ghrby") ?>"> + <span class="list-separator-desktop"><br><?= $ghrby["display_name"] ?></span> + </div></a> + </div> + </div> + <div title="<b>Primary Protector</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#002d31; padding: 10px;"> + <b><span class="list-separator-mobile">P. P.</span><span class="list-separator-desktop">Primary Protector</span></b> + <div style="margin-top: 10px; display: flex; justify-content: center;"> + <a class="gov-link" href="/<?= $zzise["name"] ?>" style="color: white !important; text-decoration: none;"><div> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "zzise") ?>"> + <span class="list-separator-desktop"><br><?= $zzise["display_name"] ?></span> + </div></a> + </div> + </div> + </div> + </div> + <div style="background:rgba(255, 255, 255, .2);"></div> + <div> + <p style="text-align: center;"> + <img style="width: 24px; vertical-align: middle;" src="/assets/uploads/raindrops.png"> + <b style="vertical-align: middle;">Raindrops System</b> + </p> + <div style="display: grid; grid-template-columns: 1.5fr 1fr; grid-column-gap: 15px;"> + <div title="<b>Head of System Operations</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#023100; padding: 10px;"> + <b><span class="list-separator-mobile">H. S. O.</span><span class="list-separator-desktop">Head of System Operations</span></b> + <div style="margin-top: 10px; display: flex; justify-content: center;"> + <a class="gov-link" href="/<?= $auvwc["name"] ?>" style="color: white !important; text-decoration: none;"><div> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "auvwc") ?>"> + <span class="list-separator-desktop"><br><?= $auvwc["display_name"] ?></span> + </div></a> + </div> + </div> + <div title="<b>Primary Protector</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#002d31; padding: 10px;"> + <b><span class="list-separator-mobile">P. P.</span><span class="list-separator-desktop">Primary Protector</span></b> + <div style="margin-top: 10px; display: flex; justify-content: center;"> + <a class="gov-link" href="/<?= $qbzxm["name"] ?>" style="color: white !important; text-decoration: none;"><div> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "qbzxm") ?>"> + <span class="list-separator-desktop"><br><?= $qbzxm["display_name"] ?></span> + </div></a> + </div> + </div> + </div> + </div> + </div> + <div style="display: grid; grid-template-columns: 1fr 1px 1fr; grid-column-gap: 15px;"> + <div title="<b>Protectors</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="margin-top: 15px;"> + <div style="text-align: center;border-radius:10px;background:#311a00; padding: 10px;"> + <b>Protectors</b> + <div style="margin-top: 10px; display: flex; justify-content: center;"> + <a class="gov-link" href="/<?= $zzise["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 20px;"> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "zzise") ?>"> + <span class="list-separator-desktop"><br><?= $zzise["display_name"] ?></span> + </div></a> + <a class="gov-link" href="/<?= $vncoa["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 20px;"> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "vncoa") ?>"> + <span class="list-separator-desktop"><br><?= $vncoa["display_name"] ?></span> + </div></a> + </div> + </div> + </div> + <div style="background:rgba(255, 255, 255, .2);"></div> + <div title="<b>Protectors</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="margin-top: 15px;"> + <div style="text-align: center;border-radius:10px;background:#311a00; padding: 10px;"> + <b>Protectors</b> + <div style="margin-top: 10px; display: flex; justify-content: center;"> + <a class="gov-link" href="/<?= $qbzxm["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 20px;"> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "qbzxm") ?>"> + <span class="list-separator-desktop"><br><?= $qbzxm["display_name"] ?></span> + </div></a> + <a class="gov-link" href="/<?= $qraku["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 20px;"> + <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "qraku") ?>"> + <span class="list-separator-desktop"><br><?= $qraku["display_name"] ?></span> + </div></a> + </div> + </div> + </div> + </div> + </div> +</div> + +<style> + .gov-link:hover { + opacity: .75; + } + + .gov-link:active { + opacity: .5; + } + + .gov-link:focus { + opacity: .5; + } +</style> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/home.php b/pages/home.inc index a2fe0c3..4f4b0f6 100644 --- a/pages/home.php +++ b/pages/home.inc @@ -1,4 +1,4 @@ -<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; ?> <br> <div class="container"> @@ -9,11 +9,17 @@ </div> <?php endif; ?> + <?php if ($readOnly && $isNormallyLoggedIn): ?> + <div class="alert alert-warning"> + <b>Notice: </b>This website is temporarily under maintenance and the administrators have locked the database. Although you are logged in as <?= $_PROFILE['name'] ?>, you cannot access any of the logged-in features while the website is under maintenance. <a href="/-/emergency">Alerts dispatching</a> remains possible in case of an emergency. + </div> + <?php endif; ?> + <?php global $travelling; if (!isset($_GET['legacy'])): $byColor = getMembersByColor(); ?> <div style="text-align: center;"> - <img alt="" src="/assets/logo/logo.png" style="width:128px;"> + <img alt="" src="/assets/logo/newlogo.png" style="width:128px;"> <p style="z-index:999;position:relative;background:black;margin: 20px -10px 0 -20px;padding-right:30px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> - <?php foreach ($byColor as $member): ?><a data-bs-html="true" class="rainbow-item tooltip-nohelp" title="<b><?= $member["display_name"] ?? $member["name"] ?></b><br><?= ($travelling[$member['id']]["travelling"] ? $member["_system"] === "ynmuc" : $member["_system"] === "gdapd") ? "Raindrops System" : "Cloudburst System" ?>" data-bs-toggle="tooltip" style="overflow: hidden;" href="/<?= $member["name"] ?>"><img src="/assets/uploads/pt-<?= $member["name"] ?>.png" style="width:32px;height:32px;position:absolute;z-index:99;"></a><?php endforeach; ?> + <?php foreach ($byColor as $member): ?><a data-bs-html="true" class="rainbow-item tooltip-nohelp" title="<b><?= $member["display_name"] ?? $member["name"] ?></b><br><?= ($travelling[$member['id']]["travelling"] ? $member["_system"] === "ynmuc" : $member["_system"] === "gdapd") ? "Raindrops System" : "Cloudburst System" ?>" data-bs-toggle="tooltip" style="overflow: hidden;" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="width:32px;height:32px;position:absolute;z-index:99;"></a><?php endforeach; ?> </p> <div style="margin-top:-33px;margin-bottom:0;margin-left:-20px;margin-right:20px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> <?php foreach ($byColor as $member): ?><div> @@ -64,4 +70,4 @@ </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/pages/login.php b/pages/login.inc index ebae1ae..ffbe2d7 100644 --- a/pages/login.php +++ b/pages/login.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; ?> @@ -9,6 +9,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <div class="container"> <div> <h2>Login</h2> + <?php if ($readOnly): ?> + <div class="alert alert-warning"> + <b>Login is temporarily disabled. </b>Login on this website has been temporarily disabled by the administrators for maintenance purposes. + </div> + <?php else: ?> <?php global $isLoggedIn; if ($isLoggedIn): ?> <div class="alert alert-warning"> <b>You are already logged in.</b> If you want to login to a different account or using a different authentication method, you may do so now. @@ -37,7 +42,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </div> </div> </div> + <?php endif; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/logout.php b/pages/logout.inc index 0263278..0263278 100644 --- a/pages/logout.php +++ b/pages/logout.inc diff --git a/pages/nicknames.php b/pages/nicknames.inc index 4c06818..434477f 100644 --- a/pages/nicknames.php +++ b/pages/nicknames.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; $members = scoreOrderGlobal(); $relations = []; @@ -45,14 +45,14 @@ foreach ($members as $member) { "name" => getMiniName($member["display_name"] ?? $member["name"]) . " and " . getMiniName($otherMember["display_name"] ?? $otherMember["name"]), "type" => $rel["type"], "images" => [ - file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-$member[name].png") ? "/assets/uploads/pt-$member[name].png" : "/assets/uploads/pt.png", - file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-$otherMember[name].png") ? "/assets/uploads/pt-$otherMember[name].png" : "/assets/uploads/pt.png", + getAsset($member['system'], $member["id"], "heads"), + getAsset($otherMember['system'], $otherMember["id"], "heads") ] ]; } } -$nicknames = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/nicknames.json"), true); +$nicknames = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/nicknames/nicknames.json"), true); ?> @@ -112,4 +112,4 @@ $nicknames = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/include } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/page.php b/pages/page.inc index cab5dcd..22291e2 100644 --- a/pages/page.php +++ b/pages/page.inc @@ -1,6 +1,6 @@ <?php -$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); +$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); $parts = explode("/", $_GET['_']); @@ -8,10 +8,10 @@ $parts = explode("/", $_GET['_']); if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops") && (!(count($parts) > 2) || $parts[1] === "-")) { $namesCloudburst = [...array_map(function ($i) { return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true)), "unknown-cb"]; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true)), "unknown-cb"]; $namesRaindrops = [...array_map(function ($i) { return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)), "unknown-rd"]; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)), "unknown-rd"]; $parts = explode("/", $_GET['_']); array_unshift($parts, ""); @@ -36,12 +36,12 @@ $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; if ($member === null) { global $_SystemName; $_SystemName = $system; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system.inc'; } else if ($member === "-" && isset($parts[2])) { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.php')) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.inc')) { global $_SystemPage; $_SystemPage = $parts[2]; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.inc'; } else { header("Location: /?error=Page not found: " . $parts[2]) and die(); } @@ -49,8 +49,8 @@ if ($member === null) { $memberFoundInAnotherSystem = false; $traveller = false; - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-members.json"), true); - $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "-members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); + $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true); $memberData = null; $memberCommonName = null; $memberID = null; @@ -84,10 +84,10 @@ if ($member === null) { } if (isset($parts[2]) && $parts[2] === "-" && isset($parts[3])) { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.php')) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.inc')) { global $_MemberPage; $_MemberPage = $parts[3]; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.inc'; } else { header("Location: /?error=Page not found: " . $parts[3]) and die(); } @@ -96,7 +96,7 @@ if ($member === null) { global $_MemberName; $_MemberName = $member; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member.php'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member.inc'; } exit;
\ No newline at end of file diff --git a/pages/parser.php b/pages/parser.inc index 1c3dea4..dc07744 100644 --- a/pages/parser.php +++ b/pages/parser.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -80,8 +80,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; let existing = <?php - $existing1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true); - $existing2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true); + $existing1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true); + $existing2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true); echo(json_encode([ "cloudburst" => $existing1, @@ -93,11 +93,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; let host = { raindrops: "<?php - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true); foreach ($members as $member) { - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json")) continue; + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json")) continue; - $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); + $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); if ($data["host"]) { echo $member['id']; } @@ -106,11 +106,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?>", cloudburst: "<?php - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true); foreach ($members as $member) { - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json")) continue; + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json")) continue; - $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); + $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); if ($data["host"]) { echo $member['id']; } @@ -252,4 +252,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/pleasure.php b/pages/pleasure.inc index 14b5440..f59d187 100644 --- a/pages/pleasure.php +++ b/pages/pleasure.inc @@ -1,15 +1,15 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> <br> <div class="container"> <div id="page-content"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/pleasure.php"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/pleasure.inc"; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/prefix.php b/pages/prefix.inc index 2b1149b..d7d8a40 100644 --- a/pages/prefix.php +++ b/pages/prefix.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -52,7 +52,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; let existing = <?php $existing1 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { if ($member["name"] !== "unknown") { foreach ($member['proxy_tags'] as $tag) { if (!$tag["prefix"]) { @@ -68,7 +68,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; $existing2 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown") { foreach ($member['proxy_tags'] as $tag) { if (!$tag["prefix"]) { @@ -92,7 +92,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; let prefixesUsedBy = <?php $existing1 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { if ($member["name"] !== "unknown") { foreach ($member['proxy_tags'] as $tag) { if (!$tag["prefix"]) { @@ -108,7 +108,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; $existing2 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown") { foreach ($member['proxy_tags'] as $tag) { if (!$tag["prefix"]) { @@ -413,6 +413,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; let index = 1; for (let prefix of generated) { + if (prefix.prefix === "n." || prefix.prefix === "g.") continue; + html.push(`<li><code data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right" title="<b>Prefix:</b> <code>${prefix.prefix}</code><br><b>Score:</b> ${((1 - (index/generated.length))*100).toFixed(2)}%<hr><div class='text-peh-nowrap'>- ${prefix.rules.join("</div><div class='text-peh-nowrap'>- ")}</div><hr><div class='text-peh-nowrap'>- <span class='text-${existing["cloudburst"].includes(prefix.prefix) ? "danger" : "success"}'>Cloudburst</span> ${existing["cloudburst"].includes(prefix.prefix) ? ` (${prefixesUsedBy["cloudburst"][prefix.prefix]})` : ""}</div><div class='text-peh-nowrap'>- <span class='text-${existing["raindrops"].includes(prefix.prefix) ? "danger" : "success"}'>Raindrops</span> ${existing["raindrops"].includes(prefix.prefix) ? ` (${prefixesUsedBy["raindrops"][prefix.prefix]})` : ""}">${prefix.prefix}</code></li>`); index++; @@ -446,4 +448,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/relations.php b/pages/relations.inc index aac2839..80520da 100644 --- a/pages/relations.php +++ b/pages/relations.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -12,7 +12,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): if (count($member["_metadata"]["marefriends"]) > 0 || count($member["_metadata"]["sisters"]) > 0): ?> <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1.5fr <?= $member["_metadata"]["little"] === 2 ? "2fr 2fr 2fr" : "3fr 3fr" ?>;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <table class="relation-item relation-item-marefriends" style="margin-left:10px;padding:0 20px;"> @@ -25,7 +25,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <span class="text-muted">None</span> <?php else: ?> <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> - <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"></a> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> <?php endforeach; ?> <?php endif; ?> </td> @@ -42,7 +42,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <span class="text-muted">None</span> <?php else: ?> <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> - <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"></a> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> <?php endforeach; ?> <?php endif; ?> </td> @@ -60,7 +60,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <span class="text-muted">None</span> <?php else: ?> <?php foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> - <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"></a> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> <?php endforeach; ?> <?php endif; ?> </td> @@ -102,4 +102,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/rules.php b/pages/rules.inc index 9148d89..21ae7e6 100644 --- a/pages/rules.php +++ b/pages/rules.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; if (isset($_POST["updateRules"])) { header("Content-Type: text/plain"); @@ -28,13 +28,13 @@ if (isset($_POST["updateRules"])) { $_POST["payload"][$index] = $rule; } - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules.json", utf8_encode(json_encode($_POST["payload"]))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules/rules.json", utf8_encode(json_encode($_POST["payload"]))); header("Location: /-/rules"); die(); } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -46,7 +46,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <?php - $rules = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules.json"), true); + $rules = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules/rules.json"), true); $protectorCloudburst = array_values(array_filter(scoreOrderGlobal(), function ($i) { return $i["_system"] === "ynmuc" && $i["_metadata"]["protector"]; @@ -72,7 +72,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </summary> <?php if (in_array(false, $rule["approved"])): ?> <div style="margin-top:10px;" class="alert alert-warning"> - <b>This rule has not yet been approved.</b> All rules need to be approved by the primary protectors from both systems. This rule is still missing approval from <?php + <b>This rule has not yet been approved.</b> All rules need to be approved by the leaders from both systems. This rule is still missing approval from <?php if ($rule["approved"][0] === false) { if ($rule["approved"][1] === false) { @@ -250,4 +250,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/score.php b/pages/score.inc index 370d757..e04f9e7 100644 --- a/pages/score.php +++ b/pages/score.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -13,10 +13,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <h4>Raindrops System (<code><?php $scores = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = $score["total"]; @@ -27,18 +27,18 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; return $a + $b; }); - echo round($total / (count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)) - 1)); + echo round($total / (count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)) - 1)); ?></code>)</h4> <ul> <?php $scores = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = [ @@ -70,10 +70,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <h4>Cloudburst System (<code><?php $scores = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = $score["total"]; @@ -84,18 +84,18 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; return $a + $b; }); - echo round($total / (count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true)) - 1)); + echo round($total / (count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true)) - 1)); ?></code>)</h4> <ul> <?php $scores = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = [ @@ -126,19 +126,19 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; <h4>Global (<code><?php $scores = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = $score["total"]; } } - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = $score["total"]; @@ -149,18 +149,18 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; return $a + $b; }); - echo round($total / ((count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)) + count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true))) - 2)); + echo round($total / ((count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)) + count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true))) - 2)); ?></code>)</h4> <ul> <?php $scores = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = [ @@ -171,11 +171,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ]; } } - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); $scores[] = [ @@ -205,4 +205,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/splitting.php b/pages/splitting.inc index d50ede8..1ea2d70 100644 --- a/pages/splitting.php +++ b/pages/splitting.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -14,7 +14,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; }); foreach ($members as $member): ?> <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($member["system"], $member["system"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;"> @@ -52,4 +52,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/stats.inc b/pages/stats.inc new file mode 100644 index 0000000..19d4453 --- /dev/null +++ b/pages/stats.inc @@ -0,0 +1,441 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; + +$switchesRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/switches.json"), true); +$switchesCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/switches.json"), true); + +?> + +<script src="/assets/editor/chart.js"></script> + +<br> +<div class="container"> + <div id="page-content"> + <h2>Statistics</h2> + <?php + + $weeks = []; + $weeksRectified = []; + + $lastWeek = 0; + foreach ($switchesRaindrops as $switch) { + $week = date('YW', strtotime($switch["timestamp"])); + if ($lastWeek === 0) $lastWeek = $week; + + if (!isset($weeks[$week])) $weeks[$week] = [ + "cloudburst" => 0, + "raindrops" => 0, + "total" => 0, + "end" => strtotime($switch["timestamp"]), + "start" => null + ]; + + if ($week !== $lastWeek) { + if (isset($weeks[$lastWeek])) { + $weeks[$lastWeek]["start"] = strtotime($switch["timestamp"]); + $lastWeek = $week; + } + } + + $weeks[$week]["raindrops"]++; + $weeks[$week]["total"]++; + } + + $lastWeek = 0; + foreach ($switchesCloudburst as $switch) { + $week = date('YW', strtotime($switch["timestamp"])); + if ($lastWeek === 0) $lastWeek = $week; + + if (!isset($weeks[$week])) $weeks[$week] = [ + "cloudburst" => 0, + "raindrops" => 0, + "total" => 0, + "end" => strtotime($switch["timestamp"]), + "start" => null + ]; + + if ($week !== $lastWeek) { + if (isset($weeks[$lastWeek])) { + $weeks[$lastWeek]["start"] = strtotime($switch["timestamp"]); + $lastWeek = $week; + } + } + + $weeks[$week]["cloudburst"]++; + $weeks[$week]["total"]++; + } + + $index = 0; + foreach ($weeks as $id => $week) { + if ($index >= 20) continue; + $weeksRectified[$id] = $week; + $index++; + } + + $weeksRectified = array_filter(array_reverse($weeksRectified), function ($i) { + return $i["start"] > 1651363200; + }); + + $members = []; + $frontersMonth = []; + + $fronts = []; + $lastFrontIDs = []; + + foreach (array_reverse($switchesRaindrops) as $switch) { + foreach ($lastFrontIDs as $frontID) { + $fronts[$frontID]["end"] = strtotime($switch["timestamp"]); + } + $lastFrontIDs = []; + + $index = 0; foreach ($switch["members"] as $member) { + if (strtotime($switch["timestamp"]) - (time() - 86400*30) < 0) continue; + $fronts[$switch["id"] . ":" . $index] = [ + "member" => $member, + "start" => strtotime($switch["timestamp"]), + "end" => strtotime(date('c')), + "duration" => null + ]; + $lastFrontIDs[] = $switch["id"] . ":" . $index; + } $index++; + } + + foreach ($fronts as $id => $front) { + $fronts[$id]["duration"] = $front["end"] - $front["start"]; + + if (!($front["start"] - (time() - 86400*30) < 0)) { + if (!isset($members[$front["member"]])) $members[$front["member"]] = [ + "time" => 0, + "name" => getMemberWithoutSystem($front["member"])["display_name"], + "color" => getMemberWithoutSystem($front["member"])["color"], + ]; + $members[$front["member"]]["time"] += $fronts[$id]["duration"]; + } + } + + foreach ($fronts as $front) { + if (!isset($frontersMonth[date('Y-m', $front["start"])])) $frontersMonth[date('Y-m', $front["start"])] = []; + if (!isset($frontersMonth[date('Y-m', $front["start"])][$front["member"]])) $frontersMonth[date('Y-m', $front["start"])][$front["member"]] = 0; + $frontersMonth[date('Y-m', $front["start"])][$front["member"]] += $front["duration"]; + } + + $fronts = []; + $lastFrontIDs = []; + + foreach (array_reverse($switchesCloudburst) as $switch) { + foreach ($lastFrontIDs as $frontID) { + $fronts[$frontID]["end"] = strtotime($switch["timestamp"]); + } + $lastFrontIDs = []; + + $index = 0; foreach ($switch["members"] as $member) { + $fronts[$switch["id"] . ":" . $index] = [ + "member" => $member, + "start" => strtotime($switch["timestamp"]), + "end" => strtotime(date('c')), + "duration" => null + ]; + $lastFrontIDs[] = $switch["id"] . ":" . $index; + } $index++; + } + + foreach ($fronts as $id => $front) { + $fronts[$id]["duration"] = $front["end"] - $front["start"]; + + if (!($front["start"] - (time() - 86400*30) < 0)) { + if (!isset($members[$front["member"]])) $members[$front["member"]] = [ + "time" => 0, + "name" => getMemberWithoutSystem($front["member"])["display_name"], + "color" => getMemberWithoutSystem($front["member"])["color"], + ]; + $members[$front["member"]]["time"] += $fronts[$id]["duration"]; + } + } + + foreach ($fronts as $front) { + if (!isset($frontersMonth[date('Y-m', $front["start"])])) $frontersMonth[date('Y-m', $front["start"])] = []; + if (!isset($frontersMonth[date('Y-m', $front["start"])][$front["member"]])) $frontersMonth[date('Y-m', $front["start"])][$front["member"]] = 0; + $frontersMonth[date('Y-m', $front["start"])][$front["member"]] += $front["duration"]; + } + + $fronts = array_reverse($fronts); + uasort($members, function ($a, $b) { + return $b["time"] - $a["time"]; + }); + + $frontersMonthRectified = []; + foreach ($frontersMonth as $monthID => $month) { + $thisMonth = []; + + foreach ($month as $id => $time) { + $thisMonth[$id] = [ + "duration" => $time, + "name" => getMemberWithoutSystem($id)["display_name"], + "color" => getMemberWithoutSystem($id)["color"] + ]; + } + + $frontersMonthRectified[$monthID] = $thisMonth; + } + + uasort($frontersMonthRectified, function ($a, $b) use ($frontersMonthRectified) { + return strtotime(array_search($a, $frontersMonthRectified) . "-01") - strtotime(array_search($b, $frontersMonthRectified) . "-01"); + }); + + $frontersMonthMembers = []; + foreach ($frontersMonthRectified as $month => $fronters) { + foreach ($fronters as $fronter => $data) { + foreach (scoreOrderGlobal() as $member) { + if (!isset($frontersMonthMembers[$member["id"]])) $frontersMonthMembers[$member["id"]] = []; + } + } + + foreach ($frontersMonthMembers as $key => $member) { + $frontersMonthMembers[$key][$month] = $frontersMonthRectified[$month][$key] ?? [ + "duration" => 0 + ]; + /*$frontersMonthMembers[$key][$month] = array_map(function ($i) { + return $i["duration"]; + }, $frontersMonthMembers[$key][$month]);*/ + } + } + + ?> + + <h3>Switches per week</h3> + <canvas id="graph-00" style="width: 100%; height: 300px; max-height: 100%;"></canvas> + <script> + const ctx0 = document.getElementById('graph-00').getContext('2d'); + window.chart00 = [ + { + label: "Raindrops System", + data: JSON.parse(`<?= json_encode(array_map(function ($i) { + return $i["raindrops"]; + }, array_values($weeksRectified))) ?>`), + borderColor: "#e598ff" + }, + { + label: "Cloudburst System", + data: JSON.parse(`<?= json_encode(array_map(function ($i) { + return $i["cloudburst"]; + }, array_values($weeksRectified))) ?>`), + borderColor: "#98e0ff" + }, + { + label: "All systems", + data: JSON.parse(`<?= json_encode(array_map(function ($i) { + return $i["total"]; + }, array_values($weeksRectified))) ?>`), + borderColor: "rgba(160,255,153,0.5)", + borderDash: [5] + } + ]; + const graph0 = new Chart(ctx0, { + type: 'line', + data: { + labels: JSON.parse(`<?= json_encode(array_map(function ($i) { + return date("M d", $i["start"]) . " to " . date("M d", $i["end"]); + }, array_values($weeksRectified))) ?>`), + datasets: window.chart00 + }, + options: { + animation: { + duration: 0 + }, + scales: { + y: { + beginAtZero: true, + grid: { + color: "rgba(255,255,255,0.25)" + } + } + }, + plugins: { + legend: { + display: false + }, + tooltip: { + intersect: false + } + } + } + }); + </script> + + <br> + <h3>Time at front in the last 30 days</h3> + <canvas id="graph-01" style="width: 100%; height: 300px; max-height: 100%;"></canvas> + <script> + function toDuration(seconds, remainder) { + if (seconds > 60) { + if (seconds > 3600) { + if (seconds > 86400) { + if (remainder) { + return Math.floor(seconds / 86400) + " d. " + Math.floor((seconds / 3600) - Math.floor(seconds / 86400) * 24) + " hr. " + Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) / 60) + " min. " + Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) - (Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) / 60)) * 60) + " sec."; + } else { + return Math.round(seconds / 86400) + " d."; + } + } else { + if (remainder) { + return Math.floor(seconds / 3600) + " hr. " + Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) / 60) + " min. " + Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) - (Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) / 60)) * 60) + " sec."; + } else { + return Math.round(seconds / 3600) + " hr."; + } + } + } else { + if (remainder) { + return Math.round(seconds / 60) + " min. " + Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) - (Math.floor((seconds - (Math.floor(seconds / 3600) * 3600)) / 60)) * 60) + " sec."; + } else { + return Math.round(seconds / 60) + " min."; + } + } + } else { + return seconds + " sec."; + } + } + + const ctx1 = document.getElementById('graph-01').getContext('2d'); + window.graph01 = { + label: "Members", + data: JSON.parse(`<?= json_encode(array_map(function ($i) { + return $i["time"]; + }, array_values($members))) ?>`), + backgroundColor: JSON.parse(`<?= json_encode(array_map(function ($i) { + return "#" . $i["color"] . "33"; + }, array_values($members))) ?>`), + borderColor: JSON.parse(`<?= json_encode(array_map(function ($i) { + return "#" . $i["color"]; + }, array_values($members))) ?>`), + borderWidth: 1 + }; + const graph1 = new Chart(ctx1, { + type: 'bar', + data: { + labels: JSON.parse(`<?= json_encode(array_map(function ($i) { + return $i["name"]; + }, array_values($members))) ?>`), + datasets: [ + window.graph01 + ] + }, + options: { + animation: { + duration: 0 + }, + scales: { + y: { + beginAtZero: true, + ticks: { + callback: function(label) { + return toDuration(label); + } + } + }, + x: { + grid: { + color: "rgba(255,255,255,0.25)" + } + } + }, + elements: { + point:{ + radius: 0 + } + }, + plugins: { + legend: { + display: false + }, + tooltip: { + callbacks: { + label: function(tooltipItem) { + return toDuration(tooltipItem.raw, true); + } + } + } + } + } + }); + </script> + + <br> + <h3>Time at front per month</h3> + <canvas id="graph-02" style="width: 100%; height: 300px; max-height: 100%;"></canvas> + <script> + const ctx2 = document.getElementById('graph-02').getContext('2d'); + window.chart02 = JSON.parse(`<?= json_encode(array_values(array_map(function ($i) use ($frontersMonthMembers) { + $name = getMemberWithoutSystem(array_search($i, $frontersMonthMembers))["name"]; + $month = (int)implode("-", explode("-", array_search($i, $frontersMonthMembers))); + + $k = array_filter($i, function ($i) { + return isset($i["name"]) && isset($i["color"]); + }); + + if (count($k) > 0) { + return [ + "label" => $k[array_keys($k)[0]]["name"], + "data" => array_values(array_map(function ($j) use ($name, $month) { + return $name === "twilight" && $month < 202208 ? 0 : $j["duration"]; + }, $i)), + "borderColor" => "#" . $k[array_keys($k)[0]]["color"] + ]; + } else { + return [ + "label" => getMemberWithoutSystem(array_search($i, $frontersMonthMembers))["display_name"], + "data" => array_values(array_map(function ($j) { + return $j["duration"]; + }, $i)), + "borderColor" => "#" . getMemberWithoutSystem(array_search($i, $frontersMonthMembers))["color"] + ]; + } + }, $frontersMonthMembers))) ?>`); + console.log(JSON.parse(`<?= json_encode(array_map(function ($i) { + return date("M Y", strtotime($i . "-00T00:00:00.000Z")); + }, array_keys($frontersMonthRectified))) ?>`)); + const graph2 = new Chart(ctx2, { + type: 'line', + data: { + labels: JSON.parse(`<?= json_encode(array_map(function ($i) { + return date("M Y", strtotime($i . "-00T00:00:00.000Z")); + }, array_keys($frontersMonthRectified))) ?>`), + datasets: window.chart02 + }, + options: { + animation: { + duration: 0 + }, + scales: { + y: { + beginAtZero: true, + grid: { + color: "rgba(255,255,255,0.25)" + }, + ticks: { + callback: function(label) { + return toDuration(label); + } + } + } + }, + plugins: { + legend: { + display: false + }, + tooltip: { + intersect: false, + callbacks: { + label: function(tooltipItem) { + return tooltipItem.dataset.label + ": " + toDuration(tooltipItem.raw, true); + } + } + } + } + } + }); + </script> + </div> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/terminology.php b/pages/terminology.inc index 955e470..c115bcf 100644 --- a/pages/terminology.php +++ b/pages/terminology.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -12,4 +12,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/pages/together-dev.php b/pages/together-dev.inc index d85cfe5..6ea9704 100644 --- a/pages/together-dev.php +++ b/pages/together-dev.inc @@ -1,4 +1,4 @@ <?php global $WebSocketAddress; $WebSocketAddress = "ws://localhost:22666"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/together.php";
\ No newline at end of file +require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/together.inc";
\ No newline at end of file diff --git a/pages/together.php b/pages/together.inc index 65786f5..87faf6a 100644 --- a/pages/together.php +++ b/pages/together.inc @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $WebSocketAddress; diff --git a/pages/toys.php b/pages/toys.inc index e0fb1fe..8e9ba57 100644 --- a/pages/toys.php +++ b/pages/toys.inc @@ -1,9 +1,9 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; if (isset($_POST['deleteAction'])) { - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json"), true); $selected = null; $selectedIndex = -1; @@ -23,13 +23,13 @@ if (isset($_POST['deleteAction'])) { } unset($data[$selectedIndex]); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json", utf8_encode(json_encode($data))); header("Location: /-/toys/?d&id=" . $id); die(); } if (isset($_POST['updateAction'])) { - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json"), true); $selected = null; $selectedIndex = -1; @@ -96,15 +96,15 @@ if (isset($_POST['updateAction'])) { } $data[$selectedIndex] = $selected; - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json", utf8_encode(json_encode($data))); header("Location: /-/toys/" . $id); die(); } if (isset($_POST['createAction'])) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.php"; - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.inc"; + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json"), true); if (!isset($_POST["name"]) || !isset($_POST["water"])) { header("Location: /-/toys"); @@ -153,14 +153,14 @@ if (isset($_POST['createAction'])) { "sexual" => $sexual ]; - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", utf8_encode(json_encode($data))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json", utf8_encode(json_encode($data))); header("Location: /-/toys/" . $id); die(); } global $pagename; $parts = explode("/", $pagename); -$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); +$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json"), true); $selected = null; @@ -182,10 +182,10 @@ if (isset($parts[1])) { } } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/keywords.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/keywords.inc'; -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json", "[]"); +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json", "[]"); global $_PROFILE; @@ -244,6 +244,7 @@ global $_PROFILE; <?php endif; ?> <hr> + <!-- <b>Can be used by:</b> <?php @@ -297,7 +298,7 @@ global $_PROFILE; <span class="badge bg-danger rounded-pill">Deprecated</span> </li> <?php endif; endforeach; ?> - </ul> + </ul>--> <div style="margin-top:10px;"></div> @@ -386,6 +387,7 @@ global $_PROFILE; <div class="card-body"> <h4 class="card-title"><?= $item["name"] ?></h4> <p class="card-text"> + <!-- <?php $uniquePonies = []; @@ -409,7 +411,8 @@ global $_PROFILE; <span data-bs-toggle="tooltip" data-bs-html="true" title="<i><?= strip_tags(getMemberWithoutSystem($name)["display_name"] ?? getMemberWithoutSystem($name)["name"]) ?></i>" style="opacity:.5;display: inline-block;"> <img src="/assets/uploads/pt-<?= getMemberWithoutSystem($name)["name"] ?>.png" style="width:32px;"> </span> - <?php endif; endforeach; ?> + <?php endif; endforeach; ?>--> + - </p> <?php if ($item["sexual"]): ?> <span style="" class="badge rounded-pill bg-danger">Sexual</span> @@ -477,13 +480,14 @@ global $_PROFILE; <input type="text" placeholder="Instructions to craft IRL" name="irl" class="form-control" style="color:white;background:#111;border-color:#222;" value="<?= str_replace('"', '"', $selected["irl"] ?? "") ?>"> + <div style="display:none;"> <hr> <p>Select the groups of ponies who can use this toy:</p> <?php $relations = []; - $actions = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); + $actions = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); foreach ($actions as $action) { if ($action["type"] !== "sexual") continue; @@ -534,7 +538,7 @@ global $_PROFILE; Mark as deprecated </label> </label> - <?php endforeach; ?> + <?php endforeach; ?></div> <br> <input type="hidden" name="updateAction"> @@ -578,33 +582,15 @@ global $_PROFILE; ksort($init); $sorted = array_values($init); - uasort($sorted, function ($a, $b) { - $uniquePonies1 = []; - - foreach ($a["ponies"] as $ponies) { - foreach ($ponies["members"] as $member) { - $uniquePonies1[$member] = true; - } - } - - $uniquePonies2 = []; - - foreach ($b["ponies"] as $ponies) { - foreach ($ponies["members"] as $member) { - $uniquePonies2[$member] = true; - } - } - - return count($uniquePonies2) - count($uniquePonies1); - }); foreach ($sorted as $item): ?> - <a href="/-/toys/<?= $item["id"] ?>" id="action-<?= $item["id"] ?>" style="display:grid;grid-template-columns: 1fr 1fr 0.2fr;" class="list-group-item list-group-item-action action-listing"> + <a href="/-/toys/<?= $item["id"] ?>" id="action-<?= $item["id"] ?>" style="display:grid;grid-template-columns: 1fr 0.2fr;" class="list-group-item list-group-item-action action-listing"> <div> <span class="<?= trim($item["description"]) === "" ? "text-danger" : "" ?>"><?= $item["name"] ?></span> <?php if (!isset($item["verified"])): ?><span class="badge bg-warning rounded-pill text-black">Unverified</span><?php endif; ?> <?php if (isset($item["untested"])): ?><span class="badge bg-info rounded-pill">Untested</span><?php endif; ?> </div> + <!-- <div> <?php @@ -627,7 +613,6 @@ global $_PROFILE; $index = 1; foreach ($uniquePonies as $name => $deprecated): if (!$deprecated): ?> - <!-- <?= $index ?> --> <span title="<?= getMemberWithoutSystem($name)["display_name"] ?? getMemberWithoutSystem($name)["display_name"] ?>" style="display: inline-block;<?= $longPonyList && $index % 2 === 0 ? "position:absolute;margin-left:-12px;z-index:" . (999 - $index) . ";" : "position:relative;z-index:" . (999 - $index) . ";" ?>"> <img src="/assets/uploads/pt-<?= getMemberWithoutSystem($name)["name"] ?>.png" style="width:24px;"> </span> @@ -638,6 +623,7 @@ global $_PROFILE; </span> <?php $index++; endif; endforeach; ?> </div> + --> <div style="text-align: right;"> <?php if ($item["sexual"]): ?> <span style="" class="badge rounded-pill bg-danger">Sexual</span> @@ -658,7 +644,7 @@ global $_PROFILE; </div> <script> - window.actions = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true)))) ?>`)); + window.actions = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json"), true)))) ?>`)); </script> <div class="modal fade" id="creator"> @@ -684,13 +670,14 @@ global $_PROFILE; Sexual toy </label> + <div style="display: none;"> <hr> <p>Select the groups of ponies who can use this toy:</p> <?php $relations = []; - $actions = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); + $actions = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); foreach ($actions as $action) { if ($action["type"] !== "sexual") continue; @@ -727,7 +714,7 @@ global $_PROFILE; <img style="vertical-align: middle;width:24px;height:24px;" src="<?= $relation["images"][1] ?>"> <span style="vertical-align: middle;"><?= $relation["name"] ?></span> </label> - <?php endforeach; ?> + <?php endforeach; ?></div> <p style="margin-top:10px;">You can add additional data (description, how to use) after adding the toy.</p> <input type="hidden" name="createAction"> @@ -912,4 +899,4 @@ global $_PROFILE; } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/travelling.php b/pages/travelling.inc index 95c7851..e808063 100644 --- a/pages/travelling.php +++ b/pages/travelling.inc @@ -1,17 +1,17 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; if (isset($_GET['toggleTravel'])) { if (isset($travelling[$_GET['member']])) { $id = $_GET['member']; $member = getSystemMember(getMemberSystem($id), $id); $system = getMemberSystem($id); - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-$id-metadata.json"), true)); + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$id.json"), true)); $travellingSystem = $system === "gdapd" ? "ynmuc" : "gdapd"; if ($travelling[$_GET['member']]["travelling"]) { @@ -93,11 +93,11 @@ if (isset($_GET['toggleTravel'])) { } header("Location: /-/travelling"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); die(); } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; ?> @@ -119,7 +119,7 @@ global $travelling; <?php foreach (scoreOrderGlobal() as $member): ?> <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;"> @@ -172,4 +172,4 @@ global $travelling; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/wakeup.php b/pages/wakeup.inc index c90d93e..2438a27 100644 --- a/pages/wakeup.php +++ b/pages/wakeup.inc @@ -1,15 +1,15 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; -$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> <br> <div class="container"> <div id="page-content"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/wakeup.php"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/wakeup.inc"; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> |