From 7d794f88a5ab9d2b0bded60cd55a78b1dd0e7000 Mon Sep 17 00:00:00 2001 From: danpros Date: Mon, 8 Jan 2024 23:35:38 +0700 Subject: [PATCH] Update dispatch.php --- system/includes/dispatch.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/system/includes/dispatch.php b/system/includes/dispatch.php index 7475beb..04d054a 100644 --- a/system/includes/dispatch.php +++ b/system/includes/dispatch.php @@ -347,12 +347,11 @@ function content($value = null) function render($view, $locals = null, $layout = null) { - $login = login(); - if (!$login) { + if (!login()) { $c = str_replace('/', '#', str_replace('?', '~', rawurldecode($_SERVER['REQUEST_URI']))); $dir = 'cache/page'; $cachefile = $dir . '/' . $c . '.cache'; - if (is_dir($dir) === false) { + if (!is_dir($dir)) { mkdir($dir, 0775, true); } } @@ -385,13 +384,11 @@ function render($view, $locals = null, $layout = null) ob_start(); require $layout; } - if (!$login && $view != '404') { - if (!file_exists($cachefile)) { - if (config('cache.timestamp') == 'true') { - echo "\n" . ''; - } - file_put_contents($cachefile, ob_get_contents()); + if (!login() && $view != '404' && config('cache.off') == "false") { + if (config('cache.timestamp') == 'true') { + echo "\n" . ''; } + file_put_contents($cachefile, ob_get_contents()); } echo trim(ob_get_clean()); } else {