summaryrefslogtreecommitdiff
path: root/includes/util/agewarning.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/util/agewarning.inc')
-rw-r--r--includes/util/agewarning.inc35
1 files changed, 35 insertions, 0 deletions
diff --git a/includes/util/agewarning.inc b/includes/util/agewarning.inc
new file mode 100644
index 0000000..1f51647
--- /dev/null
+++ b/includes/util/agewarning.inc
@@ -0,0 +1,35 @@
+<?php
+
+function showWarning($name, $id, $system) {
+ $ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
+
+ if (time() > 1677628800) {
+ file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy['topic'], false, stream_context_create([
+ 'http' => [
+ 'method' => 'POST',
+ 'header' =>
+ "Content-Type: text/plain\r\n" .
+ "Title: ⚠️ $name does not have an age or birth year set\r\n" .
+ "Priority: max\r\n" .
+ "Tags: switch\r\n" .
+ "Actions: view, Edit on Cold Haze, https://ponies.equestria.horse/-/metadata/" . ($system === "gdapd" ? "raindrops" : "cloudburst") . "/" . $id . "/, clear=true\r\n" .
+ "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
+ 'content' => "To make sure they appear on the fronting schedule (and to make sure they can front again), they need to set an age or birth year now."
+ ]
+ ]));
+ } else {
+ file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy['topic'], false, stream_context_create([
+ 'http' => [
+ 'method' => 'POST',
+ 'header' =>
+ "Content-Type: text/plain\r\n" .
+ "Title: ⚠️ $name does not have an age or birth year set\r\n" .
+ "Priority: max\r\n" .
+ "Tags: switch\r\n" .
+ "Actions: view, Edit on Cold Haze, https://ponies.equestria.horse/-/metadata/" . ($system === "gdapd" ? "raindrops" : "cloudburst") . "/" . $id . "/, clear=true\r\n" .
+ "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
+ 'content' => "To make sure they still appear on the fronting schedule after March 1st, they need to set an age or birth year now."
+ ]
+ ]));
+ }
+} \ No newline at end of file