X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/85cba03008bb578b92db4c9876e5e0f96c76f543..3dd944a535c60c1b25dedda5c942d43fd0b6421e:/page.inc.php diff --git a/page.inc.php b/page.inc.php index 2c1fc6c..9d49fad 100644 --- a/page.inc.php +++ b/page.inc.php @@ -1,26 +1,49 @@ \n"; ob_start(); -include './menu.html'; -$nav = ob_get_clean(); +include DOCROOT.'menu.html'; +ob_start(); +if (isset($User)) { + print '

'; + printf('Ingelogd: %s', $User['name']); + if ($User['admin']) { + 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 return $m[1] == substr($request, 0, strlen($m[1])) ? "$html" : $html; }, $nav); +if (isset($User)) { + $nav = preg_replace('{\s*
  • .*?
  • }', '', $nav); +} +else { + $nav = preg_replace('{\s*
  • .*?
  • }', '', $nav); +} print $nav; print "\n\n"; +print $body; + register_shutdown_function(function () { - include 'foot.inc.php'; - print "\n"; -}); + print '\n"; -print '
    '."\n\n"; -include "./$Page.html"; -print "
    \n\n"; + global $User; + if (isset($User) and $User['admin']) { + print ''."\n"; + print ''."\n"; + } -if (file_exists("$Page.php")) include_once("./$Page.php"); + print "\n"; +});