summaryrefslogtreecommitdiff
path: root/includes/util/agewarning.inc
blob: 06a5e4de10ef716fa1d5f63d236925bfeaa1e432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

function showWarning($name, $id, $system) {
    $ntfy = $GLOBALS["ColdHazeApp"]["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: " . formatPonypush("⚠️ $name does not have an age or birth year set") . "\r\n" .
                    "Priority: max\r\n" .
                    "Tags: switch\r\n" .
                    "Actions: view, Edit on Ponycule, https://ponycule.p.equestria.dev/-/metadata/" . ($system === "gdapd" ? "raindrops" : ($system === "hrbom" ? "moonglow" : $GLOBALS["ColdHazeApp"]["other"]["slug"])) . "/" . $id . "/, clear=true\r\n" .
                    "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
                'content' => formatPonypush("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: " . formatPonypush("⚠️ $name does not have an age or birth year set") . "\r\n" .
                    "Priority: max\r\n" .
                    "Tags: switch\r\n" .
                    "Actions: view, Edit on Ponycule, https://ponycule.p.equestria.dev/-/metadata/" . ($system === "gdapd" ? "raindrops" : ($system === "hrbom" ? "moonglow" : $GLOBALS["ColdHazeApp"]["other"]["slug"])) . "/" . $id . "/, clear=true\r\n" .
                    "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
                'content' => formatPonypush("To make sure they still appear on the fronting schedule after March 1st, they need to set an age or birth year now.")
            ]
        ]));
    }
}