diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-10-02 09:03:00 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-10-02 09:03:00 +0000 |
commit | 876c7a1ba43f29af378baa3ca3d71a1388132180 (patch) | |
tree | f70748d0d9d3fb663d8244361ae89096b87bd351 /pmwiki.php | |
parent | 33dec7699c86a45a850e7bb957e2bfa2d0a3466d (diff) | |
download | pmwiki.svn-876c7a1ba43f29af378baa3ca3d71a1388132180.tar.bz2 |
When merging last edit, if there is no change summary, reuse the last one. Ignore errors with date/timezone formats (PITS:01495).
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4507 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'pmwiki.php')
-rw-r--r-- | pmwiki.php | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -762,7 +762,8 @@ function cb_PSFT($fmt, $vars) { if (isset($iformats[$fmt])) { $ifmt = $iformats[$fmt]; - return datefmt_create(@$locale, $ifmt[0], $ifmt[1], $tz, null, @$ifmt[2])->format($timestamp); + $dfmt = datefmt_create(@$locale, $ifmt[0], $ifmt[1], $tz, null, @$ifmt[2]); + if ($dfmt) return $dfmt->format($timestamp); } return $fmt; } @@ -2564,7 +2565,8 @@ function SaveAttributes($pagename,&$page,&$new) { ## Based on Cookbook:FuseEdit function MergeLastMinorEdit($pagename, &$page, &$new) { - global $EnableMergeLastMinorEdit, $Now, $EnablePost, $Author; + global $EnableMergeLastMinorEdit, $Now, $EnablePost, $Author, + $EnableRCDiffBytes, $ChangeSummary; if (!$EnablePost || !IsEnabled($EnableMergeLastMinorEdit, 0)) return; if (@$_POST['diffclass'] !== 'minor') return; if ($page['agent'] != @$_SERVER['HTTP_USER_AGENT']) return; @@ -2594,6 +2596,14 @@ function MergeLastMinorEdit($pagename, &$page, &$new) { $new[$newdiffkey] = ''; $new["csum:$time"] = XL('[Edit fused with more recent]') . ' ' . $new["csum:$time"]; + + # If $ChangeSummary is empty, reuse the previous one + if (!$ChangeSummary) { + $csum = $page["csum"]; + if (IsEnabled($EnableRCDiffBytes, 0)) + $csum = preg_replace('/\\s*\\([-+]\\d+\\)\\s*$/', '', $csum); + $ChangeSummary = $page["csum"]; + } } function SaveChangeSummary($pagename, &$page, &$new) { |