From 27bc06f395acc3a29bf7522ee16a127c19d6b0d4 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 31 Jul 2018 20:16:39 +0200 Subject: [PATCH] page: predetermine static html include --- page.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/page.php b/page.php index bb53a94..e83a585 100644 --- a/page.php +++ b/page.php @@ -133,6 +133,17 @@ while (TRUE) { } } +$staticpage = NULL; +if (file_exists("$Page$Args.html")) { + $staticpage = "$Page$Args.html"; +} +elseif (file_exists("$Page$Args/index.html")) { + $staticpage = "$Page$Args/index.html"; +} +elseif (!empty($User['admin'])) { + $staticpage = (file_exists("$Page/template.html") ? "$Page/template.html" : 'template.html'); +} + # load static contents ob_start(); # page body @@ -140,14 +151,8 @@ ob_start(); # inner html print '
'."\n\n"; $found = FALSE; -if (file_exists("$Page$Args.html")) { - $found = include "./$Page$Args.html"; -} -elseif (file_exists("$Page$Args/index.html")) { - $found = include "./$Page$Args/index.html"; -} -elseif (!empty($User['admin'])) { - $found = include (file_exists("$Page/template.html") ? "$Page/template.html" : './template.html'); +if (isset($staticpage)) { + $found = include "./$staticpage"; } print "
\n\n"; -- 2.30.0