diff -ur phpBB2/admin/admin_board.php phpBB-2.0.6/admin/admin_board.php
--- phpBB2/admin/admin_board.php	2003-01-15 13:34:08.000000000 +0000
+++ phpBB-2.0.6/admin/admin_board.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: admin_board.php,v 1.51.2.3 2002/12/19 17:17:39 psotfx Exp $
+ *   $Id: admin_board.php,v 1.51.2.6 2003/06/10 00:37:12 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -16,7 +16,7 @@
 if( !empty($setmodules) )
 {
 	$file = basename(__FILE__);
-	$module['General']['Configuration'] = "$file?mode=config";
+	$module['General']['Configuration'] = "$file";
 	return;
 }
 
@@ -247,6 +247,9 @@
 	"ACTIVATION_USER_CHECKED" => $activation_user,
 	"ACTIVATION_ADMIN" => USER_ACTIVATION_ADMIN, 
 	"ACTIVATION_ADMIN_CHECKED" => $activation_admin, 
+	"CONFIRM_ENABLE" => $confirm_yes,
+	"CONFIRM_DISABLE" => $confirm_no,
+	"ACTIVATION_NONE_CHECKED" => $activation_none,
 	"BOARD_EMAIL_FORM_ENABLE" => $board_email_form_yes, 
 	"BOARD_EMAIL_FORM_DISABLE" => $board_email_form_no, 
 	"MAX_POLL_OPTIONS" => $new['max_poll_options'], 
diff -ur phpBB2/admin/admin_db_utilities.php phpBB-2.0.6/admin/admin_db_utilities.php
--- phpBB2/admin/admin_db_utilities.php	2003-01-15 13:34:09.000000000 +0000
+++ phpBB-2.0.6/admin/admin_db_utilities.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
 *     copyright            : (C) 2001 The phpBB Group
 *     email                : support@phpbb.com
 *
-*     $Id: admin_db_utilities.php,v 1.42.2.9 2002/12/21 19:09:56 psotfx Exp $
+*     $Id: admin_db_utilities.php,v 1.42.2.10 2003/03/04 21:02:19 acydburn Exp $
 *
 ****************************************************************************/
 
@@ -701,6 +701,8 @@
 
 			$gzipcompress = (!empty($HTTP_POST_VARS['gzipcompress'])) ? $HTTP_POST_VARS['gzipcompress'] : ( (!empty($HTTP_GET_VARS['gzipcompress'])) ? $HTTP_GET_VARS['gzipcompress'] : 0 );
 
+			$drop = (!empty($HTTP_POST_VARS['drop'])) ? intval($HTTP_POST_VARS['drop']) : ( (!empty($HTTP_GET_VARS['drop'])) ? intval($HTTP_GET_VARS['drop']) : 0 );
+
 			if(!empty($additional_tables))
 			{
 				if(ereg(",", $additional_tables))
@@ -856,7 +858,7 @@
 			break;
 
 		case 'restore':
-			if(!isset($restore_start))
+			if(!isset($HTTP_POST_VARS['restore_start']))
 			{
 				//
 				// Define Template files...
diff -ur phpBB2/admin/admin_groups.php phpBB-2.0.6/admin/admin_groups.php
--- phpBB2/admin/admin_groups.php	2003-01-15 13:34:08.000000000 +0000
+++ phpBB-2.0.6/admin/admin_groups.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: admin_groups.php,v 1.25.2.5 2002/07/31 19:14:46 dougk_ff7 Exp $
+ *   $Id: admin_groups.php,v 1.25.2.8 2003/05/17 17:32:18 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -43,7 +43,7 @@
 }
 else
 {
-	$group_id = '';
+	$group_id = 0;
 }
 
 if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
@@ -171,6 +171,56 @@
 	//
 	if ( isset($HTTP_POST_VARS['group_delete']) )
 	{
+		//
+		// Reset User Moderator Level
+		//
+
+		// Is Group moderating a forum ?
+		$sql = "SELECT auth_mod FROM " . AUTH_ACCESS_TABLE . " 
+			WHERE group_id = " . $group_id;
+		if ( !($result = $db->sql_query($sql)) )
+		{
+			message_die(GENERAL_ERROR, 'Could not select auth_access', '', __LINE__, __FILE__, $sql);
+		}
+
+		$row = $db->sql_fetchrow($result);
+		if (intval($row['auth_mod']) == 1)
+		{
+			// Yes, get the assigned users and update their Permission if they are no longer moderator of one of the forums
+			$sql = "SELECT user_id FROM " . USER_GROUP_TABLE . "
+				WHERE group_id = " . $group_id;
+			if ( !($result = $db->sql_query($sql)) )
+			{
+				message_die(GENERAL_ERROR, 'Could not select user_group', '', __LINE__, __FILE__, $sql);
+			}
+
+			$rows = $db->sql_fetchrowset($result);
+			for ($i = 0; $i < count($rows); $i++)
+			{
+				$sql = "SELECT g.group_id FROM " . AUTH_ACCESS_TABLE . " a, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
+				WHERE (a.auth_mod = 1) AND (g.group_id = a.group_id) AND (a.group_id = ug.group_id) AND (g.group_id = ug.group_id) 
+					AND (ug.user_id = " . intval($rows[$i]['user_id']) . ") AND (ug.group_id <> " . $group_id . ")";
+				if ( !($result = $db->sql_query($sql)) )
+				{
+					message_die(GENERAL_ERROR, 'Could not obtain moderator permissions', '', __LINE__, __FILE__, $sql);
+				}
+
+				if ($db->sql_numrows($result) == 0)
+				{
+					$sql = "UPDATE " . USERS_TABLE . " SET user_level = " . USER . " 
+					WHERE user_level = " . MOD . " AND user_id = " . intval($rows[$i]['user_id']);
+					
+					if ( !$db->sql_query($sql) )
+					{
+						message_die(GENERAL_ERROR, 'Could not update moderator permissions', '', __LINE__, __FILE__, $sql);
+					}
+				}
+			}
+		}
+
+		//
+		// Delete Group
+		//
 		$sql = "DELETE FROM " . GROUPS_TABLE . "
 			WHERE group_id = " . $group_id;
 		if ( !$db->sql_query($sql) )
@@ -213,7 +263,7 @@
 			message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
 		}
 		
-		$this_userdata = get_userdata($group_moderator);
+		$this_userdata = get_userdata($group_moderator, true);
 		$group_moderator = $this_userdata['user_id'];
 
 		if ( !$group_moderator )
diff -ur phpBB2/admin/admin_mass_email.php phpBB-2.0.6/admin/admin_mass_email.php
--- phpBB2/admin/admin_mass_email.php	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/admin/admin_mass_email.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
 *     copyright            : (C) 2001 The phpBB Group
 *     email                : support@phpbb.com
 *
-*     $Id: admin_mass_email.php,v 1.15.2.5 2002/05/20 00:52:18 psotfx Exp $
+*     $Id: admin_mass_email.php,v 1.15.2.7 2003/05/03 23:24:01 acydburn Exp $
 *
 ****************************************************************************/
 
@@ -79,10 +79,10 @@
 
 	if ( $row = $db->sql_fetchrow($result) )
 	{
-		$bcc_list = '';
+		$bcc_list = array();
 		do
 		{
-			$bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $row['user_email'];
+			$bcc_list[] = $row['user_email'];
 		}
 		while ( $row = $db->sql_fetchrow($result) );
 
@@ -116,12 +116,18 @@
 
 		$emailer = new emailer($board_config['smtp_delivery']);
 	
-		$email_headers = 'Return-Path: ' . $userdata['board_email'] . "\nFrom: " . $board_config['board_email'] . "\n";
-		$email_headers .= 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
+		$emailer->from($board_config['board_email']);
+		$emailer->replyto($board_config['board_email']);
+
+		for ($i = 0; $i < count($bcc_list); $i++)
+		{
+			$emailer->bcc($bcc_list[$i]);
+		}
+
+		$email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
 		$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
 		$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
 		$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
-		$email_headers .= "Bcc: $bcc_list\n";
 
 		$emailer->use_template('admin_send_email');
 		$emailer->email_address($board_config['board_email']);
diff -ur phpBB2/admin/admin_styles.php phpBB-2.0.6/admin/admin_styles.php
--- phpBB2/admin/admin_styles.php	2003-01-15 13:34:08.000000000 +0000
+++ phpBB-2.0.6/admin/admin_styles.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: admin_styles.php,v 1.27.2.9 2002/12/21 19:09:57 psotfx Exp $
+ *   $Id: admin_styles.php,v 1.27.2.11 2003/06/26 00:08:17 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -39,16 +39,14 @@
 // Check if the user has cancled a confirmation message.
 //
 $phpbb_root_path = "./../";
+require($phpbb_root_path . 'extension.inc');
 
 $confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : FALSE;
 $cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE;
 
-if (empty($HTTP_POST_VARS['send_file']))
-{
-	$no_page_header = ( $cancel ) ? TRUE : FALSE;
-	require($phpbb_root_path . 'extension.inc');
-	require('./pagestart.' . $phpEx);
-}
+$no_page_header = (!empty($HTTP_POST_VARS['send_file']) || $cancel) ? TRUE : FALSE;
+
+require('./pagestart.' . $phpEx);
 
 if ($cancel)
 {
diff -ur phpBB2/admin/admin_ug_auth.php phpBB-2.0.6/admin/admin_ug_auth.php
--- phpBB2/admin/admin_ug_auth.php	2003-01-15 13:34:09.000000000 +0000
+++ phpBB-2.0.6/admin/admin_ug_auth.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: admin_ug_auth.php,v 1.13.2.2 2002/05/12 15:57:44 psotfx Exp $
+ *   $Id: admin_ug_auth.php,v 1.13.2.4 2003/05/17 17:32:19 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -54,6 +54,9 @@
 	}
 }
 
+$user_id = intval($user_id);
+$group_id = intval($group_id);
+
 //
 // Start program - define vars
 //
@@ -510,7 +513,7 @@
 {
 	if ( isset($HTTP_POST_VARS['username']) )
 	{
-		$this_userdata = get_userdata($HTTP_POST_VARS['username']);
+		$this_userdata = get_userdata($HTTP_POST_VARS['username'], true);
 		if ( !is_array($this_userdata) )
 		{
 			message_die(GENERAL_MESSAGE, $lang['No_such_user']);
diff -ur phpBB2/admin/admin_user_ban.php phpBB-2.0.6/admin/admin_user_ban.php
--- phpBB2/admin/admin_user_ban.php	2003-01-15 13:34:09.000000000 +0000
+++ phpBB-2.0.6/admin/admin_user_ban.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: admin_user_ban.php,v 1.21.2.2 2002/05/12 15:57:45 psotfx Exp $
+ *   $Id: admin_user_ban.php,v 1.21.2.4 2003/03/31 06:56:30 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -49,7 +49,7 @@
 	$user_list = array();
 	if ( !empty($HTTP_POST_VARS['username']) )
 	{
-		$this_userdata = get_userdata($HTTP_POST_VARS['username']);
+		$this_userdata = get_userdata($HTTP_POST_VARS['username'], true);
 		if( !$this_userdata )
 		{
 			message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
@@ -155,7 +155,7 @@
 			// contained in the annotated php manual at php.com (ereg
 			// section)
 			//
-			if ( eregi('^(([[:alnum:]\*]+([-_.][[:alnum:]\*]+)*\.?)|(\*))@([[:alnum:]]+([-_]?[[:alnum:]]+)*\.){1,3}([[:alnum:]]{2,6})$', trim($email_list_temp[$i])) )
+			if (preg_match('#^(([a-z0-9&.-_+])|(\*))+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$#is', trim($email_list_temp[$i])))
 			{
 				$email_list[] = trim($email_list_temp[$i]);
 			}
diff -ur phpBB2/admin/admin_users.php phpBB-2.0.6/admin/admin_users.php
--- phpBB2/admin/admin_users.php	2003-01-15 13:34:08.000000000 +0000
+++ phpBB-2.0.6/admin/admin_users.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: admin_users.php,v 1.57.2.17 2002/12/21 19:09:57 psotfx Exp $
+ *   $Id: admin_users.php,v 1.57.2.25 2003/06/20 07:40:27 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -30,7 +30,7 @@
 	return;
 }
 
-$phpbb_root_path = "./../";
+$phpbb_root_path = './../';
 require($phpbb_root_path . 'extension.inc');
 require('./pagestart.' . $phpEx);
 require($phpbb_root_path . 'includes/bbcode.'.$phpEx);
@@ -56,14 +56,14 @@
 //
 // Begin program
 //
-if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_URL]) || isset( $HTTP_POST_VARS[POST_USERS_URL]) ) )
+if ( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_URL]) || isset( $HTTP_POST_VARS[POST_USERS_URL]) ) )
 {
 	//
 	// Ok, the profile has been modified and submitted, let's update
 	//
-	if( ( $mode == 'save' && isset( $HTTP_POST_VARS['submit'] ) ) || isset( $HTTP_POST_VARS['avatargallery'] ) || isset( $HTTP_POST_VARS['submitavatar'] ) || isset( $HTTP_POST_VARS['cancelavatar'] ) )
+	if ( ( $mode == 'save' && isset( $HTTP_POST_VARS['submit'] ) ) || isset( $HTTP_POST_VARS['avatargallery'] ) || isset( $HTTP_POST_VARS['submitavatar'] ) || isset( $HTTP_POST_VARS['cancelavatar'] ) )
 	{
-		$user_id = intval( $HTTP_POST_VARS['id'] );
+		$user_id = intval($HTTP_POST_VARS['id']);
 
 		if (!($this_userdata = get_userdata($user_id)))
 		{
@@ -216,7 +216,7 @@
 			message_die(GENERAL_MESSAGE, $message);
 		}
 
-		$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags( $HTTP_POST_VARS['username'] ) ) : '';
+		$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : '';
 		$email = ( !empty($HTTP_POST_VARS['email']) ) ? trim(strip_tags(htmlspecialchars( $HTTP_POST_VARS['email'] ) )) : '';
 
 		$password = ( !empty($HTTP_POST_VARS['password']) ) ? trim(strip_tags(htmlspecialchars( $HTTP_POST_VARS['password'] ) )) : '';
@@ -304,24 +304,33 @@
 
 		$error = FALSE;
 
-		if( stripslashes($username) != $this_userdata['username'] )
+		if (stripslashes($username) != $this_userdata['username'])
 		{
 			unset($rename_user);
 
-			$result = validate_username($username);
-			if ( $result['error'] )
+			if ( stripslashes(strtolower($username)) != strtolower($this_userdata['username']) ) 
 			{
-				$error = TRUE;
-				$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
+				$result = validate_username($username);
+				if ( $result['error'] )
+				{
+					$error = TRUE;
+					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
+				}
+				else if ( strtolower(str_replace("\\'", "''", $username)) == strtolower($userdata['username']) )
+				{
+					$error = TRUE;
+					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Username_taken'];
+				}
 			}
-			else
+
+			if (!$error)
 			{
-				$username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
+				$username_sql = "username = '" . str_replace("\\'", "''", $username) . "', ";
 				$rename_user = $username; // Used for renaming usergroup
 			}
 		}
 
-		$passwd_sql = "";
+		$passwd_sql = '';
 		if( !empty($password) && !empty($password_confirm) )
 		{
 			//
@@ -349,7 +358,7 @@
 			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
 		}
 
-		if( $signature != "" )
+		if ($signature != '')
 		{
 			$sig_length_check = preg_replace('/(\[.*?)(=.*?)\]/is', '\\1]', stripslashes($signature));
 			if ( $allowhtml )
@@ -653,12 +662,25 @@
 				{
 					$sql = "UPDATE " . GROUPS_TABLE . "
 						SET group_name = '".str_replace("\'", "''", $rename_user)."'
-						WHERE group_name = '".str_replace("\'", "''", $this_userdata['username'] )."'";
+						WHERE group_name = '".str_replace("'", "''", $this_userdata['username'] )."'";
 					if( !$result = $db->sql_query($sql) )
 					{
 						message_die(GENERAL_ERROR, 'Could not rename users group', '', __LINE__, __FILE__, $sql);
 					}
 				}
+				
+				// Delete user session, to prevent the user navigating the forum (if logged in) when disabled
+				if (!$user_status)
+				{
+					$sql = "DELETE FROM " . SESSIONS_TABLE . " 
+						WHERE session_user_id = " . $user_id;
+
+					if ( !$db->sql_query($sql) )
+					{
+						message_die(GENERAL_ERROR, 'Error removing user session', '', __LINE__, __FILE__, $sql);
+					}
+				}
+				
 				$message .= $lang['Admin_user_updated'];
 			}
 			else
@@ -716,7 +738,7 @@
 		}
 		else
 		{
-			$this_userdata = get_userdata(htmlspecialchars($HTTP_POST_VARS['username']));
+			$this_userdata = get_userdata($HTTP_POST_VARS['username'], true);
 			if( !$this_userdata )
 			{
 				message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
@@ -727,7 +749,7 @@
 		// Now parse and display it as a template
 		//
 		$user_id = $this_userdata['user_id'];
-		$username = htmlspecialchars($this_userdata['username']);
+		$username = $this_userdata['username'];
 		$email = $this_userdata['user_email'];
 		$password = '';
 		$password_confirm = '';
@@ -1127,4 +1149,4 @@
 
 include('./page_footer_admin.'.$phpEx);
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/admin/index.php phpBB-2.0.6/admin/index.php
--- phpBB2/admin/index.php	2003-01-15 13:34:08.000000000 +0000
+++ phpBB-2.0.6/admin/index.php	2003-08-03 11:59:56.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: index.php,v 1.40.2.3 2003/01/07 20:51:34 psotfx Exp $
+ *   $Id: index.php,v 1.40.2.5 2003/08/03 11:50:51 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -132,6 +132,7 @@
 		"L_ADMIN_INTRO" => $lang['Admin_intro'],
 		"L_FORUM_STATS" => $lang['Forum_stats'],
 		"L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
+		"L_USERNAME" => $lang['Username'],
 		"L_LOCATION" => $lang['Location'],
 		"L_LAST_UPDATE" => $lang['Last_updated'],
 		"L_IP_ADDRESS" => $lang['IP_Address'],
@@ -454,7 +455,7 @@
 					"FORUM_LOCATION" => $location,
 					"IP_ADDRESS" => $reg_ip, 
 
-					"U_WHOIS_IP" => "http://www.geektools.com/cgi-bin/proxy.cgi?query=$reg_ip&targetnic=auto", 
+					"U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$reg_ip", 
 					"U_USER_PROFILE" => append_sid("admin_users.$phpEx?mode=edit&amp;" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']),
 					"U_FORUM_LOCATION" => append_sid($location_url))
 				);
@@ -546,7 +547,7 @@
 				"FORUM_LOCATION" => $location,
 				"IP_ADDRESS" => $guest_ip, 
 
-				"U_WHOIS_IP" => "http://www.geektools.com/cgi-bin/proxy.cgi?query=$guest_ip&targetnic=auto", 
+				"U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$guest_ip", 
 				"U_FORUM_LOCATION" => append_sid($location_url))
 			);
 		}
diff -ur phpBB2/admin/page_header_admin.php phpBB-2.0.6/admin/page_header_admin.php
--- phpBB2/admin/page_header_admin.php	2003-01-15 13:34:08.000000000 +0000
+++ phpBB-2.0.6/admin/page_header_admin.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: page_header_admin.php,v 1.12.2.3 2002/12/10 11:13:58 bartvb Exp $
+ *   $Id: page_header_admin.php,v 1.12.2.5 2003/06/10 20:48:18 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -64,6 +64,10 @@
 	'header' => 'admin/page_header.tpl')
 );
 
+// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility
+$l_timezone = explode('.', $board_config['board_timezone']);
+$l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])];
+
 //
 // The following assigns all _common_ variables that may be used at any point
 // in a template. Note that all URL's should be wrapped in append_sid, as
@@ -79,7 +83,7 @@
 
 	'U_INDEX' => append_sid('../index.'.$phpEx),
 
-	'S_TIMEZONE' => sprintf($lang['All_times'], $lang[$board_config['board_timezone']]),
+	'S_TIMEZONE' => sprintf($lang['All_times'], $l_timezone),
 	'S_LOGIN_ACTION' => append_sid('../login.'.$phpEx),
 	'S_JUMPBOX_ACTION' => append_sid('../viewforum.'.$phpEx),
 	'S_CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])), 
diff -ur phpBB2/admin/pagestart.php phpBB-2.0.6/admin/pagestart.php
--- phpBB2/admin/pagestart.php	2003-01-15 13:34:08.000000000 +0000
+++ phpBB-2.0.6/admin/pagestart.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: pagestart.php,v 1.1.2.4 2002/11/30 21:37:43 psotfx Exp $
+ *   $Id: pagestart.php,v 1.1.2.6 2003/05/06 20:18:42 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -49,7 +49,10 @@
 
 if ($HTTP_GET_VARS['sid'] != $userdata['session_id'])
 {
-	$url = preg_replace('/sid=([^&]*)(&?)/i', '', $HTTP_SERVER_VARS['REQUEST_URI']);
+	$url = str_replace(preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name'])), '', $HTTP_SERVER_VARS['REQUEST_URI']);
+	$url = str_replace(preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path'])), '', $url);
+	$url = str_replace('//', '/', $url);
+	$url = preg_replace('/sid=([^&]*)(&?)/i', '', $url);
 	$url = preg_replace('/\?$/', '', $url);
 	$url .= ((strpos($url, '?')) ? '&' : '?') . 'sid=' . $userdata['session_id'];
 
Only in phpBB-2.0.6: cache
diff -ur phpBB2/common.php phpBB-2.0.6/common.php
--- phpBB2/common.php	2003-01-15 13:34:16.000000000 +0000
+++ phpBB-2.0.6/common.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: common.php,v 1.74.2.5 2002/12/17 23:59:37 psotfx Exp $
+ *   $Id: common.php,v 1.74.2.10 2003/06/04 17:41:39 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -124,38 +124,28 @@
 include($phpbb_root_path . 'includes/db.'.$phpEx);
 
 //
-// Mozilla navigation bar
-// Default items that should be valid on all pages.
-// Defined here and not in page_header.php so they can be redefined in the code
-//
-$nav_links['top'] = array ( 
-	'url' => append_sid($phpbb_root_dir."index.".$phpEx),
-	'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
-);
-$nav_links['search'] = array ( 
-	'url' => append_sid($phpbb_root_dir."search.".$phpEx),
-	'title' => $lang['Search']
-);
-$nav_links['help'] = array ( 
-	'url' => append_sid($phpbb_root_dir."faq.".$phpEx),
-	'title' => $lang['FAQ']
-);
-$nav_links['author'] = array ( 
-	'url' => append_sid($phpbb_root_dir."memberlist.".$phpEx),
-	'title' => $lang['Memberlist']
-);
-
-//
 // Obtain and encode users IP
 //
 if( getenv('HTTP_X_FORWARDED_FOR') != '' )
 {
 	$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 );
 
-	if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip_list) )
+	$entries = explode(',', getenv('HTTP_X_FORWARDED_FOR'));
+	reset($entries);
+	while (list(, $entry) = each($entries)) 
 	{
-		$private_ip = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10.\.*/', '/^224.\.*/', '/^240.\.*/');
-		$client_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
+		$entry = trim($entry);
+		if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list) )
+		{
+			$private_ip = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.((1[6-9])|(2[0-9])|(3[0-1]))\..*/', '/^10\..*/', '/^224\..*/', '/^240\..*/');
+			$found_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
+
+			if ($client_ip != $found_ip)
+			{
+				$client_ip = $found_ip;
+				break;
+			}
+		}
 	}
 }
 else
diff -ur phpBB2/contrib/README.html phpBB-2.0.6/contrib/README.html
--- phpBB2/contrib/README.html	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/contrib/README.html	2003-07-20 15:25:54.000000000 +0000
@@ -4,7 +4,7 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html">
 <meta http-equiv="Content-Style-Type" content="text/css">
-<title>phpBB 2.0.0 :: Extras</title>
+<title>phpBB 2.0.x :: Contrib</title>
 <link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
 <style type="text/css">
 <!--
@@ -16,12 +16,12 @@
 </head>
 <body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#006699">
 
-<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> 
-	<tr> 
+<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
+	<tr>
 		<td class="bodyline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
 			<tr>
 				<td>
-				
+
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 	<tr>
 		<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB2 : Creating Communities" vspace="1" /></a></td>
@@ -43,6 +43,8 @@
 
 <p><b>Authors: Crimsonbane, psoTFX and nathan</b></p>
 
+<p align="center"><b>File Caching Updated</b></p>
+
 <p>During development of phpBB2 a recurring issue of server load has cropped up. phpBB 2.0.0 differs from many of its contemporaries by doing many more tasks at runtime. While this allows for simpler upgrade and modification paths it also leads to a greater strain being placed on the server. To help reduce this issue a cacheing template system was created based on work by Crimsonbane. This stores a compiled version of each template resulting in a generally significant reduction in server load and perhaps page generation time.</p>
 
 <p>Two versions of the cacheing system are contained in this directory, one uses flat files the other a MySQL database. Testing has shown that, in general, the average virtual host seems to show better performance with the flat file solution. However this may not be the case for your system, so please feel free to try both.</p>
@@ -51,30 +53,117 @@
 
 <h3>template_file_cache.php</h3>
 
-<p>To use the flat file system you need to add the following folders to templates/subSilver (or whatever template/s you are using): </p>
+<p>To use the flat file system you need to create a directory called 'cache' in your phpBB root directory (it may already exist and contain some default files, do not delete these). This directory must be writeable by the web server, e.g. global write access. Under UNIX systems this is typically achieved by using <i>chmod a+w cache</i> or <i>chmod 777 cache</i>. Many FTP applications also allow you to change permission properties. See your applications manual for details on how to do this.</p>
 
-<pre>cache/ 
-cache/admin/</pre>
+<p><b>Please note</b> that creating a world writeable directory is of course a potential security issue. Most of the time this is not a great issue, however on virtual hosting accounts there may be users who have nothing better to do than cause problems. Therefore you should monitor the status of this directory regularly and report any problems to your hosting provider (who will be in a position to take action against any offending user).</p>
 
-<p>And give both of them global write access (ie. chmod a+w, or if you prefer chmod 777). <b>Please note</b> that creating a world writeable directory is of course a potential security issue. Most of the time this is not a great issue, however on virtual hosting accounts there may be users who have nothing better to do than cause problems. Therefore you should monitor the status of these directories regularly and report any problems to your hosting provider (who will be in a position to take action against any offending user).</p>
+<p>NB: The directory required for this version of the file caching template system differs from previous releases. You can safely delete the old caching directories.</p>
 
 <h3>template_db_cache.php</h3>
 
 <p>To use the database system (note that this is <b>only</b> compatible with MySQL at present) you need to create the following table (replacing the phpbb_ prefix with your own if you used something different):</p>
 
 <pre>
