X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/467fdea52c27dcf01e79cb96068134403afff660..v4.5-6-g50f9b29cc2:/page.php diff --git a/page.php b/page.php index 5eefadb..8d2d01c 100644 --- a/page.php +++ b/page.php @@ -23,9 +23,11 @@ function fail($error) $Page->title = 'Fout'; } include_once 'page.inc.php'; + ob_start(); require '500.inc.html'; $Page->place['debug'] = htmlspecialchars($error); + $Page->raw = ob_get_clean(); print $Page->render(); } @@ -95,7 +97,6 @@ header(sprintf('Content-Security-Policy: %s', implode('; ', [ "frame-ancestors 'none'", # prevent malicious embedding ]))); -ob_start(); # page body $Page->place += [ 'user' => $User->login ?: '', 'url' => htmlspecialchars($_SERVER['REQUEST_URI']), @@ -127,15 +128,18 @@ if (isset($Page->raw)) { # output dynamic and/or static html -if (!$Page->handler or require("./{$Page->handler}/index.php")) { - # static contents - if (isset($Page->raw)) { - print $Page->raw; - } - else { +ob_start(); +if ($Page->handler and !require("./{$Page->handler}/index.php")) { + # replace contents by code output on false return + $Page->raw = ob_get_clean(); +} +else { + # keep article contents + if (!isset($Page->raw)) { # no resulting output http_response_code(404); @require '404.inc.html'; + $Page->raw = ob_get_clean(); } }