page: predetermine static html include
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 31 Jul 2018 18:16:39 +0000 (20:16 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 10 Aug 2018 23:27:43 +0000 (01:27 +0200)
page.php

index bb53a94a407306a04c99c13c3102a40562b2417c..e83a5853f355b25579fc1e2e208673be225e8674 100644 (file)
--- 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 '<div class="static">'."\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 "</div>\n\n";