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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<?php
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json", "[]");
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json", "{}");
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
global $use2023UI;
$pairs = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/pairs.json"), true);
$ignored = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json"), true);
$locked = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json"), true);
if (isset($_GET["ignore"]) && isset($_GET["day"])) {
if ($_GET["ignore"] === "1") {
if (preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET["day"]) === false) {
header("Location: /$_GET[_]");
die();
}
if (!in_array($_GET["day"], $ignored)) {
$ignored[] = $_GET["day"];
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json", json_encode($ignored));
header("Location: /$_GET[_]");
die();
} elseif ($_GET["ignore"] === "0") {
if (preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET["day"]) === false) {
header("Location: /$_GET[_]");
die();
}
if (in_array($_GET["day"], $ignored)) {
unset($ignored[array_search($_GET["day"], $ignored)]);
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json", json_encode($ignored));
header("Location: /$_GET[_]");
die();
}
die();
}
if (isset($_GET["lock"]) && isset($_GET["day"]) && isset($_GET["data"])) {
if (isset($locked[$_GET["day"]])) {
unset($locked[$_GET["day"]]);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json", json_encode($locked));
header("Location: /$_GET[_]");
die();
} else {
$locked[$_GET["day"]] = $_GET["data"];
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json", json_encode($locked));
header("Location: /$_GET[_]");
die();
}
}
|