edit/head: check original file request for writability
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 20 Dec 2020 00:58:13 +0000 (01:58 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 21 Dec 2020 16:46:33 +0000 (17:46 +0100)
edit/head.inc.php

index 9759ec818a4e8cbac0bd34b21b1004c94bf61b2e..a12c54be218713d6140adc52d1ecdb3f1254d8f8 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+if (file_exists($Page->file) and !is_writable($Page->file)) {
+       return;
+}
+
 if (!isset($Page->raw)) {
        # open bottom template as initial contents
        $template = 'template.inc.html';
@@ -11,19 +15,6 @@ if (!isset($Page->raw)) {
        $Page->body = NULL;
 }
 
-$editpage = $Page->link;
-if (is_dir($editpage)) {
-       if (file_exists("$editpage/index.html")) {
-               $editpage .= '/index.html';
-       }
-}
-else {
-       $editpage .= '.html';
-}
-if (file_exists($editpage) and !is_writable($editpage)) {
-       return;
-}
-
 if (isset($Page->raw)) {
        # restore meta tags in static contents for editing
        foreach (array_reverse($Page->meta) as $metaprop => $val) {