function page_write($page, $postdata, $notimestamp = FALSE) { global $trackback; if (PKWK_READONLY) { return; } // Do nothing $postdata = make_str_rules($postdata); // Create and write diff $oldpostdata = is_page($page) ? join('', get_source($page)) : ''; $diffdata = do_diff($oldpostdata, $postdata); file_write(DIFF_DIR, $page, $diffdata); // Create backup make_backup($page, $postdata == ''); // Is $postdata null? // Create wiki text file_write(DATA_DIR, $page, $postdata, $notimestamp); if ($trackback) { // TrackBack Ping $_diff = explode("\n", $diffdata); $plus = join("\n", preg_replace('/^\\+/', '', preg_grep('/^\\+/', $_diff))); $minus = join("\n", preg_replace('/^-/', '', preg_grep('/^-/', $_diff))); tb_send($page, $plus, $minus); } links_update($page); }
function page_write($page,$postdata,$notimestamp=FALSE) { $postdata = make_str_rules($postdata); // 差分ファイルの作成 $oldpostdata = is_page($page) ? join('',get_source($page)) : ''; $diffdata = do_diff($oldpostdata,$postdata); file_write(DIFF_DIR,$page,$diffdata); // バックアップの作成 make_backup($page,$postdata == ''); // ファイルの書き込み file_write(DATA_DIR,$page,$postdata,$notimestamp); // TrackBack Ping の送信 // 「追加」行を抽出 $lines = join("\n",preg_replace('/^\+/','',preg_grep('/^\+/',explode("\n",$diffdata)))); tb_send($page,$lines); // linkデータベースを更新 links_update($page); }
function page_write($page, $postdata, $notimestamp = FALSE) { global $trackback, $autoalias, $aliaspage; global $autoglossary, $glossarypage; global $use_spam_check; // if (PKWK_READONLY) return; // Do nothing if (auth::check_role('readonly')) { return; } // Do nothing if (is_page($page)) { $oldpostdata = get_source($page, TRUE, TRUE); } else { if (auth::is_check_role(PKWK_CREATE_PAGE)) { die_message(_('PKWK_CREATE_PAGE prohibits editing')); } $oldpostdata = ''; } $postdata = make_str_rules($postdata); // Create and write diff $diffdata = do_diff($oldpostdata, $postdata); $role_adm_contents = auth::check_role('role_adm_contents'); $links = array(); if ($trackback > 1 || $role_adm_contents && $use_spam_check['page_contents']) { $links = get_this_time_links($postdata, $diffdata); } // Blocking SPAM if ($role_adm_contents) { if ($use_spam_check['page_remote_addr'] && SpamCheck($_SERVER['REMOTE_ADDR'], 'ip')) { die_message('Writing was limited by IPBL (Blocking SPAM).'); } if ($use_spam_check['page_contents'] && SpamCheck($links)) { die_message('Writing was limited by DNSBL (Blocking SPAM).'); } if ($use_spam_check['page_write_proxy'] && is_proxy()) { die_message('Writing was limited by PROXY (Blocking SPAM).'); } } // Logging postdata postdata_write(); // Create diff text file_write(DIFF_DIR, $page, $diffdata); // Create backup make_backup($page, $postdata == ''); // Is $postdata null? // Create wiki text file_write(DATA_DIR, $page, $postdata, $notimestamp); if (function_exists('senna_update')) { senna_update($page, $oldpostdata, $postdata); } if ($trackback > 1) { // TrackBack Ping tb_send($page, $links); } unset($oldpostdata, $diffdata, $links); links_update($page); // Update autoalias.dat (AutoAliasName) if ($autoalias && $page == $aliaspage) { $aliases = get_autoaliases(); if (empty($aliases)) { // Remove @unlink(CACHE_DIR . PKWK_AUTOALIAS_REGEX_CACHE); } else { // Create or Update autolink_pattern_write(CACHE_DIR . PKWK_AUTOALIAS_REGEX_CACHE, get_autolink_pattern(array_keys($aliases), $autoalias)); } } // Update glossary.dat (AutoGlossary) if ($autoglossary && $page == $glossarypage) { $words = get_autoglossaries(); if (empty($words)) { // Remove @unlink(CACHE_DIR . PKWK_GLOSSARY_REGEX_CACHE); } else { // Create or Update autolink_pattern_write(CACHE_DIR . PKWK_GLOSSARY_REGEX_CACHE, get_glossary_pattern(array_keys($words), $autoglossary)); } } log_write('update', $page); }
$data = get_source($page); $data = @join("", $data); //weblogのばあいは、記事のみ送信。 if (preg_match("/#weblog_field\\(__BODY\\,Start\\)\\s*\n(.*\n)#weblog_field\\(__BODY\\,End\\)\n/ms", $data, $match)) { $data1 = $match[1]; $data1 = preg_replace("/\\s*((\r\n)|(\r)|(\n))/", "\n", $data1); if (preg_match_all("/#ping\\([^)]*\\)/", $data, $matches, PREG_PATTERN_ORDER)) { $data2 = ""; foreach ($matches[0] as $match) { $data2 .= $match . "\n"; } } $data = $data1 . "\n" . $data2; } //処理しないプラグインを削除 if ($notb_plugin) { // 念のため quote $notb_plugin = preg_quote($notb_plugin, "/"); // 正規表現形式へ $notb_plugin = str_replace(",", "|", $notb_plugin); // 該当プラグインを削除 $data = preg_replace("/#({$notb_plugin})(\\(((?!#[^(]+\\()(?!\\),).)*\\))?/", "", $data); } // $data = join("",$data); //delete_page_info($data); $data = convert_html($data); tb_send($page, $data); } header("Content-Type: image/gif"); readfile('image/transparent.gif'); exit;