diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/components/details.inc | 6 | ||||
-rw-r--r-- | includes/jobs/CleanupDocs.php | 25 | ||||
-rw-r--r-- | includes/refresh.php | 19 |
3 files changed, 22 insertions, 28 deletions
diff --git a/includes/components/details.inc b/includes/components/details.inc index bc7e408..6a9f241 100644 --- a/includes/components/details.inc +++ b/includes/components/details.inc @@ -79,7 +79,7 @@ <?php if ($systemID !== $app["other"]["id"]): ?> <div id="member-details-2" style="background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;<?php if ($isLowerLoggedIn): ?>grid-template-columns: repeat(3, 1fr);<?php endif; ?>"> <?php endif; ?> - <?php $age2 = $age ?? 0; if (is_string($age2)) $age2 = (int)(explode("-", $age2)[1] ?? "0"); if (((isset($age2) && $age2 >= 16 && $metadata["little"] === 0) || (!isset($age2) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?> + <?php $age2 = $age ?? 0; if (is_string($age2)) $age2 = (int)(explode("-", $age2)[1] ?? "0"); if (((isset($age2) && $age2 >= 15 && $metadata["little"] !== 1) || (!isset($age2) && $metadata["little"] !== 1)) || $metadata["sexual_features"]): ?> <?php if ($isLoggedIn && $systemID !== $app["other"]["id"]): ?> <div> <span style="vertical-align: middle;"> @@ -90,8 +90,8 @@ <span title="Consent is absolutely required every time when having sex with this pony." data-bs-toggle="tooltip">Required</span> <?php endif; ?> </span> - <?php if (!((isset($age) && $age >= 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0))): ?> - <img src="/assets/icons/warning.svg" style="width: 16px;" title="Although this pony is able to engage in sexual relationships, this pony is not allowed to have sex with ponies who are over 16 years old." data-bs-toggle="tooltip"> + <?php if (!((isset($age) && $age >= 15 && $metadata["little"] !== 1) || (!isset($age) && $metadata["little"] !== 1))): ?> + <img src="/assets/icons/warning.svg" style="width: 16px;" title="Although this pony is able to engage in sexual relationships, this pony is not allowed to have sex with ponies who are over 15 years old." data-bs-toggle="tooltip"> <?php endif; ?> </div> <?php endif; ?> diff --git a/includes/jobs/CleanupDocs.php b/includes/jobs/CleanupDocs.php deleted file mode 100644 index 70f37b9..0000000 --- a/includes/jobs/CleanupDocs.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -$options = json_decode($argv[1], true); -$_SERVER['DOCUMENT_ROOT'] = "../.."; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/composer/vendor/autoload.php'; -use ColorThief\ColorThief; - -$documents = array_map(function ($i) { - return [ - "id" => substr($i, 0, -5), - ...(json_decode(file_get_contents("./data/docs/" . $i), true) ?? []) - ]; -}, array_filter(scandir("./data/docs"), function ($i) { - return !str_starts_with($i, ".") && str_ends_with($i, ".json"); -})); - -$deletable = array_values(array_filter($documents, function ($i) { - return str_starts_with(strip_tags($i["contents"]), "/delete"); -})); - -foreach ($deletable as $item) { - if (time() - $item["last"]["date"] > 86400) { - unlink("./data/docs/" . $item["id"] . ".json"); - } -}
\ No newline at end of file diff --git a/includes/refresh.php b/includes/refresh.php index 9abe297..98bda15 100644 --- a/includes/refresh.php +++ b/includes/refresh.php @@ -45,6 +45,25 @@ foreach ($screens as $screen) { if ($delete) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/screens/" . $screen); } +$documents = array_map(function ($i) { + return [ + "id" => substr($i, 0, -5), + ...(json_decode(file_get_contents("./data/docs/" . $i), true) ?? []) + ]; +}, array_filter(scandir("./data/docs"), function ($i) { + return !str_starts_with($i, ".") && str_ends_with($i, ".json"); +})); + +$deletable = array_values(array_filter($documents, function ($i) { + return str_starts_with(strip_tags($i["contents"]), "/delete"); +})); + +foreach ($deletable as $item) { + if (time() - $item["last"]["date"] > 86400) { + unlink("./data/docs/" . $item["id"] . ".json"); + } +} + function rscandir($dir) { global $ignore; $files = []; |