X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/c5d71935bf920cae82c602ff3d644d2e4bb6df47..c3518f67a1134e20a497dbfc3161353b650e279d:/page.inc.php diff --git a/page.inc.php b/page.inc.php index 0ca6589..8298c6d 100644 --- a/page.inc.php +++ b/page.inc.php @@ -1,10 +1,33 @@ \n"; ob_start(); include 'menu.html'; -$nav = ob_get_clean(); +ob_start(); +if ($User) { + print '

'; + printf('Ingelogd: %s', '/login', $User->login); + if ($User->admin) { + $editpage = $Page.$Args; + if (is_dir($editpage)) { + if (file_exists("$editpage/index.html")) { + $editpage .= '/index.html'; + } + } + else { + $editpage .= '.html'; + } + if (!file_exists($editpage) or 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 @@ -13,16 +36,23 @@ $nav = preg_replace_callback('{(.*?)}', function ($m) { print $nav; print "\n\n"; -print '
'."\n\n"; - -include_once 'auth.inc.php'; +print $body; register_shutdown_function(function () { - print "
\n\n"; - include 'foot.inc.php'; + print '\n"; + + global $User; + if ($User and $User->admin) { + $ckesrc = '/lib/ckeditor'; # local install + if (!file_exists(DOCROOT . $ckesrc)) { + $ckesrc = '//cdn.ckeditor.com/4.7.3/full-all'; # remote fallback + } + printf(''."\n", "$ckesrc/ckeditor.js"); + print ''."\n"; + } + print "\n"; }); -include "$Page.html"; -if (file_exists("$Page.php")) include_once("$Page.php"); -