page: apply placeholder replacement to all page output
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 8 Jun 2018 16:47:55 +0000 (18:47 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 8 Jun 2018 22:37:09 +0000 (00:37 +0200)
login/index.php
page.inc.php
page.php

index 08351339d81cbeacd09ba11c2d3a86e3b6fd71de..40fcb6138caca20b3765a6a57306551e57971b65 100644 (file)
@@ -35,8 +35,7 @@ elseif (isset($_GET['logout'])) {
 if (empty($User)) {
        ob_clean();
        require_once 'login/form.inc.php';
-       $part = ['warn' => $message];
-       print getoutput($part);
+       $Place['warn'] = $message;
        return TRUE;
 }
 
@@ -48,11 +47,6 @@ if (isset($_GET['goto'])) {
        exit;
 }
 
-$part = [
-       'user'  => $User['name'],
-];
-print getoutput($part);
-
 if (empty($Args) and !empty($User['admin'])) {
        include_once 'login/admin.html';
        include_once 'login/admin/index.php';
index 333a70521e5de72c69d20904902fe679dbc4a5dc..c4884b9a098821f963514cf5be07334e57a5adea 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-$body = ob_get_clean();
+$body = getoutput($Place);
 
 include_once DOCROOT.'head.inc.php';
 
index 059b615fcb1d0adc2e2d384a34ce9669b8fd93ed..2c3a68ae4e172c86524bbe91004c551bec0794b3 100644 (file)
--- a/page.php
+++ b/page.php
@@ -130,19 +130,22 @@ print "</div>\n\n";
 
 # execute dynamic code
 
+$Place = [
+       'user'  => $User['name'],
+       'url'   => htmlspecialchars($_SERVER['REQUEST_URI']),
+];
+
 if ($Page) {
        $found |= require "./$Page/index.php";
 }
 
 # global html
 
-include_once 'page.inc.php';
-
 if (!$found) {
        # no resulting output
        http_response_code(404);
-       ob_start();
        @require "./404.html";
-       print getoutput([ 'url' => htmlspecialchars($_SERVER['REQUEST_URI']) ]);
 }
 
+include_once 'page.inc.php';
+