['Bold', 'Italic', 'Underline', 'Strike', '-', 'Link'],
['HorizontalRule', 'Table', 'Image'],
];
- config.enterMode = CKEDITOR.ENTER_BR; // results in <p>; ENTER_P does it twice
});
});
exit;
}
-$filename = $_POST['page'];
-$filename = ltrim($filename, '/');
-if (!preg_match('/^[a-z]+\.html$/', $filename))
- abort('403 input error', "Ongeldige bestandsnaam: $filename");
+if (!$_POST)
+ abort('405 post error', "niets te doen");
+if (!isset($_POST['page']))
+ abort('409 input error', "geen bestand aangeleverd");
+
+$filename = preg_replace('/(?:\.html)?$/', '.html', ltrim($_POST['page'], '/'), 1);
+if (file_exists($filename) and !is_writable($filename))
+ abort('403 input error', "ongeldige bestandsnaam: $filename");
$prepend = '<!--#include virtual="common.html" -->'."\n\n";
-$append = "\n\n".'<!--#include virtual="footer.html" -->'."\n";
+$append = "\n".'<!--#include virtual="footer.html" -->'."\n";
$upload = $_POST['body'];
if (!$upload)
abort('409 input error', "leeg bestand aangeleverd");
if (!file_put_contents($filename, $prepend . $upload . $append))
- abort('500 save error', "kon bestand niet overschrijven");
+ abort('500 save error', "fout bij schrijven van $filename");
print "Bestand opgeslagen";
</div>
-<hr style="clear:both" />
+<hr class="footer" />
+<!--#if expr="-A /edit.php" -->
+<p class="footer">Beheer toegestaan voor <!--#echo var="REMOTE_ADDR" --></p>
<script src="/ckeditor/ckeditor.js"></script>
<script src="/edit.js"></script>
+<!--#endif -->
</body></html>