-CREATE TABLE phpbb_template_cache ( 
-  template_name char(255) NOT NULL default '', 
-  template_handle char(50) NOT NULL default '', 
-  template_cached int(11) NOT NULL default '0', 
-  template_echo tinyint(1) NOT NULL default '1', 
-  template_compile text NOT NULL, 
-  PRIMARY KEY  (template_name) 
-) 
+CREATE TABLE phpbb_template_cache (
+  template_name char(255) NOT NULL default '',
+  template_handle char(50) NOT NULL default '',
+  template_cached int(11) NOT NULL default '0',
+  template_echo tinyint(1) NOT NULL default '1',
+  template_compile text NOT NULL,
+  PRIMARY KEY  (template_name)
+)
 </pre>
 
 <p>These files should not be incorporated into any mod or other plug-in, etc. They have been tested quite thoroughly but we cannot guarantee their stability in all cases. The system is based on work by Crimsonbane and of course Nathan's original templating system.</p>
 
+<h2><u>Visual Confirmation System</u></h2>
+
+<p><b>Author: psoTFX</b></p>
+
+<p>Unfortunately there are people "out there" who have nothing better to do than cause other people trouble. Even worse are groups that write applications which cause problems. One very annoying (and pointless) way in which people can cause you trouble is by mass registering users. This Mod, back-ported from the forthcoming phpBB 2.2 helps eliminate or reduce this problem. It generates a random series of six alphanumeric characters as a png image. The user must then input these characters before they can register a new user. Should they fail three times in a row they will be locked out for the rest of that session </p>
+
+<p>To get the best from this Mod you should be running PHP4 and have the <b>zlib</b> module installed and loaded. It is quite common for zlib to be installed by default. If you are unsure whether it is please check with your hosting provider or review the output of phpinfo();. This Mod does <b>not</b> require GD, Imagemagick, NetPBM or any other module or utility. If you do not have zlib available the Mod will fall-back to a simpler output method. However this will still deter the majority of would be trouble makers.</p>
+
+<p>phpBB 2.0.6 is shipped with various bits of the visual confirmation system already installed. To complete installation you should unzip the contents of the visual_confirmation.zip archive into your phpBB root directory. Allow it to overwrite any existing files. <b>Please Note</b> that if you have any Mods installed which have altered; <U>profile.php</U>, <U>includes/usercp_register.php</U>, <U>admin/admin_board.php</U> or <U>templates/subSilver/admin/board_config_body.tpl</U> you <b>will lose</b> these changes. In this situation you are advised to manually diff the files and make the changes yourself.</p>
+
+<p>The default English language pack includes the necessary new strings for this mod. Other languages may be updated in time. However you can easily add the strings yourself, they are listed below. Please do not translate the %s present in one of these strings. This is a placeholder for additional text that will be inserted by phpBB.</p>
+
+<form>
+
+<p><b>lang_main.php</b></p>
+<textarea style="font-family: monospace;font-size: 10pt" rows="9" cols="80">
+$lang['Confirm_code_wrong'] = 'The confirmation code you entered was incorrect';
+$lang['Too_many_registers'] = 'You have exceeded the number of registration attempts for this session. Please try again later.';
+$lang['Confirm_code_impaired'] = 'If you are visually impaired or cannot otherwise read this code please contact the %sAdministrator%s for help.';
+$lang['Confirm_code'] = 'Confirmation code';
+$lang['Confirm_code_explain'] = 'Enter the code exactly as you see it. The code is case sensitive and zero has a diagonal line through it.';
+</textarea>
+
+<p><b>lang_admin.php</b></p>
+<textarea style="font-family: monospace;font-size: 10pt" rows="3" cols="80">
+$lang['Visual_confirm'] = 'Enable Visual Confirmation';
+$lang['Visual_confirm_explain'] = 'Requires users enter a code defined by an image when registering.';
+</textarea>
+
+<p>If you use a style other than subSilver you will need to make changes to two templates. The changes are quite straightforward, see below for details.</p>
+
+
+<p><b>profile_add_body.tpl</b></p>
+
+<p>Find similar:</p>
+
+<textarea style="font-family: monospace;font-size: 10pt" rows="9" cols="80">
+	&lt;tr&gt;
+	  &lt;td class="row1"&gt;&lt;span class="gen"&gt;{L_CONFIRM_PASSWORD}: * &lt;/span&gt;&lt;br /&gt;
+		&lt;span class="gensmall"&gt;{L_PASSWORD_CONFIRM_IF_CHANGED}&lt;/span&gt;&lt;/td&gt;
+	  &lt;td class="row2"&gt;
+		&lt;input type="password" class="post" style="width: 200px" name="password_confirm" size="25" maxlength="32" value="{PASSWORD_CONFIRM}" /&gt;
+	  &lt;/td&gt;
+	&lt;/tr&gt;
+</textarea>
+
+<p>Add after:</p>
+
+<textarea style="font-family: monospace;font-size: 10pt" rows="9" cols="80">
+	&lt;!-- BEGIN switch_confirm --&gt;
+	&lt;tr&gt;
+		&lt;td class="row1" colspan="2" align="center"&gt;&lt;span class="gensmall"&gt;{L_CONFIRM_CODE_IMPAIRED}&lt;/span&gt;<br /&gt;<br /&gt;{CONFIRM_IMG}<br /&gt;<br /&gt;</td&gt;
+	</tr&gt;
+	<tr&gt;
+	  &lt;td class="row1"&gt;<span class="gen">{L_CONFIRM_CODE}: * &lt;/span&gt;&lt;br /&gt;&lt;span class="gensmall"&gt;{L_CONFIRM_CODE_EXPLAIN}&lt;/span>&lt;/td&gt;
+	  &lt;td class="row2"&gt;&lt;input type="text" class="post" style="width: 200px" name="confirm_code" size="6" maxlength="6" value="" /&gt;&lt;/td&gt;
+	&lt;/tr&gt;
+	&lt;!-- END switch_confirm --&gt;
+</textarea>
+
+<p><b>admin/board_config_body.tpl</b></p>
+
+<p>Find similar:</p>
+
+<textarea style="font-family: monospace;font-size: 10pt" rows="9" cols="80">
+	&lt;tr&gt;
+		&lt;td class="row1"&gt;{L_ACCT_ACTIVATION}&lt;/td&gt;
+		&lt;td class="row2"&gt;vinput type="radio" name="require_activation" value="{ACTIVATION_NONE}" {ACTIVATION_NONE_CHECKED} /&gt;{L_NONE}&nbsp; &nbsp;&lt;input type="radio" name="require_activation" value="{ACTIVATION_USER}" {ACTIVATION_USER_CHECKED} /&gt;{L_USER}&nbsp; &nbsp;&lt;input type="radio" name="require_activation" value="{ACTIVATION_ADMIN}" {ACTIVATION_ADMIN_CHECKED} /&gt;{L_ADMIN}&lt;/td&gt;
+	&lt;/tr&gt;
+</textarea>
+
+<p>Add after:</p>
+
+<textarea style="font-family: monospace;font-size: 10pt" rows="9" cols="80">
+	&lt;tr&gt;
+		&lt;td class="row1"&gt;{L_VISUAL_CONFIRM}&lt;br /&gt;&lt;span class="gensmall"&gt;{L_VISUAL_CONFIRM_EXPLAIN}&lt;/span&gt;&lt;/td&gt;
+		&lt;td class="row2">&lt;input type="radio" name="enable_confirm" value="1" {CONFIRM_ENABLE} /&gt;{L_YES}&nbsp; &nbsp;&lt;input type="radio" name="enable_confirm" value="0" {CONFIRM_DISABLE} /&gt;{L_NO}&lt;/td&gt;
+	&lt;/tr&gt;
+</textarea>
+</form>
+
+<p>PLEASE NOTE: Templates can vary greatly and the above code should only be used as a guide. You may want to contact the template designer if you do not feel comfortable making the changes yourself.</p>
+
+<p>Once these tasks have been completed you should visit your Administration Control Panel. Under General -> Configuration you will find a new option "Enable Visual Confirmation", check the yes box to switch the system on. Because some of your visitors may be visually impaired a message is output along with the image noting the board email address as a point of contact should they be unable to read the code.</p>
+
+<p>While the Mod is designed to be relatively light in terms of load a very busy board with dozens of registrations a minute may see some affect from it. We would be interested in your experiences in this respect.</p>
+
+
 <h2><u>Database Informer</u></h2>
 
 <p><b>Authors: Blade, AL, Techie-Michael, Black Fluffy Lion</b></p>
Only in phpBB-2.0.6/contrib: fixfiles.sh
diff -ur phpBB2/contrib/template_db_cache.php phpBB-2.0.6/contrib/template_db_cache.php
--- phpBB2/contrib/template_db_cache.php	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/contrib/template_db_cache.php	2003-07-20 15:25:54.000000000 +0000
@@ -55,10 +55,12 @@
 	 * Constructor. Simply sets the root dir.
 	 *
 	 */
-	function Template($root = '.', $_board_config = false, $_db = false)
+	function Template($root = '.')
 	{
+		global $db;
+
 		$this->set_rootdir($root);
-		$this->db = $_db;
+		$this->db = &$db;
 
 		$this->pparse_order = array();
 	}
diff -ur phpBB2/contrib/template_file_cache.php phpBB-2.0.6/contrib/template_file_cache.php
--- phpBB2/contrib/template_file_cache.php	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/contrib/template_file_cache.php	2003-07-20 15:25:54.000000000 +0000
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *                              template.inc
+ *                              template.php
  *                            -------------------
  *   begin                : Saturday, Feb 13, 2001
  *   copyright            : (C) 2001 The phpBB Group
@@ -8,7 +8,6 @@
  *
  *   $Id: template.php,v 1.7 2002/01/28 19:12:37 psotfx Exp $
  *
- *
  ***************************************************************************/
 
 /***************************************************************************
@@ -25,6 +24,9 @@
  * The interface was originally inspired by PHPLib templates,
  * and the template file formats are quite similar.
  *
+ * Updated 9th June 2003 - psoTFX
+ * Backported various aspects of 2.2 template class
+ *
  */
 
 class Template {
@@ -32,17 +34,13 @@
 
 	// variable that holds all the data we'll be substituting into
 	// the compiled templates.
-	// ...
-	// This will end up being a multi-dimensional array like this:
-	// $this->_tpldata[block.][iteration#][child.][iteration#][child2.][iteration#][variablename] == value
-	// if it's a root-level variable, it'll be like this:
-	// $this->_tpldata[.][0][varname] == value
 	var $_tpldata = array();
 
 	// Hash of filenames for each template handle.
 	var $files = array();
 
-	// Root template directory.
+	// Root template directories
+	var $cache_root = 'cache/';
 	var $root = '';
 
 	// this will hash handle names to the compiled code for that handle.
@@ -79,13 +77,24 @@
 	{
 		global $phpbb_root_path;
 
-		if (!is_dir($dir))
+		if (is_file($dir) || is_link($dir))
 		{
 			return false;
 		}
-//		echo "<br />" . 
+
 		$this->root = phpbb_realpath($dir);
-        $this->cachedir = phpbb_realpath($dir . '/cache/');
+		$this->cachedir = phpbb_realpath($phpbb_root_path . $this->cache_root) . substr($dir, strrpos($dir, '/')) . '/';
+
+		if (!file_exists($this->cachedir . 'admin/'))
+		{
+			@umask(0);
+			if (!file_exists($this->cachedir))
+			{
+				mkdir($this->cachedir, 0777);
+			}
+			mkdir($this->cachedir . 'admin/', 0777);
+		}
+
 		return true;
 	}
 
@@ -95,14 +104,14 @@
 	 */
 	function set_filenames($filename_array)
 	{
-		if ( !is_array($filename_array) )
+		if (!is_array($filename_array))
 		{
 			return false;
 		}
 
 		$template_names = '';
 		@reset($filename_array);
-		while ( list($handle, $filename) = @each($filename_array) )
+		while (list($handle, $filename) = @each($filename_array))
 		{
 			$this->filename[$handle] = $filename;
 			$this->files[$handle] = $this->make_filename($filename);
@@ -120,29 +129,27 @@
 	function pparse($handle)
 	{
 		global $phpEx;
-//echo "<br />" . 
-		$cache_file = $this->cachedir . '/' . $this->filename[$handle] . '.' . $phpEx;
 
-		if( @filemtime($cache_file) == @filemtime($this->files[$handle]) )
+		$cache_file = $this->cachedir . $this->filename[$handle] . '.' . $phpEx;
+
+		if(@filemtime($cache_file) == @filemtime($this->files[$handle]))
 		{
 			$_str = '';
 			include($cache_file);
 
-			if ( $_str != '' )
+			if ($_str != '')
 			{
 				echo $_str;
 			}
 		}
 		else 
 		{
-			if ( !$this->loadfile($handle) )
+			if (!$this->loadfile($handle))
 			{
 				die("Template->pparse(): Couldn't load template file for handle $handle");
 			}
 
-			//
 			// Actually compile the code now.
-			//
 			$this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]);
 
 			$fp = fopen($cache_file, 'w+');
@@ -172,14 +179,14 @@
 
 		$cache_file = $this->cachedir . $this->filename[$handle] . '.' . $phpEx;
 
-		if( @filemtime($cache_file) == @filemtime($this->files[$handle]) )
+		if(@filemtime($cache_file) == @filemtime($this->files[$handle]))
 		{
 			$_str = '';
 			include($cache_file);
 		}
 		else 
 		{
-			if ( !$this->loadfile($handle) )
+			if (!$this->loadfile($handle))
 			{
 				die("Template->pparse(): Couldn't load template file for handle $handle");
 			}
@@ -218,27 +225,25 @@
 			// Nested block.
 			$blocks = explode('.', $blockname);
 			$blockcount = sizeof($blocks) - 1;
-			$str = '$this->_tpldata';
-			for ($i = 0; $i < $blockcount; $i++)
+
+			$str = &$this->_tpldata; 
+			for ($i = 0; $i < $blockcount; $i++) 
 			{
-				$str .= '[\'' . $blocks[$i] . '.\']';
-				eval('$lastiteration = sizeof(' . $str . ') - 1;');
-				$str .= '[' . $lastiteration . ']';
-			}
+				$str = &$str[$blocks[$i]]; 
+				$str = &$str[sizeof($str) - 1]; 
+			} 
+
 			// Now we add the block that we're actually assigning to.
 			// We're adding a new iteration to this block with the given
 			// variable assignments.
-			$str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;';
-
-			// Now we evaluate this assignment we've built up.
-			eval($str);
+			$str[$blocks[$blockcount]][] = $vararray;
 		}
 		else
 		{
 			// Top-level block.
 			// Add a new iteration to this block with the variable assignments
 			// we were given.
-			$this->_tpldata[$blockname . '.'][] = $vararray;
+			$this->_tpldata[$blockname][] = $vararray;
 		}
 
 		return true;
@@ -300,7 +305,7 @@
 	function loadfile($handle)
 	{
 		// If the file for this handle is already loaded and compiled, do nothing.
-		if ( !empty($this->uncompiled_code[$handle]) )
+		if (!empty($this->uncompiled_code[$handle]))
 		{
 			return true;
 		}
@@ -335,6 +340,8 @@
 	 */
 	function compile($code, $do_not_echo = false, $retvar = '')
 	{
+		$concat = (!$do_not_echo) ? ',' : '.';
+
 		// replace \ with \\ and then ' with \'.
 		$code = str_replace('\\', '\\\\', $code);
 		$code = str_replace('\'', '\\\'', $code);
@@ -349,13 +356,13 @@
 		{
 			$namespace = $varrefs[1][$i];
 			$varname = $varrefs[3][$i];
-			$new = $this->generate_block_varref($namespace, $varname);
+			$new = $this->generate_block_varref($namespace, $varname, $concat);
 
 			$code = str_replace($varrefs[0][$i], $new, $code);
 		}
 
 		// This will handle the remaining root-level varrefs
-		$code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'', $code);
+		$code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "' $concat ((isset(\$this->_tpldata['.'][0]['\\1'])) ? \$this->_tpldata['.'][0]['\\1'] : '') $concat '", $code);
 
 		// Break it up into lines.
 		$code_lines = explode("\n", $code);
@@ -375,32 +382,32 @@
 				$n[1] = $m[1];
 
 				// Added: dougk_ff7-Keeps templates from bombing if begin is on the same line as end.. I think. :)
-				if ( preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n) )
+				if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n))
 				{
 					$block_nesting_level++;
 					$block_names[$block_nesting_level] = $m[1];
 					if ($block_nesting_level < 2)
 					{
 						// Block is not nested.
-						$code_lines[$i] = '$_' . $a[1] . '_count = ( isset($this->_tpldata[\'' . $n[1] . '.\']) ) ?  sizeof($this->_tpldata[\'' . $n[1] . '.\']) : 0;';
-						$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
-						$code_lines[$i] .= "\n" . '{';
+						$code_lines[$i] = '$_' . $a[1] . '_count = (isset($this->_tpldata[\'' . $n[1] . '\'])) ?  sizeof($this->_tpldata[\'' . $n[1] . '\']) : 0;';
+						$code_lines[$i] .= 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
+						$code_lines[$i] .= '{';
 					}
 					else
 					{
 						// This block is nested.
 
 						// Generate a namespace string for this block.
-						$namespace = implode('.', $block_names);
+						$namespace = substr(implode('.', $block_names), 0, -1);
 						// strip leading period from root level..
 						$namespace = substr($namespace, 2);
 						// Get a reference to the data array for this block that depends on the
 						// current indices of all parent blocks.
 						$varref = $this->generate_block_data_ref($namespace, false);
 						// Create the for loop code to iterate over this block.
-						$code_lines[$i] = '$_' . $a[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
-						$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
-						$code_lines[$i] .= "\n" . '{';
+						$code_lines[$i] = '$_' . $a[1] . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
+						$code_lines[$i] .= 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
+						$code_lines[$i] .= '{';
 					}
 
 					// We have the end of a block.
@@ -418,9 +425,9 @@
 					if ($block_nesting_level < 2)
 					{
 						// Block is not nested.
-						$code_lines[$i] = '$_' . $m[1] . '_count = ( isset($this->_tpldata[\'' . $m[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $m[1] . '.\']) : 0;';
-						$code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
-						$code_lines[$i] .= "\n" . '{';
+						$code_lines[$i] = '$_' . $m[1] . '_count = (isset($this->_tpldata[\'' . $m[1] . '\'])) ? sizeof($this->_tpldata[\'' . $m[1] . '\']) : 0;';
+						$code_lines[$i] .= 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
+						$code_lines[$i] .= '{';
 					}
 					else
 					{
@@ -434,9 +441,9 @@
 						// current indices of all parent blocks.
 						$varref = $this->generate_block_data_ref($namespace, false);
 						// Create the for loop code to iterate over this block.
-						$code_lines[$i] = '$_' . $m[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
-						$code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
-						$code_lines[$i] .= "\n" . '{';
+						$code_lines[$i] = '$_' . $m[1] . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
+						$code_lines[$i] .= 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
+						$code_lines[$i] .= '{';
 					}
 				}
 			}
@@ -452,11 +459,11 @@
 				// We have an ordinary line of code.
 				if (!$do_not_echo)
 				{
-					$code_lines[$i] = 'echo \'' . $code_lines[$i] . '\' . "\\n";';
+					$code_lines[$i] = "echo '" . $code_lines[$i] . "\n';\n";
 				}
 				else
 				{
-					$code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";'; 
+					$code_lines[$i] = '$' . $retvar . ".= '" . $code_lines[$i] . "\n';\n"; 
 				}
 			}
 		}
@@ -474,7 +481,7 @@
 	 * It's ready to be inserted into an "echo" line in one of the templates.
 	 * NOTE: expects a trailing "." on the namespace.
 	 */
