1 頁 (共 7 頁)

[教學] phpBB 2.0.11 更新至 2.0.12 的步驟

發表於 : 2005-02-22 14:32
Mac
http://www.phpbb.com/phpBB/viewtopic.php?t=265444

竹貓全檔案分流下載:
http://phpbb-tw.net/phpbb/viewtopic.php?t=32964


phpBB 2.0.11 to phpBB 2.0.12 Code Changes

These are the Changes from phpBB 2.0.11 to phpBB 2.0.12 summed up into a little Mod. This might be very helpful if you want to update your Board and have installed a bunch of Mods. Then it's normally easier to apply the Code Changes than to install all Mods again.

當你看到 '之後,加上'-語法, 代碼必須加在 '尋找'-語法找的的最後一行的下面.
當你看到 '之前,加上'-語法, 代碼必須加在 '尋找'-語法找的的最後一行的上面.
當你看到 '取代為'-語法, 在 '尋找'-語法找到的代碼必須完全的取代成 '取代為'-語法中的代碼.
當你看到 '刪除'-語法, 代碼必須刪除.

After you have finished this tutorial, you have to upload the update_to_latest.php file, execute it and then delete it from your webspace.

Ok, 讓我們開始吧:


  • admin/admin_db_utilities.php
  1. 尋找 - 行 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');
    
    取代為

    代碼: 選擇全部

    
    			$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');
    
  • admin/index.php
  1. 尋找 - 行 562

    代碼: 選擇全部

    
    			"L_NO_GUESTS_BROWSING" => $lang['No_users_browsing'])
    		);
    	}
    
    之後,加上

    代碼: 選擇全部

    
    
    	// Check for new version
    	$current_version = explode('.', '2' . $board_config['version']);
    	$minor_revision = (int) $current_version[2];
    
    	$errno = 0;
    	$errstr = $version_info = '';
    
    	if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr))
    	{
    		@fputs($fsock, "GET /updatecheck/20x.txt HTTP/1.1
    ");
    		@fputs($fsock, "HOST: www.phpbb.com
    ");
    		@fputs($fsock, "Connection: close
    
    ");
    
    		$get_info = false;
    		while (!@feof($fsock))
    		{
    			if ($get_info)
    			{
    				$version_info .= @fread($fsock, 1024);
    			}
    			else
    			{
    				if (@fgets($fsock, 1024) == "
    ")
    				{
    					$get_info = true;
    				}
    			}
    		}
    		@fclose($fsock);
    
    		$version_info = explode("
    ", $version_info);
    		$latest_head_revision = (int) $version_info[0];
    		$latest_minor_revision = (int) $version_info[2];
    		$latest_version = (int) $version_info[0] . '.' . (int) $version_info[1] . '.' . (int) $version_info[2];
    
    		if ($latest_head_revision == 2 && $minor_revision == $latest_minor_revision)
    		{
    			$version_info = '<p style="color:green">' . $lang['Version_up_to_date'] . '</p>';
    		}
    		else
    		{
    			$version_info = '<p style="color:red">' . $lang['Version_not_up_to_date'];
    			$version_info .= '<br />' . sprintf($lang['Latest_version_info'], $latest_version) . sprintf($lang['Current_version_info'], '2' . $board_config['version']) . '</p>';
    		}
    	}
    	else
    	{
    		if ($errstr)
    		{
    			$version_info = '<p style="color:red">' . sprintf($lang['Connect_socket_error'], $errstr) . '</p>';
    		}
    		else
    		{
    			$version_info = '<p>' . $lang['Socket_functions_disabled'] . '</p>';
    		}
    	}
    	
    	$version_info .= '<p>' . $lang['Mailing_list_subscribe_reminder'] . '</p>';
    	
    
    	$template->assign_vars(array(
    		'VERSION_INFO'	=> $version_info,
    		'L_VERSION_INFORMATION'	=> $lang['Version_information'])
    	);
    
  • common.php
  1. 尋找 - 行 56

    代碼: 選擇全部

    
    	$test = array('HTTP_GET_VARS' => NULL, 'HTTP_POST_VARS' => NULL, 'HTTP_COOKIE_VARS' => NULL, 'HTTP_SERVER_VARS' => NULL, 'HTTP_ENV_VARS' => NULL, 'HTTP_POST_FILES' => NULL);
    
    取代為

    代碼: 選擇全部

    
    	$test = array('HTTP_GET_VARS' => NULL, 'HTTP_POST_VARS' => NULL, 'HTTP_COOKIE_VARS' => NULL, 'HTTP_SERVER_VARS' => NULL, 'HTTP_ENV_VARS' => NULL, 'HTTP_POST_FILES' => NULL, 'phpEx' => NULL, 'phpbb_root_path' => NULL);
    
  2. 尋找 - 行 75

    代碼: 選擇全部

    
    else if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
    {
    	// PHP4+ path
    
    之後,加上

    代碼: 選擇全部

    
    	$not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path');
    
  3. 尋找 - 行 92

    代碼: 選擇全部

    
    	unset($input['input']);
    	
    	while (list($var,) = @each($input))
    	{
    		unset($$var);
    	}
    
    取代為

    代碼: 選擇全部

    
    	unset($input['input']);
    	unset($input['not_unset']);
    
    	while (list($var,) = @each($input))
    	{
    		if (!in_array($var, $not_unset))
    		{
    			unset($$var);
    		}
    	}
    
  4. 尋找 - 行 207

    代碼: 選擇全部

    
    $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR );
    
    取代為

    代碼: 選擇全部

    
    $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
    
  • includes/functions.php
  1. 尋找 - 行 80

    代碼: 選擇全部

    
    	$username = htmlspecialchars(rtrim(trim($username), "\\\"));
    	$username = substr(str_replace("\\\'", "'", $username), 0, 25);
    	$username = str_replace("'", "\\\'", $username);
    
    取代為

    代碼: 選擇全部

    
    	$username = substr(htmlspecialchars(str_replace("\'", "'", trim($username))), 0, 25);
    	$username = phpbb_rtrim($username, "\\\");	
    	$username = str_replace("'", "\'", $username);
    
  2. 尋找 - 行 83

    代碼: 選擇全部

    
    
    	return $username;
    }
    
    之後,加上

    代碼: 選擇全部

    
    
    // added at phpBB 2.0.12 to fix a bug in PHP 4.3.10 (only supporting charlist in php >= 4.1.0)
    function phpbb_rtrim($str, $charlist = false)
    {
    	if ($charlist === false)
    	{
    		return rtrim($str);
    	}
    	
    	$php_version = explode('.', PHP_VERSION);
    
    	// php version < 4.1.0
    	if ((int) $php_version[0] < 4 || ((int) $php_version[0] == 4 && (int) $php_version[1] < 1))
    	{
    		while ($str{strlen($str)-1} == $charlist)
    		{
    			$str = substr($str, 0, strlen($str)-1);
    		}
    	}
    	else
    	{
    		$str = rtrim($str, $charlist);
    	}
    
    	return $str;
    }
    
    
  3. 尋找 - 行 608

    代碼: 選擇全部

    
    			$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file;
    
    取代為

    代碼: 選擇全部

    
    			$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . basename($err_file);
    
  • includes/page_tail.php
  1. 尋找 - 行 38

    代碼: 選擇全部

    
    	'PHPBB_VERSION' => '2' . $board_config['version'],
    
    取代為

    代碼: 選擇全部

    
    //	'PHPBB_VERSION' => '2' . $board_config['version'],
    
  • includes/template.php
  1. 尋找 - 行 233

    代碼: 選擇全部

    
           		$filename = phpbb_realpath($this->root . '/' . $filename);
    
    取代為

    代碼: 選擇全部

    
           		$filename = ($rp_filename = phpbb_realpath($this->root . '/' . $filename)) ? $rp_filename : $filename;
    
  • includes/usercp_avatar.php
  1. 尋找 - 行 54

    代碼: 選擇全部

    
    {
    	global $board_config, $userdata;
    
    
    之後,加上

    代碼: 選擇全部

    
    	$avatar_file = basename($avatar_file);
    
  2. 尋找 - 行 69

    代碼: 選擇全部

    
    function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
    {
    	global $board_config;
    
    之後,加上

    代碼: 選擇全部

    
    
    	$avatar_filename = str_replace(array('../', '..\\\', './', '.\\\'), '', $avatar_filename);
    	if ($avatar_filename{0} == '/' || $avatar_filename{0} == "\\\")
    	{
    		return '';
    	}
    
    \n
  3. 尋找 - 行 235

    代碼: 選擇全部

    
    				$move_file = 'copy';
    			}
    
    
    之後,加上

    代碼: 選擇全部

    
    			if (!is_uploaded_file($avatar_filename))
    			{
    				message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
    			}
    
  • includes/usercp_register.php
  1. 尋找 - 行 462

    代碼: 選擇全部

    
    			$avatar_mode = ( !empty($user_avatar_name) ) ? 'local' : 'remote';
    
    取代為

    代碼: 選擇全部

    
    			$avatar_mode = (empty($user_avatar_name)) ? 'remote' : 'local';
    
  • language/lang_chinese_traditional_taiwan/lang_admin.php
  1. 尋找

    代碼: 選擇全部

    
    //
    // That's all Folks!
    // -------------------------------------------------
    
    之前,加上

    代碼: 選擇全部

    
    //
    // Version Check
    //
    $lang['Version_up_to_date'] = '你目前安裝的版本是最新的, 你不需要做更新的動作.';
    $lang['Version_not_up_to_date'] = '你目前安裝的版本 <b>不是</b> 最新的. phpBB 的最新(更新)檔案可以在 <a href="http://www.phpbb.com/downloads.php" target="_new">http://www.phpbb.com/downloads.php</a> 下載到.';
    $lang['Latest_version_info'] = '目前最新的版本是 <b>phpBB %s</b>.';
    $lang['Current_version_info'] = '你目前使用的是 <b>phpBB %s</b>.';
    $lang['Connect_socket_error'] = '無法成功連上 phpBB 的主機, 錯誤回報:<br />%s';
    $lang['Socket_functions_disabled'] = '無法使用 socket 功能.';
    $lang['Mailing_list_subscribe_reminder'] = '欲得知 phpBB 的最新更新消息, 何不 <a href="http://www.phpbb.com/support/" target="_new">訂閱我們的電子報</a>.';
    $lang['Version_information'] = '版本資訊';
    
  • templates/subSilver/admin/index_body.tpl
  1. 尋找 - 行 80

    代碼: 選擇全部

    
    </table>
    
    <br />
    
    之後,加上

    代碼: 選擇全部

    
    
    <h1>{L_VERSION_INFORMATION}</h1>
    
    {VERSION_INFO}
    
    <br />
    
  • templates/subSilver/overall_footer.tpl
  1. 尋找 - 行 8

    代碼: 選擇全部

    
    	Powered by phpBB {PHPBB_VERSION} line, with phpBB linked to www.phpbb.com. If you refuse
    	to include even this then support on our forums may be affected. 
    
    	The phpBB Group : 2002
    // -->
    Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> {PHPBB_VERSION} &copy; 2001, 2002 phpBB Group<br />{TRANSLATION_INFO}</span></div>
    
    取代為

    代碼: 選擇全部

    
    	Powered by phpBB line, with phpBB linked to www.phpbb.com. If you refuse
    	to include even this then support on our forums may be affected.
    
    	The phpBB Group : 2002
    // -->
    Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> &copy; 2001, 2005 phpBB Group<br />{TRANSLATION_INFO}</span></div>
    
  • templates/subSilver/simple_footer.tpl
  1. 尋找 - 行 8

    代碼: 選擇全部

    
    	Powered by phpBB {PHPBB_VERSION} line, with phpBB linked to www.phpbb.com. If you refuse
    	to include even this then support on our forums may be affected. 
    
    	The phpBB Group : 2002
    // -->
    Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> {PHPBB_VERSION} &copy; 2001,2002 phpBB Group</span></div>
    
    取代為

    代碼: 選擇全部

    
    	Powered by phpBB line, with phpBB linked to www.phpbb.com. If you refuse
    	to include even this then support on our forums may be affected. 
    
    	The phpBB Group : 2002
    // -->
    Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> &copy; 2001, 2005 phpBB Group</span></div>
    
  • viewtopic.php
  1. 尋找 - 行 498

    代碼: 選擇全部

    
    	unset($words);
    
    	$highlight = urlencode($HTTP_GET_VARS['highlight']);
    
    之後,加上

    代碼: 選擇全部

    
    	$highlight_match = phpbb_rtrim($highlight_match, "\\\");
    
~Mac

發表於 : 2005-02-22 14:40
Mowd
另外將版本號升級的方式請參考
http://phpbb-tw.net/phpbb/viewtopic.php?t=32964

phpbb_2011_to_2012.zip這個檔案裡面有個更新程式
update_to_latest.php
執行之後就可以將版本號升級至2.0.12。
如果不升級的話,進到控制台就會出現一串紅色的字要你升級到最新版本。
如果已經擁有最新版本,字的顏色會是綠色的。

發表於 : 2005-02-22 14:45
Mowd
請大家注意,不知道是否是疏忽,update_to_latest.php執行會錯誤,但是只要照下列步驟執行就可以正常升級版本號了了。

尋找第 45 行

代碼: 選擇全部

$phpbb_root_path = './../';
更改成

代碼: 選擇全部

$phpbb_root_path = './';
完成

發表於 : 2005-02-22 14:58
Mac
每次都是用兩個 //,好像是因為要用戶上傳到 install 這個文件夾中(當然,install 已經被刪掉了)

所以看自己的喜好吧,不然隨便傳到哪一個文件夾中都可以執行 update_to_latest.php

~Mac

發表於 : 2005-02-22 15:14
赤兔
補充一下
已安裝 eXtreme Styles MOD 的人,includes/template.php 不用改\r
原因請見原作者回答

發表於 : 2005-02-22 15:47
Mowd
另外如果有安裝 Mac 的 EasySite,請於更新overall_footer.tpl以及simple_footer.tpl後把

代碼: 選擇全部

Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> &copy; 2001, 2005 phpBB Group[color=red]</span>[/color]</div>
紅色部分刪掉,不然字體就會變很大。

發表於 : 2005-02-22 18:07
bc010843
update_to_latest.php 這個檔執行後需要刪除嗎?

發表於 : 2005-02-22 18:08
deliabest
Mowd 寫:另外將版本號升級的方式請參考
http://phpbb-tw.net/phpbb/viewtopic.php?t=32964

phpbb_2011_to_2012.zip這個檔案裡面有個更新程式
update_to_latest.php
執行之後就可以將版本號升級至2.0.12。
如果不升級的話,進到控制台就會出現一串紅色的字要你升級到最新版本。
如果已經擁有最新版本,字的顏色會是綠色的。
升級完成後,update_to_latest.php 檔可以刪除嗎?我怕會有人一直玩他。

發表於 : 2005-02-22 18:12
aHfUi
刪除罷
裡面有講到\r

代碼: 選擇全部

After you have finished this tutorial, you have to upload the update_to_latest.php file, execute it and then delete it from your webspace. 

發表於 : 2005-02-22 18:14
友誼第一
這是更新原有檔案還是附加檔案?因為我裝了外掛不能覆蓋檔案!

發表於 : 2005-02-22 18:23
赤兔
這個就是給裝了一堆外掛的人用的 = =|||
跟安裝 MOD 一樣,照著改就對了

發表於 : 2005-02-22 18:44
webor
請問一下這篇主題裏面有的代碼框框太長而被論壇截掉了,要如何讓它顯示出來呢?

發表於 : 2005-02-22 18:47
赤兔
這裡下載吧

發表於 : 2005-02-22 18:52
BPO
Mowd 寫:update_to_latest.php
執行之後就可以將版本號升級至2.0.12。
我有問題那我先大致說明一下~
我的論壇是放在別的主機~
要更新檔案的話是使用信箱的網路硬碟上傳update~
我自己在我原先的備分安裝~
成功才想上傳~那是成功了~
原本想說傳資料上去update就好~
可是現在就卡在引言這段~
我不知道我上傳修成功的資料後這段有沒有用到~
因為我不知道在別的主機如何update這update_to_latest.php的檔案~
有沒有牽扯到SQL~因資料庫的地方我不好改~
希望我的敘述有人能看懂~我不太會表達~謝謝。

發表於 : 2005-02-22 19:30
and4amy
感謝 :-)