page: prepend 404 contents to admin template
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 4 Dec 2020 22:50:39 +0000 (23:50 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 19 Dec 2020 02:01:43 +0000 (03:01 +0100)
Preview actual output on edit.

page.php

index 8d2d01c1f3b7852d58db9a3ed283fb9dcd055a7c..ba5830692e0eeaf65705b962c866e57e5a8a2c59 100644 (file)
--- a/page.php
+++ b/page.php
@@ -111,6 +111,7 @@ if (!isset($Page->raw) and $User->admin("edit {$Page->link}")) {
        $Page->raw($template);
        $Page->meta['article:published_time'] = date('Y-m-d h:i:s O');
        $Page->meta['article:author'] = '/' . $User->dir;
+       $Page->body = NULL;
 }
 
 if (isset($Page->raw)) {
@@ -135,11 +136,11 @@ if ($Page->handler and !require("./{$Page->handler}/index.php")) {
 }
 else {
        # keep article contents
-       if (!isset($Page->raw)) {
+       if (!isset($Page->body)) {
                # no resulting output
                http_response_code(404);
                @require '404.inc.html';
-               $Page->raw = ob_get_clean();
+               $Page->raw = ob_get_clean() . $Page->raw;
        }
 }