• R/O
  • HTTP
  • SSH
  • HTTPS

pukiwiki: Commit


Commit MetaInfo

Revisionfdfc7785f930f9c8e1893697aa07c8d6dc1f1f91 (tree)
Time2016-12-05 05:36:37
Authorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2404 Add filetime as author attr on "Don't change timestamp"

Change Summary

Incremental Difference

--- a/lib/file.php
+++ b/lib/file.php
@@ -84,8 +84,12 @@ function page_write($page, $postdata, $notimestamp = FALSE)
8484 if (PKWK_READONLY) return; // Do nothing
8585
8686 $postdata = make_str_rules($postdata);
87+ $timestamp_to_keep = null;
88+ if ($notimestamp) {
89+ $timestamp_to_keep = get_filetime($page);
90+ }
8791 $text_without_author = remove_author_info($postdata);
88- $postdata = add_author_info($text_without_author);
92+ $postdata = add_author_info($text_without_author, $timestamp_to_keep);
8993 $is_delete = empty($text_without_author);
9094
9195 // Do nothing when it has no changes
@@ -167,7 +171,13 @@ function make_str_rules($source)
167171 return implode("\n", $lines);
168172 }
169173
170-function add_author_info($wikitext)
174+/**
175+ * Add author plugin text for wiki text body
176+ *
177+ * @param string $wikitext
178+ * @param integer $timestamp_to_keep Set null when not to keep timestamp
179+ */
180+function add_author_info($wikitext, $timestamp_to_keep)
171181 {
172182 global $auth_user, $auth_user_fullname;
173183 $author = preg_replace('/"/', '', $auth_user);
@@ -176,10 +186,14 @@ function add_author_info($wikitext)
176186 // Fullname is empty, use $author as its fullname
177187 $fullname = preg_replace('/^[^:]*:/', '', $author);
178188 }
189+ $datetime_to_keep = '';
190+ if (!is_null($timestamp_to_keep)) {
191+ $datetime_to_keep .= ';' . get_date_atom($timestamp_to_keep + LOCALZONE);
192+ }
179193 $displayname = preg_replace('/"/', '', $fullname);
180194 $user_prefix = get_auth_user_prefix();
181195 $author_text = sprintf('#author("%s","%s","%s")',
182- get_date_atom(UTIME + LOCALZONE),
196+ get_date_atom(UTIME + LOCALZONE) . $datetime_to_keep,
183197 ($author ? $user_prefix . $author : ''),
184198 $displayname) . "\n";
185199 return $author_text . $wikitext;
Show on old repository browser