diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-12-17 12:23:19 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-12-17 12:23:19 +0100 |
commit | 31fed783e82dd065c71b234ba08ece596a081f05 (patch) | |
tree | 9cda68ddf5b5beb9d81b0d708dfe9ed15b42945a /pages | |
parent | 1e5d2072fb4e257e82e2a97b4fb62e5b553b8e6d (diff) | |
download | pluralconnect-31fed783e82dd065c71b234ba08ece596a081f05.tar.gz pluralconnect-31fed783e82dd065c71b234ba08ece596a081f05.tar.bz2 pluralconnect-31fed783e82dd065c71b234ba08ece596a081f05.zip |
Updated 15 files and deleted 3 files (automated)
Diffstat (limited to 'pages')
-rw-r--r-- | pages/alerts.inc | 7 | ||||
-rw-r--r-- | pages/api/emergency-real.php | 31 | ||||
-rw-r--r-- | pages/api/emergency.php | 31 | ||||
-rw-r--r-- | pages/api/pleasure-real.php | 23 | ||||
-rw-r--r-- | pages/api/pleasure.php | 23 | ||||
-rw-r--r-- | pages/docs.inc | 423 | ||||
-rw-r--r-- | pages/emergency.inc | 4 | ||||
-rw-r--r-- | pages/money.inc | 4 | ||||
-rw-r--r-- | pages/pleasure.inc | 6 | ||||
-rw-r--r-- | pages/wakeup.inc | 15 |
10 files changed, 74 insertions, 493 deletions
diff --git a/pages/alerts.inc b/pages/alerts.inc index ec6c988..46d514d 100644 --- a/pages/alerts.inc +++ b/pages/alerts.inc @@ -2,6 +2,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; global $isLowerLoggedIn; +if ($_PROFILE["login"] === "cloudburst") die(); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> <br> @@ -24,11 +25,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> }, 1000); </script><?php endif; ?> </a> - <?php if (!$isLowerLoggedIn): ?> - <a href="/-/wakeup" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> - <img src="<?= icon('wakeup', null, true) ?>" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Wake-up alert</div> - </a> - <?php endif; if ($_PROFILE["login"] !== "Moonwind"): ?> + <?php if ($isLowerLoggedIn || $_PROFILE["login"] === "raindrops"): ?> <a href="/-/pleasure" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"> <img src="<?= icon('pleasure', null, true) ?>" style="margin-right: 5px; height: 24px; width: 24px;"><div style="display: flex; align-items: center; color: var(--bs-body-color);">Pleasure alert</div> </a> diff --git a/pages/api/emergency-real.php b/pages/api/emergency-real.php index a67f549..700a6a7 100644 --- a/pages/api/emergency-real.php +++ b/pages/api/emergency-real.php @@ -1,6 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; +if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -10,31 +11,27 @@ if (!$isLoggedIn && !$isLowerLoggedIn) { global $_PROFILE; $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; +$channels = []; -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("鈿狅笍馃啒 EMERGENCY 鈿狅笍馃啒") . "\r\n" . - "Priority: urgent\r\n" . - "Tags: emergency\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!") - ] -])); +if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; +if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; -file_get_contents('https://' . $ntfy["server"] . '/emergency', false, stream_context_create([ +$context = stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("鈿狅笍馃啒 EMERGENCY 鈿狅笍馃啒") . "\r\n" . + "Title: " . formatPonypush("鈿狅笍 Emergency alert") . "\r\n" . "Priority: urgent\r\n" . "Tags: emergency\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!") + 'content' => formatPonypush("This is an emergency, " . $_PROFILE['name'] . " is in need of immediate help. Please act now!") ] -])); +]); + +foreach ($channels as $channel) { + file_get_contents('https://' . $ntfy["server"] . '/' . $channel, false, $context); +} die();
\ No newline at end of file diff --git a/pages/api/emergency.php b/pages/api/emergency.php index 24c975a..a8a6e20 100644 --- a/pages/api/emergency.php +++ b/pages/api/emergency.php @@ -1,6 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; +if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -10,31 +11,27 @@ if (!$isLoggedIn && !$isLowerLoggedIn) { global $_PROFILE; $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; +$channels = []; -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("[Test] 鈿狅笍馃啒 EMERGENCY 鈿狅笍馃啒") . "\r\n" . - "Priority: urgent\r\n" . - "Tags: emergency\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]") - ] -])); +if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; +if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; -file_get_contents('https://' . $ntfy["server"] . '/emergency', false, stream_context_create([ +$context = stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("[Test] 鈿狅笍馃啒 EMERGENCY 鈿狅笍馃啒") . "\r\n" . + "Title: " . formatPonypush("[Test] 鈿狅笍 Emergency alert") . "\r\n" . "Priority: urgent\r\n" . "Tags: emergency\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]") + 'content' => formatPonypush("[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of immediate help. Please act now! [This notification is test]") ] -])); +]); + +foreach ($channels as $channel) { + file_get_contents('https://' . $ntfy["server"] . '/' . $channel, false, $context); +} die();
\ No newline at end of file diff --git a/pages/api/pleasure-real.php b/pages/api/pleasure-real.php index b523c1a..adfe732 100644 --- a/pages/api/pleasure-real.php +++ b/pages/api/pleasure-real.php @@ -1,6 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; +if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -11,18 +12,26 @@ global $_PROFILE; $frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; $frontOther = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/fronters.json"), true)["members"]; +$frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/fronters.json"), true)["members"]; if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { + $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; } $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; +$channels = []; -file_get_contents('https://' . $ntfy["server"] . '/pleasure', false, stream_context_create([ +if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; +if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "pleasure"; + +$context = stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => @@ -31,8 +40,12 @@ file_get_contents('https://' . $ntfy["server"] . '/pleasure', false, stream_cont "Priority: high\r\n" . "Tags: pleasure\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("Hey, $pony wants to play and have fun for a bit, get up!") + 'content' => formatPonypush("Hey, $pony wants to play and have fun with you, get up!") ] -])); +]); + +foreach ($channels as $channel) { + file_get_contents('https://' . $ntfy["server"] . '/' . $channel, false, $context); +} die();
\ No newline at end of file diff --git a/pages/api/pleasure.php b/pages/api/pleasure.php index 58def71..7d331ce 100644 --- a/pages/api/pleasure.php +++ b/pages/api/pleasure.php @@ -1,6 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; +if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -11,18 +12,26 @@ global $_PROFILE; $frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; $frontOther = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/fronters.json"), true)["members"]; +$frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/fronters.json"), true)["members"]; if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { + $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; } $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; +$channels = []; -file_get_contents('https://' . $ntfy["server"] . '/pleasure', false, stream_context_create([ +if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; +if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "pleasure"; + +$context = stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => @@ -31,8 +40,12 @@ file_get_contents('https://' . $ntfy["server"] . '/pleasure', false, stream_cont "Priority: high\r\n" . "Tags: pleasure\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("[This is a test] Hey, $pony wants to play and have fun for a bit, get up!") + 'content' => formatPonypush("[This notification is a test] Hey, $pony wants to play and have fun with you, get up! [This notification is a test]") ] -])); +]); + +foreach ($channels as $channel) { + file_get_contents('https://' . $ntfy["server"] . '/' . $channel, false, $context); +} die();
\ No newline at end of file diff --git a/pages/docs.inc b/pages/docs.inc deleted file mode 100644 index 403a4f9..0000000 --- a/pages/docs.inc +++ /dev/null @@ -1,423 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/random.inc"; - -$parts = explode("/", $_GET['_']); -$select = $parts[2] ?? null; - -if ($select === "add") { - $id = random(); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $id . ".json", json_encode([ - "name" => "Untitled document ($id)", - "category" => null, - "contents" => "This is a new document you just created.", - "last" => [ - "author" => $_PROFILE["login"], - "date" => time() - ] - ])); - - header("Location: /-/docs/$id"); - die(); -} elseif (isset($select)) { - if (ctype_alnum($select) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json")) { - $id = $_documentId = $select; - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json"), true); - $titleBase = " 路 " . $title . " 路 Ponycule"; - $title = $data["name"] . " 路 " . $title; - } else { - header("Location: /-/docs"); - die(); - } -} - -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; - -function showDocument($item) { ?> - <div style="display: grid; grid-template-columns: 2fr repeat(3, 1fr);"> - <span> - <?= $item["name"] ?> - <?php if (isset($item["nsfw"]) && $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: ?> - <span class="text-muted"><?= prettySize(filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $item["id"] . ".json")) ?></span> - <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> - <span class="text-muted"><?= $item["last"]["author"] === "raindrops" ? "Raindrops System" : "Cloudburst System" ?></span> - <?php endif; ?> - </div> -<?php } - -?> - -<br> -<div class="container"> - <div> - <?php if (isset($data)): ?><div id="page-content"> - <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> 路 <label style="margin-bottom:5px;"> - <input <?= (isset($data["nsfw"]) && $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> - <?php else: ?> - Last modified <span id="last-edit-time" class="relative-time" data-relative-timestamp="<?= $data["last"]["date"] ?>"><?= timeAgo($data["last"]["date"]) ?></span> - <?php if ($data["last"]["author"] !== $_PROFILE["login"]): ?> - <span id="last-edit-author">by <?= $data["last"]["author"] === "raindrops" ? "the Raindrops System" : "the Cloudburst System" ?></span> - <?php endif; ?> - <?php endif; ?> - 路 <span id="editor-save-status" class="text-muted">Saved</span> - </p> - - <?php $timeDiff = round((1800 - (time() - $data["last"]["date"])) / 60); if ($timeDiff >= 0 && $data["last"]["author"] !== $_PROFILE["login"]): ?> - <div class="alert alert-warning"> - <b>This document is currently in use by <?= $data["last"]["author"] === "raindrops" ? "the Raindrops System" : "the Cloudburst System" ?>.</b> It has been open in read-only to prevent conflicts with the changes they make. If they stopped editing the document, it will become editable for you after you refresh the page in <?= $timeDiff ?> minute<?= $timeDiff > 1 ? "s" : "" ?>. - </div> - <?= $data["contents"] ?> - <?php else: ?> - <textarea id="editor"><?= $data["contents"] ?></textarea> - - <script src="/assets/editor/editor.js"></script> - <script> - let editor; - ClassicEditor - .create( document.querySelector( '#editor' ), { - toolbar: [ - 'undo', 'redo', '|', 'removeFormat', '|', 'heading', '|', 'fontSize', 'fontColor', 'fontBackgroundColor', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 'code', '|', 'outdent', 'indent', '|', 'bulletedList', 'numberedList', '|', 'link', 'imageUpload', 'mediaEmbed', 'blockQuote', 'insertTable', 'codeBlock', '|', 'horizontalLine' - ] - } ) - - .then( newEditor => { - editor = newEditor; - } ) - .catch( error => { - console.error( error ); - } ); - </script> - <!--suppress CssUnresolvedCustomProperty --> - <style> - :root { - --ck-color-base-background: transparent; - } - - .ck-toolbar { - filter: invert(1); - border-bottom-left-radius: var(--ck-border-radius) !important; - border-bottom-right-radius: var(--ck-border-radius) !important; - border-bottom-width: 1px !important; - } - - .ck-tooltip__text { - color: white !important; - } - - .ck-dropdown__panel { - background: #ddd !important; - } - - .ck-color-grid__tile { - filter: invert(1); - } - - .ck-balloon-rotator { - background-color: #ccc !important; - } - - .ck-balloon-panel { - filter: invert(1); - } - - .ck-editor__editable { - border-color: transparent !important; - } - - .ck.ck-sticky-panel__content_sticky { - top: 59px !important; - } - </style> - <script> - - let titleBase = "<?= $titleBase ?>"; - let lastSavedData = getData(); - let lastFetchedData = getData(); - let timeSinceLastModified = 0; - let saving = false; - - async function save() { - let data = editor.getData(); - document.getElementById("editor-save-status").innerHTML = "Saving..."; - document.getElementById("editor-save-status").classList.remove("text-danger"); - document.getElementById("editor-save-status").classList.remove("text-muted"); - document.getElementById("editor-save-status").classList.remove("text-warning"); - document.getElementById("editor-save-status").classList.add("text-primary"); - saving = true; - - 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, 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 = ""; - document.title = document.getElementById("document-name").innerText + titleBase; - document.getElementById("editor-save-status").innerHTML = "Saved"; - document.getElementById("editor-save-status").classList.remove("text-danger"); - 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 = getData(); - saving = false; - } catch (e) { - console.error(e); - document.getElementById("editor-save-status").innerHTML = "Failed to save"; - document.getElementById("editor-save-status").classList.add("text-danger"); - document.getElementById("editor-save-status").classList.remove("text-muted"); - document.getElementById("editor-save-status").classList.remove("text-warning"); - document.getElementById("editor-save-status").classList.remove("text-primary"); - } - } - - document.onclick = async () => { - if (saving) return; - - 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 (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 (getData() !== lastFetchedData) { - lastFetchedData = getData(); - timeSinceLastModified = 0; - } else { - timeSinceLastModified++; - } - - if (timeSinceLastModified > 20 || !document.hasFocus()) { - await save(); - } - } else { - timeSinceLastModified = 0; - } - }, 100) - - </script> - <?php endif; ?> - </div><?php else: ?> - <h2>Documents</h2> - <div id="list"> - <?php - - $documents = array_map(function ($i) { - return [ - "id" => substr($i, 0, -5), - ...(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $i), true) ?? []) - ]; - }, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs"), function ($i) { - return !str_starts_with($i, ".") && str_ends_with($i, ".json"); - })); - - $deletable = array_values(array_filter($documents, function ($i) { - return str_starts_with(strip_tags($i["contents"]), "/delete"); - })); - $unsorted_pre = array_values(array_filter($documents, function ($i) { - return !str_starts_with(strip_tags($i["contents"]), "/delete"); - })); - - $categoryFirst = []; - $unsorted = []; - $categories = []; - foreach ($unsorted_pre as $item) { - if (isset($item["category"])) { - $existing_categories = [...array_keys($categories), ...array_keys($categoryFirst)]; - $matched_category = null; - - foreach ($existing_categories as $existing_category) { - if (levenshtein($item["category"], $existing_category) < 3) { - $matched_category = $existing_category; - } - } - - $selected_category = $matched_category ?? $item["category"]; - - if (str_starts_with($item["category"], ".")) { - if (!isset($categoryFirst[$selected_category])) $categoryFirst[$selected_category] = []; - $categoryFirst[$selected_category][] = $item; - } else { - if (!isset($categories[$selected_category])) $categories[$selected_category] = []; - $categories[$selected_category][] = $item; - } - } else { - $unsorted[] = $item; - } - } - - foreach ($categories as $category => $_) { - uasort($categories[$category], function ($a, $b) { - return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); - }); - } - - foreach ($categoryFirst as $category => $_) { - uasort($categoryFirst[$category], function ($a, $b) { - return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); - }); - } - - uasort($unsorted, function ($a, $b) { - return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); - }); - - uasort($deletable, function ($a, $b) { - return preg_replace("/[^a-z\d]/m", "", strtolower($b["name"])) < preg_replace("/[^a-z\d]/m", "", strtolower($a["name"])); - }); - - $fullList = [...$categoryFirst, ...$categories]; - - ?> - - <?php foreach ($fullList as $category => $items): if ($category != "Archives"): ?> - <h4><?= str_starts_with($category, ".") ? substr($category, 1) : $category ?></h4><div class="list-group"> - <?php foreach ($items as $item): ?> - <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> - <?php showDocument($item) ?> - </a> - <?php endforeach; ?></div> - <hr> - <?php endif; endforeach; ?> - - <h4>Unsorted</h4><div class="list-group"> - <?php foreach ($unsorted as $item): ?> - <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> - <?php showDocument($item) ?> - </a> - <?php endforeach; ?></div> - - <hr> - <details> - <summary>Show archives and marked for deletion</summary> - - <h4 style="margin-top: 10px;">Archives</h4> - <div class="list-group"> - <?php foreach ($categories["Archives"] as $item): ?> - <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> - <?php showDocument($item) ?> - </a> - <?php endforeach; ?></div> - - <hr> - <h4 id="deletable">Marked for deletion</h4><div class="list-group"> - <?php foreach ($deletable as $item): ?> - <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>opacity-75<?php endif; ?>"> - <?php showDocument($item) ?> - </a> - <?php endforeach; ?></div> - </details> - </div> - - <hr> - <div id="page-content"> - <a href="/-/docs/add">Create a new document</a> - </div> - <?php endif; ?> - </div> -</div> - -<script> - setInterval(async () => { - Array.from(document.getElementsByClassName("relative-time")).forEach((el) => { - el.innerText = timeAgo(parseInt(el.getAttribute("data-relative-timestamp")) * 1000); - }) - }, 1000) - - function timeAgo(time) { - if (!isNaN(parseInt(time))) { - time = new Date(time).getTime(); - } - - let periods = ["sec", "min", "hr", "d", "wk", "mo", "y", "ages"]; - - let lengths = ["60", "60", "24", "7", "4.35", "12", "100"]; - - let now = new Date().getTime(); - - let difference = Math.round((now - time) / 1000); - let tense; - let period; - - if (difference <= 10 && difference >= 0) { - return "now"; - } else if (difference > 0) { - tense = "ago"; - } else { - tense = "later"; - } - - let j; - - for (j = 0; difference >= lengths[j] && j < lengths.length - 1; j++) { - difference /= lengths[j]; - } - - difference = Math.round(difference); - - period = periods[j]; - - return `${difference} ${period} ${tense}`; - } -</script> -<style> - <?php global $use2023UI; if (!$use2023UI): ?> - .list-group-item { - color: #fff; - background-color: #222; - border: 1px solid rgba(255, 255, 255, .125); - } - - .list-group-item.disabled { - color: #fff; - background-color: #222; - border-color: rgba(255, 255, 255, .125); - opacity: .75; - } - - .list-group-item:hover { - background-color: #252525; - color: #ddd; - } - - .list-group-item:active, .list-group-item:focus { - background-color: #272727; - color: #bbb; - } - <?php endif; ?> -</style> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/emergency.inc b/pages/emergency.inc index 244571b..e51b410 100644 --- a/pages/emergency.inc +++ b/pages/emergency.inc @@ -1,6 +1,8 @@ <?php -$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; + +if ($_PROFILE["login"] === "cloudburst") die(); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> diff --git a/pages/money.inc b/pages/money.inc index d1651bc..881c618 100644 --- a/pages/money.inc +++ b/pages/money.inc @@ -241,6 +241,10 @@ function getMonthlyEarnings(): array { <div> <h2>Money tracker</h2> + <div class="alert alert-danger"> + <b>The Ponycule money tracker is deprecated and will be removed.</b> Data currently in the money tracker will be moved to individual accounts on a dedicated money tracking application that Equestria.dev will not have control over. + </div> + <hr> <?php diff --git a/pages/pleasure.inc b/pages/pleasure.inc index 883af9a..1a6e50a 100644 --- a/pages/pleasure.inc +++ b/pages/pleasure.inc @@ -1,11 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $_PROFILE; global $pages; - -if ($_PROFILE["id"] !== "0f3661dd-ff60-4cde-bf13-1b0a59e78f11" && $_PROFILE["id"] !== "ce1606a9-344f-4547-bffe-bc2ab0eebfa8") { - header("Location: /"); - die(); -} +if ($_PROFILE["login"] === "cloudburst") die(); $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; diff --git a/pages/wakeup.inc b/pages/wakeup.inc deleted file mode 100644 index 43fa614..0000000 --- a/pages/wakeup.inc +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; - -?> - -<br> -<div class="container"> - <div id="page-content"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/wakeup.inc"; ?> - </div> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> |