page: global var to indicate edit mode v2.0
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 12 Sep 2017 00:40:41 +0000 (02:40 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Sep 2017 18:21:28 +0000 (20:21 +0200)
foot.inc.php
page.php

index e3e36b6f183b07e9f3c5c7bbb752205af56d7d85..a7f52d692a1c5930d86724bfdbb6e6ee09a240a1 100755 (executable)
@@ -2,13 +2,12 @@
 <?php
 define('N', "\n");
 
-global $Page, $User, $Admin;
+global $Page, $User, $Admin, $Edit;
 
 if ($Admin) {
-       $edit = preg_match('/[?]edit$/', $_SERVER['REQUEST_URI']);
        $notfound = $Page == '404';
 
-       if ($edit) {
+       if ($Edit) {
                echo '<script src="/ckeditor/ckeditor.js"></script>'.N;
                echo '<script src="/edit.js"></script>'.N;
                if ($notfound) {
@@ -24,8 +23,8 @@ EOT;
        echo '<p class="footer">'.N;
        echo "Beheer toegestaan voor $User:".N;
        printf('<a href="?%s">%s</a>'.N,
-               $edit ? '' : 'edit',
-               $edit ? 'lezen' : ($notfound ? 'aanmaken' : 'aanpassen')
+               $Edit ? '' : 'edit',
+               $Edit ? 'lezen' : ($notfound ? 'aanmaken' : 'aanpassen')
        );
        echo '</p>'.N;
 }
index 5d79cf6846ff9e740bf675f5928773fe25e15f45..e2043edb4b4cd6ed3a30805f76637f9b213693e4 100644 (file)
--- a/page.php
+++ b/page.php
@@ -29,4 +29,6 @@ while (TRUE) {
        $Page = substr($Page, 0, $up);
 }
 
+$Edit = isset($_GET['edit']);
+
 include 'head.inc.php';