page: set placeholder after page script v3.0
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 8 Jun 2018 22:50:33 +0000 (00:50 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 9 Jun 2018 03:18:59 +0000 (05:18 +0200)
User may be set or changed by login.

page.php

index 7c4f8b1363101fa091eb40e8ac0ccaaaff21e76a..554735c69b53f9f0db275d5c6ea2fe6df80a4198 100644 (file)
--- a/page.php
+++ b/page.php
@@ -145,15 +145,17 @@ print "</div>\n\n";
 
 # execute dynamic code
 
-$Place = [
-       'user'  => $User['name'],
-       'url'   => htmlspecialchars($_SERVER['REQUEST_URI']),
-];
+$Place = [];
 
 if ($Page) {
        $found |= require "./$Page/index.php";
 }
 
+$Place += [
+       'user'  => $User ? $User['name'] : '',
+       'url'   => htmlspecialchars($_SERVER['REQUEST_URI']),
+];
+
 # global html
 
 if (!$found) {