OSDN Git Service

BugTrack/2418 Delete blank page even if it has only small changes
authorumorigu <umorigu@gmail.com>
Thu, 16 Feb 2017 17:04:00 +0000 (02:04 +0900)
committerumorigu <umorigu@gmail.com>
Thu, 16 Feb 2017 17:28:31 +0000 (02:28 +0900)
lib/file.php
plugin/edit.inc.php

index b3b0389..80d6594 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
 // file.php
-// Copyright (C)
-//   2002-2016 PukiWiki Development Team
+// Copyright
+//   2002-2017 PukiWiki Development Team
 //   2001-2002 Originally written by yu-ji
 // License: GPL v2 or (at your option) any later version
 //
@@ -95,7 +95,7 @@ function page_write($page, $postdata, $notimestamp = FALSE)
        // Do nothing when it has no changes
        $oldpostdata = is_page($page) ? join('', get_source($page)) : '';
        $oldtext_without_author = remove_author_info($oldpostdata);
-       if ($text_without_author === $oldtext_without_author) {
+       if (!$is_delete && $text_without_author === $oldtext_without_author) {
                // Do nothing on updating with unchanged content
                return;
        }
index 6b73573..8e3ab00 100644 (file)
@@ -28,7 +28,7 @@ function plugin_edit_action()
        }
 
        $postdata = @join('', get_source($page));
-       if ($postdata == '') $postdata = auto_template($page);
+       if ($postdata === '') $postdata = auto_template($page);
        $postdata = remove_author_info($postdata);
        return array('msg'=>$_title_edit, 'body'=>edit_form($page, $postdata));
 }
@@ -62,7 +62,7 @@ function plugin_edit_preview()
        }
 
        $body = $_msg_preview . '<br />' . "\n";
-       if ($postdata == '')
+       if ($postdata === '')
                $body .= '<strong>' . $_msg_preview_delete . '</strong>';
        $body .= '<br />' . "\n";
 
@@ -219,7 +219,7 @@ function plugin_edit_write()
        }
 
        // NULL POSTING, OR removing existing page
-       if ($postdata == '') {
+       if ($postdata === '') {
                page_write($page, $postdata);
                $retvars['msg' ] = $_title_deleted;
                $retvars['body'] = str_replace('$1', htmlsc($page), $_title_deleted);