summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/external/next/index.php115
-rw-r--r--includes/fragments/dashboard.inc6
2 files changed, 120 insertions, 1 deletions
diff --git a/includes/external/next/index.php b/includes/external/next/index.php
new file mode 100644
index 0000000..5e96fb7
--- /dev/null
+++ b/includes/external/next/index.php
@@ -0,0 +1,115 @@
+<?php
+
+$_SERVER['DOCUMENT_ROOT'] = "../../..";
+
+$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
+$pairs = [];
+
+$pairs2 = [
+ ["lqolg"],
+ ["tfbob"],
+ ["zajrk"],
+ ["ktrdb"],
+ ["hpwyq"],
+ ["qbzxm"],
+ ["qraku"],
+ ["mhnqy"],
+ ["ztfjz"],
+ ["ufadt"],
+ ["ckqsw"]
+];
+
+$special = ["ckqsw"];
+
+// --------------------
+
+function getRelativeDay($offset) {
+ if ($offset === 0) return "Today";
+ if ($offset === 1) return "Tomorrow";
+ return "On " . date('l', time() + ($offset * 86400)) . " (in $offset days, " . date('j M', time() + ($offset * 86400)) . ")";
+}
+
+$members = array_map(function ($i) {
+ $system = "gdapd";
+ $i["_lastFronted"] = -1;
+ $id = $i["id"];
+ $memberData = $i;
+
+ $fronters = array_map(function ($item) {
+ return $item["id"];
+ }, 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);
+
+ $thisMember = array_filter($switches, function ($item) use ($memberData) {
+ return in_array($memberData["id"], $item["members"]);
+ });
+
+ $thisMember = array_values($thisMember);
+ $frontingEnd = null;
+
+ if (count($thisMember) > 0) {
+ $thisIndex = array_search($thisMember[0], $switches);
+
+ $frontingStart = $thisMember[0];
+ $frontingEnd = $switches[$thisIndex - 1];
+ }
+
+ if ($frontingEnd !== null && isset($frontingStart)) {
+ $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]);
+ }
+ }
+
+ return $i;
+}, array_values(array_filter(scoreOrderGlobal(), function ($i) {
+ return $i["_system"] === "gdapd";
+})));
+
+$requested = [];
+foreach ([...$pairs, ...$pairs2] as $pair) {
+ array_push($requested, ...$pair);
+}
+
+$fronters = array_map(function ($i) {
+ return $i["id"];
+}, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]);
+
+$requested = array_values(array_filter(array_reverse(array_unique($requested)), function ($i) use ($fronters) {
+ return !in_array($i, $fronters);
+}));
+
+$i = 0;
+$list = [$requested[$i]];
+while (in_array($list[count($list) - 1], $special)) {
+ $i++;
+ $list[] = $requested[$i];
+}
+
+if (count($list) > 1) {
+ $str = implode(" or ", array_map(function ($i) {
+ return (getMemberWithoutSystem($i)["display_name"] ?? getMemberWithoutSystem($i)["name"]);
+ }, $list)) . " is fronting today.";
+} elseif (count($list) > 0) {
+ $str = (getMemberWithoutSystem($list[0])["display_name"] ?? getMemberWithoutSystem($list[0])["name"]) . " is fronting today.";
+} else {
+ $str = "We couldn't tell who will front today, sorry.";
+}
+
+$context = stream_context_create([
+ 'http' => [
+ 'method' => 'POST',
+ 'header' =>
+ "Content-Type: text/plain\r\n" .
+ "Title: " . formatPonypush("🎠 Pony fronting today") . "\r\n" .
+ "Priority: high\r\n" .
+ "Tags: schedule\r\n" .
+ "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
+ 'content' => formatPonypush($str)
+ ]
+]);
+
+file_get_contents('https://' . $ntfy["server"] . '/main', false, $context);
diff --git a/includes/fragments/dashboard.inc b/includes/fragments/dashboard.inc
index 3cf8d6f..29b5b84 100644
--- a/includes/fragments/dashboard.inc
+++ b/includes/fragments/dashboard.inc
@@ -24,6 +24,10 @@ global $use2023UI;
<b>GPU acceleration is turned off or not supported.</b> A lot of visual effects on this website rely on GPU acceleration, which is currently disabled on your browser, meaning the website's overall look will be affected. Please enable GPU acceleration in your browser settings.
</div>
+ <div class="alert alert-warning">
+ <b>Ponycule's user-space pages are going away.</b> Starting in April 2024, we will be discontinuing all the Ponycule public pages to better focus on making Ponycule a central hub for plural integrations with other services. If you need access to all your content, you may request a backup to the administrators.
+ </div>
+
<style>
.day-gradient {
background-image: linear-gradient(180deg, rgba(7,15,36,1) 0%, rgba(36,56,83,1) 14%, rgba(165,126,57,1) 28%, rgba(37,109,201,1) 42%, rgba(47,165,208,1) 57%, rgba(252,120,15,1) 71%, rgba(38,66,97,1) 85%, rgba(7,15,36,1) 100%);
@@ -240,4 +244,4 @@ global $use2023UI;
</div>
</div>
</div>
-<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> \ No newline at end of file
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>