phpBBHacks.com, the place for phpBB users

Bookmark and Share

phpBB 2.0.7 to 2.0.8a Code Changes

phpBB 2.0.7 to 2.0.8a Code Changes

Postby Thoul » March 28th 2004, 9:10 pm

HTML Version.
Text Version.

These are the code changes introduced between phpBB 2.0.7 and phpBB 2.0.8a. 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.

There was one security update made to each phpBB 2.0.7 and phpBB 2.0.8 after their initial releases, called 2.0.7a and 2.0.8a respectively. This tutorial includes all of these changes. For those of you that might be upgrading from the original releases of phpBB 2.0.7 or 2.0.8, the changes introduced in 2.0.7a and 2.0.8a for these are listed separately from others below.

These code changes use the following instruction labels:
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 last line of code in the preceding FIND instruction.
FIND AND DELETE - Locate the code in this instruction as with a FIND statement, and then delete the code.

Once you have completed the code changes, create an install/ directory in your forum's root directory, and upload the update_to_208.php file that comes in any phpBB 2.0.8 download to the install/ directory. Run update_to_208.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!
User avatar
Thoul
Admin/Webmaster
 
Posts: 18551
Joined: July 30th 2002, 11:30 am
Location: USA

Postby Thoul » March 28th 2004, 9:11 pm

The changes in this post are those introduced in phpBB 2.0.7a. If you are upgrading from the original phpBB 2.0.7 release, make these changes. Otherwise, proceed to the next post.

login.php
FIND
Code: Select all
						$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : "index.$phpEx";


REPLACE WITH
Code: Select all
						$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "index.$phpEx";


FIND
Code: Select all
					$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : '';


REPLACE WITH
Code: Select all
					$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : '';


FIND
Code: Select all
			$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : "";


REPLACE WITH
Code: Select all
			$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "";


FIND
Code: Select all
			$url = (!empty($HTTP_POST_VARS['redirect'])) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : htmlspecialchars($HTTP_GET_VARS['redirect']);


AFTER, ADD
Code: Select all
			$url = str_replace('&', '&', $url);


FIND
Code: Select all
		$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : "index.$phpEx";


REPLACE WITH
Code: Select all
		$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "index.$phpEx";



search.php
FIND
Code: Select all
$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : 'posts';


AFTER, ADD
Code: Select all
$show_results = ($show_results == 'topics') ? 'topics' : 'posts';


FIND
Code: Select all
	$store_vars = array('search_results', 'total_match_count', 'split_search', 'sort_by', 'sort_dir', 'show_results', 'return_chars');


AFTER, ADD
Code: Select all
	$search_results = '';



privmsg.php
FIND
Code: Select all
if ( $row = $db->sql_fetchrow($result) )
{
	do
	{
		$privmsg_id = $row['privmsgs_id'];


REPLACE WITH
Code: Select all
if ( $row = $db->sql_fetchrow($result) )
{
	$i = 0;
	do
	{
		$privmsg_id = $row['privmsgs_id'];


FIND
Code: Select all
		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];


AFTER, ADD
Code: Select all
		$i++;
User avatar
Thoul
Admin/Webmaster
 
Posts: 18551
Joined: July 30th 2002, 11:30 am
Location: USA

Postby Thoul » March 28th 2004, 9:12 pm

The changes in this post are those introduced in phpBB 2.0.8. If you are upgrading from phpBB 2.0.7 or 2.0.7a, make these changes. Otherwise, proceed to the next post.

admin/admin_forumauth.php
FIND
Code: Select all
			$simple_ary = $simple_auth_ary[$HTTP_POST_VARS['simpleauth']];


REPLACE WITH
Code: Select all
			$simple_ary = $simple_auth_ary[intval($HTTP_POST_VARS['simpleauth'])];


FIND
Code: Select all
			$sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";


REPLACE WITH
Code: Select all
			if (is_array($simple_ary))
			{
				$sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
			}


FIND
Code: Select all
				$value = $HTTP_POST_VARS[$forum_auth_fields[$i]];


REPLACE WITH
Code: Select all
				$value = intval($HTTP_POST_VARS[$forum_auth_fields[$i]]);



admin/admin_forums.php
FIND
Code: Select all
	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];


AFTER, ADD
Code: Select all
	$mode = htmlspecialchars($mode);



admin/admin_groups.php
FIND
Code: Select all
	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];


AFTER, ADD
Code: Select all
	$mode = htmlspecialchars($mode);



admin/admin_ranks.php
FIND
Code: Select all
	$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];


AFTER, ADD
Code: Select all
	$mode = htmlspecialchars($mode);



admin/admin_smilies.php
FIND
Code: Select all
	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];


AFTER, ADD
Code: Select all
	$mode = htmlspecialchars($mode);