-	function generate_block_varref($namespace, $varname)
+	function generate_block_varref($namespace, $varname, $concat)
 	{
 		// Strip the trailing period.
 		$namespace = substr($namespace, 0, strlen($namespace) - 1);
@@ -484,9 +491,9 @@
 		// Prepend the necessary code to stick this in an echo line.
 
 		// Append the variable reference.
-		$varref .= '[\'' . $varname . '\']';
+		$varref .= "['$varname']";
 
-		$varref = '\' . ( ( isset(' . $varref . ') ) ? ' . $varref . ' : \'\' ) . \'';
+		$varref = "' $concat ((isset($varref)) ? $varref : '') $concat '";
 
 		return $varref;
 
@@ -510,10 +517,10 @@
 		// Build up the string with everything but the last child.
 		for ($i = 0; $i < $blockcount; $i++)
 		{
-			$varref .= '[\'' . $blocks[$i] . '.\'][$_' . $blocks[$i] . '_i]';
+			$varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
 		}
 		// Add the block reference for the last child.
-		$varref .= '[\'' . $blocks[$blockcount] . '.\']';
+		$varref .= "['" . $blocks[$blockcount] . "']";
 		// Add the iterator for the last child if requried.
 		if ($include_last_iterator)
 		{
Only in phpBB-2.0.6/contrib: visual_confirmation.tar.gz
diff -ur phpBB2/docs/CHANGELOG.html phpBB-2.0.6/docs/CHANGELOG.html
--- phpBB2/docs/CHANGELOG.html	2003-01-15 13:34:06.000000000 +0000
+++ phpBB-2.0.6/docs/CHANGELOG.html	2003-12-30 14:11:46.000000000 +0000
@@ -3,7 +3,7 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html">
 <meta http-equiv="Content-Style-Type" content="text/css">
-<title>phpBB 2.0.4 :: Changelog</title>
+<title>phpBB 2.0.6 :: Changelog</title>
 <link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
 <style type="text/css">
 <!--
@@ -24,7 +24,7 @@
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 	<tr>
 		<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
-		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.4 CHANGELOG</span></td>
+		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.5 CHANGELOG</span></td>
 	</tr>
 </table>
 
@@ -32,6 +32,8 @@
 <ol>
 <li><a href="#changelog">Changelog</a></li>
 <ol type="i">
+	<li><a href="#205">Changes since 2.0.5</a></li>
+	<li><a href="#204">Changes since 2.0.4</a></li>
 	<li><a href="#203">Changes since 2.0.3</a></li>
 	<li><a href="#202">Changes since 2.0.2</a></li>
 	<li><a href="#201">Changes since 2.0.1</a></li>
@@ -49,7 +51,100 @@
 
 <p>This is a non-exhaustive (but still near complete) changelog for phpBB 2.0.x including beta and release candidate versions. Our thanks to all those people who've contributed bug reports and code fixes.</p>
 
-<a name="203"></a><h3 class="h3">1.i. Changes since 2.0.3</h3>
+<a name="205"></a><h3 class="h3">1.i. Changes since 2.0.5</h3>
+
+<ul>
+<li>Fixed sql injection vulnerability in groupcp.php</li>
+<li>Fixed xss vulnerability in privmsg.php</li>
+<li>Fixed sql injection vulnerability in search.php</li>
+<li>Fixed various email issues</li>
+<li>Fixed registration email bug with Administrator Confirmation used</li>
+<li>Fixed mass emailer</li>
+<li>Fixed long post time issue</li>
+<li>Fixed bug with usernames containing single quotes</li>
+<li>Fixed word list bug - Word boundaries were not considered</li>
+<li>Fixed vulnerability in style admin</li>
+<li>Fixed sql injection vulnerability in viewtopic</li>
+<li>Fixed vulnerability allowing server side variable access in search - <b>tendor</b></li>
+<li>Fixed potential vulnerability in 2.0.5 login username entry - <b>throw away/eomer</b></li>
+<li>Fixed sql injection with reset date format field in profile - <b>tendor</b></li>
+<li>Fixed several vulnerabilities in modcp - <b>Robert Lavierck</b></li>
+<li>Changed whois lookup address within admin index</li>
+</ul>
+
+<a name="204"></a><h3 class="h3">1.ii. Changes since 2.0.4</h3>
+
+<ul>
+<li>Removed user facing session_id checks</li>
+<li>Fixed user self-activation after deactivation</li>
+<li>Fixed incorrect functioning of phpbb_realpath</li>
+<li>Fixed wrong path to database schema files within the upgrade script</li>
+<li>Fixed double quote problem with username validation</li>
+<li>Allow & within email addresses</li>
+<li>Fixed email validation for banned email addresses</li>
+<li>Removed underline from email domain validation</li>
+<li>Fixed redirection for sentbox folder, installation and email</li>
+<li>Fixed poll deletion</li>
+<li>Fixed Mozilla navigation bar</li>
+<li>Fixed URL bbcode parsing</li>
+<li>Fixed database timeouts while searching the forums</li>
+<li>Fixed wrong email return path in admin mass mailing - <b>netclectic</b></li>
+<li>Fixed MS-SQL failures within the update script</li>
+<li>Fixed memberlist sort order</li>
+<li>Fixed not showing leading spaces within Code BBCode</li>
+<li>Fixed problem with adding double quotes to subject titles</li>
+<li>Remove username input field from profile when user cannot change name</li>
+<li>Fixed pagination error with highlighting</li>
+<li>Fixed errors if no smilies are installed</li>
+<li>Fixed CSS issues with IE 5.2 on MacOS X</li>
+<li>Fixed missing sid propagation problem within the Moderator Control Panel</li>
+<li>Fixed language variables within Authentication error output</li>
+<li>Removed doubled CSS class definitions within input fields</li>
+<li>Fixed username change within the Administration Panel</li>
+<li>Added missing &lt;tr&gt; tags to index_body.tpl</li>
+<li>Added missing username language variable to admin index page</li>
+<li>Fixed moderator status update if a usergroup got deleted</li>
+<li>Fixed poll handling upon post edit</li>
+<li>Fixed remove common words from search table if post get pruned - <b>Nuttzy99</b></li>
+<li>Fixed behaviour on splitting topics if no checkbox is selected</li>
+<li>Anonymous is no longer displayed within Username dropdown boxes</li>
+<li>Fixed viewprofile redirection if an invalid mode was specified</li>
+<li>Fixed fraction settings within determining common words - <b>Novan</b></li>
+<li>Prevent admin change usernames to his own within the ACP</li>
+<li>Activation email is sent to all admins</li>
+<li>Fixed conversion of &amp; to &amp;amp; in appropriate cases</li>
+<li>Fixed display of "greater than topics per page" announcements preventing display of normal posts</li>
+<li>Added variable checks to database backup and restore screen</li>
+<li>Prevented pm popup window from resetting after visiting avatar gallery</li>
+<li>Fixed special character handling with word censor</li>
+<li>Added SID to jumpbox</li>
+<li>Fixed problems with usernames using html special chars</li>
+<li>Added GMT + 13 to English lang_main, all translators are encouraged to do likewise</li>
+<li>Deleted doubled 'U_MEMBERLIST' assignment from page_header.php</li>
+<li>Fixed wrong display of Signature Checkbox while editing Private Message</li>
+<li>Fixed disappearing post text if emoticon was inserted directly after pressing a BBCode button</li>
+<li>Display correct alt-tag for smilies within postings</li>
+<li>Prevented the ability to apply BBCode to website contents</li>
+<li>Fixed maxlength issue with password field in login_body.tpl</li>
+<li>Fixed possible username duplication issue with validation and username length</li>
+<li>Fixed split words function to handle additional foreign characters</li>
+<li>Changed empty email To Field to use a non-disclosure delimiter</li>
+<li>Fixed wrong language var in install.php - FTP Config screen</li>
+<li>Fixed alt tag for locked topic images in viewforum_body.tpl</li>
+<li>Fixed typo in groupcp.php - $lang['Unsub_success'] instead of $lang['Usub_success']</li>
+<li>Fixed timezone display</li>
+<li>Fixed wrong display of author quote tag within profile - <b>Cl1mh4224rd</b></li>
+<li>Added deletion of sessions of users whose account is deactivated</li>
+<li>Added mail header X-MimeOLE to the emailer class</li>
+<li>Prevent registration if user is logged in or user trying to register again</li>
+<li>Prevent usage of char(255) in usernames</li>
+<li>Added check for additional FORWARDED_FOR IP's - <b>cosmos</b></li>
+<li>Fixed handling of non-selection of option when voting</li>
+<li>Fixed potential xss issue with memberslist mode</li>
+<li>Default English support for visual confirmation - translators are encouraged to support this</li>
+</ul>
+
+<a name="203"></a><h3 class="h3">1.iii. Changes since 2.0.3</h3>
 
 <ul>
 <li>Fixed cross-browser scripting issue with highlight param</li>
@@ -176,7 +271,7 @@
 <li>Fixed potential SQL vulnerability with marking of private messages - <b>Ulf Harnhammar</b></li>
 </ul>
 
-<a name="202"></a><h3 class="h3">1.ii. Changes since 2.0.2</h3>
+<a name="202"></a><h3 class="h3">1.iv. Changes since 2.0.2</h3>
 
 <ul>
 <li>Fixed potential cross-site scripting vulnerability with avatars - <b>Showscout</b></li>
@@ -185,7 +280,7 @@
 <li>Fixed (hopefully) issue with MS Access and multiple pages</li>
 </ul>
 
-<a name="201"></a><h3 class="h3">1.iii. Changes since 2.0.1</h3>
+<a name="201"></a><h3 class="h3">1.v. Changes since 2.0.1</h3>
 
 <ul>
 <li>Fixed missing "username" lang variable in user admin template</li>
@@ -220,7 +315,7 @@
 <li>Fix emailer to allow sending emails with language-specific character sets</li>
 </ul>
 
-<a name="200"></a><h3 class="h3">1.iv. Changes since 2.0.0</h3>
+<a name="200"></a><h3 class="h3">1.vi. Changes since 2.0.0</h3>
 
 <ul>
 <li>Fixed delete image bug for normal users</li>
@@ -277,7 +372,7 @@
 <li>Added database closure to admin frameset page</li>
 </ul>
 
-<a name="final"></a><h3 class="h3">1.v. Changes since RC-4</h3>
+<a name="final"></a><h3 class="h3">1.vii. Changes since RC-4</h3>
 
 <ul>
 <li>Fixed improper report of general error when posting messages containing errors</li>
@@ -307,7 +402,7 @@
 <li>Fixed various remaining usergroup display issues</li>
 </ul>
 
-<a name="rc4"></a><h3 class="h3">1.vi. Changes since RC-3</h3>
+<a name="rc4"></a><h3 class="h3">1.viii. Changes since RC-3</h3>
 
 <ul>
 <li>Addressed serious security issue with included files</li>
@@ -338,7 +433,7 @@
 <li>Fix (hopefully) remaining ICQ overlay issue with view profile in subSilver</li>
 </ul>
 
-<a name="rc3"></a><h3 class="h3">1.vii. Changes since RC-2</h3>
+<a name="rc3"></a><h3 class="h3">1.ix. Changes since RC-2</h3>
 
 <ul>
 <li>Fixed infamous install parse error</li>
@@ -371,7 +466,7 @@
 <li>Hidden usergroups are now completely hidden from view</li>
 </ul>
 
-<a name="rc2"></a><h3 class="h3">1.viii. Changes since RC-1</h3>
+<a name="rc2"></a><h3 class="h3">1.x. Changes since RC-1</h3>
 
 <ul>
 <li>Fixed numerous PostgreSQL related issues</li>
@@ -391,7 +486,7 @@
 <li>Various other fixes and updates</li>
 </ul>
 
-<a name="rc1"></a><h3 class="h3">1.ix. Changes since RC-1 (pre)</h3>
+<a name="rc1"></a><h3 class="h3">1.xi. Changes since RC-1 (pre)</h3>
 
 <ul>
 <li>Upgrade script completed for initial fully functional release</li>
diff -ur phpBB2/docs/FAQ.html phpBB-2.0.6/docs/FAQ.html
--- phpBB2/docs/FAQ.html	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/docs/FAQ.html	2003-07-20 15:59:15.000000000 +0000
@@ -3,7 +3,7 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html">
 <meta http-equiv="Content-Style-Type" content="text/css">
-<title>phpBB 2.0.0 :: FAQ</title>
+<title>phpBB 2.0.x :: FAQ</title>
 <link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
 <style type="text/css">
 <!--
@@ -24,7 +24,7 @@
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 	<tr>
 		<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
-		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB2 FAQ</span></td>
+		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.x FAQ</span></td>
 	</tr>
 </table>
 
diff -ur phpBB2/docs/INSTALL.html phpBB-2.0.6/docs/INSTALL.html
--- phpBB2/docs/INSTALL.html	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/docs/INSTALL.html	2003-07-20 15:59:15.000000000 +0000
@@ -3,7 +3,7 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html">
 <meta http-equiv="Content-Style-Type" content="text/css">
-<title>phpBB 2.0.4 :: Install</title>
+<title>phpBB 2.0.6 :: Install</title>
 <link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css">
 <style type="text/css">
 <!--
@@ -24,7 +24,7 @@
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 	<tr>
 		<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
-		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.4 INSTALL</span></td>
+		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.6 INSTALL</span></td>
 	</tr>
 </table>
 
@@ -33,7 +33,7 @@
 
 <p>Please note these instructions are not fully comprehensive, a more thorough userguide will be available on the phpBB website in the near future. However, this document will walk you through the basics on installing the forum software.</p>
 
-<p>A basic overview of running phpBB 2.0.4 can be found in the accompanying <a href="README.html">README</a> documentation. Please ensure you read that document in addition to this! For more detailed information on using phpBB 2 you should read <a href="http://www.phpbb.com/guide/phpBB_Users_Guide.html" target="_new">Userguide</a> now available online.</p>
+<p>A basic overview of running phpBB 2.0.6 can be found in the accompanying <a href="README.html">README</a> documentation. Please ensure you read that document in addition to this! For more detailed information on using phpBB 2 you should read <a href="http://www.phpbb.com/guide/phpBB_Users_Guide.html" target="_new">Userguide</a> now available online.</p>
 
 <ol>
 <li><a href="#quickinstall">Quick Install</a></li>
@@ -76,10 +76,10 @@
 <ol>
 <li>Decompress the phpBB 2 archive to a local directory on your system.</li>
 <li>Upload all the files contained in this archive (retaining the directory structure) to a web accessible directory on your server or hosting account.
-<li>Change the permissions on config.php to be writeable by all</li>
+<li>Change the permissions on config.php to be writeable by all (666 or -rw-rw-rw- within your FTP Client)</li>
 <li>Using your web browser visit the location you placed phpBB 2 with the addition of install/install.php, e.g. http://www.mydomain.com/phpBB2/install/install.php, http://www.mydomain.com/forum/install/install.php etc.
 <li>Fill out all the requested information and hit <i>Submit</i></li>
-<li>Change the permissions on config.php to be writeable only by yourself</li>
+<li>Change the permissions on config.php to be writeable only by yourself (644 or -rw-r--r-- within your FTP Client)</li>
 <li>Click the <i>Complete Installation</i> button or revisit the location you entered above.</li>
 <li>phpBB 2 should now be available, please <b>MAKE SURE</b> you read at least <a href="#postinstall">Section 8</a> below for important, security related post-installation instructions.</li>
 </ol>
@@ -88,7 +88,7 @@
 
 <a name="require"></a><h2 class="h2"><u>2. Requirements</u></h2>
 
-<p>Installation of phpBB 2.0.4 requires the following:</p>
+<p>Installation of phpBB 2.0.6 requires the following:</p>
 <ul>
 <li>A webserver or web hosting account running on any major Operating System</li>
 <li>A SQL database system, <b>one of</b>:
@@ -170,11 +170,11 @@
 
 <p>Upgrading from these versions is generally quite easy. First you should make a copy of your existing <u>config.php</u>, keep it in a safe place! Next delete all the existing phpBB 2 files, do not leave any in place otherwise you may encounter errors later. You can leave alternative templates in-place but you should note they may not function correctly with the final release. It is therefore recommended you switch back to subSilver if you are currently using a different style. With this complete you can upload the new phpBB 2.0.0 files (see <a href="#install">New Installations</a> for details if necessary). Once complete copy back your saved <u>config.php</u>, replacing the new one.</p>
 
-<p>You should now run <b>install/update_to_204.php</b> which, depending on your previous version, will make a number of database changes. You may receive <u>FAILURES</u> during this procedure, they should not be a cause for concern unless you see an actual <u>ERROR</u>, in which case the script will stop (in this case you should seek help via our forums or bug tracker).</p>
+<p>You should now run <b>install/update_to_206.php</b> which, depending on your previous version, will make a number of database changes. You may receive <u>FAILURES</u> during this procedure, they should not be a cause for concern unless you see an actual <u>ERROR</u>, in which case the script will stop (in this case you should seek help via our forums or bug tracker).</p>
 
-<p><b>RC-2 and below MSSQL users</b>, please note that during the update procedure your existing forums table will be dropped and re-created. All data in standard fields will be retained. However if you have modified the forums table and added additional fields or altered existing ones these changes <b>WILL</b> be lost. If this is a significant issue for you we advise you comment out the "DROP FORUM TABLE" section in update_to_204.php and instead, manually alter the forum_id column to remove the IDENTITY setting (if it exists).</p>
+<p><b>RC-2 and below MSSQL users</b>, please note that during the update procedure your existing forums table will be dropped and re-created. All data in standard fields will be retained. However if you have modified the forums table and added additional fields or altered existing ones these changes <b>WILL</b> be lost. If this is a significant issue for you we advise you comment out the "DROP FORUM TABLE" section in update_to_206.php and instead, manually alter the forum_id column to remove the IDENTITY setting (if it exists).</p>
 
-<p>Once the update_to_204 has completed you <b>MUST</b> proceed to the Administration General Configuration panel and check all the values in General Configuration. This is essential if you were running any version before RC-3 since extra information needs to be entered to enable correct URLs to be output in emails.</p>
+<p>Once the update_to_206 has completed you <b>MUST</b> proceed to the Administration General Configuration panel and check all the values in General Configuration. This is essential if you were running any version before RC-3 since extra information needs to be entered to enable correct URLs to be output in emails.</p>
 
 <a name="langtempchanges"></a><h3 class="h3">6.i. Changes in language pack format and templates</h3>
 
@@ -192,21 +192,21 @@
 
 <a name="#upgradeSTABLE_files"></a><h3 class="h3">7.ii. Changed files only</h3>
 
-<p>This package contains a number of archives, each contains the files changed from a given release to 2.0.4. You should select the appropriate archive for your current version, e.g. if you currently have 2.0.3 you should select the phpBB-2.0.3_to_2.0.4.zip/tar.gz file.</p>
+<p>This package contains a number of archives, each contains the files changed from a given release to 2.0.6. You should select the appropriate archive for your current version, e.g. if you currently have 2.0.5 you should select the phpBB-2.0.5_to_2.0.6.zip/tar.gz file.</p>
 
 <p>The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any Mods these files will overwrite the originals possibly destroying them in the process. You will need to re-add Mods to any affected file before uploading.</p>
 
-<p>As for the other upgrade procedures you should run <b>install/update_to_204.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
+<p>As for the other upgrade procedures you should run <b>install/update_to_206.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
 
 <a name="#upgradeSTABLE_patch"></a><h3 class="h3">7.iii. Patch file</h3>
 
 <p>The patch file is probably the best solution for those with many Mods or other changes who do not want to re-add them back to all the changed files. To use this you will need command line access to a standard UNIX type <b>patch</b> application.</p>
 
-<p>A number of patch files are provided to allow you to upgrade from previous stable releases. Select the correct patch, e.g. if your current version is 2.0.2 you need the phpBB-2.0.2_to_2.0.4.patch. Place the correct patch in the parent directory containing the phpBB 2 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <b>patch -p0 &lt; [PATCH NAME]</b> (where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.</p>
+<p>A number of patch files are provided to allow you to upgrade from previous stable releases. Select the correct patch, e.g. if your current version is 2.0.2 you need the phpBB-2.0.2_to_2.0.6.patch. Place the correct patch in the parent directory containing the phpBB 2 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <b>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</b> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB2, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.</p>
 
 <p>If you do get failures you should look at using the <a href="#upgradeSTABLE_files">Changed files only</a> package to replace the files which failed to patch, please note that you will need to manually re-add any Mods to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.</p>
 
-<p>You should of course delete the patch file (or files) after use. As for the other upgrade procedures you should run <b>install/update_to_204.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
+<p>You should of course delete the patch file (or files) after use. As for the other upgrade procedures you should run <b>install/update_to_206.php</b> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p>
 
 <a name="#upgradeSTABLE_all"></a><h3 class="h3">7.iv. All package types</h3>
 
@@ -214,7 +214,7 @@
 
 <a name="postinstall"></a><h2 class="h2"><u>8. Important (security related) post-Install tasks for all installation methods</u></h2>
 
-<p>Once you have succssfully installed phpBB 2.0.4 you <b>MUST</b> ensure you remove the entire install/ and contrib/ directories. Leaving these in place is a <u>very serious potential security issue</u> which may lead to deletion or alteration of files, etc. Please note that until these directories are remove phpBB2 will not operate and a warning message will be displayed. Beyond these <b>essential</b> deletions you may also wish to delete the docs/ directories if you wish.</p>
+<p>Once you have succssfully installed phpBB 2.0.6 you <b>MUST</b> ensure you remove the entire install/ and contrib/ directories. Leaving these in place is a <u>very serious potential security issue</u> which may lead to deletion or alteration of files, etc. Please note that until these directories are remove phpBB2 will not operate and a warning message will be displayed. Beyond these <b>essential</b> deletions you may also wish to delete the docs/ directories if you wish.</p>
 
 <p>With these directories deleted you should proceed to the administration panel. Depending on how the installation completed you may have been directed there automatically. If not, login as the administrator you specified during install/upgrade and click the "<b>Administration Panel</b>" link at the bottom of any page. Ensure that details specified in General -> Configuration are correct!</p>
 
@@ -232,7 +232,7 @@
 
 <a name="safemode"></a><h3 class="h3">8.ii. Safe Mode</h3>
 
-<p>phpBB 2.0.4 includes support for using uploadable avatars on systems running PHP in safe mode. If this applies to your hosting service you will need to create a sub-directory called <u>tmp</u> in the directory you specified for storage of uploaded avatars (by default this is images/avatars as explained above). Give it the same access rights as for uploadable avatars above.</p>
+<p>phpBB 2.0.6 includes support for using uploadable avatars on systems running PHP in safe mode. If this applies to your hosting service you will need to create a sub-directory called <u>tmp</u> in the directory you specified for storage of uploaded avatars (by default this is images/avatars as explained above). Give it the same access rights as for uploadable avatars above.</p>
 
 <p>This safe mode support includes compatibility with various directory restrictions your host may impose (assuming they are not too restrictive and that the PHP installed is version 4.0.3 or later). There is generally no need for any manual setup for safe mode support it is typically handled transparantly.</p>
 
diff -ur phpBB2/docs/README.html phpBB-2.0.6/docs/README.html
--- phpBB2/docs/README.html	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/docs/README.html	2003-07-20 15:59:15.000000000 +0000
@@ -3,7 +3,7 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html">
 <meta http-equiv="Content-Style-Type" content="text/css">
-<title>phpBB 2.0.4 :: Readme</title>
+<title>phpBB 2.0.6 :: Readme</title>
 <link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css" />
 <style type="text/css">
 <!--
@@ -24,7 +24,7 @@
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
 	<tr>
 		<td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2 : Creating Communities" vspace="1" /></a></td>
-		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.4 README</span></td>
+		<td align="center" width="100%" valign="middle"><span class="maintitle">phpBB 2.0.6 README</span></td>
 	</tr>
 </table>
 
@@ -62,7 +62,7 @@
 
 <p>Installation and upgrade instructions can be found in the <a href="INSTALL.html">INSTALL</a> document contained in this distribution. If you are intending to upgrade from a previous phpBB 1.4.x installation we highly recommend you backup any existing data before proceeding!</p>
 
-<p><b>Please note</b> that users of Release Candidate (RC) versions of phpBB 2 should run the update_to_204.php script <b>BEFORE</b> attempting to access your board. Failing to do so may result in errors and unexpected behaviour! While these won't do any damage they will prevent you using your board.</p>
+<p><b>Please note</b> that users of Release Candidate (RC) versions of phpBB 2 should run the update_to_205.php script <b>BEFORE</b> attempting to access your board. Failing to do so may result in errors and unexpected behaviour! While these won't do any damage they will prevent you using your board.</p>
 
 <p>If you are using RC-1 (pre) you may find some other DB changes have occured and should examine the schemas to see if your installation requires any modifications (note that most of these have already been discussed on the phpBB 2 forums and are handled by the update script). If you are uncomfortable doing any of this we recommend you re-install (you may backup your existing data if you wish, re-install phpBB 2 and then insert your backup).</p>
 
@@ -84,7 +84,7 @@
 
 <p>If your language is not available please visit our forums where you will find a topic listing translations currently available or in preparation. This topic also gives you information should you wish to volunteer to translate a language not currently listed</p>
 
-<p><b>Please note</b> that users who have upgraded to 2.0.4 from versions prior to RC-3 should will <b>need</b> to download new versions of the language/subSilver image packs. Any package downloaded prior to the availability of RC-3 will <b>not</b> function correctly with this version of phpBB 2.</p>
+<p><b>Please note</b> that users who have upgraded to 2.0.6 from versions prior to RC-3 should will <b>need</b> to download new versions of the language/subSilver image packs. Any package downloaded prior to the availability of RC-3 will <b>not</b> function correctly with this version of phpBB 2.</p>
 
 <p>If you have upgraded from 2.0.0 and make use of non-English language packs you will benefit from downloading updated versions which will become available shortly. These introduce a number of strings which went missing from the first version plus a few updates and additions.</p>
 
Only in phpBB2/docs: coding-guidelines.txt
Only in phpBB2/docs: codingstandards.htm
diff -ur phpBB2/groupcp.php phpBB-2.0.6/groupcp.php
--- phpBB2/groupcp.php	2003-01-15 13:34:07.000000000 +0000
+++ phpBB-2.0.6/groupcp.php	2003-12-30 17:11:18.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: groupcp.php,v 1.58.2.12 2003/01/09 00:17:23 psotfx Exp $
+ *   $Id: groupcp.php,v 1.58.2.19 2003/12/30 14:17:49 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -137,6 +137,7 @@
 if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
 {
 	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
+	$mode = htmlspecialchars($mode);
 }
 else
 {
@@ -160,11 +161,6 @@
 		redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
 	}
 
-	if (!isset($HTTP_POST_VARS['sid']) || $HTTP_POST_VARS['sid'] != $userdata['session_id'])
-	{
-		message_die(GENERAL_ERROR, 'Invalid_session');
-	}
-
 	$sql = "SELECT group_moderator 
 		FROM " . GROUPS_TABLE . "  
 		WHERE group_id = $group_id";
@@ -214,11 +210,6 @@
 		redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
 	}
 
-	if (!isset($HTTP_POST_VARS['sid']) || $HTTP_POST_VARS['sid'] != $userdata['session_id'])
-	{
-		message_die(GENERAL_ERROR, 'Invalid_session');
-	}
-
 	$sql = "SELECT ug.user_id, g.group_type
 		FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g 
 		WHERE g.group_id = $group_id 
@@ -284,12 +275,12 @@
 	include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 	$emailer = new emailer($board_config['smtp_delivery']);
 
-	$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
+	$emailer->from($board_config['board_email']);
+	$emailer->replyto($board_config['board_email']);
 
 	$emailer->use_template('group_request', $moderator['user_lang']);
 	$emailer->email_address($moderator['user_email']);
 	$emailer->set_subject($lang['Group_request']);
-	$emailer->extra_headers($email_headers);
 
 	$emailer->assign_vars(array(
 		'SITENAME' => $board_config['sitename'], 
@@ -324,11 +315,6 @@
 		redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
 	}
 
-	if (!isset($HTTP_POST_VARS['sid']) || $HTTP_POST_VARS['sid'] != $userdata['session_id'])
-	{
-		message_die(GENERAL_ERROR, 'Invalid_session');
-	}
-
 	if ( $confirm )
 	{
 		$sql = "DELETE FROM " . USER_GROUP_TABLE . " 
@@ -367,7 +353,7 @@
 			'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">')
 		);
 
-		$message = $lang['Usub_success'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
+		$message = $lang['Unsub_success'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
 
 		message_die(GENERAL_MESSAGE, $message);
 	}
@@ -375,7 +361,7 @@
 	{
 		$unsub_msg = ( isset($HTTP_POST_VARS['unsub']) ) ? $lang['Confirm_unsub'] : $lang['Confirm_unsub_pending'];
 
-		$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" /><input type="hidden" name="unsub" value="1" />';
+		$s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" /><input type="hidden" name="unsub" value="1" />';
 
 		$page_title = $lang['Group_Control_Panel'];
 		include($phpbb_root_path . 'includes/page_header.'.$phpEx);
@@ -473,11 +459,6 @@
 				redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
 			}
 
-			if (!isset($HTTP_POST_VARS['sid']) || $HTTP_POST_VARS['sid'] != $userdata['session_id'])
-			{
-				message_die(GENERAL_ERROR, 'Invalid_session');
-			}
-
 			if ( !$is_moderator )
 			{
 				$template->assign_vars(array(
@@ -491,7 +472,7 @@
 
 			if ( isset($HTTP_POST_VARS['add']) )
 			{
-				$username = ( isset($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : "";
+				$username = ( isset($HTTP_POST_VARS['username']) ) ? htmlspecialchars($HTTP_POST_VARS['username']) : '';
 				
 				$sql = "SELECT user_id, user_email, user_lang, user_level  
 					FROM " . USERS_TABLE . " 
@@ -572,12 +553,12 @@
 					include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 					$emailer = new emailer($board_config['smtp_delivery']);
 
-					$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
+					$emailer->from($board_config['board_email']);
+					$emailer->replyto($board_config['board_email']);
 
 					$emailer->use_template('group_added', $row['user_lang']);
 					$emailer->email_address($row['user_email']);
 					$emailer->set_subject($lang['Group_added']);
-					$emailer->extra_headers($email_headers);
 
 					$emailer->assign_vars(array(
 						'SITENAME' => $board_config['sitename'], 
@@ -610,7 +591,7 @@
 					$sql_in = '';
 					for($i = 0; $i < count($members); $i++)
 					{
-						$sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . $members[$i];
+						$sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . intval($members[$i]);
 					}
 
 					if ( isset($HTTP_POST_VARS['approve']) )
@@ -704,10 +685,10 @@
 							message_die(GENERAL_ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql);
 						}
 
-						$email_addresses = '';
-						while( $row = $db->sql_fetchrow($result) )
+						$bcc_list = array();
+						while ($row = $db->sql_fetchrow($result))
 						{
-							$email_addresses .= ( ( $email_addresses != '' ) ? ', ' : '' ) . $row['user_email'];
+							$bcc_list[] = $row['user_email'];
 						}
 
 						//
@@ -727,12 +708,16 @@
 						include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 						$emailer = new emailer($board_config['smtp_delivery']);
 
-						$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\nBcc: " . $email_addresses . "\n";
+						$emailer->from($board_config['board_email']);
+						$emailer->replyto($board_config['board_email']);
+
+						for ($i = 0; $i < count($bcc_list); $i++)
+						{
+							$emailer->bcc($bcc_list[$i]);
+						}
 
 						$emailer->use_template('group_approved');
-						$emailer->email_address(' ');//$userdata['user_email']
 						$emailer->set_subject($lang['Group_approved']);
-						$emailer->extra_headers($email_headers);
 
 						$emailer->assign_vars(array(
 							'SITENAME' => $board_config['sitename'], 
@@ -912,7 +897,7 @@
 
 	generate_user_info($group_moderator, $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim);
 
-	$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
+	$s_hidden_fields .= '';
 
 	$template->assign_vars(array(
 		'L_GROUP_INFORMATION' => $lang['Group_Information'],
@@ -1258,7 +1243,7 @@
 			$template->assign_block_vars('switch_groups_remaining', array() );
 		}
 
-		$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
+		$s_hidden_fields = '';
 
 		$template->assign_vars(array(
 			'L_GROUP_MEMBERSHIP_DETAILS' => $lang['Group_member_details'],
Only in phpBB-2.0.6/images: avatars
diff -ur phpBB2/images/index.htm phpBB-2.0.6/images/index.htm
--- phpBB2/images/index.htm	2001-11-21 13:06:55.000000000 +0000
+++ phpBB-2.0.6/images/index.htm	2001-11-21 13:06:55.000000000 +0000
@@ -1,10 +1,10 @@
-<html>
-<head>
-<title></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<body bgcolor="#FFFFFF" text="#000000">
-
-</body>
-</html>
+<html>
+<head>
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+
+</body>
+</html>
diff -ur phpBB2/includes/auth.php phpBB-2.0.6/includes/auth.php
--- phpBB2/includes/auth.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/auth.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group        
  *   email                : support@phpbb.com                           
  *                                                          
- *   $Id: auth.php,v 1.37.2.2 2002/12/22 18:46:26 psotfx Exp $                                                           
+ *   $Id: auth.php,v 1.37.2.3 2003/02/25 16:02:59 acydburn Exp $                                                           
  *                                                            
  * 
  ***************************************************************************/ 
@@ -200,7 +200,7 @@
 			{
 				case AUTH_ALL:
 					$auth_user[$key] = TRUE;
-					$auth_user[$key . '_type'] = $lang['Auth_Anonymous_users'];
+					$auth_user[$key . '_type'] = $lang['Auth_Anonymous_Users'];
 					break;
 
 				case AUTH_REG:
@@ -239,7 +239,7 @@
 				{
 					case AUTH_ALL:
 						$auth_user[$f_forum_id][$key] = TRUE;
-						$auth_user[$f_forum_id][$key . '_type'] = $lang['Auth_Anonymous_users'];
+						$auth_user[$f_forum_id][$key . '_type'] = $lang['Auth_Anonymous_Users'];
 						break;
 
 					case AUTH_REG:
diff -ur phpBB2/includes/bbcode.php phpBB-2.0.6/includes/bbcode.php
--- phpBB2/includes/bbcode.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/bbcode.php	2003-09-10 16:37:50.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: bbcode.php,v 1.36.2.19 2003/01/10 13:21:24 psotfx Exp $
+ *   $Id: bbcode.php,v 1.36.2.27 2003/06/09 20:01:18 psotfx Exp $
  *
  ***************************************************************************/
 
@@ -95,17 +95,17 @@
 	$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']);
 
 	// We do URLs in several different ways..
-	$bbcode_tpl['url1'] = str_replace('{URL}', '\1\2', $bbcode_tpl['url']);
-	$bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\1\2', $bbcode_tpl['url1']);
+	$bbcode_tpl['url1'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']);
+	$bbcode_tpl['url1'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url1']);
 
 	$bbcode_tpl['url2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
 	$bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']);
 
-	$bbcode_tpl['url3'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['url']);
-	$bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\6', $bbcode_tpl['url3']);
+	$bbcode_tpl['url3'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']);
+	$bbcode_tpl['url3'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url3']);
 
-	$bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
-	$bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\5', $bbcode_tpl['url4']);
+	$bbcode_tpl['url4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']); 
+	$bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url4']);
 
 	$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);
 
@@ -197,24 +197,24 @@
 	$patterns[] = "#\[img:$uid\](.*?)\[/img:$uid\]#si";
 	$replacements[] = $bbcode_tpl['img'];
 
-	// [url]xxxx://www.phpbb.com[/url] code..
-	$patterns[] = "#\[url\]([a-z0-9]+?://){1}([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\[/url\]#is";
-	$replacements[] = $bbcode_tpl['url1'];
-
-	// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
-	$patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\[/url\]#si";
-	$replacements[] = $bbcode_tpl['url2'];
-
-	// [url=xxxx://www.phpbb.com]phpBB[/url] code..
-	$patterns[] = "#\[url=([a-z0-9]+://)([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*?)?)\](.*?)\[/url\]#si";
-	$replacements[] = $bbcode_tpl['url3'];
-
-	// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
-	$patterns[] = "#\[url=(([\w\-]+\.)*?[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\](.*?)\[/url\]#si";
-	$replacements[] = $bbcode_tpl['url4'];
+	// matches a [url]xxxx://www.phpbb.com[/url] code.. 
+	$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is"; 
+	$replacements[] = $bbcode_tpl['url1']; 
+
+	// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix). 
+	$patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is"; 
+	$replacements[] = $bbcode_tpl['url2']; 
+
+	// [url=xxxx://www.phpbb.com]phpBB[/url] code.. 
+	$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
+	$replacements[] = $bbcode_tpl['url3']; 
+
+	// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix). 
+	$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; 
+	$replacements[] = $bbcode_tpl['url4']; 
 
 	// [email]user@domain.tld[/email] code..
-	$patterns[] = "#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
+	$patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
 	$replacements[] = $bbcode_tpl['email'];
 
 	$text = preg_replace($patterns, $replacements, $text);
@@ -393,7 +393,10 @@
 					// Grab a bit more of the string to hopefully get all of it..
 					if ($close_pos = strpos($text, '"]', $curr_pos + 9))
 					{
-						$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 2);
+						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);
+						}
 					}
 				}
 
@@ -576,6 +579,9 @@
 		// Replace tabs with "&nbsp; &nbsp;" so tabbed code indents sorta right without making huge long lines.
 		$after_replace = str_replace("\t", "&nbsp; &nbsp;", $after_replace);
 
+		// now Replace space occurring at the beginning of a line
+		$after_replace = preg_replace("/^ {1}/m", '&nbsp;', $after_replace);
+
 		$str_to_match = "[code:1:$uid]" . $before_replace . "[/code:1:$uid]";
 
 		$replacement = $code_start_html;
@@ -612,20 +618,20 @@
 	// pad it with a space so we can match things at the start of the 1st line.
 	$ret = ' ' . $text;
 
-	// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
-	// xxxx can only be alpha characters.
-	// yyyy is anything up to the first space, newline, comma, double quote or <
-	$ret = preg_replace("#([\t\r\n ])([a-z0-9]+?){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1<a href="\2://\3" target="_blank">\2://\3</a>', $ret);
+	// matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
+	// xxxx can only be alpha characters. 
+	// yyyy is anything up to the first space, newline, comma, double quote or < 
+	$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); 
 
-	// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
-	// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
+	// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
+	// Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
 	// zzzz is optional.. will contain everything up to the first space, newline, 
-	// comma, double quote or <.
-	$ret = preg_replace("#([\t\r\n ])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", '\1<a href="http://\2.\3" target="_blank">\2.\3</a>', $ret);
+	// comma, double quote or <. 
+	$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); 
 
 	// matches an email@domain type address at the start of a line, or after a space.
 	// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
-	$ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
+	$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
 
 	// Remove our padding..
 	$ret = substr($ret, 1);
@@ -731,34 +737,39 @@
 //
 function smilies_pass($message)
 {
-   static $orig, $repl;
+	static $orig, $repl;
 
-   if (!isset($orig))
-   {
-      global $db, $board_config;
-      $orig = $repl = array();
+	if (!isset($orig))
+	{
+		global $db, $board_config;
+		$orig = $repl = array();
 
-      $sql = 'SELECT code, smile_url FROM ' . SMILIES_TABLE;
-      if( !$result = $db->sql_query($sql) )
-      {
-         message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
-      }
-      $smilies = $db->sql_fetchrowset($result);
+		$sql = 'SELECT * FROM ' . SMILIES_TABLE;
+		if( !$result = $db->sql_query($sql) )
+		{
+			message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
+		}
+		$smilies = $db->sql_fetchrowset($result);
 
-      usort($smilies, 'smiley_sort');
-      for($i = 0; $i < count($smilies); $i++)
-      {
-         $orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
-         $repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '" border="0" />';
-      }
-   }
+		if (count($smilies))
+		{
+			usort($smilies, 'smiley_sort');
+		}
 
-   if (count($orig))
-   {
-      $message = preg_replace($orig, $repl, ' ' . $message . ' ');
-      $message = substr($message, 1, -1);
-   }
-   return $message;
+		for ($i = 0; $i < count($smilies); $i++)
+		{
+			$orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
+			$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
+		}
+	}
+
+	if (count($orig))
+	{
+		$message = preg_replace($orig, $repl, ' ' . $message . ' ');
+		$message = substr($message, 1, -1);
+	}
+	
+	return $message;
 }
 
 function smiley_sort($a, $b)
@@ -771,5 +782,4 @@
 	return ( strlen($a['code']) > strlen($b['code']) ) ? -1 : 1;
 }
 
-
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/includes/constants.php phpBB-2.0.6/includes/constants.php
--- phpBB2/includes/constants.php	2003-01-15 13:34:12.000000000 +0000
+++ phpBB-2.0.6/includes/constants.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : ('C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: constants.php,v 1.47.2.2 2002/12/21 19:09:57 psotfx Exp $
+ *   $Id: constants.php,v 1.47.2.4 2003/06/10 00:39:51 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -178,4 +178,4 @@
 define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results');
 define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/includes/emailer.php phpBB-2.0.6/includes/emailer.php
--- phpBB2/includes/emailer.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/emailer.php	2003-09-10 16:37:50.000000000 +0000
@@ -6,7 +6,7 @@
     copyright            : (C) 2001 The phpBB Group
     email                : support@phpbb.com
 
-    $Id: emailer.php,v 1.15.2.21 2003/01/15 13:31:53 psotfx Exp $
+    $Id: emailer.php,v 1.15.2.34 2003/07/26 11:41:35 acydburn Exp $
 
 ***************************************************************************/
 
@@ -26,134 +26,140 @@
 //
 class emailer
 {
-	var $tpl_file;
+	var $msg, $subject, $extra_headers;
+	var $addresses, $reply_to, $from;
 	var $use_smtp;
-	var $msg;
-	var $mimeOut;
-	var $arrPlaceHolders = array();	// an associative array that has the key = placeHolderName and val = placeHolderValue.
-	var $subject, $extra_headers, $address;
+
+	var $tpl_msg = array();
 
 	function emailer($use_smtp)
 	{
+		$this->reset();
 		$this->use_smtp = $use_smtp;
-		$this->tpl_file = NULL;
-		$this->address = NULL;
- 		$this->msg = '';
-		$this->mimeOut = '';
+		$this->reply_to = $this->from = '';
 	}
 
-	//
 	// Resets all the data (address, template file, etc etc to default
-	//
 	function reset()
 	{
-		$this->tpl_file = '';
-		$this->address = '';
-		$this->msg = '';
-		$this->memOut = '';
-		$this->vars = '';
+		$this->addresses = array();
+		$this->vars = $this->msg = $this->extra_headers = '';
 	}
 
-	//
 	// Sets an email address to send to
-	//
 	function email_address($address)
 	{
-		$this->address = '';
-		$this->address .= $address;
+		$this->addresses['to'] = trim($address);
+	}
+
+	function cc($address)
+	{
+		$this->addresses['cc'][] = trim($address);
+	}
+
+	function bcc($address)
+	{
+		$this->addresses['bcc'][] = trim($address);
+	}
+
+	function replyto($address)
+	{
+		$this->reply_to = trim($address);
+	}
+
+	function from($address)
+	{
+		$this->from = trim($address);
 	}
 
-	//
 	// set up subject for mail
-	//
 	function set_subject($subject = '')
 	{
 		$this->subject = trim(preg_replace('#[\n\r]+#s', '', $subject));
 	}
 
-	//
 	// set up extra mail headers
-	//
 	function extra_headers($headers)
 	{
-		$this->extra_headers = $headers;
+		$this->extra_headers .= trim($headers) . "\n";
 	}
 
 	function use_template($template_file, $template_lang = '')
 	{
 		global $board_config, $phpbb_root_path;
 
-		if ( $template_lang == '' )
+		if (trim($template_file) == '')
 		{
-			$template_lang = $board_config['default_lang'];
+			message_die(GENERAL_ERROR, 'No template file set', '', __LINE__, __FILE__);
 		}
 
-		$this->tpl_file = @phpbb_realpath($phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl');
-
-		if ( !file_exists(phpbb_realpath($this->tpl_file)) )
+		if (trim($template_lang) == '')
 		{
-			$this->tpl_file = @phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/email/' . $template_file . '.tpl');
-
-			if ( !file_exists(phpbb_realpath($this->tpl_file)) )
-			{
-				message_die(GENERAL_ERROR, 'Could not find email template file ' . $template_file, '', __LINE__, __FILE__);
-			}
+			$template_lang = $board_config['default_lang'];
 		}
 
-		if ( !$this->load_msg() )
+		if (empty($this->tpl_msg[$template_lang . $template_file]))
 		{
-			message_die(GENERAL_ERROR, 'Could not load email template file ' . $template_file, '', __LINE__, __FILE__);
-		}
+			$tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl';
 
-		return true;
-	}
+			if (!@file_exists(@phpbb_realpath($tpl_file)))
+			{
+				$tpl_file = $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/email/' . $template_file . '.tpl';
 
-	//
-	// Open the template file and read in the message
-	//
-	function load_msg()
-	{
-		if ( $this->tpl_file == NULL )
-		{
-			message_die(GENERAL_ERROR, 'No template file set', '', __LINE__, __FILE__);
-		}
+				if (!@file_exists(@phpbb_realpath($tpl_file)))
+				{
+					message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file, '', __LINE__, __FILE__);
+				}
+			}
 
-		if ( !($fd = fopen($this->tpl_file, 'r')) )
-		{
-			message_die(GENERAL_ERROR, 'Failed opening template file', '', __LINE__, __FILE__);
+			if (!($fd = @fopen($tpl_file, 'r')))
+			{
+				message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file, '', __LINE__, __FILE__);
+			}
+
+			$this->tpl_msg[$template_lang . $template_file] = fread($fd, filesize($tpl_file));
+			fclose($fd);
 		}
 
-		$this->msg .= fread($fd, filesize($this->tpl_file));
-		fclose($fd);
+		$this->msg = $this->tpl_msg[$template_lang . $template_file];
 
 		return true;
 	}
 
+	// assign variables
 	function assign_vars($vars)
 	{
-		$this->vars = ( empty($this->vars) ) ? $vars : $this->vars . $vars;
+		$this->vars = (empty($this->vars)) ? $vars : $this->vars . $vars;
 	}
 
-	function parse_email()
+	// Send the mail out to the recipients set previously in var $this->address
+	function send()
 	{
-		global $lang;
-		@reset($this->vars);
-		while (list($key, $val) = @each($this->vars))
-		{
-			$$key = $val;
-		}
+		global $board_config, $lang, $phpEx, $phpbb_root_path, $db;
 
     	// Escape all quotes, else the eval will fail.
 		$this->msg = str_replace ("'", "\'", $this->msg);
 		$this->msg = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "' . $\\1 . '", $this->msg);
 
+		// Set vars
+		reset ($this->vars);
+		while (list($key, $val) = each($this->vars)) 
+		{
+			$$key = $val;
+		}
+
 		eval("\$this->msg = '$this->msg';");
 
-		//
+		// Clear vars
+		reset ($this->vars);
+		while (list($key, $val) = each($this->vars)) 
+		{
+			unset($$key);
+		}
+
 		// We now try and pull a subject from the email body ... if it exists,
 		// do this here because the subject may contain a variable
-		//
-		$drop_header = "";
+		$drop_header = '';
 		$match = array();
 		if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match))
 		{
@@ -180,32 +186,15 @@
 			$this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg));
 		}
 
-		return true;
-	}
+		$to = $this->addresses['to'];
 
-	//
-	// Send the mail out to the recipients set previously in var $this->address
-	//
-	function send()
-	{
-		global $phpEx, $phpbb_root_path;
-
-		if ( $this->address == NULL )
-		{
-			message_die(GENERAL_ERROR, 'No email address set', '', __LINE__, __FILE__);
-		}
-
-		if ( !$this->parse_email() )
-		{
-			return false;
-		}
+		$cc = (count($this->addresses['cc'])) ? implode(', ', $this->addresses['cc']) : '';
+		$bcc = (count($this->addresses['bcc'])) ? implode(', ', $this->addresses['bcc']) : '';
 
-		//
-		// Add date and encoding type
-		//
-		$universal_extra = "MIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . gmdate('D, d M Y H:i:s', time()) . " UT\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\n";
-		$this->extra_headers = $universal_extra . trim($this->extra_headers); 
+		// Build header
+		$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '')  . (($bcc != '') ? "Bcc: $bcc\n" : ''); 
 
+		// Send message ... removed $this->encode() from subject for time being
 		if ( $this->use_smtp )
 		{
 			if ( !defined('SMTP_INCLUDED') ) 
@@ -213,21 +202,69 @@
 				include($phpbb_root_path . 'includes/smtp.' . $phpEx);
 			}
 
-			$result = smtpmail($this->address, $this->subject, $this->msg, $this->extra_headers);
+			$result = smtpmail($to, $this->subject, $this->msg, $this->extra_headers);
 		}
 		else
 		{
-			$result = @mail($this->address, $this->subject, $this->msg, $this->extra_headers);
+			$empty_to_header = ($to == '') ? TRUE : FALSE;
+			$to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to;
+	
+			$result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers);
+			
+			if (!$result && !$board_config['sendmail_fix'] && $empty_to_header)
+			{
+				$to = ' ';
+
+				$sql = "UPDATE " . CONFIG_TABLE . " 
+					SET config_value = '1'
+					WHERE config_name = 'sendmail_fix'";
+				if (!$db->sql_query($sql))
+				{
+					message_die(GENERAL_ERROR, 'Unable to update config table', '', __LINE__, __FILE__, $sql);
+				}
+
+				$board_config['sendmail_fix'] = 1;
+				$result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers);
+			}
 		}
 
-		if ( !$result )
+		// Did it work?
+		if (!$result)
 		{
-			message_die(GENERAL_ERROR, 'Failed sending email :: ' . $result, '', __LINE__, __FILE__);
+			message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__);
 		}
 
 		return true;
 	}
 
+	// Encodes the given string for proper display for this encoding ... nabbed 
+	// from php.net and modified. There is an alternative encoding method which 
+	// may produce lesd output but it's questionable as to its worth in this 
+	// scenario IMO
+	function encode($str)
+	{
+		if ($this->encoding == '')
+		{
+			return $str;
+		}
+
+		// define start delimimter, end delimiter and spacer
+		$end = "?=";
+		$start = "=?$this->encoding?B?";
+		$spacer = "$end\r\n $start";
+
+		// determine length of encoded text within chunks and ensure length is even
+		$length = 75 - strlen($start) - strlen($end);
+		$length = floor($length / 2) * 2;
+
+		// encode the string and split it into chunks with spacers after each chunk
+		$str = chunk_split(base64_encode($str), $length, $spacer);
+
+		// remove trailing spacer and add start and end delimiters
+		$str = preg_replace('#' . phpbb_preg_quote($spacer, '#') . '$#', '', $str);
+
+		return $start . $str . $end;
+	}
 
 	//
 	// Attach files via MIME.
@@ -237,7 +274,7 @@
 		global $lang;
 		$mime_boundary = "--==================_846811060==_";
 
-		$this->mailMsg = '--' . $mime_boundary . "\nContent-Type: text/plain;\n\tcharset=\"" . $lang['ENCODING'] . "\"\n\n" . $this->mailMsg;
+		$this->msg = '--' . $mime_boundary . "\nContent-Type: text/plain;\n\tcharset=\"" . $lang['ENCODING'] . "\"\n\n" . $this->msg;
 
 		if ($mime_filename)
 		{
@@ -333,4 +370,4 @@
 
 } // class emailer
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/includes/functions.php phpBB-2.0.6/includes/functions.php
--- phpBB2/includes/functions.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/functions.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: functions.php,v 1.133.2.21 2003/01/13 18:54:16 psotfx Exp $
+ *   $Id: functions.php,v 1.133.2.31 2003/07/20 13:14:27 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -74,14 +74,28 @@
 	return false;
 }
 
-function get_userdata($user)
+//
+// Get Userdata, $user can be username or user_id. If force_str is true, the username will be forced.
+//
+function get_userdata($user, $force_str = false)
 {
 	global $db;
 
+	if (intval($user) == 0 || $force_str)
+	{
+		$user = trim(htmlspecialchars($user));
+		$user = substr(str_replace("\\'", "'", $user), 0, 25);
+		$user = str_replace("'", "\\'", $user);
+	}
+	else
+	{
+		$user = intval($user);
+	}
+
 	$sql = "SELECT *
 		FROM " . USERS_TABLE . " 
 		WHERE ";
-	$sql .= ( ( is_integer($user) ) ? "user_id = $user" : "username = '" .  str_replace("\'", "''", $user) . "'" ) . " AND user_id <> " . ANONYMOUS;
+	$sql .= ( ( is_integer($user) ) ? "user_id = $user" : "username = '" .  $user . "'" ) . " AND user_id <> " . ANONYMOUS;
 	if ( !($result = $db->sql_query($sql)) )
 	{
 		message_die(GENERAL_ERROR, 'Tried obtaining data for a non-existent user', '', __LINE__, __FILE__, $sql);
@@ -92,7 +106,7 @@
 
 function make_jumpbox($action, $match_forum_id = 0)
 {
-	global $template, $userdata, $lang, $db, $nav_links, $phpEx;
+	global $template, $userdata, $lang, $db, $nav_links, $phpEx, $SID;
 
 //	$is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);
 
@@ -201,6 +215,7 @@
 {
 	global $board_config, $theme, $images;
 	global $template, $lang, $phpEx, $phpbb_root_path;
+	global $nav_links;
 
 	if ( $userdata['user_id'] != ANONYMOUS )
 	{
@@ -253,6 +268,29 @@
 
 	$theme = setup_style($board_config['default_style']);
 
+	//
+	// Mozilla navigation bar
+	// Default items that should be valid on all pages.
+	// Defined here to correctly assign the Language Variables
+	// and be able to change the variables within code.
+	//
+	$nav_links['top'] = array ( 
+		'url' => append_sid($phpbb_root_path . 'index.' . $phpEx),
+		'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
+	);
+	$nav_links['search'] = array ( 
+		'url' => append_sid($phpbb_root_path . 'search.' . $phpEx),
+		'title' => $lang['Search']
+	);
+	$nav_links['help'] = array ( 
+		'url' => append_sid($phpbb_root_path . 'faq.' . $phpEx),
+		'title' => $lang['FAQ']
+	);
+	$nav_links['author'] = array ( 
+		'url' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx),
+		'title' => $lang['Memberlist']
+	);
+
 	return;
 }
 
@@ -276,7 +314,7 @@
 	$template_path = 'templates/' ;
 	$template_name = $row['template_name'] ;
 
-	$template = new Template($phpbb_root_path . $template_path . $template_name, $board_config, $db);
+	$template = new Template($phpbb_root_path . $template_path . $template_name);
 
 	if ( $template )
 	{
@@ -692,6 +730,8 @@
 // dougk_ff7 <October 5, 2002>
 function phpbb_realpath($path)
 {
+	global $phpbb_root_path, $phpEx;
+
 	return (!@function_exists('realpath') || !@realpath($phpbb_root_path . 'includes/functions.'.$phpEx)) ? $path : @realpath($path);
 }
 
diff -ur phpBB2/includes/functions_post.php phpBB-2.0.6/includes/functions_post.php
--- phpBB2/includes/functions_post.php	2003-01-15 13:34:13.000000000 +0000
+++ phpBB-2.0.6/includes/functions_post.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: functions_post.php,v 1.9.2.25 2003/01/13 22:03:24 psotfx Exp $
+ *   $Id: functions_post.php,v 1.9.2.34 2003/06/09 15:45:10 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -25,7 +25,7 @@
 	die('Hacking attempt');
 }
 
-$html_entities_match = array('#&[a-z]+?;#', '#<#', '#>#');
+$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#');
 $html_entities_replace = array('&amp;', '&lt;', '&gt;');
 
 $unhtml_specialchars_match = array('#&gt;#', '#&lt;#', '#&quot;#', '#&amp;#');
@@ -72,9 +72,9 @@
 				for ($i = 0; $i < sizeof($allowed_html_tags); $i++)
 				{
 					$match_tag = trim($allowed_html_tags[$i]);
-					if (preg_match('#^<\/?' . $match_tag . '(?!(.*?)((style)|( on[\w]+?[\s]?=))[\s]*?)#i', $hold_string))
+					if (preg_match('#^<\/?' . $match_tag . '[> ]#i', $hold_string))
 					{
-						$tagallowed = true;
+						$tagallowed = (preg_match('#^<\/?' . $match_tag . ' .*?(style[ ]*?=|on[\w]+[ ]*?=)#i', $hold_string)) ? false : true;
 					}
 				}
 
@@ -222,7 +222,7 @@
 
 	$current_time = time();
 
-	if ($mode == 'newtopic' || $mode == 'reply') 
+	if ($mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost') 
 	{
 		//
 		// Flood control
@@ -242,7 +242,8 @@
 			}
 		}
 	}
-	else if ($mode == 'editpost')
+
+	if ($mode == 'editpost')
 	{
 		remove_search_post($post_id);
 	}
@@ -250,7 +251,8 @@
 	if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
 	{
 		$topic_vote = (!empty($poll_title) && count($poll_options) >= 2) ? 1 : 0;
-		$sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_vote = $topic_vote WHERE topic_id = $topic_id";
+
+		$sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . " WHERE topic_id = $topic_id";
 		if (!$db->sql_query($sql))
 		{
 			message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
@@ -599,9 +601,9 @@
 			$user_id_sql = '';
 			while ($row = $db->sql_fetchrow($result))
 			{
-				if (isset($row['ban_userid']))
+				if (isset($row['ban_userid']) && !empty($row['ban_userid']))
 				{
-					$user_id_sql = ', ' . $row['ban_userid'];
+					$user_id_sql .= ', ' . $row['ban_userid'];
 				}
 			}
 
@@ -618,6 +620,7 @@
 
 			$update_watched_sql = '';
 			$bcc_list_ary = array();
+			
 			if ($row = $db->sql_fetchrow($result))
 			{
 				// Sixty second limit
@@ -627,7 +630,7 @@
 				{
 					if ($row['user_email'] != '')
 					{
-						$bcc_list_ary[$row['user_lang']] .= (($bcc_list_ary[$row['user_lang']] != '') ? ', ' : '') . $row['user_email'];
+						$bcc_list_ary[$row['user_lang']][] = $row['user_email'];
 					}
 					$update_watched_sql .= ($update_watched_sql != '') ? ', ' . $row['user_id'] : $row['user_id'];
 				}
@@ -652,31 +655,36 @@
 					include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 					$emailer = new emailer($board_config['smtp_delivery']);
 
-					$orig_word = array();
-					$replacement_word = array();
-					obtain_word_list($orig_word, $replacement_word);
-
 					$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
 					$script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
 					$server_name = trim($board_config['server_name']);
 					$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
 					$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';
 
-					$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
+					$orig_word = array();
+					$replacement_word = array();
+					obtain_word_list($orig_word, $replacement_word);
+
+					$emailer->from($board_config['board_email']);
+					$emailer->replyto($board_config['board_email']);
 
 					$topic_title = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, unprepare_message($topic_title)) : unprepare_message($topic_title);
 
+					@reset($bcc_list_ary);
 					while (list($user_lang, $bcc_list) = each($bcc_list_ary))
 					{
 						$emailer->use_template('topic_notify', $user_lang);
-						$emailer->email_address(' ');
+		
+						for ($i = 0; $i < count($bcc_list); $i++)
+						{
+							$emailer->bcc($bcc_list[$i]);
+						}
+
 						// The Topic_reply_notification lang string below will be used
 						// if for some reason the mail template subject cannot be read 
 						// ... note it will not necessarily be in the posters own language!
 						$emailer->set_subject($lang['Topic_reply_notification']); 
 						
-						$emailer->extra_headers($email_headers . "Bcc: $bcc_list\n");
-
 						// This is a nasty kludge to remove the username var ... till (if?)
 						// translators update their templates
 						$emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
diff -ur phpBB2/includes/functions_search.php phpBB-2.0.6/includes/functions_search.php
--- phpBB2/includes/functions_search.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/functions_search.php	2003-09-10 16:37:50.000000000 +0000
@@ -6,7 +6,7 @@
 *     copyright            : (C) 2002 The phpBB Group
 *     email                : support@phpbb.com
 *
-*     $Id: functions_search.php,v 1.8.2.10 2003/01/06 09:18:35 bartvb Exp $
+*     $Id: functions_search.php,v 1.8.2.17 2003/08/23 01:16:13 psotfx Exp $
 *
 ****************************************************************************/
 
@@ -58,7 +58,7 @@
 		$entry = str_replace('*', ' ', $entry);
 
 		// 'words' that consist of <3 or >20 characters are removed.
-		$entry = preg_replace('/\b([a-z0-9]{1,2}|[a-z0-9]{21,})\b/',' ', $entry); 
+		$entry = preg_replace('/[ ]([\S]{1,2}|[\S]{21,})[ ]/',' ', $entry);
 	}
 
 	if ( !empty($stopword_list) )
@@ -69,7 +69,7 @@
 
 			if ( $mode == 'post' || ( $stopword != 'not' && $stopword != 'and' && $stopword != 'or' ) )
 			{
-				$entry =  preg_replace('#\b' . preg_quote($stopword) . '\b#', ' ', $entry);
+				$entry = str_replace(' ' . trim($stopword) . ' ', ' ', $entry);
 			}
 		}
 	}
@@ -81,7 +81,7 @@
 			list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_list[$j])));
 			if ( $mode == 'post' || ( $match_synonym != 'not' && $match_synonym != 'and' && $match_synonym != 'or' ) )
 			{
-				$entry =  preg_replace('#\b' . trim($match_synonym) . '\b#', ' ' . trim($replace_synonym) . ' ', $entry);
+				$entry =  str_replace(' ' . trim($match_synonym) . ' ', ' ' . trim($replace_synonym) . ' ', $entry);
 			}
 		}
 	}
@@ -91,10 +91,15 @@
 
 function split_words(&$entry, $mode = 'post')
 {
+	// If you experience problems with the new method, uncomment this block.
+/*	
 	$rex = ( $mode == 'post' ) ? "/\b([\w±µ-ÿ][\w±µ-ÿ']*[\w±µ-ÿ]+|[\w±µ-ÿ]+?)\b/" : '/(\*?[a-z0-9±µ-ÿ]+\*?)|\b([a-z0-9±µ-ÿ]+)\b/';
 	preg_match_all($rex, $entry, $split_entries);
 
 	return $split_entries[1];
+*/
+	// Trim 1+ spaces to one space and split this trimmed string into words.
+	return explode(' ', trim(preg_replace('#\s+#', ' ', $entry)));
 }
 
 function add_search_words($mode, $post_id, $post_text, $post_title = '')
@@ -108,6 +113,8 @@
 	$search_raw_words['text'] = split_words(clean_words('post', $post_text, $stopword_array, $synonym_array));
 	$search_raw_words['title'] = split_words(clean_words('post', $post_title, $stopword_array, $synonym_array));
 
+	@set_time_limit(0);
+
 	$word = array();
 	$word_insert_sql = array();
 	while ( list($word_in, $search_matches) = @each($search_raw_words) )
@@ -246,7 +253,7 @@
 
 	if ($mode == 'single')
 	{
-		remove_common('single', 0.4, $word);
+		remove_common('single', 4/10, $word);
 	}
 
 	return;
@@ -430,7 +437,7 @@
 
 		$sql = "SELECT username 
 			FROM " . USERS_TABLE . " 
-			WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' 
+			WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' AND user_id <> " . ANONYMOUS . "
 			ORDER BY username";
 		if ( !($result = $db->sql_query($sql)) )
 		{
@@ -486,4 +493,4 @@
 	return;
 }
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/includes/functions_validate.php phpBB-2.0.6/includes/functions_validate.php
--- phpBB2/includes/functions_validate.php	2003-01-15 13:34:12.000000000 +0000
+++ phpBB-2.0.6/includes/functions_validate.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: functions_validate.php,v 1.6.2.5 2002/12/21 12:56:07 psotfx Exp $
+ *   $Id: functions_validate.php,v 1.6.2.12 2003/06/09 19:13:05 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -29,7 +29,11 @@
 {
 	global $db, $lang, $userdata;
 
-	$username = str_replace("\'", "''", $username);
+	// Remove doubled up spaces
+	$username = preg_replace('#\s+#', ' ', $username); 
+	// Limit username length
+	$username = substr(str_replace("\'", "'", $username), 0, 25);
+	$username = str_replace("'", "''", $username);
 
 	$sql = "SELECT username 
 		FROM " . USERS_TABLE . " 
@@ -98,8 +102,8 @@
 	}
 	$db->sql_freeresult($result);
 
-	// Don't allow " in username.
-	if (strstr($username, '"'))
+	// Don't allow " and ALT-255 in username.
+	if (strstr($username, '"') || strstr($username, '&quot;') || strstr($username, chr(160)))
 	{
 		return array('error' => true, 'error_msg' => $lang['Username_invalid']);
 	}
@@ -117,7 +121,7 @@
 
 	if ($email != '')
 	{
-		if (preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email))
+		if (preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$/is', $email))
 		{
 			$sql = "SELECT ban_email
 				FROM " . BANLIST_TABLE;
diff -ur phpBB2/includes/page_header.php phpBB-2.0.6/includes/page_header.php
--- phpBB2/includes/page_header.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/page_header.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: page_header.php,v 1.106.2.11 2002/12/19 17:17:39 psotfx Exp $
+ *   $Id: page_header.php,v 1.106.2.20 2003/06/10 20:48:19 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -257,7 +257,7 @@
 // Obtain number of new private messages
 // if user is logged in
 //
-if ( $userdata['session_logged_in'] )
+if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) )
 {
 	if ( $userdata['user_new_privmsg'] )
 	{
@@ -312,6 +312,11 @@
 //
 // Generate HTML required for Mozilla Navigation bar
 //
+if (!isset($nav_links))
+{
+	$nav_links = array();
+}
+
 $nav_links_html = '';
 $nav_link_proto = '<link rel="%s" href="%s" title="%s" />' . "\n";
 while( list($nav_item, $nav_array) = @each($nav_links) )
@@ -330,6 +335,9 @@
 	}
 }
 
+// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility
+$l_timezone = explode('.', $board_config['board_timezone']);
+$l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])];
 //
 // The following assigns all _common_ variables that may be used at any point
 // in a template.
