1 頁 (共 1 頁)

[問題] 按主題名稱會有錯誤訊息

發表於 : 2005-04-20 00:01
cbr
架設主機作業系統:Linux RedHat。
上網方式:學術網。
安裝的程式:Apache + php + MySql。
phpBB2 版本:phpBB 2.0.14。

請問各位大大
當我在我的論壇觀看文章時
再按一次那篇文章的主題就會跳出下面這句\r
錯誤代碼:
Fatal error: Call to undefined function: phpbb_rtrim() in /home/gsme/WWW/phpBB2/viewtopic.php on line 498
請問這是什麼意思呢?

發表於 : 2005-04-20 21:17
kp3011
貼前後十行出來吧

發表於 : 2005-04-20 21:47
cbr
for($i = 0; $i < sizeof($words); $i++)
{
if (trim($words[$i]) != '')
{
$highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', phpbb_preg_quote($words[$i], '#'));
}
}
unset($words);

$highlight = urlencode($HTTP_GET_VARS['highlight']);
$highlight_match = phpbb_rtrim($highlight_match, "\\\");
}

//
// Post, reply and other URL generation for
// templating vars
//
$new_topic_url = append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id");
$reply_topic_url = append_sid("posting.$phpEx?mode=reply&" . POST_TOPIC_URL . "=$topic_id");
$view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id");
$view_prev_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=previous");
$view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=next");

發表於 : 2005-04-20 21:52
kp3011
你可能是更新 2.0.12 時更新漏了:

include/functions.php
尋找

代碼: 選擇全部

function phpbb_clean_username($username)
{
	$username = substr(htmlspecialchars(str_replace("\'", "'", trim($username))), 0, 25);
	$username = phpbb_rtrim($username, "\\\");	
	$username = str_replace("'", "\'", $username);

	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);\r
	}

	return $str;
}

發表於 : 2005-04-20 22:57
cbr
可以了
感謝這位大大的協助