X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/33ac6d1d20c9834ea1309f15d2baf32eb4b85ef0..0080b6c4c668dd3cc4e309afe4ab33c62393d8c2:/page.inc.php diff --git a/page.inc.php b/page.inc.php index 7d93a22..7a54bf7 100644 --- a/page.inc.php +++ b/page.inc.php @@ -5,12 +5,12 @@ include_once 'head.inc.php'; print "
\n"; ob_start(); -include 'menu.html'; +include 'menu.inc.html'; ob_start(); if (!empty($User)) { print '

'; - printf('Ingelogd: %s', '/login', $User['name']); - if (!empty($User['admin'])) { + printf('Ingelogd: %s', '/login', $User->login); + if ($User->admin("edit $Page$Args")) { $editpage = $Page.$Args; if (is_dir($editpage)) { if (file_exists("$editpage/index.html")) { @@ -33,12 +33,6 @@ $nav = preg_replace_callback('{(.*?)}', function ($m) { $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 (!empty($User)) { - $nav = preg_replace('{\s*

  • .*?
  • }', '', $nav); -} -else { - $nav = preg_replace('{\s*}', '', $nav); -} print $nav; print "
    \n\n"; @@ -46,17 +40,17 @@ print $body; register_shutdown_function(function () { print '\n"; - global $User; - if (!empty($User['admin'])) { + global $User, $Page, $Args; + if (!empty($User) and $User->admin("edit $Page$Args")) { $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"; } print "\n";