phpBBHacks.com, the place for phpBB users

Bookmark and Share

phpBB 2.0.13 to 2.0.14 Code Changes

phpBB 2.0.13 to 2.0.14 Code Changes

Postby Thoul » April 16th 2005, 1:48 pm

HTML Version.
Text Version.

These are the code changes introduced between phpBB 2.0.13 and phpBB 2.0.14. If you have installed many hacks on a forum, but wish to update it, these may help you. It is often easier to apply code changes such as these instead of replacing and rehacking your current files.

These code changes use the following instruction labels:
filename - The name of a file to be edited. Equivalent to an OPEN action in a hack or modification.
FIND - This indicates lines of code you should locate. Changes will be made in reference to this code.
REPLACE WITH - This code should completely replace the code in the preceding FIND instruction.
AFTER, ADD - The code in this instruction should be added on a new line after the last line of code in the preceding FIND instruction.
BEFORE, ADD - The code in this instruction should be added on a new line before the first line of code in the preceding FIND instruction.

Once you have completed the code changes, create an install/ directory in your forum's root directory and upload the update_to_latest.php file that comes in any phpBB 2.0.14 download to the install/ directory. Run update_to_latest.php by opening it via your web browser, just as you would a normal forum page. Afterward, delete the file and the install/ directory so that your forum is accessible again.

Now, onward to the file changes!




db/oracle.php
The file db/oracle.php has been removed in phpBB 2.0.14. Please delete it from your forum's web space.


modcp.php
FIND
Code: Select all
	$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
	$forum_id = $topic_row['forum_id'];
	$forum_name = $topic_row['forum_name'];


BEFORE, ADD
Code: Select all
	if (!$topic_row)
	{
		message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
	}


FIND
Code: Select all
	$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
	$forum_name = $topic_row['forum_name'];


BEFORE, ADD
Code: Select all
	if (!$topic_row)
	{
		message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
	}





privmsg.php
FIND
Code: Select all
	if ( !$board_config['allow_html'] )
	{
		if ( $user_sig != '' && $privmsg['privmsgs_enable_sig'] && $userdata['user_allowhtml'] )


REPLACE WITH
Code: Select all
	if ( !$board_config['allow_html'] || !$userdata['user_allowhtml'])
  	{
		if ( $user_sig != '')


FIND
Code: Select all
		if ( !$html_on )
		{
			if ( $user_sig != '' || !$userdata['user_allowhtml'] )


REPLACE WITH
Code: Select all
		if ( !$html_on || !$board_config['allow_html'] || !$userdata['user_allowhtml'] )
		{
			if ( $user_sig != '' )




search.php
FIND
Code: Select all
				$search_author = str_replace('*', '%', trim($search_author));


BEFORE, ADD
Code: Select all
				if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
				{
					$search_author = '';
				}


FIND
Code: Select all
			for($i = 0; $i < count($split_search); $i++)
			{


AFTER, ADD
Code: Select all
				if (preg_match('#^[\*%]+$#', trim($split_search[$i])) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i]))))
				{
					$split_search[$i] = '';
					continue;
				}


FIND
Code: Select all
		if ( $search_author != '' )
		{


AFTER, ADD
Code: Select all
			if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
			{
				$search_author = '';
			}





viewtopic.php
FIND
Code: Select all
	if ( !$board_config['allow_html'] )
	{
		if ( $user_sig != '' && $userdata['user_allowhtml'] )


REPLACE WITH
Code: Select all
	if ( !$board_config['allow_html'] || !$userdata['user_allowhtml'])
	{
		if ( $user_sig != '' )


FIND
Code: Select all
			$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));


REPLACE WITH
Code: Select all
			$user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));


FIND
Code: Select all
		$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));


REPLACE WITH
Code: Select all
		$message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));





admin/admin_styles.php
FIND
Code: Select all
			include($phpbb_root_path. "templates/" . $install_to . "/theme_info.cfg");


REPLACE WITH
Code: Select all
			include($phpbb_root_path. "templates/" . basename($install_to) . "/theme_info.cfg");


FIND
Code: Select all
			$fp = @fopen($phpbb_root_path . 'templates/' . $template_name . '/theme_info.cfg', 'w');


REPLACE WITH
Code: Select all
			$fp = @fopen($phpbb_root_path . 'templates/' . basename($template_name) . '/theme_info.cfg', 'w');




admin/page_footer_admin.php
FIND
Code: Select all
	'PHPBB_VERSION' => '2' . $board_config['version'],


REPLACE WITH
Code: Select all
	'PHPBB_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? '2' . $board_config['version'] : '',





admin/page_header_admin.php
FIND
Code: Select all
	$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;


REPLACE WITH
Code: Select all
	$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');





db/postgres7.php
FIND
Code: Select all
			$query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $query);


AFTER, ADD
Code: Select all
			$query = preg_replace('#(.*WHERE.*)(username|user_email|ban_email) = \'(.*)\'#ise', "\"\\1LOWER(\\2) = '\" . strtolower('\\3') . \"'\"", $query);





includes/page_header.php
FIND
Code: Select all
	$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;


REPLACE WITH
Code: Select all
	$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');


FIND
Code: Select all
if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))


REPLACE WITH
Code: Select all
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))





includes/sessions.php
FIND
Code: Select all
	$last_visit = 0;
	$current_time = time();
	$expiry_time = $current_time - $board_config['session_length'];


BEFORE, ADD
Code: Select all
	$page_id = (int) $page_id;


FIND
Code: Select all
					// No match; don't login, set as anonymous user
					$login = 0; 
					$enable_autologin = 0; 
					$user_id = $userdata['user_id'] = ANONYMOUS;


AFTER, ADD
Code: Select all
					$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS;
					$result = $db->sql_query($sql);
					$userdata = $db->sql_fetchrow($result);
					$db->sql_freeresult($result);


FIND
Code: Select all
				// Autologin is not set. Don't login, set as anonymous user
				$login = 0;
				$enable_autologin = 0;
				$user_id = $userdata['user_id'] = ANONYMOUS;


AFTER, ADD
Code: Select all
				$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS;
				$result = $db->sql_query($sql);
				$userdata = $db->sql_fetchrow($result);
				$db->sql_freeresult($result);


FIND
Code: Select all
	{
		$session_id = '';
	}

	//
	// Does a session exist?


REPLACE WITH
Code: Select all
	{
		$session_id = '';
	}

	$thispage_id = (int) $thispage_id;

	//
	// Does a session exist?



templates/subSilver/login_body.tpl
FIND
Code: Select all
			  <input type="text" name="username" size="25" maxlength="40" value="{USERNAME}" />


REPLACE WITH
Code: Select all
			  <input type="text" class="post" name="username" size="25" maxlength="40" value="{USERNAME}" />


FIND
Code: Select all
			  <input type="password" name="password" size="25" maxlength="32" />
  			</td>


REPLACE WITH
Code: Select all
			  <input type="password" class="post" name="password" size="25" maxlength="32" />
User avatar
Thoul
Admin/Webmaster
 
Posts: 18551
Joined: July 30th 2002, 11:30 am
Location: USA

Return to phpBB 2: Fixes and Code Changes

Who is online

Users browsing this forum: No registered users and 0 guests