From a51979ad60074db84af78a06d30fcb888ccb0b03 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sun, 24 Mar 2024 13:42:39 +0100 Subject: Updated 3 files and added includes/external/next/index.php (automated) --- includes/external/next/index.php | 115 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 includes/external/next/index.php (limited to 'includes/external/next') 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 @@ + 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); -- cgit