X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/9de683f8c399ee4a78fbc86b5ee96ce5662acf97..f065f4739ae477d8877805463017f2e7b15e2db5:/page.inc.php diff --git a/page.inc.php b/page.inc.php index b3fa5f7..78cca99 100644 --- a/page.inc.php +++ b/page.inc.php @@ -1,10 +1,37 @@ render(@$Place); + +include_once 'head.inc.php'; print "
\n"; ob_start(); -include './menu.html'; -$nav = ob_get_clean(); +$menu = new ArchiveArticle('menu.inc.html'); +print $menu->raw; +ob_start(); +if ($User and property_exists($User, 'login') and $User->login) { + print '

'; + printf('%s %s', + '👤', + '/login', $User->login + ); + if ($User->admin("edit {$Page->link}")) { + $editpage = $Page->link; + 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 ' '; + } + } + print "

\n"; +} +$nav = $menu->render(['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 +40,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, $Page; + if ($User and $User->admin("edit {$Page->link}")) { + $ckesrc = '/lib/ckeditor'; # local install + if (!file_exists(DOCROOT . $ckesrc)) { + $ckesrc = '//cdn.ckeditor.com/4.15.1/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"); -