以下是把 phpBB 2.0.18 至 phpBB 2.0.19 的程式碼修改部分寫成外掛的方式。這對於已經安裝了多種外掛的討論版應該是一個比較好的升級方式。修改以下不同之處當然會比重新安裝所有外掛來的簡單。
當你看到 '之後,加上'-語法, 代碼必須加在 '尋找'-語法找的的最後一行的下面.
當你看到 '之前,加上'-語法, 代碼必須加在 '尋找'-語法找到的最上一行的上面.
當你看到 '取代為'-語法, 在 '尋找'-語法找到的代碼必須完全的取代成 '取代為'-語法中的代碼.
當你執行完以下的修正後,你必須上傳 install/update_to_latest.php 檔案到你的主機上的 phpBB 目錄下,然後在執行它後刪除。
- admin/admin_board.php
-
尋找:行號 19
取代為
代碼: 選擇全部
$module['General']['Configuration'] = "$file";代碼: 選擇全部
$module['General']['Configuration'] = $file; -
尋找:行號 194
之後,加上
代碼: 選擇全部
"L_MAX_POLL_OPTIONS" => $lang['Max_poll_options'], "L_FLOOD_INTERVAL" => $lang['Flood_Interval'], "L_FLOOD_INTERVAL_EXPLAIN" => $lang['Flood_Interval_explain'],代碼: 選擇全部
'L_MAX_LOGIN_ATTEMPTS' => $lang['Max_login_attempts'], 'L_MAX_LOGIN_ATTEMPTS_EXPLAIN' => $lang['Max_login_attempts_explain'], 'L_LOGIN_RESET_TIME' => $lang['Login_reset_time'], 'L_LOGIN_RESET_TIME_EXPLAIN' => $lang['Login_reset_time_explain'], 'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'], 'LOGIN_RESET_TIME' => $new['login_reset_time'],
- admin/admin_db_utilities.php
-
尋找:行號 696
取代為
代碼: 選擇全部
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words', 'confirm');代碼: 選擇全部
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words', 'confirm', 'sessions_keys');
- admin/admin_disallow.php
-
尋找:行號 28
取代為
代碼: 選擇全部
$module['Users']['Disallow'] = append_sid($filename);代碼: 選擇全部
$module['Users']['Disallow'] = $filename;
- admin/admin_ranks.php
-
尋找:行號 27
取代為
代碼: 選擇全部
$module['Users']['Ranks'] = "$file";代碼: 選擇全部
$module['Users']['Ranks'] = $file;
- admin/admin_styles.php
-
尋找:行號 30
取代為
代碼: 選擇全部
$module['Styles']['Manage'] = "$file";代碼: 選擇全部
$module['Styles']['Manage'] = $file;
- admin/admin_users.php
-
尋找:行號 180
之後,加上
代碼: 選擇全部
message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql); }代碼: 選擇全部
$sql = "DELETE FROM " . SESSIONS_TABLE . " WHERE session_user_id = $user_id"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete sessions for this user', '', __LINE__, __FILE__, $sql); } $sql = "DELETE FROM " . SESSIONS_KEYS_TABLE . " WHERE user_id = $user_id"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete auto-login keys for this user', '', __LINE__, __FILE__, $sql); } -
尋找:行號 234
取代為
代碼: 選擇全部
$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : '';代碼: 選擇全部
$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : ''; -
尋找:行號 407
取代為
代碼: 選擇全部
if( @file_exists(@phpbb_realpath("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) ) { @unlink("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);代碼: 選擇全部
if( @file_exists(@phpbb_realpath('./../' . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) ) { @unlink('./../' . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
- admin/admin_words.php
-
尋找:行號 28
取代為
代碼: 選擇全部
$module['General']['Word_Censor'] = "$file";代碼: 選擇全部
$module['General']['Word_Censor'] = $file;
- admin/index.php
-
尋找:行號 63
取代為
代碼: 選擇全部
\r include($file);代碼: 選擇全部
include('./' . $file); -
尋找:行號 237
取代為
代碼: 選擇全部
if( preg_match("/^(3\.23|4\.)/", $version) ) { $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$dbname`" : $dbname;代碼: 選擇全部
if( preg_match("/^(3\.23|4\.|5\.)/", $version) ) { $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)|(5\.)/", $version) ) ? "`$dbname`" : $dbname;
- includes/bbcode.php
-
尋找:行號 203
取代為
代碼: 選擇全部
$patterns[] = "#\[url\]([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*?)\[/url\]#is"; $replacements[] = $bbcode_tpl['url1']; // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). $patterns[] = "#\[url\]((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\[/url\]#is";代碼: 選擇全部
$patterns[] = "#\[url\]([\w]+?://([\w\#$%&~/.\-;:=,?@\]+]|\[(?!url=))*?)\[/url\]#is"; $replacements[] = $bbcode_tpl['url1']; // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). $patterns[] = "#\[url\]((www|ftp)\.([\w\#$%&~/.\-;:=,?@\]+]|\[(?!url=))*?)\[/url\]#is"; -
尋找:行號 255
取代為
代碼: 選擇全部
$text = bbencode_first_pass_pda($text, $uid, '/\[quote=(\\\".*?\\\")\]/is', '[/quote]', '', false, '', "[quote:$uid=\\1]");代碼: 選擇全部
$text = bbencode_first_pass_pda($text, $uid, '/\[quote=\\\\"(.*?)\\\\"\]/is', '[/quote]', '', false, '', "[quote:$uid=\\\"\\1\\\"]"); -
尋找:行號 392
取代為
代碼: 選擇全部
if( preg_match('#\[quote=\\\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\\\"(.*?)\\\\\"\]#si', $possible_start) ) { // OK we are in a quote tag that probably contains a ] bracket. // Grab a bit more of the string to hopefully get all of it.. if ($close_pos = strpos($text, '"]', $curr_pos + 9)) { if (strpos(substr($text, $curr_pos + 9, $close_pos - ($curr_pos + 9)), '[quote') === false) { $possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 2);代碼: 選擇全部
if( preg_match('#\[quote=\\\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\\\"(.*?)\\\\\"\]#si', $possible_start) ) { // OK we are in a quote tag that probably contains a ] bracket. // Grab a bit more of the string to hopefully get all of it.. if ($close_pos = strpos($text, '"]', $curr_pos + 14)) { if (strpos(substr($text, $curr_pos + 14, $close_pos - ($curr_pos + 14)), '[quote') === false) { $possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 7);
- common.php
-
尋找:行號 223
取代為
代碼: 選擇全部
message_die(GENERAL_MESSAGE, 'Please ensure both the install/ and contrib/ directories are deleted');代碼: 選擇全部
message_die(GENERAL_MESSAGE, 'Please_remove_install_contrib');
- includes/functions.php
-
尋找:行號 161
取代為
代碼: 選擇全部
$sql .= ( ( is_integer($user) ) ? "user_id = $user" : "username = '" . $user . "'" ) . " AND user_id <> " . ANONYMOUS;代碼: 選擇全部
$sql .= ( ( is_integer($user) ) ? "user_id = $user" : "username = '" . str_replace("\'", "''", $user) . "'" ) . " AND user_id <> " . ANONYMOUS;
- includes/functions_post.php
-
尋找:行號 28
取代為
代碼: 選擇全部
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#'); $html_entities_replace = array('&', '<', '>');代碼: 選擇全部
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#'); $html_entities_replace = array('&', '<', '>', '"');
- includes/usercp_confirm.php
-
尋找:行號 156
取代為
代碼: 選擇全部
if (!empty($HTTP_GET_VARS['c'])) { $_png = define_raw_pngs(); $char = substr($code, intval($HTTP_GET_VARS['c']) - 1, 1); header('Content-Type: image/png'); header('Cache-control: no-cache, no-store'); echo base64_decode($_png[$char]); unset($_png); exit; }代碼: 選擇全部
$_png = define_raw_pngs(); $char = substr($code, -1); header('Content-Type: image/png'); header('Cache-control: no-cache, no-store'); echo base64_decode($_png[$char]); unset($_png); exit;
- includes/usercp_register.php
-
尋找:行號 110
取代為
代碼: 選擇全部
$strip_var_list = array('username' => 'username', 'email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests'); $strip_var_list['confirm_code'] = 'confirm_code';代碼: 選擇全部
$strip_var_list = array('email' => 'email', 'icq' => 'icq', 'aim' => 'aim', 'msn' => 'msn', 'yim' => 'yim', 'website' => 'website', 'location' => 'location', 'occupation' => 'occupation', 'interests' => 'interests', 'confirm_code' => 'confirm_code'); -
尋找:行號 126
之前,加上
代碼: 選擇全部
$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');代碼: 選擇全部
$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : ''; -
尋找:行號 301
之前,加上
代碼: 選擇全部
if ($row['code'] != $confirm_code)代碼: 選擇全部
// Only compare one char if the zlib-extension is not loaded if (!@extension_loaded('zlib')) { $row['code'] = substr($row['code'], -1); }
- language/lang_chinese_traditional_taiwan/lang_admin.php
-
尋找:行號 749
之前,加上
代碼: 選擇全部
// // That's all Folks!代碼: 選擇全部
// // Login attempts configuration // $lang['Max_login_attempts'] = '允許登入次數'; $lang['Max_login_attempts_explain'] = '允許登入期限內可登入的次數'; $lang['Login_reset_time'] = '允許登入期限'; $lang['Login_reset_time_explain'] = '以分鐘為單位,這段時間之內不能登入多次允許登入次數。';
- language/lang_chinese_traditional_taiwan/lang_main.php
-
尋找:行號 1021
之前,加上
代碼: 選擇全部
// // That's all, Folks!代碼: 選擇全部
$lang['Login_attempts_exceeded'] = '你嘗試登入%s次,達到了上限,請於%s後再登入。'; $lang['Please_remove_install_contrib'] = '請確定install/ 及 contrib/ 目錄已被刪除!';
- login.php
-
尋找:行號 60
取代為
代碼: 選擇全部
$sql = "SELECT user_id, username, user_password, user_active, user_level代碼: 選擇全部
$sql = "SELECT user_id, username, user_password, user_active, user_level, user_login_tries, user_last_login_try -
\n尋找:行號 79
之前,加上
代碼: 選擇全部
if( md5($password) == $row['user_password'] && $row['user_active'] )代碼: 選擇全部
// If the last login is more than x minutes ago, then reset the login tries/time if ($row['user_last_login_try'] && $board_config['login_reset_time'] && $row['user_last_login_try'] < (time() - ($board_config['login_reset_time'] * 60))) { $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_login_tries = 0, user_last_login_try = 0 WHERE user_id = ' . $row['user_id']); $row['user_last_login_try'] = $row['user_login_tries'] = 0; } // Check to see if user is allowed to login again... if his tries are exceeded if ($row['user_last_login_try'] && $board_config['login_reset_time'] && $board_config['max_login_attempts'] && $row['user_last_login_try'] >= (time() - ($board_config['login_reset_time'] * 60)) && $row['user_login_tries'] >= $board_config['max_login_attempts']) { message_die(GENERAL_MESSAGE, sprintf($lang['Login_attempts_exceeded'], $board_config['max_login_attempts'], $board_config['login_reset_time'])); } -
尋找:行號 97
之後,加上
代碼: 選擇全部
$admin = (isset($HTTP_POST_VARS['admin'])) ? 1 : 0; $session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin, $admin);代碼: 選擇全部
// Reset login tries $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_login_tries = 0, user_last_login_try = 0 WHERE user_id = ' . $row['user_id']); -
尋找:行號 115
之前,加上
代碼: 選擇全部
$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : ''; $redirect = str_replace('?', '&', $redirect);代碼: 選擇全部
// Save login tries and last login if ($row['user_id'] != ANONYMOUS) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_login_tries = user_login_tries + 1, user_last_login_try = ' . time() . ' WHERE user_id = ' . $row['user_id']; $db->sql_query($sql); }
- privmsg.php
-
尋找:行號 38
取代為
代碼: 選擇全部
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#'); $html_entities_replace = array('&', '<', '>');代碼: 選擇全部
$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#'); $html_entities_replace = array('&', '<', '>', '"');
- templates/subSilver/admin/board_config_body.tpl
-
尋找:行號 59
之後,加上
代碼: 選擇全部
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="flood_interval" value="{FLOOD_INTERVAL}" /></td> </tr>代碼: 選擇全部
<tr> <td class="row1">{L_MAX_LOGIN_ATTEMPTS}<br /><span class="gensmall">{L_MAX_LOGIN_ATTEMPTS_EXPLAIN}</span></td> <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="max_login_attempts" value="{MAX_LOGIN_ATTEMPTS}" /></td> </tr> <tr> <td class="row1">{L_LOGIN_RESET_TIME}<br /><span class="gensmall">{L_LOGIN_RESET_TIME_EXPLAIN}</span></td> <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="login_reset_time" value="{LOGIN_RESET_TIME}" /></td> </tr>
- templates/subSilver/admin/index_body.tpl


