edit: autostart mode on #edit hash
[minimedit.git] / edit.php
old mode 100755 (executable)
new mode 100644 (file)
index 1856336..2a63bd2
--- a/edit.php
+++ b/edit.php
@@ -1,4 +1,6 @@
 <?php
+ob_clean();
+
 function abort($status, $body) {
        header("HTTP/1.1 $status");
        print "$body\n";
@@ -14,9 +16,9 @@ if (!isset($_SERVER['PATH_INFO']) or strlen($_SERVER['PATH_INFO']) <= 1)
        abort('409 input error', "geen bestand aangeleverd");
 
 $filename = ltrim($Args, '/').'.html';
-if (file_exists($filename) and !is_writable($filename))
+if (!preg_match('{^(?:[/a-z0-9-])+\.html$}', $filename))
        abort('403 input error', "ongeldige bestandsnaam: $filename");
-if (is_executable($filename))
+if (file_exists($filename) and !is_writable($filename))
        abort('403 input error', "onwijzigbaar bestand: $filename");
 
 if (!isset($_POST['body']))