X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/97bc8f54b09859842e53d4886234a3b09122ea71..0c5eed59b9187f54cedadc383bf2326f5ba354e0:/page.inc.php
diff --git a/page.inc.php b/page.inc.php
index dcb0573..1253338 100644
--- a/page.inc.php
+++ b/page.inc.php
@@ -1,26 +1,64 @@
\n";
ob_start();
-include './menu.html';
-$nav = ob_get_clean();
+include 'menu.html';
+ob_start();
+if (!empty($User)) {
+ print '
';
+ printf('Ingelogd: %s', '/login', $User['name']);
+ if (!empty($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
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";
-print ''."\n\n";
+print $body;
register_shutdown_function(function () {
- print "
\n\n";
- include 'foot.inc.php';
+ print '\n";
+
+ global $User;
+ if (!empty($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 "