edit: detect executable files as uneditable
[minimedit.git] / edit.php
old mode 100644 (file)
new mode 100755 (executable)
index 80a49eb..357d3a4
--- a/edit.php
+++ b/edit.php
@@ -1,4 +1,3 @@
-#!/usr/bin/php-cgi
 <?php
 function abort($status, $body) {
        header("HTTP/1.1 $status");
@@ -14,6 +13,8 @@ if (!isset($_SERVER['PATH_INFO']) or strlen($_SERVER['PATH_INFO']) <= 1)
 $filename = preg_replace('/(?:\.html)?$/', '.html', ltrim($_SERVER['PATH_INFO'], '/'), 1);
 if (file_exists($filename) and !is_writable($filename))
        abort('403 input error', "ongeldige bestandsnaam: $filename");
+if (is_executable($filename))
+       abort('403 input error', "onwijzigbaar bestand: $filename");
 
 if (!isset($_POST['body']))
        abort('409 input error', "geen inhoud aangeleverd");