@@ -384,14 +392,13 @@
 	'U_FAQ' => append_sid('faq.'.$phpEx),
 	'U_VIEWONLINE' => append_sid('viewonline.'.$phpEx),
 	'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
-	'U_MEMBERSLIST' => append_sid('memberlist.'.$phpEx),
 	'U_GROUP_CP' => append_sid('groupcp.'.$phpEx),
 
 	'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
 	'S_CONTENT_ENCODING' => $lang['ENCODING'],
 	'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
 	'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'],
-	'S_TIMEZONE' => sprintf($lang['All_times'], $lang[number_format($board_config['board_timezone'])]),
+	'S_TIMEZONE' => sprintf($lang['All_times'], $l_timezone),
 	'S_LOGIN_ACTION' => append_sid('login.'.$phpEx),
 
 	'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],
@@ -453,18 +460,21 @@
 	}
 }
 
+// Add no-cache control for cookies if they are set
+//$c_no_cache = (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_data'])) ? 'no-cache="set-cookie", ' : '';
+
 // Work around for "current" Apache 2 + PHP module which seems to not
 // cope with private cache control setting
-if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
+if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
 {
-	header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
+	header ('Cache-Control: no-cache, pre-check=0, post-check=0');
 }
 else
 {
 	header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
 }
-header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
-header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
+header ('Expires: 0');
+header ('Pragma: no-cache');
 
 $template->pparse('overall_header');
 
