edit: distinct admin template for missing pages
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 13 Sep 2017 02:00:15 +0000 (04:00 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Sep 2017 18:21:28 +0000 (20:21 +0200)
Similar results to javascript modification but much easier to maintain.

foot.inc.php
page.php
template.html [new file with mode: 0644]

index 493dcc9ee72c1967943af17265331818d5a811aa..e2ac444285d6b3819a074a99f9682800f222ca4a 100755 (executable)
@@ -5,19 +5,9 @@ define('N', "\n");
 global $Page, $User, $Edit;
 
 if ($User['admin']) {
-       $notfound = $Page == '404';
-
        if ($Edit) {
                echo '<script src="/ckeditor/ckeditor.js"></script>'.N;
                echo '<script src="/edit.js"></script>'.N;
-               if ($notfound) {
-                       echo <<<'EOT'
-<script>
-var pagebody = document.getElementsByClassName('article')[0];
-pagebody.innerHTML = '<h2>Nieuwe pagina</h2><p>&nbsp;</p>';
-</script>
-EOT;
-               }
        }
 
        echo '<p class="footer">'.N;
index f6088dd859dcb2906477307b99a52088610ee554..38f54ecc285fe38381d898138da4eaf10b167ec0 100644 (file)
--- a/page.php
+++ b/page.php
@@ -24,6 +24,10 @@ while (TRUE) {
 
        $up = strrpos($Page, '/');
        if ($up === FALSE) {
+               if ($User['admin']) {
+                       $Page = 'template';
+                       break;
+               }
                http_response_code(404);
                $Page = '404';
                break;
diff --git a/template.html b/template.html
new file mode 100644 (file)
index 0000000..99b73a4
--- /dev/null
@@ -0,0 +1,3 @@
+<h2>Nieuwe pagina</h2>
+
+<p></p>