summaryrefslogtreecommitdiff
path: root/pages/rules.inc
diff options
context:
space:
mode:
Diffstat (limited to 'pages/rules.inc')
-rw-r--r--pages/rules.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/pages/rules.inc b/pages/rules.inc
index 967a4b4..23447f2 100644
--- a/pages/rules.inc
+++ b/pages/rules.inc
@@ -1,5 +1,6 @@
<?php
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/Parsedown.php"; $Parsedown = new Parsedown();
@@ -30,15 +31,21 @@ if (isset($_POST["updateRules"])) {
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules/rules.json", json_encode($_POST["payload"]));
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/rules.json", "{}");
+ createJob("RefreshCache", []);
header("Location: /-/rules");
die();
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/rules.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/rules.json", "{}");
+$cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/rules.json"), true);
?>
+<?php if (!isset($cache["content"])): ob_start(); ?>
+
<br>
<div class="container">
<div id="page-content">
@@ -272,5 +279,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
filter: invert(1);
}
</style>
+<?php $cache["content"] = ob_get_contents(); ob_end_clean(); endif;
+echo($cache["content"]); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/rules.json", json_encode($cache)); ?>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>