diff -ur phpBB2/includes/prune.php phpBB-2.0.6/includes/prune.php
--- phpBB2/includes/prune.php	2003-01-15 13:34:12.000000000 +0000
+++ phpBB-2.0.6/includes/prune.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
-*   $Id: prune.php,v 1.19.2.3 2002/11/29 06:58:37 dougk_ff7 Exp $
+*   $Id: prune.php,v 1.19.2.6 2003/03/18 23:23:57 acydburn Exp $
 *
 *
 ***************************************************************************/
@@ -56,6 +56,7 @@
 	{
 		$sql_topics .= ( ( $sql_topics != '' ) ? ', ' : '' ) . $row['topic_id'];
 	}
+	$db->sql_freeresult($result);
 		
 	if( $sql_topics != '' )
 	{
@@ -73,6 +74,7 @@
 		{
 			$sql_post .= ( ( $sql_post != '' ) ? ', ' : '' ) . $row['post_id'];
 		}
+		$db->sql_freeresult($result);
 
 		if ( $sql_post != '' )
 		{
@@ -108,13 +110,6 @@
 				message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
 			}
 
-			$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . " 
-				WHERE post_id IN ($sql_post)";
-			if ( !$db->sql_query($sql) )
-			{
-				message_die(GENERAL_ERROR, 'Could not delete search matches', '', __LINE__, __FILE__, $sql);
-			}
-
 			remove_search_post($sql_post);
 
 			return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
@@ -163,4 +158,4 @@
 	return;
 }
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/includes/sessions.php phpBB-2.0.6/includes/sessions.php
--- phpBB2/includes/sessions.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/sessions.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: sessions.php,v 1.58.2.8 2002/12/18 01:06:19 psotfx Exp $
+ *   $Id: sessions.php,v 1.58.2.10 2003/04/05 12:04:33 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -37,12 +37,12 @@
 	if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) || isset($HTTP_COOKIE_VARS[$cookiename . '_data']) )
 	{
 		$session_id = isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ? $HTTP_COOKIE_VARS[$cookiename . '_sid'] : '';
-		$sessiondata = isset($HTTP_COOKIE_VARS[$cookiename . '_data']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : '';
+		$sessiondata = isset($HTTP_COOKIE_VARS[$cookiename . '_data']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();
 		$sessionmethod = SESSION_METHOD_COOKIE;
 	}
 	else
 	{
-		$sessiondata = '';
+		$sessiondata = array();
 		$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';
 		$sessionmethod = SESSION_METHOD_GET;
 	}
@@ -206,13 +206,13 @@
 
 	if ( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) || isset($HTTP_COOKIE_VARS[$cookiename . '_data']) )
 	{
-		$sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : '';
+		$sessiondata = isset( $HTTP_COOKIE_VARS[$cookiename . '_data'] ) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : array();
 		$session_id = isset( $HTTP_COOKIE_VARS[$cookiename . '_sid'] ) ? $HTTP_COOKIE_VARS[$cookiename . '_sid'] : '';
 		$sessionmethod = SESSION_METHOD_COOKIE;
 	}
 	else
 	{
-		$sessiondata = '';
+		$sessiondata = array();
 		$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';
 		$sessionmethod = SESSION_METHOD_GET;
 	}
@@ -329,6 +329,8 @@
 	$cookiedomain = $board_config['cookie_domain'];
 	$cookiesecure = $board_config['cookie_secure'];
 
+	$current_time = time();
+
 	//
 	// Pull cookiedata or grab the URI propagated sid
 	//
diff -ur phpBB2/includes/smtp.php phpBB-2.0.6/includes/smtp.php
--- phpBB2/includes/smtp.php	2003-01-15 13:34:13.000000000 +0000
+++ phpBB-2.0.6/includes/smtp.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: smtp.php,v 1.16.2.2 2002/12/22 15:09:17 psotfx Exp $
+ *   $Id: smtp.php,v 1.16.2.9 2003/07/18 16:34:01 acydburn Exp $
  *
  ***************************************************************************/
 
@@ -20,54 +20,43 @@
  ***************************************************************************/
 
 define('SMTP_INCLUDED', 1);
+
 //
 // This function has been modified as provided
 // by SirSir to allow multiline responses when 
 // using SMTP Extensions
 //
-function server_parse($socket, $response) 
+function server_parse($socket, $response, $line = __LINE__) 
 { 
-   while ( substr($server_response,3,1) != ' ' ) 
-   { 
-      if( !( $server_response = fgets($socket, 256) ) ) 
-      { 
-         message_die(GENERAL_ERROR, "Couldn't get mail server response codes", "", __LINE__, __FILE__); 
-      } 
-   } 
-
-   if( !( substr($server_response, 0, 3) == $response ) ) 
-   { 
-      message_die(GENERAL_ERROR, "Ran into problems sending Mail. Response: $server_response", "", __LINE__, __FILE__); 
-   } 
-} 
-
-/****************************************************************************
-*	Function: 		smtpmail
-*	Description: 	This is a functional replacement for php's builtin mail
-*						function, that uses smtp.
-*	Usage:			The usage for this function is identical to that of php's
-*						built in mail function.
-****************************************************************************/
-function smtpmail($mail_to, $subject, $message, $headers = "")
+	while (substr($server_response, 3, 1) != ' ') 
+	{
+		if (!($server_response = fgets($socket, 256))) 
+		{ 
+			message_die(GENERAL_ERROR, "Couldn't get mail server response codes", "", $line, __FILE__); 
+		} 
+	} 
+
+	if (!(substr($server_response, 0, 3) == $response)) 
+	{ 
+		message_die(GENERAL_ERROR, "Ran into problems sending Mail. Response: $server_response", "", $line, __FILE__); 
+	} 
+}
+
+// Replacement or substitute for PHP's mail command
+function smtpmail($mail_to, $subject, $message, $headers = '')
 {
-	// For now I'm using an array based $smtp_vars to hold the smtp server
-	// info, but it should probably change to $board_config...
-	// then the relevant info would be $board_config['smtp_host'] and
-	// $board_config['smtp_port'].
 	global $board_config;
 
-	//
 	// Fix any bare linefeeds in the message to make it RFC821 Compliant.
-	//
-	$message = preg_replace("/(?<!\r)\n/si", "\r\n", $message);
+	$message = preg_replace("#(?<!\r)\n#si", "\r\n", $message);
 
-	if ($headers != "")
+	if ($headers != '')
 	{
-		if(is_array($headers))
+		if (is_array($headers))
 		{
-			if(sizeof($headers) > 1)
+			if (sizeof($headers) > 1)
 			{
-				$headers = join("\r\n", $headers);
+				$headers = join("\n", $headers);
 			}
 			else
 			{
@@ -76,140 +65,129 @@
 		}
 		$headers = chop($headers);
 
-		//
 		// Make sure there are no bare linefeeds in the headers
-		//
-		$headers = preg_replace("/(?<!\r)\n/si", "\r\n", $headers);
-		//
+		$headers = preg_replace('#(?<!\r)\n#si', "\r\n", $headers);
+
 		// Ok this is rather confusing all things considered,
 		// but we have to grab bcc and cc headers and treat them differently
 		// Something we really didn't take into consideration originally
-		//
 		$header_array = explode("\r\n", $headers);
 		@reset($header_array);
-		$headers = "";
-		while( list(, $header) = each($header_array) )
+
+		$headers = '';
+		while(list(, $header) = each($header_array))
 		{
-			if( preg_match("/^cc:/si", $header) )
+			if (preg_match('#^cc:#si', $header))
 			{
-				$cc = preg_replace("/^cc:(.*)/si", "\\1", $header);
+				$cc = preg_replace('#^cc:(.*)#si', '\1', $header);
 			}
-			else if( preg_match("/^bcc:/si", $header ))
+			else if (preg_match('#^bcc:#si', $header))
 			{
-				$bcc = preg_replace("/^bcc:(.*)/si", "\\1", $header);
-				$header = "";
+				$bcc = preg_replace('#^bcc:(.*)#si', '\1', $header);
+				$header = '';
 			}
-			$headers .= $header . "\r\n";
+			$headers .= ($header != '') ? $header . "\r\n" : '';
 		}
+
 		$headers = chop($headers);
-		$cc = explode(",", $cc);
-		$bcc = explode(",", $bcc);
+		$cc = explode(', ', $cc);
+		$bcc = explode(', ', $bcc);
 	}
-	if($mail_to == "")
-	{
-		message_die(GENERAL_ERROR, "No email address specified", "", __LINE__, __FILE__);
-	}
-	if(trim($subject) == "")
+
+	if (trim($subject) == '')
 	{
 		message_die(GENERAL_ERROR, "No email Subject specified", "", __LINE__, __FILE__);
 	}
-	if(trim($message) == "")
+
+	if (trim($message) == '')
 	{
 		message_die(GENERAL_ERROR, "Email message was blank", "", __LINE__, __FILE__);
 	}
-	$mail_to_array = explode(",", $mail_to);
 
-	//
 	// Ok we have error checked as much as we can to this point let's get on
 	// it already.
-	//
 	if( !$socket = fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) )
 	{
 		message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__);
 	}
-	server_parse($socket, "220");
 
+	// Wait for reply
+	server_parse($socket, "220", __LINE__);
+
+	// Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO
+	// This improved as provided by SirSir to accomodate
 	if( !empty($board_config['smtp_username']) && !empty($board_config['smtp_password']) )
 	{ 
-		// Send the RFC2554 specified EHLO. 
-		// This improved as provided by SirSir to accomodate
-		// both SMTP AND ESMTP capable servers
-		fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n"); 
-		server_parse($socket, "250"); 
-
-		fputs($socket, "AUTH LOGIN\r\n"); 
-		server_parse($socket, "334"); 
-		fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n"); 
-		server_parse($socket, "334"); 
-		fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n"); 
-		server_parse($socket, "235"); 
-	} 
-	else 
-	{ 
-		// Send the RFC821 specified HELO. 
-		fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n"); 
-		server_parse($socket, "250"); 
+		fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n");
+		server_parse($socket, "250", __LINE__);
+
+		fputs($socket, "AUTH LOGIN\r\n");
+		server_parse($socket, "334", __LINE__);
+
+		fputs($socket, base64_encode($board_config['smtp_username']) . "\r\n");
+		server_parse($socket, "334", __LINE__);
+
+		fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n");
+		server_parse($socket, "235", __LINE__);
+	}
+	else
+	{
+		fputs($socket, "HELO " . $board_config['smtp_host'] . "\r\n");
+		server_parse($socket, "250", __LINE__);
 	}
 
 	// From this point onward most server response codes should be 250
 	// Specify who the mail is from....
 	fputs($socket, "MAIL FROM: <" . $board_config['board_email'] . ">\r\n");
-	server_parse($socket, "250");
+	server_parse($socket, "250", __LINE__);
 
 	// Specify each user to send to and build to header.
-	$to_header = "To: ";
-	@reset( $mail_to_array );
-	while( list( , $mail_to_address ) = each( $mail_to_array ))
-	{
-		//
-		// Add an additional bit of error checking to the To field.
-		//
-		$mail_to_address = trim($mail_to_address);
-		if ( preg_match('/[^ ]+\@[^ ]+/', $mail_to_address) )
-		{
-			fputs( $socket, "RCPT TO: <$mail_to_address>\r\n" );
-			server_parse( $socket, "250" );
-		}
-		$to_header .= ( ( $mail_to_address != '' ) ? ', ' : '' ) . "<$mail_to_address>";
+	$to_header = '';
+
+	// Add an additional bit of error checking to the To field.
+	$mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to);
+	if (preg_match('#[^ ]+\@[^ ]+#', $mail_to))
+	{
+		fputs($socket, "RCPT TO: <$mail_to>\r\n");
+		server_parse($socket, "250", __LINE__);
 	}
+
 	// Ok now do the CC and BCC fields...
-	@reset( $bcc );
-	while( list( , $bcc_address ) = each( $bcc ))
+	@reset($bcc);
+	while(list(, $bcc_address) = each($bcc))
 	{
-		//
 		// Add an additional bit of error checking to bcc header...
-		//
-		$bcc_address = trim( $bcc_address );
-		if ( preg_match('/[^ ]+\@[^ ]+/', $bcc_address) )
+		$bcc_address = trim($bcc_address);
+		if (preg_match('#[^ ]+\@[^ ]+#', $bcc_address))
 		{
-			fputs( $socket, "RCPT TO: <$bcc_address>\r\n" );
-			server_parse( $socket, "250" );
+			fputs($socket, "RCPT TO: <$bcc_address>\r\n");
+			server_parse($socket, "250", __LINE__);
 		}
 	}
-	@reset( $cc );
-	while( list( , $cc_address ) = each( $cc ))
+
+	@reset($cc);
+	while(list(, $cc_address) = each($cc))
 	{
-		//
 		// Add an additional bit of error checking to cc header
-		//
-		$cc_address = trim( $cc_address );
-		if ( preg_match('/[^ ]+\@[^ ]+/', $cc_address) )
+		$cc_address = trim($cc_address);
+		if (preg_match('#[^ ]+\@[^ ]+#', $cc_address))
 		{
 			fputs($socket, "RCPT TO: <$cc_address>\r\n");
-			server_parse($socket, "250");
+			server_parse($socket, "250", __LINE__);
 		}
 	}
+
 	// Ok now we tell the server we are ready to start sending data
 	fputs($socket, "DATA\r\n");
 
 	// This is the last response code we look for until the end of the message.
-	server_parse($socket, "354");
+	server_parse($socket, "354", __LINE__);
 
 	// Send the Subject Line...
 	fputs($socket, "Subject: $subject\r\n");
 
 	// Now the To Header.
-	fputs($socket, "$to_header\r\n");
+	fputs($socket, "To: $mail_to\r\n");
 
 	// Now any custom headers....
 	fputs($socket, "$headers\r\n\r\n");
@@ -219,7 +197,7 @@
 
 	// Ok the all the ingredients are mixed in let's cook this puppy...
 	fputs($socket, ".\r\n");
-	server_parse($socket, "250");
+	server_parse($socket, "250", __LINE__);
 
 	// Now tell the server we are done and close the socket...
 	fputs($socket, "QUIT\r\n");
