X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/3f78a38cb23e2bb2609e010f0d3b4dce2d3c1727..7e01ee5991abc18d92a8c57e8e0ebe8887a18593:/foot.inc.php diff --git a/foot.inc.php b/foot.inc.php index d2ba826..799fb13 100755 --- a/foot.inc.php +++ b/foot.inc.php @@ -1,18 +1,13 @@ -var pagebody = document.getElementsByClassName('article')[0]; -pagebody.innerHTML = '

Nieuwe pagina

 

'; - -EOT; -} - define('N', "\n"); -$editable = FALSE; // "Beheer toegestaan voor {$_SERVER['REMOTE_ADDR']}:"; +$ALLOWED = [ + '127.0.0.1', +]; +$editable = in_array($_SERVER['REMOTE_ADDR'], $ALLOWED) ? + $_SERVER['REMOTE_ADDR'] : FALSE; $curfile = ltrim($_SERVER['SCRIPT_NAME'], '/'); if (is_executable(__DIR__ . '/' . $curfile)) { @@ -21,11 +16,23 @@ if (is_executable(__DIR__ . '/' . $curfile)) { } if ($editable) { + $edit = preg_match('/[?]edit$/', $_SERVER['REQUEST_URI']); + + if ($edit) { + echo ''.N; + echo ''.N; + if (($notfound = $_SERVER['SCRIPT_NAME'] == '/404.php')) { + echo <<<'EOT' + +EOT; + } + } + echo '