init: function(editor) {
editor.addCommand( 'inlinesave', {
exec: function (editor) {
- var pagename = window.location.pathname.replace(/^\/(?:\.html)?/, '') || 'index';
- var data = 'page='+encodeURIComponent(pagename)+'&body='+encodeURIComponent(editor.getData());
+ var pagename = window.location.pathname.replace(/\.html$/, '').replace(/\/$/, '/index');
+ var data = 'body='+encodeURIComponent(editor.getData());
ajaxpost = new XMLHttpRequest();
- ajaxpost.open('POST', '/edit.php', true);
+ ajaxpost.open('POST', '/edit.php'+pagename, true);
ajaxpost.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
ajaxpost.onreadystatechange = function () {
if (ajaxpost.readyState != 4)
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");