page: edit template in static contents
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 15 Sep 2017 13:42:59 +0000 (15:42 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Sep 2017 18:21:28 +0000 (20:21 +0200)
Allow post-processing by relevant scripts.

page.php

index 9e3388ee0757cc27a3d384066c74799d1f805ade..3c0977ebf776b78590b646b7b5107fc9f5159abf 100644 (file)
--- a/page.php
+++ b/page.php
@@ -52,6 +52,9 @@ if (file_exists("$Page$Args/index.html")) {
 elseif (file_exists("$Page$Args.html")) {
        $found = include "./$Page$Args.html";
 }
+elseif (isset($User) and $User['admin']) {
+       $found = require './template.html';
+}
 
 print "</div>\n\n";
 
@@ -76,14 +79,9 @@ include_once 'page.inc.php';
 
 if (!$found) {
        # no resulting output
-       if (isset($User) and $User['admin']) {
-               require './template.html';
-       }
-       else {
-               http_response_code(404);
-               ob_start();
-               require "./404.html";
-               print getoutput([ 'url' => htmlspecialchars($_SERVER['REQUEST_URI']) ]);
-       }
+       http_response_code(404);
+       ob_start();
+       require "./404.html";
+       print getoutput([ 'url' => htmlspecialchars($_SERVER['REQUEST_URI']) ]);
 }