@@ -228,4 +206,4 @@
 	return TRUE;
 }
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/includes/usercp_activate.php phpBB-2.0.6/includes/usercp_activate.php
--- phpBB2/includes/usercp_activate.php	2003-01-15 13:34:12.000000000 +0000
+++ phpBB-2.0.6/includes/usercp_activate.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: usercp_activate.php,v 1.6.2.5 2002/12/22 16:01:16 psotfx Exp $
+ *   $Id: usercp_activate.php,v 1.6.2.7 2003/05/03 23:24:02 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -37,7 +37,7 @@
 
 if ( $row = $db->sql_fetchrow($result) )
 {
-	if ( $row['user_active'] && $row['user_actkey'] == '' )
+	if ( $row['user_active'] && trim($row['user_actkey']) == '' )
 	{
 		$template->assign_vars(array(
 			'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
@@ -45,7 +45,7 @@
 
 		message_die(GENERAL_MESSAGE, $lang['Already_activated']);
 	}
-	else if ( $row['user_actkey'] == $HTTP_GET_VARS['act_key'] )
+	else if ((trim($row['user_actkey']) == trim($HTTP_GET_VARS['act_key'])) && (trim($row['user_actkey']) != ''))
 	{
 		$sql_update_pass = ( $row['user_newpasswd'] != '' ) ? ", user_password = '" . str_replace("\'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : '';
 
@@ -62,12 +62,12 @@
 			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 			$emailer = new emailer($board_config['smtp_delivery']);
 
-			$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
+			$emailer->from($board_config['board_email']);
+			$emailer->replyto($board_config['board_email']);
 
 			$emailer->use_template('admin_welcome_activated', $row['user_lang']);
 			$emailer->email_address($row['user_email']);
 			$emailer->set_subject($lang['Account_activated_subject']);
-			$emailer->extra_headers($email_headers);
 
 			$emailer->assign_vars(array(
 				'SITENAME' => $board_config['sitename'], 
diff -ur phpBB2/includes/usercp_avatar.php phpBB-2.0.6/includes/usercp_avatar.php
--- phpBB2/includes/usercp_avatar.php	2003-01-15 13:34:12.000000000 +0000
+++ phpBB-2.0.6/includes/usercp_avatar.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: usercp_avatar.php,v 1.8.2.16 2002/12/21 19:09:57 psotfx Exp $
+ *   $Id: usercp_avatar.php,v 1.8.2.17 2003/03/04 21:02:36 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -242,7 +242,7 @@
 	return $avatar_sql;
 }
 
-function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popuppm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
+function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
 {
 	global $board_config, $db, $template, $lang, $images, $theme;
 	global $phpbb_root_path, $phpEx;
@@ -318,7 +318,7 @@
 		}
 	}
 
-	$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popuppm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');
+	$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');
 
 	$s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="agreed" value="true" />';
 
diff -ur phpBB2/includes/usercp_email.php phpBB-2.0.6/includes/usercp_email.php
--- phpBB2/includes/usercp_email.php	2003-01-15 13:34:12.000000000 +0000
+++ phpBB-2.0.6/includes/usercp_email.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: usercp_email.php,v 1.7.2.9 2003/01/05 01:06:40 psotfx Exp $
+ *   $Id: usercp_email.php,v 1.7.2.13 2003/06/06 18:02:15 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -27,6 +27,12 @@
 	exit;
 }
 
+// Is send through board enabled? No, return to index
+if (!$board_config['board_email_form'])
+{
+	redirect(append_sid("index.$phpEx", true));
+}
+
 if ( !empty($HTTP_GET_VARS[POST_USERS_URL]) || !empty($HTTP_POST_VARS[POST_USERS_URL]) )
 {
 	$user_id = ( !empty($HTTP_GET_VARS[POST_USERS_URL]) ) ? intval($HTTP_GET_VARS[POST_USERS_URL]) : intval($HTTP_POST_VARS[POST_USERS_URL]);
@@ -61,12 +67,6 @@
 
 		if ( isset($HTTP_POST_VARS['submit']) )
 		{
-			// session id check
-			if ($sid == '' || $sid != $userdata['session_id'])
-			{
-				message_die(GENERAL_ERROR, 'Invalid_session');
-			}
-
 			$error = FALSE;
 
 			if ( !empty($HTTP_POST_VARS['subject']) )
@@ -99,8 +99,10 @@
 					include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 					$emailer = new emailer($board_config['smtp_delivery']);
 
-					$email_headers = 'Return-Path: ' . $userdata['user_email'] . "\nFrom: " . $userdata['user_email'] . "\n";
-					$email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
+					$emailer->from($userdata['user_email']);
+					$emailer->replyto($userdata['user_email']);
+
+					$email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
 					$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
 					$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
 					$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
@@ -122,11 +124,11 @@
 
 					if ( !empty($HTTP_POST_VARS['cc_email']) )
 					{
-						$email_headers = 'Return-Path: ' . $userdata['user_email'] . "\nFrom: " . $userdata['user_email'] . "\n";
+						$emailer->from($userdata['user_email']);
+						$emailer->replyto($userdata['user_email']);
 						$emailer->use_template('profile_send_email');
 						$emailer->email_address($userdata['user_email']);
 						$emailer->set_subject($subject);
-						$emailer->extra_headers($email_headers);
 
 						$emailer->assign_vars(array(
 							'SITENAME' => $board_config['sitename'], 
@@ -175,8 +177,8 @@
 		$template->assign_vars(array(
 			'USERNAME' => $username,
 
-			'S_HIDDEN_FIELDS' => '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />', 
-			'S_POST_ACTION' => append_sid("profile.$phpEx?&amp;mode=email&amp;" . POST_USERS_URL . "=$user_id"), 
+			'S_HIDDEN_FIELDS' => '', 
+			'S_POST_ACTION' => append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL . "=$user_id"), 
 
 			'L_SEND_EMAIL_MSG' => $lang['Send_email_msg'], 
 			'L_RECIPIENT' => $lang['Recipient'], 
diff -ur phpBB2/includes/usercp_register.php phpBB-2.0.6/includes/usercp_register.php
--- phpBB2/includes/usercp_register.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/usercp_register.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: usercp_register.php,v 1.20.2.35 2003/01/10 21:28:08 psotfx Exp $
+ *   $Id: usercp_register.php,v 1.20.2.54 2003/07/18 16:34:01 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -27,6 +27,9 @@
 	exit;
 }
 
+$unhtml_specialchars_match = array('#&gt;#', '#&lt;#', '#&quot;#', '#&amp;#');
+$unhtml_specialchars_replace = array('>', '<', '"', '&');
+
 // ---------------------------------------
 // Load agreement template since user has not yet
 // agreed to registration conditions/coppa
@@ -46,8 +49,8 @@
 		"AGREE_UNDER_13" => $lang['Agree_under_13'],
 		'DO_NOT_AGREE' => $lang['Agree_not'],
 
-		"U_AGREE_OVER13" => "profile.$phpEx?mode=register&amp;agreed=true&amp;sid=" . $userdata['session_id'],
-		"U_AGREE_UNDER13" => "profile.$phpEx?mode=register&amp;agreed=true&amp;coppa=true&amp;sid=" . $userdata['session_id'])
+		"U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&amp;agreed=true"),
+		"U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&amp;agreed=true&amp;coppa=true"))
 	);
 
 	$template->pparse('body');
@@ -80,12 +83,6 @@
 	isset($HTTP_POST_VARS['cancelavatar']) ||
 	$mode == 'register' )
 {
-	// session id check
-	if ($sid == '' || $sid != $userdata['session_id'])
-	{
-		message_die(GENERAL_ERROR, 'Invalid_session');
-	}
-
 	include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
 	include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
 	include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
@@ -129,7 +126,7 @@
 	$allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;
 	$notifyreply = ( isset($HTTP_POST_VARS['notifyreply']) ) ? ( ($HTTP_POST_VARS['notifyreply']) ? TRUE : 0 ) : 0;
 	$notifypm = ( isset($HTTP_POST_VARS['notifypm']) ) ? ( ($HTTP_POST_VARS['notifypm']) ? TRUE : 0 ) : TRUE;
-	$popuppm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
+	$popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE;
 
 	if ( $mode == 'register' )
 	{
@@ -168,6 +165,16 @@
 	}
 
 	$user_timezone = ( isset($HTTP_POST_VARS['timezone']) ) ? doubleval($HTTP_POST_VARS['timezone']) : $board_config['board_timezone'];
+
+	$sql = "SELECT config_value
+		FROM " . CONFIG_TABLE . "
+		WHERE config_name = 'default_dateformat'";
+	if ( !($result = $db->sql_query($sql)) )
+	{
+		message_die(GENERAL_ERROR, 'Could not select default dateformat', '', __LINE__, __FILE__, $sql);
+	}
+	$row = $db->sql_fetchrow($result);
+	$board_config['default_dateformat'] = $row['config_value'];
 	$user_dateformat = ( !empty($HTTP_POST_VARS['dateformat']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['dateformat'])) : $board_config['default_dateformat'];
 
 	$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']) : '' );
@@ -210,12 +217,13 @@
 		}
 	}
 }
+
 //
 // Let's make sure the user isn't logged in while registering,
 // and ensure that they were trying to register a second time
 // (Prevents double registrations)
 //
-if ( $userdata['session_logged_in'] && $mode =="register" && $username == $userdata['username'])
+if ($mode == 'register' && ($userdata['session_logged_in'] || $username == $userdata['username']))
 {
 	message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
 }
@@ -333,8 +341,8 @@
 	{
 		if ( empty($username) )
 		{
+			// Error is already triggered, since one field is empty.
 			$error = TRUE;
-			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Username_disallowed'];
 		}
 		else if ( $username != $userdata['username'] || $mode == 'register' )
 		{
@@ -370,7 +378,6 @@
 		$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
 	}
 
-	//??
 	if ( $website != '' )
 	{
 		rawurlencode($website);
@@ -445,7 +452,7 @@
 			}
 
 			$sql = "UPDATE " . USERS_TABLE . "
-				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
+				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
 				WHERE user_id = $user_id";
 			if ( !($result = $db->sql_query($sql)) )
 			{
@@ -460,16 +467,16 @@
 				include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 				$emailer = new emailer($board_config['smtp_delivery']);
 
-				$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
+				$emailer->from($board_config['board_email']);
+				$emailer->replyto($board_config['board_email']);
 
 				$emailer->use_template('user_activate', stripslashes($user_lang));
 				$emailer->email_address($email);
 				$emailer->set_subject($lang['Reactivate']);
-				$emailer->extra_headers($email_headers);
 
 				$emailer->assign_vars(array(
 					'SITENAME' => $board_config['sitename'],
-					'USERNAME' => $username,
+					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
 					'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
 
 					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
@@ -509,7 +516,7 @@
 			// Get current date
 			//
 			$sql = "INSERT INTO " . USERS_TABLE . "	(user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
-				VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
+				VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
 			if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
 			{
 				$user_actkey = gen_rand_string(true);
@@ -568,19 +575,19 @@
 			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 			$emailer = new emailer($board_config['smtp_delivery']);
 
-			$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
+			$emailer->from($board_config['board_email']);
+			$emailer->replyto($board_config['board_email']);
 
 			$emailer->use_template($email_template, stripslashes($user_lang));
 			$emailer->email_address($email);
 			$emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
-			$emailer->extra_headers($email_headers);
 
 			if( $coppa )
 			{
 				$emailer->assign_vars(array(
 					'SITENAME' => $board_config['sitename'],
 					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
-					'USERNAME' => $username,
+					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
 					'PASSWORD' => $password_confirm,
 					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
 
@@ -602,7 +609,7 @@
 				$emailer->assign_vars(array(
 					'SITENAME' => $board_config['sitename'],
 					'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
-					'USERNAME' => $username,
+					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
 					'PASSWORD' => $password_confirm,
 					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
 
@@ -615,20 +622,34 @@
 
 			if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
 			{
-				//$emailer->use_template("admin_activate", stripslashes($user_lang));
-				$emailer->use_template("admin_activate", $board_config['default_lang']);
-				$emailer->email_address($board_config['board_email']);
-				$emailer->set_subject($lang['New_account_subject']);
-				$emailer->extra_headers($email_headers);
-
-				$emailer->assign_vars(array(
-					'USERNAME' => $username,
-					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
-
-					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
-				);
-				$emailer->send();
-				$emailer->reset();
+				$sql = "SELECT user_email, user_lang 
+					FROM " . USERS_TABLE . "
+					WHERE user_level = " . ADMIN;
+				
+				if ( !($result = $db->sql_query($sql)) )
+				{
+					message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
+				}
+				
+				while ($row = $db->sql_fetchrow($result))
+				{
+					$emailer->from($board_config['board_email']);
+					$emailer->replyto($board_config['board_email']);
+					
+					$emailer->email_address(trim($row['user_email']));
+					$emailer->use_template("admin_activate", $row['user_lang']);
+					$emailer->set_subject($lang['New_account_subject']);
+
+					$emailer->assign_vars(array(
+						'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
+						'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
+
+						'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
+					);
+					$emailer->send();
+					$emailer->reset();
+				}
+				$db->sql_freeresult($result);
 			}
 
 			$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'],  '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
@@ -659,7 +680,7 @@
 	$occupation = stripslashes($occupation);
 	$interests = stripslashes($interests);
 	$signature = stripslashes($signature);
-	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid\]/si", ']', $signature) : $signature;
+	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $signature) : $signature;
 
 	$user_lang = stripslashes($user_lang);
 	$user_dateformat = stripslashes($user_dateformat);
@@ -683,11 +704,11 @@
 	$occupation = $userdata['user_occ'];
 	$interests = $userdata['user_interests'];
 	$signature_bbcode_uid = $userdata['user_sig_bbcode_uid'];
-	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid\]/si", ']', $userdata['user_sig']) : $userdata['user_sig'];
+	$signature = ($signature_bbcode_uid != '') ? preg_replace("/:(([a-z0-9]+:)?)$signature_bbcode_uid(=|\])/si", '\\3', $userdata['user_sig']) : $userdata['user_sig'];
 
 	$viewemail = $userdata['user_viewemail'];
 	$notifypm = $userdata['user_notify_pm'];
-	$popuppm = $userdata['user_popup_pm'];
+	$popup_pm = $userdata['user_popup_pm'];
 	$notifyreply = $userdata['user_notify'];
 	$attachsig = $userdata['user_attachsig'];
 	$allowhtml = $userdata['user_allowhtml'];
@@ -732,7 +753,7 @@
 
 	$allowviewonline = !$allowviewonline;
 
-	display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, &$new_password, &$cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popuppm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']);
+	display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, &$new_password, &$cur_password, $password_confirm, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popup_pm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $userdata['session_id']);
 }
 else
 {
@@ -765,7 +786,7 @@
 		}
 	}
 
-	$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
+	$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
 	if( $mode == 'editprofile' )
 	{
 		$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';
@@ -805,6 +826,15 @@
 		$template->assign_block_vars('switch_edit_profile', array());
 	}
 
+	if ( ($mode == 'register') || ($board_config['allow_namechange']) )
+	{
+		$template->assign_block_vars('switch_namechange_allowed', array());
+	}
+	else
+	{
+		$template->assign_block_vars('switch_namechange_disallowed', array());
+	}
+
 	//
 	// Let's do an overall check for settings/versions which would prevent
 	// us from doing file uploads....
@@ -833,8 +863,8 @@
 		'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',
 		'NOTIFY_PM_YES' => ( $notifypm ) ? 'checked="checked"' : '',
 		'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
-		'POPUP_PM_YES' => ( $popuppm ) ? 'checked="checked"' : '',
-		'POPUP_PM_NO' => ( !$popuppm ) ? 'checked="checked"' : '',
+		'POPUP_PM_YES' => ( $popup_pm ) ? 'checked="checked"' : '',
+		'POPUP_PM_NO' => ( !$popup_pm ) ? 'checked="checked"' : '',
 		'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
 		'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
 		'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
@@ -957,4 +987,4 @@
 
 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/includes/usercp_sendpasswd.php phpBB-2.0.6/includes/usercp_sendpasswd.php
--- phpBB2/includes/usercp_sendpasswd.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/includes/usercp_sendpasswd.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: usercp_sendpasswd.php,v 1.6.2.9 2003/01/10 13:22:00 psotfx Exp $
+ *   $Id: usercp_sendpasswd.php,v 1.6.2.11 2003/05/03 23:24:03 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -29,12 +29,6 @@
 
 if ( isset($HTTP_POST_VARS['submit']) )
 {
-	// session id check
-	if ($sid == '' || $sid != $userdata['session_id'])
-	{
-		message_die(GENERAL_ERROR, 'Invalid_session');
-	}
-
 	$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags($HTTP_POST_VARS['username'])) : '';
 	$email = ( !empty($HTTP_POST_VARS['email']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : '';
 
@@ -71,12 +65,12 @@
 			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 			$emailer = new emailer($board_config['smtp_delivery']);
 
-			$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
+			$emailer->from($board_config['board_email']);
+			$emailer->replyto($board_config['board_email']);
 
 			$emailer->use_template('user_activate_passwd', $row['user_lang']);
 			$emailer->email_address($row['user_email']);
 			$emailer->set_subject($lang['New_password_activation']);
-			$emailer->extra_headers($email_headers);
 
 			$emailer->assign_vars(array(
 				'SITENAME' => $board_config['sitename'], 
@@ -133,7 +127,7 @@
 	'L_SUBMIT' => $lang['Submit'],
 	'L_RESET' => $lang['Reset'],
 	
-	'S_HIDDEN_FIELDS' => '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />', 
+	'S_HIDDEN_FIELDS' => '', 
 	'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=sendpassword"))
 );
 
diff -ur phpBB2/includes/usercp_viewprofile.php phpBB-2.0.6/includes/usercp_viewprofile.php
--- phpBB2/includes/usercp_viewprofile.php	2003-01-15 13:34:12.000000000 +0000
+++ phpBB-2.0.6/includes/usercp_viewprofile.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: usercp_viewprofile.php,v 1.5 2002/03/31 00:06:34 psotfx Exp $
+ *   $Id: usercp_viewprofile.php,v 1.5.2.1 2003/02/25 23:28:30 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -31,7 +31,7 @@
 {
 	message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
 }
-$profiledata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));
+$profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);
 
 $sql = "SELECT *
 	FROM " . RANKS_TABLE . "
diff -ur phpBB2/install/install.php phpBB-2.0.6/install/install.php
--- phpBB2/install/install.php	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/install.php	2003-07-20 15:27:29.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: install.php,v 1.6.2.7 2003/01/06 09:30:12 bartvb Exp $
+ *   $Id: install.php,v 1.6.2.12 2003/05/17 17:32:25 acydburn Exp $
  *
  ***************************************************************************/
 
@@ -99,7 +99,7 @@
 
 ?>
 					<tr> 
-					  <td class="catbottom" align="center" colspan="2"><?php echo $hidden; ?><input class="mainoption" type="submit" value="<?php echo $submit; ?>" /></td>
+					  <td class="catBottom" align="center" colspan="2"><?php echo $hidden; ?><input class="mainoption" type="submit" value="<?php echo $submit; ?>" /></td>
 					</tr>
 <?php
 
@@ -111,10 +111,10 @@
 
 ?>
 					<tr>
-						<td class="catbottom" align="center" colspan="2"><?php echo $lang['continue_upgrade']; ?></td>
+						<td class="catBottom" align="center" colspan="2"><?php echo $lang['continue_upgrade']; ?></td>
 					</tr>
 					<tr>
-						<td class="catbottom" align="center" colspan="2"><input type="submit" name="upgrade_now" value="<?php echo $lang['upgrade_submit']; ?>" /></td>
+						<td class="catBottom" align="center" colspan="2"><input type="submit" name="upgrade_now" value="<?php echo $lang['upgrade_submit']; ?>" /></td>
 					</tr>
 <?php 
 
@@ -370,7 +370,7 @@
 
 $dbms = isset($HTTP_POST_VARS['dbms']) ? $HTTP_POST_VARS['dbms'] : '';
 
-$dbhost = (!empty($HTTP_POST_VARS['dbhost'])) ? $HTTP_POST_VARS['dbhost'] : '';
+$dbhost = (!empty($HTTP_POST_VARS['dbhost'])) ? $HTTP_POST_VARS['dbhost'] : 'localhost';
 $dbuser = (!empty($HTTP_POST_VARS['dbuser'])) ? $HTTP_POST_VARS['dbuser'] : '';
 $dbpasswd = (!empty($HTTP_POST_VARS['dbpasswd'])) ? $HTTP_POST_VARS['dbpasswd'] : '';
 $dbname = (!empty($HTTP_POST_VARS['dbname'])) ? $HTTP_POST_VARS['dbname'] : '';
@@ -443,7 +443,7 @@
 // Is phpBB already installed? Yes? Redirect to the index
 if (defined("PHPBB_INSTALLED"))
 {
-	redirect('index.'.$phpEx);
+	redirect('../index.'.$phpEx);
 }
 
 // Import language file, setup template ...
@@ -463,7 +463,7 @@
 if (!empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 1 && empty($HTTP_POST_VARS['upgrade_now']))
 {
 	header('Content-Type: text/x-delimtext; name="config.' . $phpEx . '"');
-	header('Content-disposition: attachment; filename=config.' . $phpEx . '"');
+	header('Content-disposition: attachment; filename="config.' . $phpEx . '"');
 
 	// We need to stripslashes no matter what the setting of magic_quotes_gpc is
 	// because we add slashes at the top if its off, and they are added automaticlly 
@@ -493,11 +493,11 @@
 						<td class="row2"><input type="text" name="ftp_dir"></td>
 					</tr>
 					<tr>
-						<td class="row1" align="right"><span class="gen"><?php echo $lang['ftp_password']; ?></span></td>
+						<td class="row1" align="right"><span class="gen"><?php echo $lang['ftp_username']; ?></span></td>
 						<td class="row2"><input type="text" name="ftp_user"></td>
 					</tr>
 					<tr>
-						<td class="row1" align="right"><span class="gen"><?php echo $lang['ftp_username']; ?></span></td>
+						<td class="row1" align="right"><span class="gen"><?php echo $lang['ftp_password']; ?></span></td>
 						<td class="row2"><input type="password" name="ftp_pass"></td>
 					</tr>
 <?php
Binary files phpBB2/install/schemas/ms_access_primer.zip and phpBB-2.0.6/install/schemas/ms_access_primer.zip differ
diff -ur phpBB2/install/schemas/mssql_basic.sql phpBB-2.0.6/install/schemas/mssql_basic.sql
--- phpBB2/install/schemas/mssql_basic.sql	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/schemas/mssql_basic.sql	2003-07-20 15:27:29.000000000 +0000
@@ -2,7 +2,7 @@
 
   Basic DB data for phpBB2 devel (MSSQL)
 
- $Id: mssql_basic.sql,v 1.1.2.2 2002/12/21 18:31:54 psotfx Exp $
+ $Id: mssql_basic.sql,v 1.1.2.6 2003/07/20 13:14:27 acydburn Exp $
 
 */
 
@@ -41,10 +41,12 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_savebox_privmsgs','50');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host','');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username','');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');
@@ -67,7 +69,7 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.yourdomain.tld');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.4');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.6');
 
 /*
   -- Categories
diff -ur phpBB2/install/schemas/mssql_schema.sql phpBB-2.0.6/install/schemas/mssql_schema.sql
--- phpBB2/install/schemas/mssql_schema.sql	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/schemas/mssql_schema.sql	2003-07-20 15:27:29.000000000 +0000
@@ -2,7 +2,7 @@
 
   mssql_schema.sql for phpBB2 (c) 2001, phpBB Group
 
- $Id: mssql_schema.sql,v 1.1.2.3 2002/12/21 18:31:54 psotfx Exp $
+ $Id: mssql_schema.sql,v 1.1.2.7 2003/06/30 17:18:37 acydburn Exp $
 
 */
 
@@ -48,6 +48,14 @@
 ) ON [PRIMARY]
 GO
 
+
+CREATE TABLE [phpbb_confirm] (
+	[confirm_id] [char] (32) NOT NULL ,
+	[session_id] [char] (32) NOT NULL ,
+	[code] [char] (6) NOT NULL
+) ON [PRIMARY]
+GO
+
 CREATE TABLE [phpbb_disallow] (
 	[disallow_id] [int] IDENTITY (1, 1) NOT NULL ,
 	[disallow_username] [varchar] (100) NULL
@@ -401,6 +409,13 @@
 	)  ON [PRIMARY]
 GO
 
+ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD
+	CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY  CLUSTERED
+	(
+		[session_id],[confirm_id]
+	)  ON [PRIMARY]
+GO
+
 ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD
 	CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY  CLUSTERED
 	(
@@ -553,6 +568,12 @@
 	CONSTRAINT [DF_phpbb_forums_auth_attachments] DEFAULT (0) FOR [auth_attachments]
 GO
 
+ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD
+	CONSTRAINT [DF_phpbb_confirm_confirm_id] DEFAULT ('') FOR [confirm_id],
+	CONSTRAINT [DF_phpbb_confirm_session_id] DEFAULT ('') FOR [session_id],
+	CONSTRAINT [DF_phpbb_confirm_code] DEFAULT ('') FOR [code]
+GO
+
 ALTER TABLE [phpbb_posts] WITH NOCHECK ADD
 	CONSTRAINT [DF_phpbb_posts_enable_bbcode] DEFAULT (1) FOR [enable_bbcode],
 	CONSTRAINT [DF_phpbb_posts_enable_html] DEFAULT (0) FOR [enable_html],
diff -ur phpBB2/install/schemas/mysql_basic.sql phpBB-2.0.6/install/schemas/mysql_basic.sql
--- phpBB2/install/schemas/mysql_basic.sql	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/schemas/mysql_basic.sql	2003-07-20 15:27:29.000000000 +0000
@@ -1,7 +1,7 @@
 #
 # Basic DB data for phpBB2 devel
 #
-# $Id: mysql_basic.sql,v 1.29.2.2 2002/12/21 18:31:54 psotfx Exp $
+# $Id: mysql_basic.sql,v 1.29.2.6 2003/07/20 13:14:27 acydburn Exp $
 
 # -- Config
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('config_id','1');
@@ -23,6 +23,7 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','15');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','50');
@@ -38,6 +39,7 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host','');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username','');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');
@@ -60,7 +62,7 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.myserver.tld');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.4');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.6');
 
 
 # -- Categories
diff -ur phpBB2/install/schemas/mysql_schema.sql phpBB-2.0.6/install/schemas/mysql_schema.sql
--- phpBB2/install/schemas/mysql_schema.sql	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/schemas/mysql_schema.sql	2003-07-20 15:27:29.000000000 +0000
@@ -1,7 +1,7 @@
 #
 # phpBB2 - MySQL schema
 #
-# $Id: mysql_schema.sql,v 1.35.2.3 2002/12/21 00:15:13 psotfx Exp $
+# $Id: mysql_schema.sql,v 1.35.2.7 2003/06/10 12:42:31 psotfx Exp $
 #
 
 #
@@ -93,6 +93,18 @@
 
 # --------------------------------------------------------
 #
+# Table structure for table 'phpbb_confirm'
+#
+CREATE TABLE phpbb_confirm (
+  confirm_id char(32) DEFAULT '' NOT NULL,
+  session_id char(32) DEFAULT '' NOT NULL,
+  code char(6) DEFAULT '' NOT NULL, 
+  PRIMARY KEY  (session_id,confirm_id)
+);
+
+
+# --------------------------------------------------------
+#
 # Table structure for table 'phpbb_disallow'
 #
 CREATE TABLE phpbb_disallow (
diff -ur phpBB2/install/schemas/postgres_basic.sql phpBB-2.0.6/install/schemas/postgres_basic.sql
--- phpBB2/install/schemas/postgres_basic.sql	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/schemas/postgres_basic.sql	2003-07-20 15:27:29.000000000 +0000
@@ -1,7 +1,7 @@
 /*
 * Basic DB data for phpBB2 devel
 *
-* $Id: postgres_basic.sql,v 1.1.2.2 2002/12/21 18:31:54 psotfx Exp $
+* $Id: postgres_basic.sql,v 1.1.2.6 2003/07/20 13:14:28 acydburn Exp $
 */
 
 -- Config
@@ -24,6 +24,7 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','15');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','50');
@@ -39,6 +40,7 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host','');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username','');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password','');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');
@@ -61,7 +63,7 @@
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.yourdomain.tld');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
 INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.4');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.6');
 
 -- Categories
 INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test category 1', 10);
diff -ur phpBB2/install/schemas/postgres_schema.sql phpBB-2.0.6/install/schemas/postgres_schema.sql
--- phpBB2/install/schemas/postgres_schema.sql	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/schemas/postgres_schema.sql	2003-07-20 15:27:29.000000000 +0000
@@ -2,7 +2,7 @@
  phpBB2 PostgreSQL DB schema - phpBB group 2001
 
 
- $Id: postgres_schema.sql,v 1.1.2.2 2003/01/13 16:35:57 psotfx Exp $
+ $Id: postgres_schema.sql,v 1.1.2.4 2003/06/10 12:42:31 psotfx Exp $
 */
 
 CREATE SEQUENCE phpbb_banlist_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
@@ -33,17 +33,28 @@
    auth_reply int2 DEFAULT '0' NOT NULL,
    auth_edit int2 DEFAULT '0' NOT NULL,
    auth_delete int2 DEFAULT '0' NOT NULL,
-   auth_announce int2 DEFAULT '0' NOT NULL,
    auth_sticky int2 DEFAULT '0' NOT NULL,
+   auth_announce int2 DEFAULT '0' NOT NULL,
+   auth_vote int2 DEFAULT '0' NOT NULL,
    auth_pollcreate int2 DEFAULT '0' NOT NULL,
    auth_attachments int2 DEFAULT '0' NOT NULL,
-   auth_vote int2 DEFAULT '0' NOT NULL,
    auth_mod int2 DEFAULT '0' NOT NULL,
    CONSTRAINT phpbb_auth_access_pkey PRIMARY KEY (group_id, forum_id)
 );
 
 
 /* --------------------------------------------------------
+  Table structure for table phpbb_confirm
+-------------------------------------------------------- */
+CREATE TABLE phpbb_confirm (
+   confirm_id char(32) DEFAULT '' NOT NULL,
+   session_id char(32) DEFAULT '' NOT NULL,
+   code char(6) DEFAULT '' NOT NULL,
+   CONSTRAINT phpbb_confirm_pkey PRIMARY KEY (session_id, confirm_id)
+);
+
+
+/* --------------------------------------------------------
   Table structure for table phpbb_groups
 -------------------------------------------------------- */
 CREATE TABLE phpbb_groups (
Only in phpBB2/install: update_to_204.php
Only in phpBB-2.0.6/install: update_to_206.php
diff -ur phpBB2/install/upgrade.php phpBB-2.0.6/install/upgrade.php
--- phpBB2/install/upgrade.php	2003-01-15 13:34:15.000000000 +0000
+++ phpBB-2.0.6/install/upgrade.php	2003-07-20 15:27:29.000000000 +0000
@@ -6,7 +6,7 @@
 *     copyright            : (C) 2001 The phpBB Group
 *     email                : support@phpbb.com
 *
-*     $Id: upgrade.php,v 1.1.2.6 2002/12/21 18:31:54 psotfx Exp $
+*     $Id: upgrade.php,v 1.1.2.10 2003/03/18 23:24:01 acydburn Exp $
 *
 ****************************************************************************/
 
@@ -194,7 +194,7 @@
 {
 	global $table_prefix;
 
-	$schemafile = file('db/schemas/mysql_schema.sql');
+	$schemafile = file('schemas/mysql_schema.sql');
 	$tabledata = 0;
 
 	for($i=0; $i < count($schemafile); $i++)
@@ -280,7 +280,7 @@
 {
 	global $table_prefix;
 
-	$insertfile = file('db/schemas/mysql_basic.sql');
+	$insertfile = file('schemas/mysql_basic.sql');
 
 	for($i = 0; $i < count($insertfile); $i++)
 	{
@@ -386,9 +386,8 @@
 
 function end_step($next)
 {
-	global $debug;
-
 	print "<hr /><a href=\"$PHP_SELF?next=$next\">Next step: <b>$next</b></a><br /><br />\n";
+	exit;
 }
 //
 // End functions
@@ -869,7 +868,7 @@
 					$row['user_website'] = addslashes($website);
 					
 					$row['user_icq'] = (ereg("^[0-9]+$", $row['user_icq'])) ? $row['user_icq'] : '';
-					reset($checklength);
+					@reset($checklength);
 
 					while($field = each($checklength))
 					{
@@ -1926,7 +1925,7 @@
 				// Remove common words after the first 2 batches and after every 4th batch after that.
 				if ( $batchcount % 4 == 3 )
 				{
-					remove_common('global', 0.4);
+					remove_common('global', 4/10);
 				}
 
 				print " <span class=\"ok\"><b>OK</b></span><br />\n";
@@ -1936,8 +1935,8 @@
 	}
 }
 
-print "<br />If the upgrade completed without error you may click <a href=\"index.$phpEx\">Here</a> to proceed to the index<br />";
+print "<br />If the upgrade completed without error you may click <a href=\"./../index.$phpEx\">Here</a> to proceed to the index<br />";
 
 common_footer();
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/language/lang_english/email/coppa_welcome_inactive.tpl phpBB-2.0.6/language/lang_english/email/coppa_welcome_inactive.tpl
--- phpBB2/language/lang_english/email/coppa_welcome_inactive.tpl	2003-01-15 13:34:14.000000000 +0000
+++ phpBB-2.0.6/language/lang_english/email/coppa_welcome_inactive.tpl	2003-07-20 15:42:24.000000000 +0000
@@ -44,7 +44,7 @@
 ------------------------------ CUT HERE ------------------------------
 
 
-Once the administrator has recived the above form via fax or regular mail your account will be activated.
+Once the administrator has received the above form via fax or regular mail your account will be activated.
 
 Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account.
 
diff -ur phpBB2/language/lang_english/lang_admin.php phpBB-2.0.6/language/lang_english/lang_admin.php
--- phpBB2/language/lang_english/lang_admin.php	2003-01-15 13:34:14.000000000 +0000
+++ phpBB-2.0.6/language/lang_english/lang_admin.php	2003-07-20 15:42:24.000000000 +0000
@@ -7,7 +7,7 @@
  *     copyright            : (C) 2001 The phpBB Group
  *     email                : support@phpbb.com
  *
- *     $Id: lang_admin.php,v 1.35.2.4 2002/12/18 15:40:18 psotfx Exp $
+ *     $Id: lang_admin.php,v 1.35.2.9 2003/06/10 00:31:19 psotfx Exp $
  *
  ****************************************************************************/
 
@@ -251,7 +251,7 @@
 $lang['Site_name'] = 'Site name';
 $lang['Site_desc'] = 'Site description';
 $lang['Board_disable'] = 'Disable board';
-$lang['Board_disable_explain'] = 'This will make the board unavailable to users. Do not log out when you disable the board because you will not be able to log back in!';
+$lang['Board_disable_explain'] = 'This will make the board unavailable to users. Administrators are able to access the Administration Panel while the board is disabled.';
 $lang['Acct_activation'] = 'Enable account activation';
 $lang['Acc_None'] = 'None'; // These three entries are the type of activation
 $lang['Acc_User'] = 'User';
@@ -331,6 +331,9 @@
 $lang['Cookie_secure_explain'] = 'If your server is running via SSL, set this to enabled, else leave as disabled';
 $lang['Session_length'] = 'Session length [ seconds ]';
 
+// Visual Confirmation
+$lang['Visual_confirm'] = 'Enable Visual Confirmation';
+$lang['Visual_confirm_explain'] = 'Requires users enter a code defined by an image when registering.';
 
 //
 // Forum Management
diff -ur phpBB2/language/lang_english/lang_main.php phpBB-2.0.6/language/lang_english/lang_main.php
--- phpBB2/language/lang_english/lang_main.php	2003-01-15 13:34:14.000000000 +0000
+++ phpBB-2.0.6/language/lang_english/lang_main.php	2003-07-20 15:42:24.000000000 +0000
@@ -6,7 +6,7 @@
  *     copyright            : (C) 2001 The phpBB Group
  *     email                : support@phpbb.com
  *
- *     $Id: lang_main.php,v 1.85.2.9 2002/12/21 18:31:54 psotfx Exp $
+ *     $Id: lang_main.php,v 1.85.2.15 2003/06/10 00:31:19 psotfx Exp $
  *
  ****************************************************************************/
 
@@ -604,6 +604,7 @@
 $lang['Password_mismatch'] = 'The passwords you entered did not match.';
 $lang['Current_password_mismatch'] = 'The current password you supplied does not match that stored in the database.';
 $lang['Password_long'] = 'Your password must be no more than 32 characters.';
+$lang['Too_many_registers'] = 'You have made too many registration attempts. Please try again later.';
 $lang['Username_taken'] = 'Sorry, but this username has already been taken.';
 $lang['Username_invalid'] = 'Sorry, but this username contains an invalid character such as \'.';
 $lang['Username_disallowed'] = 'Sorry, but this username has been disallowed.';
@@ -658,6 +659,17 @@
 
 
 //
+// Visual confirmation system strings
+//
+$lang['Confirm_code_wrong'] = 'The confirmation code you entered was incorrect';
+$lang['Too_many_registers'] = 'You have exceeded the number of registration attempts for this session. Please try again later.';
+$lang['Confirm_code_impaired'] = 'If you are visually impaired or cannot otherwise read this code please contact the %sAdministrator%s for help.';
+$lang['Confirm_code'] = 'Confirmation code';
+$lang['Confirm_code_explain'] = 'Enter the code exactly as you see it. The code is case sensitive and zero has a diagonal line through it.';
+
+
+
+//
 // Memberslist
 //
 $lang['Select_sort_method'] = 'Select sort method';
@@ -873,7 +885,7 @@
 
 $lang['Too_many_error'] = 'You have selected too many posts. You can only select one post to split a topic after!';
 
-$lang['None_selected'] = 'You have no selected any topics to perform this operation on. Please go back and select at least one.';
+$lang['None_selected'] = 'You have not selected any topics to perform this operation on. Please go back and select at least one.';
 $lang['New_forum'] = 'New forum';
 
 $lang['This_posts_IP'] = 'IP address for this post';
@@ -919,6 +931,7 @@
 $lang['10'] = 'GMT + 10 Hours';
 $lang['11'] = 'GMT + 11 Hours';
 $lang['12'] = 'GMT + 12 Hours';
+$lang['13'] = 'GMT + 13 Hours';
 
 // These are displayed in the timezone select box
 $lang['tz']['-12'] = 'GMT - 12 Hours';
diff -ur phpBB2/login.php phpBB-2.0.6/login.php
--- phpBB2/login.php	2003-01-15 13:34:09.000000000 +0000
+++ phpBB-2.0.6/login.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: login.php,v 1.47.2.9 2003/01/02 15:43:59 psotfx Exp $
+ *   $Id: login.php,v 1.47.2.13 2003/06/20 07:40:27 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -54,12 +54,14 @@
 {
 	if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && !$userdata['session_logged_in'] )
 	{
-		$username = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';
+		$username = isset($HTTP_POST_VARS['username']) ? trim(htmlspecialchars($HTTP_POST_VARS['username'])) : '';
+		$username = substr(str_replace("\\'", "'", $username), 0, 25);
+		$username = str_replace("'", "\\'", $username);
 		$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
 
 		$sql = "SELECT user_id, username, user_password, user_active, user_level
 			FROM " . USERS_TABLE . "
-			WHERE username = '" . str_replace("\'", "''", $username) . "'";
+			WHERE username = '" . str_replace("\\'", "''", $username) . "'";
 		if ( !($result = $db->sql_query($sql)) )
 		{
 			message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);
@@ -92,13 +94,13 @@
 				else
 				{
 					$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : '';
-					$redirect = str_replace("?", "&", $redirect);
+					$redirect = str_replace('?', '&', $redirect);
 
 					$template->assign_vars(array(
-						'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx?redirect=$redirect&amp;sid=" . $userdata['session_id'] . '">')
+						'META' => "<meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\">")
 					);
 
-					$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], '<a href="' . "login.$phpEx?redirect=$redirect&amp;sid=" . $userdata['session_id'] . '">', '</a>') . '<br /><br />' .  sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
+					$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], "<a href=\"login.$phpEx?redirect=$redirect\">", '</a>') . '<br /><br />' .  sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
 
 					message_die(GENERAL_MESSAGE, $message);
 				}
