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); }
$g_params['errors'] = $result['errors']; if ($result['success'] === TRUE) { $_SESSION['stage'] = $g_stage = 2; } } } if ($g_stage == 2) { $g_params['did_backup'] = FALSE; $g_params['success'] = FALSE; $g_params['error'] = ''; if (isset($_POST['next'])) { $g_stage = 3; $_SESSION['stage'] = 3; unset($_POST['next']); } elseif (isset($_POST['do_backup'])) { $result = make_backup(); $g_params['success'] = $result['success']; $g_params['error'] = $result['error']; if ($result['success']) { //$g_params['did_backup'] = TRUE; header('Content-Type: "sql"'); header('Content-Disposition: attachment; filename="phpchess_backup.sql"'); header("Content-Transfer-Encoding: binary"); header('Expires: 0'); header('Pragma: no-cache'); header("Content-Length: " . strlen($result['sql'])); echo $result['sql']; exit; } } }
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); }