X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/0e699432ba7d5b10b24ef5355dbe9b0036ebd248..5d12bd9eb6674e9101a6a89c1b7a78ac1940fe6e:/page.inc.php diff --git a/page.inc.php b/page.inc.php index 654f37f..393d614 100644 --- a/page.inc.php +++ b/page.inc.php @@ -1,12 +1,33 @@ \n"; ob_start(); -include './menu.html'; -$nav = ob_get_clean(); +include DOCROOT.'menu.html'; +ob_start(); +if (isset($User)) { + print '

'; + printf('Ingelogd: %s', '/login', $User['name']); + if ($User['admin']) { + $editpage = $Page.$Args; + if (is_dir($editpage)) { + if (file_exists("$editpage/index.html")) { + $editpage .= '/index.html'; + } + } + else { + $editpage .= '.html'; + } + if (is_writable($editpage)) { + print ' Wijzig'; + } + } + print "

\n"; +} +$nav = getoutput(['login' => ob_get_clean()]); + $nav = preg_replace_callback('{(.*?)}', function ($m) { $request = $_SERVER['REQUEST_URI']; $html = $request == $m[1] ? $m[2] : $m[0]; # text or full link @@ -14,7 +35,6 @@ $nav = preg_replace_callback('{(.*?)}', function ($m) { }, $nav); if (isset($User)) { $nav = preg_replace('{\s*
  • .*?
  • }', '', $nav); - $nav = str_replace('[[login]]', $User['name'], $nav); } else { $nav = preg_replace('{\s*
  • .*?
  • }', '', $nav); @@ -24,10 +44,9 @@ print "\n\n"; print $body; -$footinc = realpath('footer.html'); # cwd lost during shutdown register_shutdown_function(function () { print '\n"; global $User;