diff options
-rw-r--r-- | assets/icons/explicit.svg | 1 | ||||
-rw-r--r-- | assets/logo/custom.css | 4 | ||||
-rw-r--r-- | includes/components/explicit.php | 128 | ||||
-rw-r--r-- | includes/components/header.inc | 24 | ||||
-rw-r--r-- | includes/components/mobilenav.inc | 2 | ||||
-rw-r--r-- | includes/external/school/index.js | 9 | ||||
-rw-r--r-- | includes/fragments/member.inc | 4 | ||||
-rw-r--r-- | includes/fragments/sysedit.inc | 2 | ||||
-rw-r--r-- | pages/api/computername.php | 10 | ||||
-rw-r--r-- | pages/api/docs.php | 1 | ||||
-rw-r--r-- | pages/byspecies.inc | 2 | ||||
-rw-r--r-- | pages/computers.inc | 34 | ||||
-rw-r--r-- | pages/docs.inc | 38 | ||||
-rw-r--r-- | pages/relations.inc | 37 | ||||
-rw-r--r-- | pages/toys.inc | 2 |
15 files changed, 261 insertions, 37 deletions
diff --git a/assets/icons/explicit.svg b/assets/icons/explicit.svg new file mode 100644 index 0000000..7faaf33 --- /dev/null +++ b/assets/icons/explicit.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5.25 3A2.25 2.25 0 0 0 3 5.25v13.5A2.25 2.25 0 0 0 5.25 21h5.8c.053-.26.147-.511.28-.744l.433-.756H5.25a.75.75 0 0 1-.75-.75V5.25a.75.75 0 0 1 .75-.75h13.5a.75.75 0 0 1 .75.75v7.754c.06.08.116.166.166.254L21 15.589V5.25A2.25 2.25 0 0 0 18.75 3H5.25Z" fill="#ffffff"/><path d="M17.5 12a.75.75 0 0 0-.75-.75h-5.5a.75.75 0 1 0 0 1.5h4.466A2.496 2.496 0 0 1 17.5 12ZM14.337 15H11.25a.75.75 0 1 0 0 1.5h2.229l.858-1.5ZM7.75 9.25a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM11.25 7.5a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5ZM7.75 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM7.75 16.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM17.108 13.053a1.498 1.498 0 0 1 1.69.702l4.004 6.998c.205.36.246.768.145 1.139a1.493 1.493 0 0 1-1.444 1.107h-8.006c-.413 0-.787-.167-1.058-.44a1.495 1.495 0 0 1-.24-1.806l4.002-6.999a1.49 1.49 0 0 1 .907-.701Zm.888 2.447a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0v-3Zm-.496 6a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" fill="#ffffff"/></svg>
\ No newline at end of file diff --git a/assets/logo/custom.css b/assets/logo/custom.css index 0d35c4b..694a5e3 100644 --- a/assets/logo/custom.css +++ b/assets/logo/custom.css @@ -19,8 +19,8 @@ img { } .modal { - backdrop-filter: blur(10px); - -webkit-backdrop-filter: blur(10px); + backdrop-filter: blur(30px); + -webkit-backdrop-filter: blur(30px); } nav.navbar { diff --git a/includes/components/explicit.php b/includes/components/explicit.php new file mode 100644 index 0000000..9b3b159 --- /dev/null +++ b/includes/components/explicit.php @@ -0,0 +1,128 @@ +<?php global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; global $app; if ($isLoggedIn || $isLowerLoggedIn): ?> +<div class="modal" id="explicit-modal" data-bs-backdrop="static" data-bs-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-body" style="text-align: center;"> + <img alt="" style="width: 64px; height: 64px;" src="/assets/icons/explicit.svg"> + <h3>This content is sexually explicit</h3> + + <p>This page shows uncensored graphically explicit sexual content that you may not want to see in some cases. Please refrain from visiting this part of the website in a public place.</p> + <p>By continuing, you agree to be presented with sexually explicit content that is not appropriate for everyone.</p> + + <span onclick="explicitConfirm();" id="explicit-modal-confirm" class="btn btn-primary">Continue</span> + <span onclick="explicitCancel();" id="explicit-modal-cancel" class="btn btn-outline-secondary">Go back</span> + + <label style="margin-top:10px; display: block; text-align: left; opacity: .5;"> + <input checked type="checkbox" class="form-check-input" id="explicit-modal-hour"> + Don't show for the next hour + </label> + </div> + </div> + </div> +</div> + +<style> + #explicit-modal .modal-header { + border-bottom: 1px solid #353738; + } + + #explicit-modal .modal-content { + border: 1px solid rgba(255, 255, 255, .2); + background-color: #111; + } +</style> + +<!--suppress JSVoidFunctionReturnValueUsed --> +<script> + window.explicitModal = new bootstrap.Modal(document.getElementById("explicit-modal")); + window.ip = "<?= $_SERVER['REMOTE_ADDR'] ?>"; + window.front = "<?php + + $front = []; + $id = null; + + if ($_PROFILE["login"] === "raindrops") { + $id = "gdapd"; + } else if ($_PROFILE["login"] === "cloudburst") { + $id = "ynmuc"; + } else { + $id = $app["other"]["id"]; + } + + $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id/fronters.json"), true)["members"]; + $front = array_map(function ($i) { + return $i["id"]; + }, $fronters); + + echo(implode(",", $front)); + + ?>"; + window.age = <?php + + if (isset($front[0]) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0] . ".json")) { + $metadata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0] . ".json"), true); + $age = null; + + if (isset($metadata["birth"]["age"]) && $metadata["birth"]["age"] !== 0) { + $age = $metadata["birth"]["age"]; + } else if (isset($metadata["birth"]["year"]) && $metadata["birth"]["year"] > 1990) { + $age = (int)date('Y') - $metadata["birth"]["year"] + (strtotime(date('Y') . "-" . $metadata["birth"]["date"]) <= time() ? 0 : -1); + } + + if (is_string($age) && isset(explode("-", $age)[1]) && is_numeric(explode("-", $age)[1])) { + $age = (int)explode("-", $age)[1]; + } + + echo($age); + } + + ?>; + window.explicitCancelAction = "back"; + + function requestExplicit(ifNotAgreed, allowUnderage) { + window.explicitCancelAction = ifNotAgreed; + + if (!allowUnderage && (window.age < 15 || !window.age)) { + document.getElementById("explicit-modal-confirm").classList.add("disabled"); + document.getElementById("explicit-modal-hour").disabled = true; + + window.explicitModal.show(); + document.getElementById("explicit-modal").classList.add("fade"); + } + + if (!localStorage.getItem("explicit-consent")) { + window.explicitModal.show(); + document.getElementById("explicit-modal").classList.add("fade"); + } else { + let parts = localStorage.getItem("explicit-consent").split("|"); + + if (parts[0] !== window.front || parts[1] !== window.ip || new Date().getTime() - parseInt(parts[2]) > 3600000) { + window.explicitModal.show(); + document.getElementById("explicit-modal").classList.add("fade"); + } + } + } + + function explicitConfirm() { + window.explicitModal.hide(); + + if (document.getElementById("explicit-modal-hour").checked) { + localStorage.setItem("explicit-consent", window.front + "|" + window.ip + "|" + new Date().getTime()); + } + } + + function explicitCancel() { + if (window.explicitCancelAction === "refresh") { + location.reload(); + } else { + if (history.length > 1) { + if (history.back() === undefined) { + location.href = "https://ponies.equestria.horse"; + } + } else { + location.href = "https://ponies.equestria.horse"; + } + } + } +</script> +<?php endif; ?> diff --git a/includes/components/header.inc b/includes/components/header.inc index c87e5a5..34b30e6 100644 --- a/includes/components/header.inc +++ b/includes/components/header.inc @@ -85,6 +85,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; width: calc(100% - 300px); } + .modal { + left: 150px; + } + nav { display: none !important; } @@ -124,8 +128,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; right: 0; height: 48px; background: rgba(0, 0, 0, .75); - backdrop-filter: blur(10px); - -webkit-backdrop-filter: blur(10px); + backdrop-filter: blur(30px); + -webkit-backdrop-filter: blur(30px); border-top: 1px solid rgba(255, 255, 255, .25); z-index: 999999; } @@ -136,6 +140,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; width: calc(100% - 250px) !important; } + .modal { + left: 125px !important; + } + #title-bar { left: 250px !important; } @@ -159,6 +167,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; width: calc(100% - 200px) !important; } + .modal { + left: 100px !important; + } + #title-bar { left: 200px !important; } @@ -178,6 +190,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; width: 100% !important; } + .modal { + left: 0 !important; + } + #title-bar { left: 0 !important; } @@ -238,4 +254,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; display: none; } </style> -<?php } $GLOBALS["ColdHazePerformance"]["header"] = (microtime(true) - $start) * 1000; $start = microtime(true); ?> +<?php } +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/explicit.php"; +$GLOBALS["ColdHazePerformance"]["header"] = (microtime(true) - $start) * 1000; $start = microtime(true); ?> diff --git a/includes/components/mobilenav.inc b/includes/components/mobilenav.inc index f83597f..7b49434 100644 --- a/includes/components/mobilenav.inc +++ b/includes/components/mobilenav.inc @@ -14,7 +14,7 @@ </div> </div> -<div id="mobile-navigation-box-container" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 48px; background-color: rgba(0, 0, 0, .75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 99999; overflow: auto;"> +<div id="mobile-navigation-box-container" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 48px; background-color: rgba(0, 0, 0, .75); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); z-index: 99999; overflow: auto;"> <?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?> <div id="mobile-navigation-box-<?= $id ?>" style="display: none; margin-top: 10px; margin-bottom: 10px;" class="mobile-navigation-box container"> <div class="pane-group-title"> diff --git a/includes/external/school/index.js b/includes/external/school/index.js index 58947ec..00f3435 100644 --- a/includes/external/school/index.js +++ b/includes/external/school/index.js @@ -6,6 +6,11 @@ const url = config.pronote.url; const username = config.pronote.user; const password = config.pronote.password; +process.on('unhandledRejection', (e) => { + console.error(e); + process.exit(2); +}) + async function getTimetable(offset, last) { const timetable = lessons; @@ -129,8 +134,12 @@ async function display(offset) { } (async () => { + console.log("Logging in..."); + console.log("URL is", url + ", username is", username + ", password is", password); global.session = await pronote.login(url, username, password); + console.log("Gathering timetable..."); global.lessons = await session.timetable(new Date(new Date() - (86400000 * 3)), new Date(new Date().getTime() + (86400000 * 7))); + console.log("Processing..."); await updateSleepTime(0); await display(-2); diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc index 6fbf3ad..1db0dd2 100644 --- a/includes/fragments/member.inc +++ b/includes/fragments/member.inc @@ -149,7 +149,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".pn <br> <div class="container"> - <div id="member-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:<?= !isset($memberData["banner"]) ? "15vh" : "30vh" ?>;<?php if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") && !($isLoggedIn && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html"))): ?> padding-bottom: 0 !important;<?php endif; ?>"> + <div id="member-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);margin-top:<?= !isset($memberData["banner"]) ? "15vh" : "30vh" ?>;<?php if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") && !($isLoggedIn && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html"))): ?> padding-bottom: 0 !important;<?php endif; ?>"> <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/fullbanner.inc"; ?> <?php $member = $memberData; if (($isLoggedIn || $isLowerLoggedIn) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $member["id"] . ".png")): ?> <div style="padding-top: 20px; padding-bottom: 20px;"> @@ -210,7 +210,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".pn } if ($censor) { - echo("<a href='#' id='private-page-link' onclick='showPrivate();'>Show private page (NSFW)</a><div id='private-page-hidden' style='display: none;'>" . $text . "</div>"); + echo("<a href='#' id='private-page-link' onclick='requestExplicit(\"refresh\"); showPrivate();'>Show private page (NSFW)</a><div id='private-page-hidden' style='display: none;'>" . $text . "</div>"); } else { echo($text); } diff --git a/includes/fragments/sysedit.inc b/includes/fragments/sysedit.inc index 1b341b0..a743e03 100644 --- a/includes/fragments/sysedit.inc +++ b/includes/fragments/sysedit.inc @@ -10,7 +10,7 @@ <div class="container"> <div class="container"> - <div id="system-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:30vh;"> + <div id="system-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);margin-top:30vh;"> <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/sysbanner.inc"; ?> <br> diff --git a/pages/api/computername.php b/pages/api/computername.php new file mode 100644 index 0000000..1a719b0 --- /dev/null +++ b/pages/api/computername.php @@ -0,0 +1,10 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; +if (!$isLoggedIn) header("Location: /-/login") and die(); + +$names = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json"), true); +$names[$_GET["id"]] = $_GET["name"]; +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json", json_encode($names)); + +die();
\ No newline at end of file diff --git a/pages/api/docs.php b/pages/api/docs.php index 3d11831..a60a6e6 100644 --- a/pages/api/docs.php +++ b/pages/api/docs.php @@ -22,6 +22,7 @@ if (isset($select)) { if ($json_object["content"]) $data["contents"] = $json_object["content"]; if ($json_object["name"]) $data["name"] = $json_object["name"]; +if ($json_object["explicit"]) $data["nsfw"] = $json_object["explicit"]; if ($json_object["category"]) $data["category"] = trim($json_object["category"]) !== "" && trim($json_object["category"]) !== "Unsorted" && trim($json_object["category"]) !== "unsorted" && trim($json_object["category"]) !== "/no" && trim($json_object["category"]) !== "Unsort" && trim($json_object["category"]) !== "unsort" ? $json_object["category"] : null; $data["last"]["date"] = time(); diff --git a/pages/byspecies.inc b/pages/byspecies.inc index d2a2930..e3bdcc4 100644 --- a/pages/byspecies.inc +++ b/pages/byspecies.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling; +<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]]; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling; $members = scoreOrderGlobal(); diff --git a/pages/computers.inc b/pages/computers.inc index 7b25133..2e493fa 100644 --- a/pages/computers.inc +++ b/pages/computers.inc @@ -26,6 +26,7 @@ if (isset($parts[2]) && $parts[2] !== "control") { die(); } +$names = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json"), true); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; $parts = array_values(array_filter($parts, function ($i) { @@ -62,7 +63,19 @@ if (str_ends_with($computer["os"], "unknown")) { <?php if (isset($parts[2]) && !isset($parts[3])): $id = $parts[2]; ?> <div> <h2> - <span style="vertical-align: middle;"><?= $computer["host"] ?></span> + <script> + async function updateComputerName() { + let name = document.getElementById("computer_name").innerText.trim(); + + if (name === "") { + name = "<?= $computer["host"] ?>"; + document.getElementById("computer_name").innerText = name; + } else { + await fetch("/api/computername?id=<?= $id ?>&name=" + encodeURIComponent(name)); + } + } + </script> + <span id="computer_name" style="vertical-align: middle;" contenteditable="true" onkeyup="updateComputerName();"><?= $names[$id] ?? $computer["host"] ?></span> <a href="/-/computers" class="small btn btn-outline-light" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; color:white;">Back</a> </h2> @@ -273,7 +286,7 @@ if (str_ends_with($computer["os"], "unknown")) { </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>System:</b></td> - <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] === "unknown" ? "" : $computer["os_info"]["release"] ?></td> + <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] === "unknown" || $computer["os_info"]["release"] === "rolling" ? "" : $computer["os_info"]["release"] ?></td> </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>CPU architecture:</b></td> @@ -871,16 +884,25 @@ if (str_ends_with($computer["os"], "unknown")) { <p>Click on a device to view information about it</p> <ul class="list-group"> - <?php foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata"), function ($i) { + <?php + + $list = array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata"), function ($i) { return !str_starts_with($i, "."); - }) as $file): $computer = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $file), true); $id = substr($file, 0, -5); $owner = explode("-", $id)[0]; + }); + uasort($list, function ($a, $b) { + $ca = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $a), true); + $cb = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $b), true); + return strtotime($cb["date"]) - strtotime($ca["date"]); + }); + + foreach ($list as $file): $computer = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $file), true); $id = substr($file, 0, -5); $owner = explode("-", $id)[0]; if (str_ends_with($computer["os"], "unknown")) { $computer["os"] = trim(substr($computer["os"], 0, -7)); } ?> - <a href="/-/computers/<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 100px 1fr; grid-column-gap: 10px;"> + <a href="/-/computers/<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 100px 1fr; grid-column-gap: 10px; <?php if (timeAgo($computer["date"]) !== "now"): ?>opacity: .5;<?php endif; ?>"> <div style="display: flex; align-items: center;"> <img style="width: 100px;" src="<?php @@ -902,7 +924,7 @@ if (str_ends_with($computer["os"], "unknown")) { </div> <div style="display: flex; align-items: center;"> <div> - <b><?= $computer["host"] ?></b><br> + <b><?= $names[$id] ?? $computer["host"] ?></b><br> <?php if (str_starts_with($computer["os"], "Google ")) { diff --git a/pages/docs.inc b/pages/docs.inc index a94f92e..84d9d87 100644 --- a/pages/docs.inc +++ b/pages/docs.inc @@ -36,7 +36,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; function showDocument($item) { ?> <div style="display: grid; grid-template-columns: 2fr repeat(3, 1fr);"> - <?= $item["name"] ?> + <span> + <?= $item["name"] ?> + <?php if ($item["nsfw"]): ?> + <span class="badge bg-danger rounded-pill">NSFW</span> + <?php endif; ?> + </span> <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?> <span class="badge bg-warning rounded-pill text-black" style="width: max-content;">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> <?php else: ?> @@ -53,11 +58,15 @@ function showDocument($item) { ?> <div class="container"> <div> <?php if (isset($data)): ?><div id="page-content"> + <?php if ($data["nsfw"]): ?><script>requestExplicit("back");</script><?php endif; ?> <h2> <span contenteditable="true" id="document-name" style="outline: none;"><?= $data["name"] ?></span> <a href="/-/docs" class="small btn btn-outline-light" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; color:white;">Back</a> </h2> - <p><b>Category:</b> <span id="category" contenteditable="true" style="outline: none;"><?= $data["category"] ?? "Unsorted" ?></span></p> + <p><b>Category:</b> <span id="category" contenteditable="true" style="outline: none;"><?= $data["category"] ?? "Unsorted" ?></span> · <label style="margin-bottom:5px;"> + <input <?= $data["nsfw"] ? "checked" : "" ?> class="form-check-input" type="checkbox" id="explicit"> + Explicit + </label></p> <p> <?php if ($data["last"]["date"] === 0): ?> Last modified <span id="last-edit-time" class="relative-time" data-relative-timestamp="">never</span> @@ -139,8 +148,8 @@ function showDocument($item) { ?> <script> let titleBase = "<?= $titleBase ?>"; - let lastSavedData = editor.getData(); - let lastFetchedData = editor.getData(); + let lastSavedData = getData(); + let lastFetchedData = getData(); let timeSinceLastModified = 0; let saving = false; @@ -156,7 +165,7 @@ function showDocument($item) { ?> try { await window.fetch("/api/docs?id=<?= $_documentId ?>", { method: "POST", - body: JSON.stringify({ content: data, name: document.getElementById("document-name").innerText, category: document.getElementById("category").innerText }) + body: JSON.stringify({ content: data, name: document.getElementById("document-name").innerText, category: document.getElementById("category").innerText, explicit: document.getElementById("explicit").checked }) }); document.getElementById("last-edit-time").setAttribute("data-relative-timestamp", (new Date().getTime() / 1000).toFixed(0)); if (document.getElementById("last-edit-author")) document.getElementById("last-edit-author").outerHTML = ""; @@ -166,7 +175,7 @@ function showDocument($item) { ?> document.getElementById("editor-save-status").classList.add("text-muted"); document.getElementById("editor-save-status").classList.remove("text-warning"); document.getElementById("editor-save-status").classList.remove("text-primary"); - lastSavedData = data; + lastSavedData = getData(); saving = false; } catch (e) { console.error(e); @@ -181,23 +190,32 @@ function showDocument($item) { ?> document.onclick = async () => { if (saving) return; - if (editor.getData() !== lastSavedData) { + if (getData() !== lastSavedData) { await save(); } } + function getData() { + return JSON.stringify({ + document: editor.getData(), + name: document.getElementById("document-name").innerText, + category: document.getElementById("category").innerText, + explicit: document.getElementById("explicit").checked + }); + } + setInterval(async () => { if (saving) return; - if (editor.getData() !== lastSavedData) { + if (getData() !== lastSavedData) { document.getElementById("editor-save-status").innerHTML = "Modified"; document.getElementById("editor-save-status").classList.remove("text-danger"); document.getElementById("editor-save-status").classList.remove("text-muted"); document.getElementById("editor-save-status").classList.add("text-warning"); document.getElementById("editor-save-status").classList.remove("text-primary"); - if (editor.getData() !== lastFetchedData) { - lastFetchedData = editor.getData(); + if (getData() !== lastFetchedData) { + lastFetchedData = getData(); timeSinceLastModified = 0; } else { timeSinceLastModified++; diff --git a/pages/relations.inc b/pages/relations.inc index 7a05def..f872a2f 100644 --- a/pages/relations.inc +++ b/pages/relations.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $isLowerLoggedIn; global $app; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -10,7 +10,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; <div id="page-content"> <h2><?= $pages["relations"]["name"][$lang["_name"]] ?></h2> <?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): ?> - <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1.5fr 2fr 2fr 2fr;"> + <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr 2.25fr;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;" href="/<?= $member["name"] ?>"> <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> @@ -24,9 +24,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; <?php if (count($member["_metadata"]["marefriends"]) === 0): ?> <span class="text-muted"><?= $lang["relations"]["no"] ?></span> <?php else: ?> - <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> + <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> <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; endforeach; ?> <?php endif; ?> </td> </tr></tbody> @@ -41,15 +41,14 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; <?php if (count($member["_metadata"]["sisters"]) === 0): ?> <span class="text-muted"><?= $lang["relations"]["no"] ?></span> <?php else: ?> - <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> + <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> <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; endforeach; ?> <?php endif; ?> </td> </tr></tbody> </table> - <?php if ($member["_metadata"]["little"] >= 2): ?> <table class="relation-item relation-item-caretakers" style="padding:0 20px;"> <tbody><tr> <td style="width: 50%;text-align:right;"> @@ -59,14 +58,30 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; <?php if (count($member["_metadata"]["caretakers"]) === 0): ?> <span class="text-muted"><?= $lang["relations"]["no"] ?></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="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> - <?php endforeach; ?> + <?php foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> + <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> + <?php endif; endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> + + <table class="relation-item relation-item-friends" style="padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;">Friends:</b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (!isset($member["_metadata"]["friends"]) || count($member["_metadata"]["friends"]) === 0): ?> + <span class="text-muted"><?= $lang["relations"]["no"] ?></span> + <?php else: ?> + <?php foreach ($member["_metadata"]["friends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> + <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> + <?php endif; endforeach; ?> <?php endif; ?> </td> </tr></tbody> </table> - <?php endif; ?> </div> <?php endforeach; ?> </div> diff --git a/pages/toys.inc b/pages/toys.inc index afcd5ef..870bb62 100644 --- a/pages/toys.inc +++ b/pages/toys.inc @@ -197,6 +197,8 @@ $parts = explode("/", $pagename); ?> +<script>requestExplicit("back");</script> + <style> @media (max-width: 800px) { #toy-grid-img { |