@@ -110,22 +112,16 @@
 			$redirect = str_replace("?", "&", $redirect);
 
 			$template->assign_vars(array(
-				'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx?redirect=$redirect&amp;sid=" . $userdata['session_id'] . '">')
+				'META' => "<meta http-equiv=\"refresh\" content=\"3;url=login.$phpEx?redirect=$redirect\">")
 			);
 
-			$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], '<a href="' . "login.$phpEx?redirect=$redirect&amp;sid=" . $userdata['session_id'] . '">', '</a>') . '<br /><br />' .  sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
+			$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], "<a href=\"login.$phpEx?redirect=$redirect\">", '</a>') . '<br /><br />' .  sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
 
 			message_die(GENERAL_MESSAGE, $message);
 		}
 	}
 	else if( ( isset($HTTP_GET_VARS['logout']) || isset($HTTP_POST_VARS['logout']) ) && $userdata['session_logged_in'] )
 	{
-		// session id check
-		if ($sid == '' || $sid != $userdata['session_id'])
-		{
-			message_die(GENERAL_ERROR, 'Invalid_session');
-		}
-
 		if( $userdata['session_logged_in'] )
 		{
 			session_end($userdata['session_id'], $userdata['user_id']);
@@ -201,7 +197,7 @@
 
 		$username = ( $userdata['user_id'] != ANONYMOUS ) ? $userdata['username'] : '';
 
-		$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="redirect" value="' . $forward_page . '" />';
+		$s_hidden_fields = '<input type="hidden" name="redirect" value="' . $forward_page . '" />';
 
 		make_jumpbox('viewforum.'.$phpEx, $forum_id);
 		$template->assign_vars(array(
diff -ur phpBB2/memberlist.php phpBB-2.0.6/memberlist.php
--- phpBB2/memberlist.php	2003-01-15 13:34:10.000000000 +0000
+++ phpBB-2.0.6/memberlist.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: memberlist.php,v 1.36.2.5 2002/12/18 14:14:10 psotfx Exp $
+ *   $Id: memberlist.php,v 1.36.2.8 2003/06/09 13:06:19 psotfx Exp $
  *
  ***************************************************************************/
 
@@ -37,7 +37,7 @@
 
 if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
 {
-	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
+	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? htmlspecialchars($HTTP_POST_VARS['mode']) : htmlspecialchars($HTTP_GET_VARS['mode']);
 }
 else
 {
@@ -117,7 +117,7 @@
 switch( $mode )
 {
 	case 'joined':
-		$order_by = "user_regdate ASC LIMIT $start, " . $board_config['topics_per_page'];
+		$order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
 		break;
 	case 'username':
 		$order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
@@ -306,4 +306,4 @@
 
 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/modcp.php phpBB-2.0.6/modcp.php
--- phpBB2/modcp.php	2003-01-15 13:34:09.000000000 +0000
+++ phpBB-2.0.6/modcp.php	2003-07-26 12:04:09.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: modcp.php,v 1.71.2.18 2003/01/09 00:17:23 psotfx Exp $
+ *   $Id: modcp.php,v 1.71.2.21 2003/07/26 11:41:35 acydburn Exp $
  *
  ***************************************************************************/
 
@@ -221,14 +221,30 @@
 		{
 			include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
 
-			$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ?  $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
+			$topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? $HTTP_POST_VARS['topic_id_list'] : array($topic_id);
 
 			$topic_id_sql = '';
 			for($i = 0; $i < count($topics); $i++)
 			{
-				$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i];
+				$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . intval($topics[$i]);
 			}
 
+			$sql = "SELECT topic_id 
+				FROM " . TOPICS_TABLE . "
+				WHERE topic_id IN ($topic_id_sql)
+					AND forum_id = $forum_id";
+			if ( !($result = $db->sql_query($sql)) )
+			{
+				message_die(GENERAL_ERROR, 'Could not get topic id information', '', __LINE__, __FILE__, $sql);
+			}
+			
+			$topic_id_sql = '';
+			while ($row = $db->sql_fetchrow($result))
+			{
+				$topic_id_sql .= (($topic_id_sql != '') ? ', ' : '') . intval($row['topic_id']);
+			}
+			$db->sql_freeresult($result);
+
 			$sql = "SELECT poster_id, COUNT(post_id) AS posts 
 				FROM " . POSTS_TABLE . " 
 				WHERE topic_id IN ($topic_id_sql) 
@@ -269,7 +285,7 @@
 			$post_id_sql = '';
 			while ( $row = $db->sql_fetchrow($result) )
 			{
-				$post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $row['post_id'];
+				$post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . intval($row['post_id']);
 			}
 			$db->sql_freeresult($result);
 
@@ -433,7 +449,7 @@
 				message_die(GENERAL_MESSAGE, $lang['None_selected']);
 			}
 
-			$new_forum_id = $HTTP_POST_VARS['new_forum'];
+			$new_forum_id = intval($HTTP_POST_VARS['new_forum']);
 			$old_forum_id = $forum_id;
 
 			if ( $new_forum_id != $old_forum_id )
@@ -448,7 +464,8 @@
 
 				$sql = "SELECT * 
 					FROM " . TOPICS_TABLE . " 
-					WHERE topic_id IN ($topic_list) 
+					WHERE topic_id IN ($topic_list)
+						AND forum_id = $old_forum_id
 						AND topic_status <> " . TOPIC_MOVED;
 				if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
 				{
@@ -582,12 +599,13 @@
 		$topic_id_sql = '';
 		for($i = 0; $i < count($topics); $i++)
 		{
-			$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i];
+			$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . intval($topics[$i]);
 		}
 
 		$sql = "UPDATE " . TOPICS_TABLE . " 
 			SET topic_status = " . TOPIC_LOCKED . " 
 			WHERE topic_id IN ($topic_id_sql) 
+				AND forum_id = $forum_id
 				AND topic_moved_id = 0";
 		if ( !($result = $db->sql_query($sql)) )
 		{
@@ -626,12 +644,13 @@
 		$topic_id_sql = '';
 		for($i = 0; $i < count($topics); $i++)
 		{
-			$topic_id_sql .= ( ( $topic_id_sql != "") ? ', ' : '' ) . $topics[$i];
+			$topic_id_sql .= ( ( $topic_id_sql != "") ? ', ' : '' ) . intval($topics[$i]);
 		}
 
 		$sql = "UPDATE " . TOPICS_TABLE . " 
 			SET topic_status = " . TOPIC_UNLOCKED . " 
 			WHERE topic_id IN ($topic_id_sql) 
+				AND forum_id = $forum_id
 				AND topic_moved_id = 0";
 		if ( !($result = $db->sql_query($sql)) )
 		{
@@ -663,15 +682,35 @@
 		$page_title = $lang['Mod_CP'];
 		include($phpbb_root_path . 'includes/page_header.'.$phpEx);
 
+		$post_id_sql = '';
+
 		if (isset($HTTP_POST_VARS['split_type_all']) || isset($HTTP_POST_VARS['split_type_beyond']))
 		{
 			$posts = $HTTP_POST_VARS['post_id_list'];
 
-			$post_id_sql = '';
 			for ($i = 0; $i < count($posts); $i++)
 			{
 				$post_id_sql .= (($post_id_sql != '') ? ', ' : '') . intval($posts[$i]);
 			}
+		}
+
+		if ($post_id_sql != '')
+		{
+			$sql = "SELECT post_id 
+				FROM " . POSTS_TABLE . "
+				WHERE post_id IN ($post_id_sql)
+					AND forum_id = $forum_id";
+			if ( !($result = $db->sql_query($sql)) )
+			{
+				message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql);
+			}
+			
+			$post_id_sql = '';
+			while ($row = $db->sql_fetchrow($result))
+			{
+				$post_id_sql .= (($post_id_sql != '') ? ', ' : '') . intval($row['post_id']);
+			}
+			$db->sql_freeresult($result);
 
 			$sql = "SELECT post_id, poster_id, topic_id, post_time
 				FROM " . POSTS_TABLE . "
@@ -705,7 +744,7 @@
 
 				$new_forum_id = intval($HTTP_POST_VARS['new_forum_id']);
 				$topic_time = time();
-
+				
 				$sql  = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type)
 					VALUES ('" . str_replace("\'", "''", $post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ")";
 				if (!($db->sql_query($sql, BEGIN_TRANSACTION)))
@@ -769,7 +808,7 @@
 				message_die(GENERAL_ERROR, 'Could not get topic/post information', '', __LINE__, __FILE__, $sql);
 			}
 
-			$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="mode" value="split" />';
+			$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" /><input type="hidden" name="mode" value="split" />';
 
 			if( ( $total_posts = $db->sql_numrows($result) ) > 0 )
 			{
@@ -896,7 +935,8 @@
 		// Look up relevent data for this post
 		$sql = "SELECT poster_ip, poster_id 
 			FROM " . POSTS_TABLE . " 
-			WHERE post_id = $post_id";
+			WHERE post_id = $post_id
+				AND forum_id = $forum_id";
 		if ( !($result = $db->sql_query($sql)) )
 		{
 			message_die(GENERAL_ERROR, 'Could not get poster IP information', '', __LINE__, __FILE__, $sql);
@@ -1146,7 +1186,7 @@
 		}
 
 		$template->assign_vars(array(
-			'PAGINATION' => generate_pagination("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id", $forum_topics, $board_config['topics_per_page'], $start),
+			'PAGINATION' => generate_pagination("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;sid=" . $userdata['session_id'], $forum_topics, $board_config['topics_per_page'], $start),
 			'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )), 
 			'L_GOTO_PAGE' => $lang['Goto_page'])
 		);
diff -ur phpBB2/posting.php phpBB-2.0.6/posting.php
--- phpBB2/posting.php	2003-01-15 13:34:10.000000000 +0000
+++ phpBB-2.0.6/posting.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: posting.php,v 1.159.2.15 2002/12/03 17:43:59 psotfx Exp $
+ *   $Id: posting.php,v 1.159.2.18 2003/06/07 17:52:31 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -120,26 +120,6 @@
 }
 
 //
-// Compare sid ... if sids don't match
-// output message ... note that AOL'ers may
-// obtain this error until the session code
-// is modified to change the 6 to 4 in the IP
-// comparison checks ... or if a user takes
-// longer than session time to submit the form
-// both can be easily altered by the admin
-//
-if ( $submit || $refresh )
-{
-	if (!isset($HTTP_POST_VARS['sid']) || $HTTP_POST_VARS['sid'] != $userdata['session_id'])
-	{
-		// I've not added this to the language set at this time ... re-releasing
-		// every single language to include this for the once in a blue moon
-		// time it will be output is just not worthwhile at present.
-		message_die(GENERAL_MESSAGE, 'Invalid_session');
-	}
-}
-
-//
 // What auth type do we need to check?
 //
 $is_auth = array();
@@ -434,7 +414,7 @@
 	//
 	// Confirm deletion
 	//
-	$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
+	$s_hidden_fields = '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
 	$s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input type="hidden" name="mode" value="delete" />' : '<input type="hidden" name="mode" value="poll_delete" />';
 
 	$l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll'];
@@ -532,6 +512,10 @@
 		$message .=  '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
 		message_die(GENERAL_MESSAGE, $message);
 	}
+	else
+	{
+		redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
+	}
 }
 else if ( $submit || $confirm )
 {
@@ -926,7 +910,7 @@
 	}
 }
 
-$hidden_form_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="mode" value="' . $mode . '" />';
+$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
 
 switch( $mode )
 {
@@ -1078,7 +1062,7 @@
 		'POLL_LENGTH' => $poll_length)
 	);
 
-	if( $mode == 'editpost' && $post_data['edit_poll'] )
+	if( $mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll'])
 	{
 		$template->assign_block_vars('switch_poll_delete_toggle', array());
 	}
diff -ur phpBB2/privmsg.php phpBB-2.0.6/privmsg.php
--- phpBB2/privmsg.php	2003-01-15 13:34:10.000000000 +0000
+++ phpBB-2.0.6/privmsg.php	2003-12-30 17:11:18.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: privmsg.php,v 1.96.2.23 2003/01/15 00:38:13 psotfx Exp $
+ *   $Id: privmsg.php,v 1.96.2.33 2003/12/30 14:17:49 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -35,7 +35,7 @@
 	message_die(GENERAL_MESSAGE, 'PM_disabled');
 }
 
-$html_entities_match = array('#&#', '#<#', '#>#');
+$html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#');
 $html_entities_replace = array('&amp;', '&lt;', '&gt;');
 
 //
@@ -58,6 +58,7 @@
 if ( isset($HTTP_POST_VARS['folder']) || isset($HTTP_GET_VARS['folder']) )
 {
 	$folder = ( isset($HTTP_POST_VARS['folder']) ) ? $HTTP_POST_VARS['folder'] : $HTTP_GET_VARS['folder'];
+	$folder = htmlspecialchars($folder);
 
 	if ( $folder != 'inbox' && $folder != 'outbox' && $folder != 'sentbox' && $folder != 'savebox' )
 	{
@@ -69,16 +70,6 @@
 	$folder = 'inbox';
 }
 
-// session id check
-if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid']))
-{
-	$sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid'];
-}
-else
-{
-	$sid = '';
-}
-
 //
 // Start session management
 //
@@ -102,6 +93,7 @@
 if ( !empty($HTTP_POST_VARS['mode']) || !empty($HTTP_GET_VARS['mode']) )
 {
 	$mode = ( !empty($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
+	$mode = htmlspecialchars($mode);
 }
 else
 {
@@ -371,7 +363,7 @@
 		'quote_img' => '<a href="' . $post_urls['quote'] . '"><img src="' . $images['pm_quotemsg'] . '" alt="' . $lang['Post_quote_pm'] . '" border="0" /></a>',
 		'quote' => '<a href="' . $post_urls['quote'] . '">' . $lang['Post_quote_pm'] . '</a>',
 		'edit_img' => '<a href="' . $post_urls['edit'] . '"><img src="' . $images['pm_editmsg'] . '" alt="' . $lang['Edit_pm'] . '" border="0" /></a>',
-		'edit' => '<a href="' . $post_urls['edit'] . '" />' . $lang['Edit_pm'] . '</a>'
+		'edit' => '<a href="' . $post_urls['edit'] . '">' . $lang['Edit_pm'] . '</a>'
 	);
 
 	if ( $folder == 'inbox' )
@@ -437,7 +429,7 @@
 		$l_box_name = $lang['Sent'];
 	}
 
-	$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="mark[]" value="' . $privmsgs_id . '" />';
+	$s_hidden_fields = '<input type="hidden" name="mark[]" value="' . $privmsgs_id . '" />';
 
 	$page_title = $lang['Read_pm'];
 	include($phpbb_root_path . 'includes/page_header.'.$phpEx);
@@ -664,12 +656,6 @@
 		redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
 	}
 
-	// session id check
-	if ($sid == '' || $sid != $userdata['session_id'])
-	{
-		message_die(GENERAL_ERROR, 'Invalid_session');
-	}
-
 	if ( isset($mark_list) && !is_array($mark_list) )
 	{
 		// Set to empty array instead of '0' if nothing is selected.
@@ -678,7 +664,7 @@
 
 	if ( !$confirm )
 	{
-		$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="mode" value="' . $mode . '" />';
+		$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
 		$s_hidden_fields .= ( isset($HTTP_POST_VARS['delete']) ) ? '<input type="hidden" name="delete" value="true" />' : '<input type="hidden" name="deleteall" value="true" />';
 
 		for($i = 0; $i < count($mark_list); $i++)
@@ -896,12 +882,6 @@
 	{
 		redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
 	}
-
-	// session id check
-	if ($sid == '' || $sid != $userdata['session_id'])
-	{
-		message_die(GENERAL_ERROR, 'Invalid_session');
-	}
 	
 	if (sizeof($mark_list))
 	{
@@ -1079,7 +1059,7 @@
 			message_die(GENERAL_ERROR, 'Could not save private messages', '', __LINE__, __FILE__, $saved_sql);
 		}
 
-		redirect("privmsg.$phpEx?folder=savebox");
+		redirect(append_sid("privmsg.$phpEx?folder=savebox", true));
 	}
 }
 else if ( $submit || $refresh || $mode != '' )
@@ -1150,12 +1130,6 @@
 
 	if ( $submit )
 	{
-		// session id check
-		if ($sid == '' || $sid != $userdata['session_id'])
-		{
-			message_die(GENERAL_ERROR, 'Invalid_session');
-		}
-
 		if ( !empty($HTTP_POST_VARS['username']) )
 		{
 			$to_username = $HTTP_POST_VARS['username'];
@@ -1318,8 +1292,6 @@
 
 			if ( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] )
 			{
-				$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
-
 				$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
 				$script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx;
 				$server_name = trim($board_config['server_name']);
@@ -1329,8 +1301,10 @@
 				include($phpbb_root_path . 'includes/emailer.'.$phpEx);
 				$emailer = new emailer($board_config['smtp_delivery']);
 					
+				$emailer->from($board_config['board_email']);
+				$emailer->replyto($board_config['board_email']);
+
 				$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
-				$emailer->extra_headers($email_headers);
 				$emailer->email_address($to_userdata['user_email']);
 				$emailer->set_subject($lang['Notification_subject']);
 					
@@ -1473,7 +1447,7 @@
 			$privmsg_message = str_replace('<br />', "\n", $privmsg_message);
 			$privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message);
 
-			$user_sig = (  $board_config['allow_sig'] ) ? $privmsg['user_sig'] : '';
+			$user_sig = ( $board_config['allow_sig'] ) ? (($privmsg['privmsgs_type'] == PRIVMSGS_NEW_MAIL) ? $user_sig : $privmsg['user_sig']) : '';
 
 			$to_username = $privmsg['username'];
 			$to_userid = $privmsg['user_id'];
@@ -1594,7 +1568,7 @@
 		$preview_message = make_clickable($preview_message);
 		$preview_message = str_replace("\n", '<br />', $preview_message);
 
-		$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="folder" value="' . $folder . '" />';
+		$s_hidden_fields = '<input type="hidden" name="folder" value="' . $folder . '" />';
 		$s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
 
 		if ( isset($privmsg_id) )
@@ -1716,7 +1690,7 @@
 		$post_a = $lang['Edit_message'];
 	}
 
-	$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="folder" value="' . $folder . '" />';
+	$s_hidden_fields = '<input type="hidden" name="folder" value="' . $folder . '" />';
 	$s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
 	if ( $mode == 'edit' )
 	{
@@ -1728,8 +1702,11 @@
 	//
 	generate_smilies('inline', PAGE_PRIVMSGS);
 
+	$privmsg_subject = preg_replace($html_entities_match, $html_entities_replace, $privmsg_subject);
+	$privmsg_subject = str_replace('"', '&quot;', $privmsg_subject);
+
 	$template->assign_vars(array(
-		'SUBJECT' => preg_replace($html_entities_match, $html_entities_replace, $privmsg_subject), 
+		'SUBJECT' => $privmsg_subject, 
 		'USERNAME' => preg_replace($html_entities_match, $html_entities_replace, $to_username),
 		'MESSAGE' => $privmsg_message,
 		'HTML_STATUS' => $html_status, 
@@ -2082,7 +2059,7 @@
 	'L_SAVE_MARKED' => $lang['Save_marked'], 
 
 	'S_PRIVMSGS_ACTION' => append_sid("privmsg.$phpEx?folder=$folder"),
-	'S_HIDDEN_FIELDS' => '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />',
+	'S_HIDDEN_FIELDS' => '',
 	'S_POST_NEW_MSG' => $post_new_mesg_url,
 	'S_SELECT_MSG_DAYS' => $select_msg_days,
 
diff -ur phpBB2/profile.php phpBB-2.0.6/profile.php
--- phpBB2/profile.php	2003-01-15 13:34:10.000000000 +0000
+++ phpBB-2.0.6/profile.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: profile.php,v 1.193.2.2 2002/12/03 20:55:30 psotfx Exp $
+ *   $Id: profile.php,v 1.193.2.3 2003/03/02 23:16:17 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -115,9 +115,7 @@
 		exit;
 	}
 }
-else
-{
-	redirect(append_sid("index.$phpEx", true));
-}
+
+redirect(append_sid("index.$phpEx", true));
 
 ?>
\ No newline at end of file
diff -ur phpBB2/search.php phpBB-2.0.6/search.php
--- phpBB2/search.php	2003-01-15 13:34:10.000000000 +0000
+++ phpBB-2.0.6/search.php	2003-11-24 18:07:57.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: search.php,v 1.72.2.6 2003/01/09 00:17:23 psotfx Exp $
+ *   $Id: search.php,v 1.72.2.11 2003/11/22 22:36:13 ludovic_arnaud Exp $
  *
  *
  ***************************************************************************/
@@ -144,6 +144,10 @@
 else if ( $search_keywords != '' || $search_author != '' || $search_id )
 {
 	$store_vars = array('search_results', 'total_match_count', 'split_search', 'sort_by', 'sort_dir', 'show_results', 'return_chars');
+	
+	//
+	// Search ID Limiter, decrease this value if you experience further timeout problems with searching forums
+	$limiter = 5000;
 
 	//
 	// Cycle through options ...
@@ -175,7 +179,7 @@
 				{
 					$sql = "SELECT post_id 
 						FROM " . POSTS_TABLE . " 
-						WHERE poster_id = " . $userdata['user_id'];;
+						WHERE poster_id = " . $userdata['user_id'];
 				}
 				else
 				{
@@ -215,6 +219,11 @@
 				$sql = "SELECT post_id 
 					FROM " . POSTS_TABLE . " 
 					WHERE poster_id IN ($matching_userids)";
+				
+				if ($search_time)
+				{
+					$sql .= " AND post_time >= " . $search_time;
+				}
 			}
 
 			if ( !($result = $db->sql_query($sql)) )
@@ -236,7 +245,7 @@
 		{
 			$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt'); 
 			$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt'); 
-		
+
 			$split_search = array();
 			$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ?  split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);	
 
@@ -400,96 +409,153 @@
 		{
 			if ( $show_results == 'topics' )
 			{
-				$where_sql = '';
+				//
+				// This one is a beast, try to seperate it a bit (workaround for connection timeouts)
+				//
+				$search_id_chunks = array();
+				$count = 0;
+				$chunk = 0;
 
-				if ( $search_time )
+				if (count($search_ids) > $limiter)
 				{
-					$where_sql .= ( $search_author == '' && $auth_sql == ''  ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time ";
+					for ($i = 0; $i < count($search_ids); $i++) 
+					{
+						if ($count == $limiter)
+						{
+							$chunk++;
+							$count = 0;
+						}
+					
+						$search_id_chunks[$chunk][$count] = $search_ids[$i];
+						$count++;
+					}
 				}
-
-				if ( $search_author == '' && $auth_sql == '' )
+				else
 				{
-					$sql = "SELECT topic_id 
-						FROM " . POSTS_TABLE . "
-						WHERE post_id IN (" . implode(", ", $search_ids) . ") 
-							$where_sql 
-						GROUP BY topic_id";
+					$search_id_chunks[0] = $search_ids;
 				}
-				else
+
+				$search_ids = array();
+
+				for ($i = 0; $i < count($search_id_chunks); $i++)
 				{
-					$from_sql = POSTS_TABLE . " p"; 
+					$where_sql = '';
 
-					if ( $search_author != '' )
+					if ( $search_time )
 					{
-						$from_sql .= ", " . USERS_TABLE . " u";
-						$where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author' ";
+						$where_sql .= ( $search_author == '' && $auth_sql == ''  ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time ";
 					}
-
-					if ( $auth_sql != '' )
+	
+					if ( $search_author == '' && $auth_sql == '' )
 					{
-						$from_sql .= ", " . FORUMS_TABLE . " f";
-						$where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
+						$sql = "SELECT topic_id 
+							FROM " . POSTS_TABLE . "
+							WHERE post_id IN (" . implode(", ", $search_id_chunks[$i]) . ") 
+							$where_sql 
+							GROUP BY topic_id";
 					}
+					else
+					{
+						$from_sql = POSTS_TABLE . " p"; 
 
-					$sql = "SELECT p.topic_id 
-						FROM $from_sql 
-						WHERE p.post_id IN (" . implode(", ", $search_ids) . ") 
-							$where_sql 
-						GROUP BY p.topic_id";
-				}
+						if ( $search_author != '' )
+						{
+							$from_sql .= ", " . USERS_TABLE . " u";
+							$where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author' ";
+						}
 
-				if ( !($result = $db->sql_query($sql)) )
-				{
-					message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
-				}
+						if ( $auth_sql != '' )
+						{
+							$from_sql .= ", " . FORUMS_TABLE . " f";
+							$where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
+						}
 
-				$search_ids = array();
-				while( $row = $db->sql_fetchrow($result) )
-				{
-					$search_ids[] = $row['topic_id'];
+						$sql = "SELECT p.topic_id 
+							FROM $from_sql 
+							WHERE p.post_id IN (" . implode(", ", $search_id_chunks[$i]) . ") 
+								$where_sql 
+							GROUP BY p.topic_id";
+					}
+
+					if ( !($result = $db->sql_query($sql)) )
+					{
+						message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
+					}
+
+					while ($row = $db->sql_fetchrow($result))
+					{
+						$search_ids[] = $row['topic_id'];
+					}
+					$db->sql_freeresult($result);
 				}
-				$db->sql_freeresult($result);
 
 				$total_match_count = sizeof($search_ids);
 		
 			}
 			else if ( $search_author != '' || $search_time || $auth_sql != '' )
 			{
-				$where_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id IN (' . implode(', ', $search_ids) . ')' : 'p.post_id IN (' . implode(', ', $search_ids) . ')';
-				$from_sql = (  $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . ' p';
+				$search_id_chunks = array();
+				$count = 0;
+				$chunk = 0;
 
-				if ( $search_time )
+				if (count($search_ids) > $limiter)
 				{
-					$where_sql .= ( $search_author == '' && $auth_sql == '' ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time";
+					for ($i = 0; $i < count($search_ids); $i++) 
+					{
+						if ($count == $limiter)
+						{
+							$chunk++;
+							$count = 0;
+						}
+					
+						$search_id_chunks[$chunk][$count] = $search_ids[$i];
+						$count++;
+					}
 				}
-
-				if ( $auth_sql != '' )
+				else
 				{
-					$from_sql .= ", " . FORUMS_TABLE . " f";
-					$where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
+					$search_id_chunks[0] = $search_ids;
 				}
 
-				if ( $search_author != '' )
-				{
-					$from_sql .= ", " . USERS_TABLE . " u";
-					$where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author'";
-				}
+				$search_ids = array();
 
-				$sql = "SELECT p.post_id 
-					FROM $from_sql 
-					WHERE $where_sql";
-				if ( !($result = $db->sql_query($sql)) )
+				for ($i = 0; $i < count($search_id_chunks); $i++)
 				{
-					message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
-				}
+					$where_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id IN (' . implode(', ', $search_id_chunks[$i]) . ')' : 'p.post_id IN (' . implode(', ', $search_id_chunks[$i]) . ')';
+					$select_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id' : 'p.post_id';
+					$from_sql = (  $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . ' p';
 
-				$search_ids = array();
-				while( $row = $db->sql_fetchrow($result) )
-				{
-					$search_ids[] = $row['post_id'];
-				}
+					if ( $search_time )
+					{
+						$where_sql .= ( $search_author == '' && $auth_sql == '' ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time";
+					}
 
-				$db->sql_freeresult($result);
+					if ( $auth_sql != '' )
+					{
+						$from_sql .= ", " . FORUMS_TABLE . " f";
+						$where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
+					}
+
+					if ( $search_author != '' )
+					{
+						$from_sql .= ", " . USERS_TABLE . " u";
+						$where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author'";
+					}
+
+					$sql = "SELECT " . $select_sql . " 
+						FROM $from_sql 
+						WHERE $where_sql";
+					if ( !($result = $db->sql_query($sql)) )
+					{
+						message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
+					}
+
+					while( $row = $db->sql_fetchrow($result) )
+					{
+						$search_ids[] = $row['post_id'];
+					}
+					$db->sql_freeresult($result);
+				}
 
 				$total_match_count = count($search_ids);
 			}
@@ -575,6 +641,21 @@
 		// so we can serialize it and place it in the DB
 		//
 		$store_search_data = array();
+
+		//
+		// Limit the character length (and with this the results displayed at all following pages) to prevent
+		// truncated result arrays. Normally, search results above 12000 are affected.
+		// - to include or not to include
+		/*
+		$max_result_length = 60000;
+		if (strlen($search_results) > $max_result_length)
+		{
+			$search_results = substr($search_results, 0, $max_result_length);
+			$search_results = substr($search_results, 0, strrpos($search_results, ','));
+			$total_match_count = count(explode(', ', $search_results));
+		}
+		*/
+
 		for($i = 0; $i < count($store_vars); $i++)
 		{
 			$store_search_data[$store_vars[$i]] = $$store_vars[$i];
@@ -587,7 +668,7 @@
 		$search_id = mt_rand();
 
 		$sql = "UPDATE " . SEARCH_TABLE . " 
-			SET search_id = $search_id, search_array = '$result_array'
+			SET search_id = $search_id, search_array = '" . str_replace("\'", "''", $result_array) . "'
 			WHERE session_id = '" . $userdata['session_id'] . "'";
 		if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() )
 		{
@@ -601,7 +682,8 @@
 	}
 	else
 	{
-		if ( intval($search_id) )
+		$search_id = intval($search_id);
+		if ( $search_id )
 		{
 			$sql = "SELECT search_array 
 				FROM " . SEARCH_TABLE . " 
@@ -779,11 +861,6 @@
 						$message = preg_replace("/\[.*?:$bbcode_uid:?.*?\]/si", '', $message);
 						$message = preg_replace('/\[url\]|\[\/url\]/si', '', $message);
 						$message = ( strlen($message) > $return_chars ) ? substr($message, 0, $return_chars) . ' ...' : $message;
-
-						if ( count($search_string) )
-						{
-							$message = preg_replace($search_string, $replace_string, $message);
-						}
 					}
 					else
 					{
diff -ur phpBB2/templates/subSilver/admin/forum_edit_body.tpl phpBB-2.0.6/templates/subSilver/admin/forum_edit_body.tpl
--- phpBB2/templates/subSilver/admin/forum_edit_body.tpl	2003-01-15 13:34:18.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/admin/forum_edit_body.tpl	2003-07-20 15:42:24.000000000 +0000
@@ -10,7 +10,7 @@
 	</tr>
 	<tr> 
 	  <td class="row1">{L_FORUM_NAME}</td>
-	  <td class="row2"><input class="post" type="text" size="25" name="forumname" value="{FORUM_NAME}" class="post" /></td>
+	  <td class="row2"><input type="text" size="25" name="forumname" value="{FORUM_NAME}" class="post" /></td>
 	</tr>
 	<tr> 
 	  <td class="row1">{L_FORUM_DESCRIPTION}</td>
@@ -33,11 +33,11 @@
 		  </tr>
 		  <tr> 
 			<td align="right" valign="middle">{L_PRUNE_DAYS}</td>
-			<td align="left" valign="middle">&nbsp;<input class="post" type="text" name="prune_days" value="{PRUNE_DAYS}" size="5" class="post" />&nbsp;{L_DAYS}</td>
+			<td align="left" valign="middle">&nbsp;<input type="text" name="prune_days" value="{PRUNE_DAYS}" size="5" class="post" />&nbsp;{L_DAYS}</td>
 		  </tr>
 		  <tr> 
 			<td align="right" valign="middle">{L_PRUNE_FREQ}</td>
-			<td align="left" valign="middle">&nbsp;<input class="post" type="text" name="prune_freq" value="{PRUNE_FREQ}" size="5" class="post" />&nbsp;{L_DAYS}</td>
+			<td align="left" valign="middle">&nbsp;<input type="text" name="prune_freq" value="{PRUNE_FREQ}" size="5" class="post" />&nbsp;{L_DAYS}</td>
 		  </tr>
 	  </table></td>
 	</tr>
diff -ur phpBB2/templates/subSilver/admin/user_edit_body.tpl phpBB-2.0.6/templates/subSilver/admin/user_edit_body.tpl
--- phpBB2/templates/subSilver/admin/user_edit_body.tpl	2003-01-15 13:34:19.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/admin/user_edit_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -28,14 +28,14 @@
 	  <td class="row1"><span class="gen">{L_NEW_PASSWORD}: *</span><br />
 		<span class="gensmall">{L_PASSWORD_IF_CHANGED}</span></td>
 	  <td class="row2"> 
-		<input class="post" type="password" name="password" size="35" maxlength="100" value="" />
+		<input class="post" type="password" name="password" size="35" maxlength="32" value="" />
 	  </td>
 	</tr>
 	<tr> 
 	  <td class="row1"><span class="gen">{L_CONFIRM_PASSWORD}: * </span><br />
 		<span class="gensmall">{L_PASSWORD_CONFIRM_IF_CHANGED}</span></td>
 	  <td class="row2"> 
-		<input class="post" type="password" name="password_confirm" size="35" maxlength="100" value="" />
+		<input class="post" type="password" name="password_confirm" size="35" maxlength="32" value="" />
 	  </td>
 	</tr>
 	<tr> 
diff -ur phpBB2/templates/subSilver/admin/user_select_body.tpl phpBB-2.0.6/templates/subSilver/admin/user_select_body.tpl
--- phpBB2/templates/subSilver/admin/user_select_body.tpl	2003-01-15 13:34:17.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/admin/user_select_body.tpl	2003-07-20 15:42:24.000000000 +0000
@@ -8,6 +8,6 @@
 		<th class="thHead" align="center">{L_USER_SELECT}</th>
 	</tr>
 	<tr>
-		<td class="row1" align="center"><input class="post" type="text" class="post" name="username" maxlength="50" size="20" /> <input type="hidden" name="mode" value="edit" />{S_HIDDEN_FIELDS}<input type="submit" name="submituser" value="{L_LOOK_UP}" class="mainoption" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>
+		<td class="row1" align="center"><input type="text" class="post" name="username" maxlength="50" size="20" /> <input type="hidden" name="mode" value="edit" />{S_HIDDEN_FIELDS}<input type="submit" name="submituser" value="{L_LOOK_UP}" class="mainoption" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>
 	</tr>
 </table></form>
diff -ur phpBB2/templates/subSilver/index_body.tpl phpBB-2.0.6/templates/subSilver/index_body.tpl
--- phpBB2/templates/subSilver/index_body.tpl	2003-01-15 13:34:21.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/index_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -61,7 +61,9 @@
 </table>
 
 <table width="100%" cellpadding="1" cellspacing="1" border="0">
+<tr>
 	<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td>
+</tr>
 </table>
 
 <!-- BEGIN switch_user_logged_out -->
@@ -74,7 +76,7 @@
 	  <td class="row1" align="center" valign="middle" height="28"><span class="gensmall">{L_USERNAME}: 
 		<input class="post" type="text" name="username" size="10" />
 		&nbsp;&nbsp;&nbsp;{L_PASSWORD}: 
-		<input class="post" type="password" name="password" size="10" />
+		<input class="post" type="password" name="password" size="10" maxlength="32" />
 		&nbsp;&nbsp; &nbsp;&nbsp;{L_AUTO_LOGIN} 
 		<input class="text" type="checkbox" name="autologin" />
 		&nbsp;&nbsp;&nbsp; 
diff -ur phpBB2/templates/subSilver/login_body.tpl phpBB-2.0.6/templates/subSilver/login_body.tpl
--- phpBB2/templates/subSilver/login_body.tpl	2003-01-15 13:34:23.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/login_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -25,7 +25,7 @@
 		  <tr> 
 			<td align="right"><span class="gen">{L_PASSWORD}:</span></td>
 			<td> 
-			  <input type="password" name="password" size="25" maxlength="25" />
+			  <input type="password" name="password" size="25" maxlength="32" />
 			</td>
 		  </tr>
 		  <tr align="center"> 
diff -ur phpBB2/templates/subSilver/memberlist_body.tpl phpBB-2.0.6/templates/subSilver/memberlist_body.tpl
--- phpBB2/templates/subSilver/memberlist_body.tpl	2003-01-15 13:34:20.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/memberlist_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -32,7 +32,7 @@
 	</tr>
 	<!-- END memberrow -->
 	<tr> 
-	  <td class="catbottom" colspan="8" height="28">&nbsp;</td>
+	  <td class="catBottom" colspan="8" height="28">&nbsp;</td>
 	</tr>
   </table>
   <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
diff -ur phpBB2/templates/subSilver/overall_header.tpl phpBB-2.0.6/templates/subSilver/overall_header.tpl
--- phpBB2/templates/subSilver/overall_header.tpl	2003-01-15 13:34:21.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/overall_header.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -220,7 +220,7 @@
 </script>
 <!-- END switch_enable_pm_popup -->
 </head>
-<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}" />
+<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">
 
 <a name="top"></a>
 
diff -ur phpBB2/templates/subSilver/posting_body.tpl phpBB-2.0.6/templates/subSilver/posting_body.tpl
--- phpBB2/templates/subSilver/posting_body.tpl	2003-01-15 13:34:21.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/posting_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -96,7 +96,7 @@
 	text = ' ' + text + ' ';
 	if (txtarea.createTextRange && txtarea.caretPos) {
 		var caretPos = txtarea.caretPos;
-		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
+		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
 		txtarea.focus();
 	} else {
 		txtarea.value  += text;
@@ -135,6 +135,7 @@
 function bbstyle(bbnumber) {
 	var txtarea = document.post.message;
 
+	txtarea.focus();
 	donotinsert = false;
 	theSelection = false;
 	bblast = 0;
diff -ur phpBB2/templates/subSilver/privmsgs_read_body.tpl phpBB-2.0.6/templates/subSilver/privmsgs_read_body.tpl
--- phpBB2/templates/subSilver/privmsgs_read_body.tpl	2003-01-15 13:34:23.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/privmsgs_read_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -53,7 +53,7 @@
 			<td valign="middle" nowrap="nowrap">{PROFILE_IMG} {PM_IMG} {EMAIL_IMG} 
 			  {WWW_IMG} {AIM_IMG} {YIM_IMG} {MSN_IMG}</td><td>&nbsp;</td><td valign="top" nowrap="nowrap"><script language="JavaScript" type="text/javascript"><!-- 
 
-		if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 )
+		if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
 			document.write('{ICQ_IMG}');
 		else
 			document.write('<div style="position:relative"><div style="position:absolute">{ICQ_IMG}</div><div style="position:absolute;left:3px">{ICQ_STATUS_IMG}</div></div>');
diff -ur phpBB2/templates/subSilver/profile_add_body.tpl phpBB-2.0.6/templates/subSilver/profile_add_body.tpl
--- phpBB2/templates/subSilver/profile_add_body.tpl	2003-01-15 13:34:21.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/profile_add_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -16,10 +16,18 @@
 	<tr> 
 		<td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
 	</tr>
+	<!-- BEGIN switch_namechange_disallowed -->
+	<tr> 
+		<td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
+		<td class="row2"><input type="hidden" name="username" value="{USERNAME}" /><span class="gen"><b>{USERNAME}</b></span></td>
+	</tr>
+	<!-- END switch_namechange_disallowed -->
+	<!-- BEGIN switch_namechange_allowed -->
 	<tr> 
 		<td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
 		<td class="row2"><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="{USERNAME}" /></td>
 	</tr>
+	<!-- END switch_namechange_allowed -->
 	<tr> 
 		<td class="row1"><span class="gen">{L_EMAIL_ADDRESS}: *</span></td>
 		<td class="row2"><input type="text" class="post" style="width:200px" name="email" size="25" maxlength="255" value="{EMAIL}" /></td>
@@ -29,7 +37,7 @@
 	  <td class="row1"><span class="gen">{L_CURRENT_PASSWORD}: *</span><br />
 		<span class="gensmall">{L_CONFIRM_PASSWORD_EXPLAIN}</span></td>
 	  <td class="row2"> 
-		<input type="password" class="post" style="width: 200px" name="cur_password" size="25" maxlength="100" value="{CUR_PASSWORD}" />
+		<input type="password" class="post" style="width: 200px" name="cur_password" size="25" maxlength="32" value="{CUR_PASSWORD}" />
 	  </td>
 	</tr>
 	<!-- END switch_edit_profile -->
@@ -37,16 +45,26 @@
 	  <td class="row1"><span class="gen">{L_NEW_PASSWORD}: *</span><br />
 		<span class="gensmall">{L_PASSWORD_IF_CHANGED}</span></td>
 	  <td class="row2"> 
-		<input type="password" class="post" style="width: 200px" name="new_password" size="25" maxlength="100" value="{NEW_PASSWORD}" />
+		<input type="password" class="post" style="width: 200px" name="new_password" size="25" maxlength="32" value="{NEW_PASSWORD}" />
 	  </td>
 	</tr>
 	<tr> 
 	  <td class="row1"><span class="gen">{L_CONFIRM_PASSWORD}: * </span><br />
 		<span class="gensmall">{L_PASSWORD_CONFIRM_IF_CHANGED}</span></td>
 	  <td class="row2"> 
-		<input type="password" class="post" style="width: 200px" name="password_confirm" size="25" maxlength="100" value="{PASSWORD_CONFIRM}" />
+		<input type="password" class="post" style="width: 200px" name="password_confirm" size="25" maxlength="32" value="{PASSWORD_CONFIRM}" />
 	  </td>
 	</tr>
+	<!-- Visual Confirmation -->
+	<!-- BEGIN switch_confirm -->
+	<tr>
+		<td class="row1" colspan="2" align="center"><span class="gensmall">{L_CONFIRM_CODE_IMPAIRED}</span><br /><br />{CONFIRM_IMG}<br /><br /></td>
+	</tr>
+	<tr> 
+	  <td class="row1"><span class="gen">{L_CONFIRM_CODE}: * </span><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td>
+	  <td class="row2"><input type="text" class="post" style="width: 200px" name="confirm_code" size="6" maxlength="6" value="" /></td>
+	</tr>
+	<!-- END switch_confirm -->
 	<tr> 
 	  <td class="catSides" colspan="2" height="28">&nbsp;</td>
 	</tr>
diff -ur phpBB2/templates/subSilver/profile_view_body.tpl phpBB-2.0.6/templates/subSilver/profile_view_body.tpl
--- phpBB2/templates/subSilver/profile_view_body.tpl	2003-01-15 13:34:20.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/profile_view_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -72,7 +72,7 @@
 		  <td valign="middle" nowrap="nowrap" align="right"><span class="gen">{L_ICQ_NUMBER}:</span></td>
 		  <td class="row1"><script language="JavaScript" type="text/javascript"><!-- 
 
-		if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 )
+		if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
 			document.write(' {ICQ_IMG}');
 		else
 			document.write('<table cellspacing="0" cellpadding="0" border="0"><tr><td nowrap="nowrap"><div style="position:relative;height:18px"><div style="position:absolute">{ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{ICQ_STATUS_IMG}</div></div></td></tr></table>');
diff -ur phpBB2/templates/subSilver/viewforum_body.tpl phpBB-2.0.6/templates/subSilver/viewforum_body.tpl
--- phpBB2/templates/subSilver/viewforum_body.tpl	2003-01-15 13:34:20.000000000 +0000
+++ phpBB-2.0.6/templates/subSilver/viewforum_body.tpl	2003-07-20 15:42:25.000000000 +0000
@@ -86,10 +86,10 @@
 				<td class="gensmall">{L_STICKY}</td>
 			</tr>
 			<tr>
-				<td class="gensmall"><img src="{FOLDER_LOCKED_NEW_IMG}" alt="{L_NEW_POSTS_TOPIC_LOCKED}" width="19" height="18" /></td>
+				<td class="gensmall"><img src="{FOLDER_LOCKED_NEW_IMG}" alt="{L_NEW_POSTS_LOCKED}" width="19" height="18" /></td>
 				<td class="gensmall">{L_NEW_POSTS_LOCKED}</td>
 				<td>&nbsp;&nbsp;</td>
-				<td class="gensmall"><img src="{FOLDER_LOCKED_IMG}" alt="{L_NO_NEW_POSTS_TOPIC_LOCKED}" width="19" height="18" /></td>
+				<td class="gensmall"><img src="{FOLDER_LOCKED_IMG}" alt="{L_NO_NEW_POSTS_LOCKED}" width="19" height="18" /></td>
 				<td class="gensmall">{L_NO_NEW_POSTS_LOCKED}</td>
 			</tr>
 		</table></td>
diff -ur phpBB2/viewforum.php phpBB-2.0.6/viewforum.php
--- phpBB2/viewforum.php	2003-01-15 13:34:11.000000000 +0000
+++ phpBB-2.0.6/viewforum.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: viewforum.php,v 1.139.2.9 2002/12/19 17:17:40 psotfx Exp $
+ *   $Id: viewforum.php,v 1.139.2.10 2003/03/04 21:02:44 acydburn Exp $
  *
  *
  ***************************************************************************/
@@ -371,7 +371,7 @@
 
 if ( $is_auth['auth_mod'] )
 {
-	$s_auth_can .= sprintf($lang['Rules_moderate'], "<a href=\"modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;sid=" . $userdata['session_id'] . '">', '</a>');
+	$s_auth_can .= sprintf($lang['Rules_moderate'], "<a href=\"modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;start=" . $start . "&amp;sid=" . $userdata['session_id'] . '">', '</a>');
 }
 
 //
@@ -659,6 +659,8 @@
 		);
 	}
 
+	$topics_count -= $total_announcements;
+
 	$template->assign_vars(array(
 		'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
 		'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )), 
@@ -690,4 +692,4 @@
 //
 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
 
-?>
+?>
\ No newline at end of file
diff -ur phpBB2/viewtopic.php phpBB-2.0.6/viewtopic.php
--- phpBB2/viewtopic.php	2003-01-15 13:34:09.000000000 +0000
+++ phpBB-2.0.6/viewtopic.php	2003-07-20 15:42:23.000000000 +0000
@@ -6,7 +6,7 @@
  *   copyright            : (C) 2001 The phpBB Group
  *   email                : support@phpbb.com
  *
- *   $Id: viewtopic.php,v 1.186.2.23 2003/01/14 13:39:49 psotfx Exp $
+ *   $Id: viewtopic.php,v 1.186.2.32 2003/06/20 16:34:58 psotfx Exp $
  *
  *
  ***************************************************************************/
@@ -29,6 +29,7 @@
 //
 // Start initial var setup
 //
+$topic_id = $post_id = 0;
 if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) )
 {
 	$topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);
@@ -43,6 +44,7 @@
 	$post_id = intval($HTTP_GET_VARS[POST_POST_URL]);
 }
 
+
 $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
 
 if ( !isset($topic_id) && !isset($post_id) )
@@ -103,14 +105,12 @@
 		$sql_ordering = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'ASC' : 'DESC';
 
 		$sql = "SELECT t.topic_id
-			FROM " . TOPICS_TABLE . " t, " . TOPICS_TABLE . " t2, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2
-			WHERE t2.topic_id = $topic_id
-				AND p2.post_id = t2.topic_last_post_id
+			FROM " . TOPICS_TABLE . " t, " . TOPICS_TABLE . " t2
+			WHERE
+				t2.topic_id = $topic_id
 				AND t.forum_id = t2.forum_id
-				AND p.post_id = t.topic_last_post_id
-				AND p.post_time $sql_condition p2.post_time
-				AND p.topic_id = t.topic_id
-			ORDER BY p.post_time $sql_ordering
+				AND t.topic_last_post_id $sql_condition t2.topic_last_post_id
+			ORDER BY t.topic_last_post_id $sql_ordering
 			LIMIT 1";
 		if ( !($result = $db->sql_query($sql)) )
 		{
@@ -134,11 +134,11 @@
 // also allows for direct linking to a post (and the calculation of which
 // page the post is on and the correct display of viewtopic)
 //
-$join_sql_table = ( !isset($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";
-$join_sql = ( !isset($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id";
-$count_sql = ( !isset($post_id) ) ? '' : ", COUNT(p2.post_id) AS prev_posts";
+$join_sql_table = ( empty($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";
+$join_sql = ( empty($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id";
+$count_sql = ( empty($post_id) ) ? '' : ", COUNT(p2.post_id) AS prev_posts";
 
-$order_sql = ( !isset($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";
+$order_sql = ( empty($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";
 
 $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
 	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
@@ -615,7 +615,7 @@
 // If we've got a hightlight set pass it on to pagination,
 // I get annoyed when I lose my highlight after the first page.
 //
-$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order&amp;highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);
+$pagination = ( $highlight != '' ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order&amp;highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);
 
 //
 // Send vars to template
@@ -693,7 +693,7 @@
 		$sql = "SELECT vote_id
 			FROM " . VOTE_USERS_TABLE . "
 			WHERE vote_id = $vote_id
-				AND vote_user_id = " . $userdata['user_id'];
+				AND vote_user_id = " . intval($userdata['user_id']);
 		if ( !($result = $db->sql_query($sql)) )
 		{
 			message_die(GENERAL_ERROR, "Could not obtain user vote data for this topic", '', __LINE__, __FILE__, $sql);
@@ -792,7 +792,7 @@
 			$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
 		}
 
-		$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
+		$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
 
 		$template->assign_vars(array(
 			'POLL_QUESTION' => $vote_title,

