From 05af3950c40e5724f1cd9ed662528c0832fb1297 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Wed, 29 Mar 2023 22:44:18 +0200 Subject: Updated 3 files and deleted includes/jobs/CleanupDocs.php (automated) --- includes/components/details.inc | 6 +++--- includes/jobs/CleanupDocs.php | 25 ------------------------- includes/refresh.php | 19 +++++++++++++++++++ pages/api/docs.php | 3 +-- 4 files changed, 23 insertions(+), 30 deletions(-) delete mode 100644 includes/jobs/CleanupDocs.php 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 @@
; margin-left: -20px; margin-right: -20px;grid-template-columns: repeat(3, 1fr);"> - = 16 && $metadata["little"] === 0) || (!isset($age2) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?> + = 15 && $metadata["little"] !== 1) || (!isset($age2) && $metadata["little"] !== 1)) || $metadata["sexual_features"]): ?>
@@ -90,8 +90,8 @@ Required - = 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0))): ?> - + = 15 && $metadata["little"] !== 1) || (!isset($age) && $metadata["little"] !== 1))): ?> +
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 @@ - 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 = []; diff --git a/pages/api/docs.php b/pages/api/docs.php index 51b92f5..3d11831 100644 --- a/pages/api/docs.php +++ b/pages/api/docs.php @@ -27,5 +27,4 @@ if ($json_object["category"]) $data["category"] = trim($json_object["category"]) $data["last"]["date"] = time(); $data["last"]["author"] = $_PROFILE['login']; -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json", utf8_encode(json_encode($data))); -createJob("CleanupDocs", []); \ No newline at end of file +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json", utf8_encode(json_encode($data))); \ No newline at end of file -- cgit