page: include partial templates from *.inc.html
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 17 Oct 2019 00:05:09 +0000 (02:05 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 17 Oct 2019 00:30:13 +0000 (02:30 +0200)
Rename system files to be distinguishable from public pages.

403.inc.html [moved from 403.html with 100% similarity]
404.inc.html [moved from 404.html with 100% similarity]
500.inc.html [moved from 500.html with 100% similarity]
article.inc.php
foto/template.inc.html [moved from foto/template.html with 100% similarity]
page.inc.php
page.php
template.inc.html [moved from template.html with 100% similarity]

similarity index 100%
rename from 403.html
rename to 403.inc.html
similarity index 100%
rename from 404.html
rename to 404.inc.html
similarity index 100%
rename from 500.html
rename to 500.inc.html
index a39b8971c3546cc236a84fbd63b44571de780064..6fcb640dc5e8ee2f857999010fc693814a738557 100644 (file)
@@ -159,7 +159,7 @@ class PageSearch
                                }
                                # match **/*.html
                                return $current->isDir()
-                                       || preg_match('/\.html$/', $current->getFilename());
+                                       || preg_match('/(?<!\.inc)\.html$/', $current->getFilename());
                        }
                );
        }
similarity index 100%
rename from foto/template.html
rename to foto/template.inc.html
index c93fcbcd9b68898073c569bac9eb6522b0af93ab..577f1e030806152973998a8b8d4f9a7d60de69da 100644 (file)
@@ -5,7 +5,7 @@ include_once 'head.inc.php';
 
 print "<header>\n";
 ob_start();
-include 'menu.html';
+include 'menu.inc.html';
 ob_start();
 if ($User) {
        print '<div class="login"><p>';
@@ -40,7 +40,7 @@ print $body;
 
 register_shutdown_function(function () {
        print '<footer>';
-       @include 'footer.html';
+       @include 'footer.inc.html';
        print "</footer>\n";
 
        global $User;
index c2c4282ab1b38bce9cfc0cfa172d952056acc551..10e90facb00357fbf2a84123a47fdf8b50b4fccf 100644 (file)
--- a/page.php
+++ b/page.php
@@ -86,7 +86,7 @@ function fail($error)
        http_response_code(500);
        include_once 'page.inc.php';
        ob_start();
-       require_once '500.html';
+       require_once '500.inc.html';
        print getoutput(['debug' => $error]);
 }
 
@@ -160,7 +160,7 @@ elseif (file_exists("$Page$Args/index.html")) {
        $staticpage = "$Page$Args/index.html";
 }
 elseif ($User and $User->admin('edit')) {
-       $staticpage = (file_exists("$Page/template.html") ? "$Page/template.html" : 'template.html');
+       $staticpage = (file_exists("$Page/template.inc.html") ? "$Page/template.inc.html" : 'template.inc.html');
 }
 
 # load static contents
@@ -198,7 +198,7 @@ $Place += [
 if (!$found) {
        # no resulting output
        http_response_code(404);
-       @require '404.html';
+       @require '404.inc.html';
 }
 
 include_once 'page.inc.php';
similarity index 100%
rename from template.html
rename to template.inc.html