page: write edit includes from common script
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 15 Sep 2017 18:54:24 +0000 (20:54 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Sep 2017 18:21:28 +0000 (20:21 +0200)
Enforce on all sites, appending (editable) footer.html instead for
site-specific contents.

foot.inc.php [deleted file]
page.inc.php

diff --git a/foot.inc.php b/foot.inc.php
deleted file mode 100644 (file)
index b3d6e6a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<hr class="footer" />
-<?php
-define('N', "\n");
-
-global $User;
-
-if ($User['admin']) {
-               echo '<script src="/ckeditor/ckeditor.js"></script>'.N;
-               echo '<script src="/edit.js"></script>'.N;
-
-       echo '<p class="footer">'.N;
-       echo "Beheer toegestaan voor {$User['name']}.".N;
-       echo '</p>'.N;
-}
-
index 4cc693942f09a1659d0c20a2ec58c196265e7f13..654f37fa7ebeee2a412b2348fc3bab61d1ac4d88 100644 (file)
@@ -24,8 +24,18 @@ print "</header>\n\n";
 
 print $body;
 
+$footinc = realpath('footer.html'); # cwd lost during shutdown
 register_shutdown_function(function () {
-       include 'foot.inc.php';
+       print '<footer>';
+       @include $GLOBALS['footinc'];
+       print "</footer>\n";
+
+       global $User;
+       if (isset($User) and $User['admin']) {
+               print '<script src="//cdn.ckeditor.com/4.7.3/full-all/ckeditor.js"></script>'."\n";
+               print '<script src="/edit.js"></script>'."\n";
+       }
+
        print "</body></html>\n";
 });