nieuws/feed: include domain part in article link
[minimedit.git] / page.inc.php
index 333a70521e5de72c69d20904902fe679dbc4a5dc..b6723e9917c629b4483456281b3ff636276b0809 100644 (file)
@@ -1,11 +1,11 @@
 <?php
-$body = ob_get_clean();
+$body = getoutput(@$Place);
 
-include_once DOCROOT.'head.inc.php';
+include_once 'head.inc.php';
 
 print "<header>\n";
 ob_start();
-include DOCROOT.'menu.html';
+include 'menu.html';
 ob_start();
 if (!empty($User)) {
        print '<div class="login"><p>';
@@ -33,12 +33,6 @@ $nav = preg_replace_callback('{<a href="([^"]+)">(.*?)</a>}', function ($m) {
        $html = $request == $m[1] ? $m[2] : $m[0]; # text or full link
        return $m[1] == substr($request, 0, strlen($m[1])) ? "<b>$html</b>" : $html;
 }, $nav);
-if (!empty($User)) {
-       $nav = preg_replace('{\s*<li class="logout">.*?</li>}', '', $nav);
-}
-else {
-       $nav = preg_replace('{\s*<li class="login">.*?</li>}', '', $nav);
-}
 print $nav;
 print "</header>\n\n";
 
@@ -46,13 +40,17 @@ print $body;
 
 register_shutdown_function(function () {
        print '<footer>';
-       @include DOCROOT.'footer.html';
+       @include 'footer.html';
        print "</footer>\n";
 
        global $User;
        if (!empty($User['admin'])) {
-               print '<script src="//cdn.ckeditor.com/4.7.3/full-all/ckeditor.js"></script>'."\n";
-               print '<script src="/edit.js"></script>'."\n";
+               $ckesrc = '/lib/ckeditor'; # local install
+               if (!file_exists(DOCROOT . $ckesrc)) {
+                       $ckesrc = '//cdn.ckeditor.com/4.7.3/full-all'; # remote fallback
+               }
+               printf('<script src="%s"></script>'."\n", "$ckesrc/ckeditor.js");
+               print '<script src="/edit/page.js"></script>'."\n";
        }
 
        print "</body></html>\n";