rename all html files to php
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 10 Jul 2017 01:52:57 +0000 (03:52 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 12 Jul 2017 02:46:06 +0000 (04:46 +0200)
Server permissions to set "AddHandler application/x-httpd-php html"
may not be available.  Appropriate extension should work everywhere.

edit.js
edit.php

diff --git a/edit.js b/edit.js
index f7068adde6d830e49b9fd6560326dad2598ad019..dee103855135dca7f4ddd251a02cb1f9355eb820 100644 (file)
--- a/edit.js
+++ b/edit.js
@@ -2,7 +2,7 @@ CKEDITOR.plugins.add('inlinesave', {
        init: function(editor) {
                editor.addCommand( 'inlinesave', {
                        exec: function (editor) {
-                               var pagename = window.location.pathname.replace(/\.html$/, '').replace(/\/$/, '/index');
+                               var pagename = window.location.pathname.replace(/\.php$/, '').replace(/\/$/, '/index');
                                var data = 'body='+encodeURIComponent(editor.getData());
                                ajaxpost = new XMLHttpRequest();
                                ajaxpost.open('POST', '/edit.php'+pagename, true);
index afa6c6d4868c1948ade99c31579726d52ea9a358..94206bb054732b0410370b3b6bfe135f3c3bae77 100755 (executable)
--- a/edit.php
+++ b/edit.php
@@ -10,7 +10,7 @@ if (!$_POST)
 if (!isset($_SERVER['PATH_INFO']) or strlen($_SERVER['PATH_INFO']) <= 1)
        abort('409 input error', "geen bestand aangeleverd");
 
-$filename = preg_replace('/(?:\.html)?$/', '.html', ltrim($_SERVER['PATH_INFO'], '/'), 1);
+$filename = preg_replace('/(?:\.php)?$/', '.php', ltrim($_SERVER['PATH_INFO'], '/'), 1);
 if (file_exists($filename) and !is_writable($filename))
        abort('403 input error', "ongeldige bestandsnaam: $filename");
 if (is_executable($filename))