FIND
Code: Select all
			$smiley_id = ( !empty($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];


AFTER, ADD
Code: Select all
			$smiley_id = intval($smiley_id);


FIND
Code: Select all
			$smiley_id = ( !empty($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];


AFTER, ADD
Code: Select all
			$smiley_id = intval($smiley_id);



admin/admin_styles.php
FIND
Code: Select all
	$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];


AFTER, ADD
Code: Select all
	$mode = htmlspecialchars($mode);


FIND
Code: Select all
				$style_id = $HTTP_GET_VARS['style_id'];


REPLACE WITH
Code: Select all
				$style_id = intval($HTTP_GET_VARS['style_id']);


FIND
Code: Select all
				WHERE template_name = '$template_name'";


REPLACE WITH
Code: Select all
				WHERE template_name = '" . str_replace("\'", "''", $template_name) . "'";



admin/admin_ug_auth.php
FIND
Code: Select all
$group_id = intval($group_id);


AFTER, ADD
Code: Select all
$adv = intval($adv);
$mode = htmlspecialchars($mode);



admin/admin_user_ban.php
FIND
Code: Select all
				$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . $user_list[$i];


REPLACE WITH
Code: Select all
				$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . intval($user_list[$i]);


FIND
Code: Select all
				$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . $ip_list[$i];


REPLACE WITH
Code: Select all
				$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . str_replace("\'", "''", $ip_list[$i]);


FIND
Code: Select all
				$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . $email_list[$i];


REPLACE WITH
Code: Select all
				$where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . str_replace("\'", "''", $email_list[$i]);



admin/admin_users.php
FIND
Code: Select all
	$mode = ( isset( $HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];


AFTER, ADD
Code: Select all
	$mode = htmlspecialchars($mode);


FIND
Code: Select all
				$category = $HTTP_POST_VARS['avatarcategory'];


REPLACE WITH
Code: Select all
				$category = htmlspecialchars($HTTP_POST_VARS['avatarcategory']);



admin/admin_words.php
FIND
Code: Select all
	$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];


AFTER, ADD
Code: Select all
	$mode = htmlspecialchars($mode);


FIND
Code: Select all
		$word_id = ( isset($HTTP_GET_VARS['id']) ) ? $HTTP_GET_VARS['id'] : 0;


REPLACE WITH
Code: Select all
		$word_id = ( isset($HTTP_GET_VARS['id']) ) ? intval($HTTP_GET_VARS['id']) : 0;


FIND
Code: Select all
		$word_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : 0;


REPLACE WITH
Code: Select all
		$word_id = ( isset($HTTP_POST_VARS['id']) ) ? intval($HTTP_POST_VARS['id']) : 0;


FIND
Code: Select all
			$word_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];


AFTER, ADD
Code: Select all
			$word_id = intval($word_id);



admin/pagestart.php
FIND
Code: Select all
	redirect($url);


REPLACE WITH
Code: Select all
	redirect("index.$phpEx?sid=" . $userdata['session_id']);



includes/bbcode.php
FIND
Code: Select all
	$text = preg_replace("#\[img\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);


REPLACE WITH
Code: Select all
	$text = preg_replace("#\[img\]((ht|f)tp://)([^ \?&=\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);



includes/functions_search.php
FIND
Code: Select all
					case 'mssql':


AFTER, ADD
Code: Select all
					case 'mssql-odbc':


FIND
Code: Select all
				case 'mssql':


AFTER, ADD
Code: Select all
				case 'mssql-odbc':



includes/usercp_register.php
FIND
Code: Select all
	$user_avatar_local = ( isset($HTTP_POST_VARS['avatarselect']) && !empty($HTTP_POST_VARS['submitavatar']) && $board_config['allow_avatar_local'] ) ? $HTTP_POST_VARS['avatarselect'] : ( ( isset($HTTP_POST_VARS['avatarlocal'])  ) ? htmlspecialchars($HTTP_POST_VARS['avatarlocal']) : '' );


REPLACE WITH
Code: Select all
	$user_avatar_local = ( isset($HTTP_POST_VARS['avatarselect']) && !empty($HTTP_POST_VARS['submitavatar']) && $board_config['allow_avatar_local'] ) ? htmlspecialchars($HTTP_POST_VARS['avatarselect']) : ( ( isset($HTTP_POST_VARS['avatarlocal'])  ) ? htmlspecialchars($HTTP_POST_VARS['avatarlocal']) : '' );
User avatar
Thoul
Admin/Webmaster
 
Posts: 18551
Joined: July 30th 2002, 11:30 am
Location: USA

Postby Thoul » March 28th 2004, 9:13 pm

The changes in this post are those introduced in phpBB 2.0.8a. If you are upgrading from phpBB 2.0.7, 2.0.7a, or 2.0.8, make these changes.

privmsg.php
FIND
Code: Select all
			$pm_sql_user .= "AND ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . "


REPLACE WITH
Code: Select all
			$pm_sql_user = "AND ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . "
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