if (PKWK_READONLY) return; // Do nothing
$postdata = make_str_rules($postdata);
+ $postdata = add_author_info(remove_author_info($postdata));
// Create and write diff
$oldpostdata = is_page($page) ? join('', get_source($page)) : '';
return implode("\n", $lines);
}
+function add_author_info($wikitext)
+{
+ global $auth_user;
+ $author = preg_replace('/"/', '', $auth_user);
+ $displayname = preg_replace('/"/', '', $auth_user);
+ $author_text = sprintf('#author("%s","%s","%s")',
+ get_date_atom(UTIME + LOCALZONE), $author, $displayname) . "\n";
+ return $author_text . $wikitext;
+}
+
+function remove_author_info($wikitext)
+{
+ return preg_replace('/^\s*#author\([^\n]*(\n|$)/m', '', $wikitext);
+}
+
+function get_date_atom($timestamp)
+{
+ // Compatible with DATE_ATOM format
+ // return date(DATE_ATOM, $timestamp);
+ $zmin = abs(LOCALZONE / 60);
+ return date('Y-m-d\TH:i:s', $timestamp) . sprintf('%s%02d:%02d',
+ (LOCALZONE < 0 ? '-' : '+') , $zmin / 60, $zmin % 60);
+}
+
// Generate ID
function generate_fixed_heading_anchor_id($seed)
{