X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/848f9155e138a0c13a0ecab423f165d5b4ba6d4d..502945bc14e9fdd9f4268103227462af442c0560:/edit.php diff --git a/edit.php b/edit.php index 398581e..719c2f0 100644 --- a/edit.php +++ b/edit.php @@ -7,15 +7,15 @@ function abort($status, $body) { if (!$_POST) abort('405 post error', "niets te doen"); -if (!isset($_POST['page'])) +if (!isset($_SERVER['PATH_INFO']) or strlen($_SERVER['PATH_INFO']) <= 1) abort('409 input error', "geen bestand aangeleverd"); -$filename = preg_replace('/(?:\.html)?$/', '.html', ltrim($_POST['page'], '/'), 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"); -$prepend = ''."\n\n"; -$append = "\n".''."\n"; +$prepend = ''."\n\n"; +$append = "\n".''."\n"; $upload = $_POST['body']; if (!$upload)