PLUGIN_TIMESTAMP_TITLE, 'body' => "パスワードが間違っています。"); } } $filename = "./wiki/" . strtoupper(bin2hex($vars['plugin_timestamp_form_page'])) . ".txt"; if (file_exists($filename)) { if (PLUGIN_TIMESTAMP_CHECK_EDITABLE == "1") check_editable($vars['plugin_timestamp_form_page'], true, true); if (PLUGIN_TIMESTAMP_CHECK_READABLE == "1") check_readable($vars['plugin_timestamp_form_page'], true, true); $date = new DateTime($vars["plugin_timestamp_form_y"] . '-' . $vars["plugin_timestamp_form_m"] . '-' . $vars["plugin_timestamp_form_d"] . ' ' . $vars["plugin_timestamp_form_h"] . ':' . $vars["plugin_timestamp_form_min"] . ':' . $vars["plugin_timestamp_form_s"]); //PukiWiki 1.5.x~用 $filedata = file_get_contents($filename); if (preg_match('/\#author\((.+?),(.+?),(.+?)\)/u', $filedata, $matchs)) { $filedata = str_replace($matchs[0], '#author("' . $vars["plugin_timestamp_form_y"] . '-' . $vars["plugin_timestamp_form_m"] . '-' . $vars["plugin_timestamp_form_d"] . 'T' . $vars["plugin_timestamp_form_h"] . ':' . $vars["plugin_timestamp_form_min"] . ':' . $vars["plugin_timestamp_form_s"] . '+09:00",' . $matchs[2] . ',' . $matchs[3] . ')', $filedata); file_put_contents($filename, $filedata); } //キャッシュ削除 unlink('./cache/recent.dat'); touch($filename, $date->format('U') - (int)PLUGIN_TIMESTAMP_ADD_HOURS); $msg = PLUGIN_TIMESTAMP_TITLE; $body = "設定が完了しました。" . $vars["plugin_timestamp_form_page"] . "へ戻る"; }else{ $msg = PLUGIN_TIMESTAMP_TITLE; $body = "ページが存在しません。"; } } else { $msg = PLUGIN_TIMESTAMP_TITLE; if ($vars['page'] != "") { if (PLUGIN_TIMESTAMP_CHECK_EDITABLE == "1") check_editable($vars['page'], true, true); if (PLUGIN_TIMESTAMP_CHECK_READABLE == "1") check_readable($vars['page'], true, true); $filename = "./wiki/" . strtoupper(bin2hex($vars['page'])) . ".txt"; $filetime = filemtime($filename) + (int)PLUGIN_TIMESTAMP_ADD_HOURS; $y = date("Y", $filetime); $m = date("m", $filetime); $d = date("d", $filetime); $h = date("H", $filetime); $min = date("i", $filetime); $s = date("s", $filetime); if (PLUGIN_TIMESTAMP_UESR_ADMIN_ONLY == "1") { $admin_check = "
管理者パスワード:"; } else { $admin_check = ""; } $body = <<ページ: {$vars['page']}
{$admin_check}
現在のページの更新日時: {$y}年{$m}月{$d}日{$h}時{$min}分{$s}秒 EOD; } else { $body = <<ページが指定されていません。
ページ:
EOD; } } return array('msg' => $msg, 'body' => $body); } function plugin_timestamp_convert() { global $vars; return "[タイムスタンプ変更]"; }