diff -x .svn -aruN 3.0.4.src/adm/index.php 3.0.5.src/adm/index.php
--- 3.0.4.src/adm/index.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/index.php	2009-05-31 05:58:36.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: index.php 8591 2008-06-04 11:40:53Z Kellanved $
+* @version $Id: index.php 9369 2009-03-16 12:08:38Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -131,7 +131,7 @@
 		'ICON_MOVE_UP'				=> '<img src="' . $phpbb_admin_path . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
 		'ICON_MOVE_UP_DISABLED'		=> '<img src="' . $phpbb_admin_path . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
 		'ICON_MOVE_DOWN'			=> '<img src="' . $phpbb_admin_path . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
-		'ICON_MOVE_DOWN_DISABLED'	=> '<img src="' . $phpbb_admin_path . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',		
+		'ICON_MOVE_DOWN_DISABLED'	=> '<img src="' . $phpbb_admin_path . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
 		'ICON_EDIT'					=> '<img src="' . $phpbb_admin_path . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
 		'ICON_EDIT_DISABLED'		=> '<img src="' . $phpbb_admin_path . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
 		'ICON_DELETE'				=> '<img src="' . $phpbb_admin_path . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
@@ -301,8 +301,9 @@
 		break;
 
 		case 'select':
+		case 'select_multiple':
 		case 'custom':
-			
+
 			$return = '';
 
 			if (isset($vars['method']))
@@ -339,12 +340,21 @@
 			}
 			else
 			{
+				if ($tpl_type[0] == 'select_multiple')
+				{
+					$new[$config_key] = @unserialize(trim($new[$config_key]));
+				}
+
 				$args = array($new[$config_key], $key);
 			}
-			
+
 			$return = call_user_func_array($call, $args);
 
-			if ($tpl_type[0] == 'select')
+			if ($tpl_type[0] == 'select_multiple')
+			{
+				$tpl = '<select id="' . $key . '" name="' . $name . '[]" multiple="multiple">' . $return . '</select>';
+			}
+			else if ($tpl_type[0] == 'select')
 			{
 				$tpl = '<select id="' . $key . '" name="' . $name . '">' . $return . '</select>';
 			}
@@ -377,19 +387,19 @@
 	$type	= 0;
 	$min	= 1;
 	$max	= 2;
-	
+
 	foreach ($config_vars as $config_name => $config_definition)
 	{
 		if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
 		{
 			continue;
 		}
-	
+
 		if (!isset($config_definition['validate']))
 		{
 			continue;
 		}
-		
+
 		$validator = explode(':', $config_definition['validate']);
 
 		// Validate a bit. ;) (0 = type, 1 = min, 2= max)
@@ -548,14 +558,14 @@
 function validate_range($value_ary, &$error)
 {
 	global $user;
-	
+
 	$column_types = array(
 		'BOOL'	=> array('php_type' => 'int', 		'min' => 0, 				'max' => 1),
 		'USINT'	=> array('php_type' => 'int',		'min' => 0, 				'max' => 65535),
 		'UINT'	=> array('php_type' => 'int', 		'min' => 0, 				'max' => (int) 0x7fffffff),
 		'INT'	=> array('php_type' => 'int', 		'min' => (int) 0x80000000, 	'max' => (int) 0x7fffffff),
 		'TINT'	=> array('php_type' => 'int',		'min' => -128,				'max' => 127),
-		
+
 		'VCHAR'	=> array('php_type' => 'string', 	'min' => 0, 				'max' => 255),
 	);
 	foreach ($value_ary as $value)
@@ -582,7 +592,7 @@
 				}
 			break;
 
-			case 'int': 
+			case 'int':
 				$min = (isset($column[1])) ? max($column[1],$type['min']) : $type['min'];
 				$max = (isset($column[2])) ? min($column[2],$type['max']) : $type['max'];
 				if ($value['value'] < $min)
diff -x .svn -aruN 3.0.4.src/adm/style/acp_captcha.html 3.0.5.src/adm/style/acp_captcha.html
--- 3.0.4.src/adm/style/acp_captcha.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/acp_captcha.html	2009-05-31 05:58:36.000000000 -0500
@@ -22,6 +22,11 @@
 	<dd><label><input type="radio" class="radio" id="enable_post_confirm" name="enable_post_confirm" value="1"<!-- IF POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label>
 		<label><input type="radio" class="radio" name="enable_post_confirm" value="0"<!-- IF not POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label></dd>
 </dl>
+<dl>
+	<dt><label for="confirm_refresh">{L_VISUAL_CONFIRM_REFRESH}:</label><br /><span>{L_VISUAL_CONFIRM_REFRESH_EXPLAIN}</span></dt>
+	<dd><label><input type="radio" class="radio" id="confirm_refresh" name="confirm_refresh" value="1"<!-- IF CONFIRM_REFRESH --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label>
+	<label><input type="radio" class="radio" name="confirm_refresh" value="0"<!-- IF not CONFIRM_REFRESH --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label></dd>
+</dl>
 <!-- IF GD -->
 <dl>
 	<dt><label for="captcha_gd">{L_CAPTCHA_GD}:</label><br /><span>{L_CAPTCHA_GD_EXPLAIN}</span></dt>
@@ -41,6 +46,26 @@
 	<dt><label for="captcha_gd_y_grid">{L_CAPTCHA_GD_Y_GRID}:</label><br /><span>{L_CAPTCHA_GD_Y_GRID_EXPLAIN}</span></dt>
 	<dd><input id="captcha_gd_y_grid" name="captcha_gd_y_grid" value="{CAPTCHA_GD_Y_GRID}" type="text" /></dd>
 </dl>
+<dl>
+	<dt><label for="captcha_gd_wave">{L_CAPTCHA_GD_WAVE}:</label><br /><span>{L_CAPTCHA_GD_WAVE_EXPLAIN}</span></dt>
+	<dd><label><input id="captcha_gd_wave" name="captcha_gd_wave" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_WAVE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
+		<label><input name="captcha_gd_wave" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_WAVE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
+</dd>
+</dl>
+<dl>
+	<dt><label for="captcha_gd_3d_noise">{L_CAPTCHA_GD_3D_NOISE}:</label><br /><span>{L_CAPTCHA_GD_3D_NOISE_EXPLAIN}</span></dt>
+	<dd><label><input id="captcha_gd_3d_noise" name="captcha_gd_3d_noise" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_3D_NOISE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
+		<label><input name="captcha_gd_3d_noise" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_3D_NOISE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
+</dd>
+</dl>
+<dl>
+	<dt><label for="captcha_gd_fonts">{L_CAPTCHA_GD_FONTS}:</label><br /><span>{L_CAPTCHA_GD_FONTS_EXPLAIN}</span></dt>
+	<dd><label><input id="captcha_gd_fonts" name="captcha_gd_fonts" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 1 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_DEFAULT}</label>
+		<label><input name="captcha_gd_fonts" value="2" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 2 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_NEW}</label>
+		<label><input name="captcha_gd_fonts" value="3" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 3 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_LOWER}</label>
+
+</dd>
+</dl>
 <!-- ENDIF -->
 
 </fieldset>
diff -x .svn -aruN 3.0.4.src/adm/style/acp_database.html 3.0.5.src/adm/style/acp_database.html
--- 3.0.4.src/adm/style/acp_database.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/acp_database.html	2009-05-31 05:58:36.000000000 -0500
@@ -70,8 +70,8 @@
 	</dl>
 	<dl>
 		<dt><label for="where">{L_ACTION}:</label></dt>
-		<dd><label><input type="radio" class="radio" name="where" value="store_and_download" id="where" checked="checked" /> {L_STORE_AND_DOWNLOAD}</label>
-			<label><input type="radio" class="radio" name="where" value="store" /> {L_STORE_LOCAL}</label>
+		<dd>
+			<label><input type="radio" class="radio" name="where" value="store" checked="checked" /> {L_STORE_LOCAL}</label>
 			<label><input type="radio" class="radio" name="where" value="download" /> {L_DOWNLOAD}</label></dd>
 	</dl>
 	<dl>
diff -x .svn -aruN 3.0.4.src/adm/style/acp_email.html 3.0.5.src/adm/style/acp_email.html
--- 3.0.4.src/adm/style/acp_email.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/acp_email.html	2009-05-31 05:58:36.000000000 -0500
@@ -44,7 +44,7 @@
 </dl>
 
 <p class="submit-buttons">
-	<input class="button1" type="submit" id="submit" name="submit" value="{L_EMAIL}" />&nbsp;
+	<input class="button1" type="submit" id="submit" name="submit" value="{L_SEND_EMAIL}" />&nbsp;
 	<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
 </p>
 {S_FORM_TOKEN}
diff -x .svn -aruN 3.0.4.src/adm/style/acp_forums.html 3.0.5.src/adm/style/acp_forums.html
--- 3.0.4.src/adm/style/acp_forums.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/acp_forums.html	2009-05-31 05:58:36.000000000 -0500
@@ -444,7 +444,7 @@
 					<!-- IF forums.FORUM_IMAGE --><div style="float: {S_CONTENT_FLOW_BEGIN}; margin-right: 5px;">{forums.FORUM_IMAGE}</div><!-- ENDIF -->
 					<strong><!-- IF forums.S_FORUM_LINK -->{forums.FORUM_NAME}<!-- ELSE --><a href="{forums.U_FORUM}">{forums.FORUM_NAME}</a><!-- ENDIF --></strong>
 					<!-- IF forums.FORUM_DESCRIPTION --><br /><span>{forums.FORUM_DESCRIPTION}</span><!-- ENDIF -->
-					<!-- IF forums.S_FORUM_POST --><br /><br /><span>{L_TOPICS}: <strong>{forums.FORUM_TOPICS}</strong> / {L_POSTS}: <b>{forums.FORUM_POSTS}</b></span><!-- ENDIF -->
+					<!-- IF forums.S_FORUM_POST --><br /><br /><span>{L_TOPICS}: <strong>{forums.FORUM_TOPICS}</strong> / {L_POSTS}: <strong>{forums.FORUM_POSTS}</strong></span><!-- ENDIF -->
 				</td>
 				<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
 					<!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
diff -x .svn -aruN 3.0.4.src/adm/style/acp_permissions.html 3.0.5.src/adm/style/acp_permissions.html
--- 3.0.4.src/adm/style/acp_permissions.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/acp_permissions.html	2009-05-31 05:58:36.000000000 -0500
@@ -3,7 +3,7 @@
 <a name="maincontent"></a>
 
 <!-- IF S_INTRO -->
-	
+
 	<h1>{L_ACP_PERMISSIONS}</h1>
 
 	{L_ACP_PERMISSIONS_EXPLAIN}
@@ -12,10 +12,12 @@
 
 <!-- IF S_SELECT_VICTIM -->
 
+	<!-- IF U_BACK --><a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">&laquo; {L_BACK}</a><!-- ENDIF -->
+
 	<h1>{L_TITLE}</h1>
 
 	<p>{L_EXPLAIN}</p>
-	
+
 	<!-- IF S_FORUM_NAMES -->
 		<p><strong>{L_FORUMS}:</strong> {FORUM_NAMES}</p>
 	<!-- ENDIF -->
@@ -62,7 +64,7 @@
 
 			</fieldset>
 			</form>
-			
+
 		<!-- ENDIF -->
 
 	<!-- ELSEIF S_SELECT_USER and S_CAN_SELECT_USER -->
@@ -123,7 +125,7 @@
 				<!-- IF S_ALLOW_ALL_SELECT --><dd class="full" style="text-align: right;"><label><input type="checkbox" class="radio" name="all_users" value="1" /> {L_ALL_USERS}</label></dd><!-- ENDIF -->
 			</dl>
 			</fieldset>
-			
+
 			<fieldset class="quick">
 				{S_HIDDEN_FIELDS}
 				{S_FORM_TOKEN}
@@ -154,7 +156,7 @@
 		</div>
 
 		<div style="float: {S_CONTENT_FLOW_END}; width: 48%">
-			
+
 		<!-- IF S_CAN_SELECT_GROUP -->
 
 			<h1>{L_USERGROUPS}</h1>
@@ -168,7 +170,7 @@
 				<!-- IF S_ALLOW_ALL_SELECT --><dd class="full" style="text-align: right;"><label><input type="checkbox" class="radio" name="all_groups" value="1" /> {L_ALL_GROUPS}</label></dd><!-- ENDIF -->
 			</dl>
 			</fieldset>
-			
+
 			<fieldset class="quick">
 				{S_HIDDEN_FIELDS}
 				{S_FORM_TOKEN}
@@ -177,7 +179,7 @@
 			</form>
 
 			<form id="add_groups" method="post" action="{U_ACTION}">
-			
+
 			<fieldset>
 				<legend>{L_ADD_GROUPS}</legend>
 			<dl>
@@ -199,7 +201,7 @@
 	<!-- ELSEIF S_SELECT_USERGROUP_VIEW -->
 
 		<div style="float: {S_CONTENT_FLOW_BEGIN}; width: 48%;">
-		
+
 			<h1>{L_USERS}</h1>
 
 			<form id="users" method="post" action="{U_ACTION}">
@@ -210,7 +212,7 @@
 				<dd class="full"><select style="width: 100%;" name="user_id[]" multiple="multiple" size="5">{S_DEFINED_USER_OPTIONS}</select></dd>
 			</dl>
 			</fieldset>
-			
+
 			<fieldset class="quick">
 				{S_HIDDEN_FIELDS}
 				{S_FORM_TOKEN}
@@ -240,7 +242,7 @@
 		</div>
 
 		<div style="float: {S_CONTENT_FLOW_END}; width: 48%">
-			
+
 			<h1>{L_USERGROUPS}</h1>
 
 			<form id="groups" method="post" action="{U_ACTION}">
@@ -251,7 +253,7 @@
 				<dd class="full"><select style="width: 100%;" name="group_id[]" multiple="multiple" size="5">{S_DEFINED_GROUP_OPTIONS}</select></dd>
 			</dl>
 			</fieldset>
-			
+
 			<fieldset class="quick">
 				{S_HIDDEN_FIELDS}
 				{S_FORM_TOKEN}
@@ -311,11 +313,11 @@
 
 	<!-- IF S_PERMISSION_DROPDOWN -->
 		<form id="pselect" method="post" action="{U_ACTION}">
-	
+
 		<fieldset class="quick" style="float: {S_CONTENT_FLOW_BEGIN};">
 			{S_HIDDEN_FIELDS}
 			{S_FORM_TOKEN}
-			{L_SELECT_TYPE}: <select name="type">{S_PERMISSION_DROPDOWN}</select> 
+			{L_SELECT_TYPE}: <select name="type">{S_PERMISSION_DROPDOWN}</select>
 
 			<input class="button2" type="submit" name="submit" value="{L_GO}" />
 		</fieldset>
@@ -347,7 +349,7 @@
 	</fieldset>
 
 	<br /><br />
-	
+
 	</form>
 
 <!-- ENDIF -->
diff -x .svn -aruN 3.0.4.src/adm/style/acp_search.html 3.0.5.src/adm/style/acp_search.html
--- 3.0.4.src/adm/style/acp_search.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/acp_search.html	2009-05-31 05:58:36.000000000 -0500
@@ -33,6 +33,10 @@
 		<dd><input id="min_search_author_chars" type="text" size="4" maxlength="4" name="config[min_search_author_chars]" value="{MIN_SEARCH_AUTHOR_CHARS}" /></dd>
 	</dl>
 	<dl>
+		<dt><label for="max_num_search_keywords">{L_MAX_NUM_SEARCH_KEYWORDS}:</label><br /><span>{L_MAX_NUM_SEARCH_KEYWORDS_EXPLAIN}</span></dt>
+		<dd><input id="max_num_search_keywords" type="text" size="4" maxlength="4" name="config[max_num_search_keywords]" value="{MAX_NUM_SEARCH_KEYWORDS}" /></dd>
+	</dl>
+	<dl>
 		<dt><label for="search_store_results">{L_SEARCH_STORE_RESULTS}:</label><br /><span>{L_SEARCH_STORE_RESULTS_EXPLAIN}</span></dt>
 		<dd><input id="search_store_results" type="text" size="4" maxlength="6" name="config[search_store_results]" value="{SEARCH_STORE_RESULTS}" /> {L_SECONDS}</dd>
 	</dl>
@@ -130,9 +134,9 @@
 				<!-- END data -->
 				</tbody>
 				</table>
-			
+
 			<!-- ENDIF -->
-			
+
 			<p class="quick">
 			<!-- IF backend.S_INDEXED -->
 				<input class="button2" type="submit" name="action[delete]" value="{L_DELETE_INDEX}" onclick="popup_progress_bar('delete');" />
@@ -142,7 +146,7 @@
 			</p>
 			{S_FORM_TOKEN}
 			</fieldset>
-			
+
 			</form>
 		<!-- END backend -->
 
diff -x .svn -aruN 3.0.4.src/adm/style/acp_styles.html 3.0.5.src/adm/style/acp_styles.html
--- 3.0.4.src/adm/style/acp_styles.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/acp_styles.html	2009-05-31 05:58:36.000000000 -0500
@@ -54,7 +54,7 @@
 	// <![CDATA[
 		function update_image(newimage)
 		{
-			document.getElementById('newimg').src = (newimage) ? '../styles/{A_NAME}/imageset/' + encodeURI(newimage) : 'images/no_image.png';
+			document.getElementById('newimg').src = (newimage) ? '../styles/{A_PATH}/imageset/' + encodeURI(newimage) : 'images/no_image.png';
 		}
 	// ]]>
 	</script>
@@ -455,30 +455,30 @@
 		<legend>{L_TITLE}</legend>
 	<dl>
 		<dt><label for="name">{L_NAME}:</label></dt>
-		<dd><!-- IF S_INSTALL --><b id="name">{NAME}</b><!-- ELSE --><input type="text" id="name" name="name" value="{NAME}" /><!-- ENDIF --></dd>
+		<dd><!-- IF S_INSTALL --><strong id="name">{NAME}</strong><!-- ELSE --><input type="text" id="name" name="name" value="{NAME}" /><!-- ENDIF --></dd>
 	</dl>
 	<dl>
 		<dt><label for="copyright">{L_COPYRIGHT}:</label></dt>
-		<dd><!-- IF S_INSTALL --><b id="copyright">{COPYRIGHT}</b><!-- ELSE --><input type="text" id="copyright" name="copyright" value="{COPYRIGHT}" /><!-- ENDIF --></dd>
+		<dd><!-- IF S_INSTALL --><strong id="copyright">{COPYRIGHT}</strong><!-- ELSE --><input type="text" id="copyright" name="copyright" value="{COPYRIGHT}" /><!-- ENDIF --></dd>
 	</dl>
 	<!-- IF S_SUPERTEMPLATE -->
 	<dl>
 		<dt><label for="inheriting">{L_INHERITING_FROM}:</label></dt>
-		<dd><b id="inheriting">{S_SUPERTEMPLATE}</b></dd>
+		<dd><strong id="inheriting">{S_SUPERTEMPLATE}</strong></dd>
 	</dl>
 	<!-- ENDIF -->
 	<!-- IF S_STYLE and not S_BASIS -->
 		<dl>
 			<dt><label for="template_id">{L_STYLE_TEMPLATE}:</label></dt>
-			<dd><!-- IF S_INSTALL --><b id="template_id">{TEMPLATE_NAME}</b><!-- ELSE --><select id="template_id" name="template_id">{S_TEMPLATE_OPTIONS}</select><!-- ENDIF --></dd>
+			<dd><!-- IF S_INSTALL --><strong id="template_id">{TEMPLATE_NAME}</strong><!-- ELSE --><select id="template_id" name="template_id">{S_TEMPLATE_OPTIONS}</select><!-- ENDIF --></dd>
 		</dl>
 		<dl>
 			<dt><label for="theme_id">{L_STYLE_THEME}:</label></dt>
-			<dd><!-- IF S_INSTALL --><b id="theme_id">{THEME_NAME}</b><!-- ELSE --><select id="theme_id" name="theme_id">{S_THEME_OPTIONS}</select><!-- ENDIF --></dd>
+			<dd><!-- IF S_INSTALL --><strong id="theme_id">{THEME_NAME}</strong><!-- ELSE --><select id="theme_id" name="theme_id">{S_THEME_OPTIONS}</select><!-- ENDIF --></dd>
 		</dl>
 		<dl>
 			<dt><label for="imageset_id">{L_STYLE_IMAGESET}:</label></dt>
-			<dd><!-- IF S_INSTALL --><b id="imageset_id">{IMAGESET_NAME}</b><!-- ELSE --><select id="imageset_id" name="imageset_id">{S_IMAGESET_OPTIONS}</select><!-- ENDIF --></dd>
+			<dd><!-- IF S_INSTALL --><strong id="imageset_id">{IMAGESET_NAME}</strong><!-- ELSE --><select id="imageset_id" name="imageset_id">{S_IMAGESET_OPTIONS}</select><!-- ENDIF --></dd>
 		</dl>
 	<!-- ENDIF -->
 	<!-- IF (S_TEMPLATE or S_THEME) and (S_LOCATION or not S_INSTALL) -->
diff -x .svn -aruN 3.0.4.src/adm/style/install_update.html 3.0.5.src/adm/style/install_update.html
--- 3.0.4.src/adm/style/install_update.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/install_update.html	2009-05-31 05:58:36.000000000 -0500
@@ -192,94 +192,170 @@
 
 		<form id="install_update" method="post" action="{U_UPDATE_ACTION}">
 
-		<!-- IF .files -->
-			<!-- BEGIN files -->
-				<!-- IF files.S_STATUS -->
-					<!-- IF not files.S_FIRST_ROW -->
-						</fieldset></div>
+		<!-- IF .up_to_date -->
+			<h2>{L_FILES_UP_TO_DATE}</h2>
+			<p>{L_FILES_UP_TO_DATE_EXPLAIN}</p>
+
+			<fieldset>
+				<legend><img src="{T_IMAGE_PATH}file_up_to_date.gif" alt="{L_STATUS_UP_TO_DATE}" /></legend>
+			<!-- BEGIN up_to_date -->
+				<dl>
+					<dd class="full" style="text-align: left;"><strong>{up_to_date.FILENAME}</strong></dd>
+				</dl>
+			<!-- END up_to_date -->
+			</fieldset>
+
+		<!-- ENDIF -->
+
+		<!-- IF .new -->
+			<h2>{L_FILES_NEW}</h2>
+			<p>{L_FILES_NEW_EXPLAIN}</p>
+
+			<fieldset>
+				<legend><img src="{T_IMAGE_PATH}file_new.gif" alt="{L_STATUS_NEW}" /></legend>
+			<!-- BEGIN new -->
+				<dl>
+					<dt style="width: 60%;"><strong><!-- IF new.DIR_PART -->{new.DIR_PART}<br /><!-- ENDIF -->{new.FILE_PART}</strong>
+					<!-- IF new.S_CUSTOM --><br /><span><em>{L_FILE_USED}: </em>{new.CUSTOM_ORIGINAL}</span><!-- ENDIF -->
+				</dt>
+				<dd style="margin-left: 60%;">
+					<!-- IF not new.S_BINARY -->[ <a href="{new.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{new.L_SHOW_DIFF}</a>
+					<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF -->
+				</dd>
+				<!-- IF new.S_CUSTOM -->
+					<dd style="margin-left: 60%;"><label><input type="checkbox" name="no_update[]" value="{new.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd>
+				<!-- ENDIF -->
+				</dl>
+			<!-- END new -->
+			</fieldset>
+
+		<!-- ENDIF -->
+
+		<!-- IF .not_modified -->
+			<h2>{L_FILES_NOT_MODIFIED}</h2>
+			<div style="float: {S_CONTENT_FLOW_END};">&raquo; <a href="#" onclick="dE('not_modified', 0); return false;">{L_TOGGLE_DISPLAY}</a></div>
+			<p>{L_FILES_NOT_MODIFIED_EXPLAIN}</p>
+
+			<fieldset id="not_modified" style="display: none;">
+				<legend><img src="{T_IMAGE_PATH}file_not_modified.gif" alt="{L_STATUS_NOT_MODIFIED}" /></legend>
+			<!-- BEGIN not_modified -->
+				<dl>
+					<dt style="width: 60%;"><strong><!-- IF not_modified.DIR_PART -->{not_modified.DIR_PART}<br /><!-- ENDIF -->{not_modified.FILE_PART}</strong>
+						<!-- IF not_modified.S_CUSTOM --><br /><span><em>{L_FILE_USED}: </em>{not_modified.CUSTOM_ORIGINAL}</span><!-- ENDIF -->
+					</dt>
+					<dd style="margin-left: 60%;"><!-- IF not not_modified.S_BINARY -->[ <a href="{not_modified.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{not_modified.L_SHOW_DIFF}</a> ]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --></dd>
+					<!-- IF not_modified.S_CUSTOM -->
+						<dd style="margin-left: 60%;"><label><input type="checkbox" name="no_update[]" value="{not_modified.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd>
 					<!-- ENDIF -->
+				</dl>
+			<!-- END not_modified -->
+			</fieldset>
 
-					<h2>{files.TITLE}</h2>
+		<!-- ENDIF -->
 
-					<!-- IF files.STATUS eq 'not_modified' --><div style="float: {S_CONTENT_FLOW_END};">&raquo; <a href="#" onclick="dE('not_modified', 0); return false;">{L_TOGGLE_DISPLAY}</a></div><!-- ENDIF -->
-					<p>{files.EXPLAIN}</p>
+		<!-- IF .modified -->
+			<h2>{L_FILES_MODIFIED}</h2>
+			<p>{L_FILES_MODIFIED_EXPLAIN}</p>
+
+			<!-- BEGIN modified -->
+			<fieldset>
+				<legend><img src="{T_IMAGE_PATH}file_modified.gif" alt="{L_STATUS_MODIFIED}" /></legend>
+				<dl>
+					<dt style="width: 60%;"><strong><!-- IF modified.DIR_PART -->{modified.DIR_PART}<br /><!-- ENDIF -->{modified.FILE_PART}</strong>
+					<!-- IF modified.S_CUSTOM --><br /><span><em>{L_FILE_USED}: </em>{modified.CUSTOM_ORIGINAL}</span><!-- ENDIF -->
+				</dt>
+				<dd style="margin-left: 60%;">&nbsp;</dd>
+				<!-- IF modified.S_CUSTOM -->
+					<dd style="margin-left: 60%;"><label><input type="checkbox" name="no_update[]" value="{modified.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd>
+				<!-- ENDIF -->
+				</dl>
+				<dl>
+					<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{modified.FILENAME}]" value="0" checked="checked" /> {L_MERGE_MODIFICATIONS_OPTION}</label></dt>
+					<dd style="margin-left: 60%;"><!-- IF not modified.S_BINARY -->[ <a href="{modified.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{modified.L_SHOW_DIFF}</a> ]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --></dd>
+				</dl>
+				<dl>
+					<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{modified.FILENAME}]" value="1" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt>
+					<dd style="margin-left: 60%;"><!-- IF not modified.S_BINARY -->[<a href="{modified.U_VIEW_NO_MERGE_NEW}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE -->&nbsp;<!-- ENDIF --></dd>
+				</dl>
+				<dl>
+					<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{modified.FILENAME}]" value="2" /> {L_MERGE_NO_MERGE_MOD_OPTION}</label></dt>
+					<dd style="margin-left: 60%;"><!-- IF not modified.S_BINARY -->[<a href="{modified.U_VIEW_NO_MERGE_MOD}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE -->&nbsp;<!-- ENDIF --></dd>
+				</dl>
+			</fieldset>
+			<!-- END modified -->
 
-					<div style="display: <!-- IF files.STATUS neq 'not_modified' -->block<!-- ELSE -->none<!-- ENDIF -->;" id="{files.STATUS}">
+		<!-- ENDIF -->
 
-					<fieldset>
-						<legend><img src="{T_IMAGE_PATH}file_{files.STATUS}.gif" alt="{files.L_STATUS}" /></legend>
+		<!-- IF .new_conflict -->
+			<h2>{L_FILES_NEW_CONFLICT}</h2>
+			<p>{L_FILES_NEW_CONFLICT_EXPLAIN}</p>
+
+			<fieldset>
+				<legend><img src="{T_IMAGE_PATH}file_new_conflict.gif" alt="{L_STATUS_NEW_CONFLICT}" /></legend>
+			<!-- BEGIN new_conflict -->
+				<dl>
+					<dt style="width: 60%;"><strong><!-- IF new_conflict.DIR_PART -->{new_conflict.DIR_PART}<br /><!-- ENDIF -->{new_conflict.FILE_PART}</strong>
+					<!-- IF new_conflict.S_CUSTOM --><br /><span><em>{L_FILE_USED}: </em>{new_conflict.CUSTOM_ORIGINAL}</span><!-- ENDIF -->
+				</dt>
+				<dd style="margin-left: 60%;">
+					<!-- IF not new_conflict.S_BINARY -->[ <a href="{new_conflict.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{new_conflict.L_SHOW_DIFF}</a>
+					<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF -->
+				</dd>
+				<!-- IF new_conflict.S_CUSTOM -->
+					<dd style="margin-left: 60%;"><label><input type="checkbox" name="no_update[]" value="{new_conflict.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd>
+				<!-- ENDIF -->
+				</dl>
+			<!-- END new_conflict -->
+			</fieldset>
+
+		<!-- ENDIF -->
+
+		<!-- IF .conflict -->
+			<h2>{L_FILES_CONFLICT}</h2>
+			<p>{L_FILES_CONFLICT_EXPLAIN}</p>
+
+			<!-- BEGIN conflict -->
+			<fieldset>
+				<legend><img src="{T_IMAGE_PATH}file_conflict.gif" alt="{L_STATUS_CONFLICT}" /></legend>
+				<dl>
+					<dt style="width: 60%;"><strong><!-- IF conflict.DIR_PART -->{conflict.DIR_PART}<br /><!-- ENDIF -->{conflict.FILE_PART}</strong>
+						<!-- IF conflict.S_CUSTOM --><br /><span><em>{L_FILE_USED}: </em>{conflict.CUSTOM_ORIGINAL}</span><!-- ENDIF -->
+						<!-- IF conflict.NUM_CONFLICTS --><br /><span>{L_NUM_CONFLICTS}: {conflict.NUM_CONFLICTS}</span><!-- ENDIF -->
+					</dt>
+					<dd style="margin-left: 60%;">
+						<!-- IF not conflict.S_BINARY -->[ <a href="{conflict.U_SHOW_DIFF}">{L_DOWNLOAD_CONFLICTS}</a> ]<br />{L_DOWNLOAD_CONFLICTS_EXPLAIN}
+						<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF -->
+					</dd>
+					<!-- IF conflict.S_CUSTOM -->
+						<dd style="margin-left: 60%;"><label><input type="checkbox" name="no_update[]" value="{conflict.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd>
+					<!-- ENDIF -->
+				</dl>
+				<!-- IF conflict.S_BINARY -->
+					<dl>
+						<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="1" checked="checked" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt>
+						<dd style="margin-left: 60%;">&nbsp;</dd>
+					</dl>
 				<!-- ELSE -->
 					<dl>
-						<!-- IF files.STATUS eq 'up_to_date' -->
-							<dd class="full" style="text-align: left;"><strong>{files.FILENAME}</strong></dd>
-						<!-- ELSE -->
-							<dt style="width: 60%;">
-								<strong><!-- IF files.DIR_PART -->{files.DIR_PART}<br /><!-- ENDIF -->{files.FILE_PART}</strong>
-								<!-- IF files.S_CUSTOM -->
-								<br /><span><em>{L_FILE_USED}: </em>{files.CUSTOM_ORIGINAL}</span>
-								<!-- ENDIF -->
-								<!-- IF files.NUM_CONFLICTS -->
-								<br /><span>{L_NUM_CONFLICTS}: {files.NUM_CONFLICTS}</span>
-								<!-- ENDIF -->
-							</dt>
-							<dd style="margin-left: 60%;"><!-- IF files.STATUS eq 'modified' -->&nbsp;<!-- ELSE --><!-- IF not files.S_BINARY -->[ <a href="{files.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{files.L_SHOW_DIFF}</a> ]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --><!-- ENDIF --></dd>
-							<!-- IF files.S_CUSTOM -->
-								<dd style="margin-left: 60%;"><label><input type="checkbox" name="no_update[]" value="{files.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd>
-							<!-- ENDIF -->
-
-							<!-- IF files.STATUS eq 'modified' -->
-							</dl>
-							<dl>
-								<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{files.FILENAME}]" value="0" checked="checked" /> {L_MERGE_MODIFICATIONS_OPTION}</label></dt>
-								<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[ <a href="{files.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{files.L_SHOW_DIFF}</a> ]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --></dd>
-							</dl>
-							<dl>
-								<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{files.FILENAME}]" value="1" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt>
-								<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[<a href="{files.U_VIEW_NO_MERGE_NEW}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE -->&nbsp;<!-- ENDIF --></dd>
-							</dl>
-							<dl>
-								<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{files.FILENAME}]" value="2" /> {L_MERGE_NO_MERGE_MOD_OPTION}</label></dt>
-								<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[<a href="{files.U_VIEW_NO_MERGE_MOD}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE -->&nbsp;<!-- ENDIF --></dd>
-							</dl>
-							<!-- IF not files.S_LAST_ROW -->
-							</fieldset>
-
-							<fieldset>
-								<legend><img src="{T_IMAGE_PATH}file_{files.STATUS}.gif" alt="{files.L_STATUS}" /></legend>
-							<!-- ENDIF -->
-
-							<!-- ENDIF -->
-
-							<!-- IF files.STATUS eq 'conflict' -->
-							</dl>
-							<dl>
-								<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{files.FILENAME}]" value="1" checked="checked" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt>
-								<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[<a href="{files.U_VIEW_NO_MERGE_NEW}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE -->&nbsp;<!-- ENDIF --></dd>
-							</dl>
-								<!-- IF not files.S_BINARY -->
-									<dl>
-										<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{files.FILENAME}]" value="3" /> {L_MERGE_NEW_FILE_OPTION}</label></dt>
-										<dd style="margin-left: 60%;">[<a href="{files.U_VIEW_NEW_FILE}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]</dd>
-									</dl>
-									<dl>
-										<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{files.FILENAME}]" value="4" /> {L_MERGE_MOD_FILE_OPTION}</label></dt>
-										<dd style="margin-left: 60%;">[<a href="{files.U_VIEW_MOD_FILE}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]</dd>
-									</dl>
-								<!-- ENDIF -->
-							<!-- IF not files.S_LAST_ROW -->
-							</fieldset>
-
-							<fieldset>
-								<legend><img src="{T_IMAGE_PATH}file_{files.STATUS}.gif" alt="{files.L_STATUS}" /></legend>
-							<!-- ENDIF -->
-
-							<!-- ENDIF -->
-						<!-- ENDIF -->
-					<!-- IF files.STATUS neq 'conflict' and files.STATUS neq 'modified' --></dl><!-- ENDIF -->
+						<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="3" checked="checked" /> {L_MERGE_NEW_FILE_OPTION}</label></dt>
+						<dd style="margin-left: 60%;">[<a href="{conflict.U_VIEW_NEW_FILE}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_MODIFIED}</a>]</dd>
+					</dl>
+					<dl>
+						<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="4" /> {L_MERGE_MOD_FILE_OPTION}</label></dt>
+						<dd style="margin-left: 60%;">[<a href="{conflict.U_VIEW_MOD_FILE}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_MODIFIED}</a>]</dd>
+					</dl>
+					<dl>
+						<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="1" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt>
+						<dd style="margin-left: 60%;">[<a href="{conflict.U_VIEW_NO_MERGE_NEW}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]</dd>
+					</dl>
+					<dl>
+						<dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="2" /> {L_MERGE_NO_MERGE_MOD_OPTION}</label></dt>
+						<dd style="margin-left: 60%;">[<a href="{conflict.U_VIEW_NO_MERGE_MOD}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]</dd>
+					</dl>
 				<!-- ENDIF -->
-			<!-- END files -->
+			</fieldset>
+			<!-- END conflict -->
 
-			</fieldset></div>
 		<!-- ENDIF -->
 
 		<br />
@@ -371,7 +447,6 @@
 		<div class="errorbox">
 			<p>{L_CONNECTION_FAILED}<br />{ERROR_MSG}</p>
 		</div>
-
 	<!-- ENDIF -->
 
 	<fieldset>
@@ -387,7 +462,7 @@
 	</dl>
 	<!-- END data -->
 	</fieldset>
-
+	
 	<fieldset class="submit-buttons">
 		{S_HIDDEN_FIELDS}
 		<input class="button2" type="submit" name="check_again" value="{L_BACK}" />
diff -x .svn -aruN 3.0.4.src/adm/style/overall_header.html 3.0.5.src/adm/style/overall_header.html
--- 3.0.4.src/adm/style/overall_header.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/overall_header.html	2009-05-31 05:58:36.000000000 -0500
@@ -28,9 +28,16 @@
 {
 	var page = prompt(jump_page, on_page);
 
-	if (page !== null && !isNaN(page) && page > 0)	
+	if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0)
 	{
-		document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+		if (base_url.indexOf('?') == -1)
+		{
+			document.location.href = base_url + '?start=' + ((page - 1) * per_page);
+		}
+		else
+		{
+			document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+		}
 	}
 }
 
diff -x .svn -aruN 3.0.4.src/adm/style/simple_header.html 3.0.5.src/adm/style/simple_header.html
--- 3.0.4.src/adm/style/simple_header.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/adm/style/simple_header.html	2009-05-31 05:58:36.000000000 -0500
@@ -39,9 +39,16 @@
 {
 	var page = prompt(jump_page, on_page);
 
-	if (page !== null && !isNaN(page) && page > 0)	
+	if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0)
 	{
-		document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+		if (base_url.indexOf('?') == -1)
+		{
+			document.location.href = base_url + '?start=' + ((page - 1) * per_page);
+		}
+		else
+		{
+			document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+		}
 	}
 }
 
diff -x .svn -aruN 3.0.4.src/docs/CHANGELOG.html 3.0.5.src/docs/CHANGELOG.html
--- 3.0.4.src/docs/CHANGELOG.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/docs/CHANGELOG.html	2009-05-31 05:58:35.000000000 -0500
@@ -53,6 +53,7 @@
 <ol>
 	<li><a href="#changelog">Changelog</a>
 	<ol style="list-style-type: lower-roman;">
+		<li><a href="#v304">Changes since 3.0.4</a></li>
 		<li><a href="#v303">Changes since 3.0.3</a></li>
 		<li><a href="#v302">Changes since 3.0.2</a></li>
 		<li><a href="#v301">Changes since 3.0.1</a></li>
@@ -83,7 +84,96 @@
 		<div class="inner"><span class="corners-top"><span></span></span>
 
 		<div class="content">
-	<a name="v303"></a><h3>1.i. Changes since 3.0.3</h3>
+	<a name="v304"></a><h3>1.i. Changes since 3.0.4</h3>
+
+	<ul>
+		<li>[Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)</li>
+		<li>[Fix] Posts incremented for multiple approval of the same topic (Bug #40495 - Patch by TerraFrost)</li>
+		<li>[Fix] Missing end &quot; in quote bb tag deletes text (Bug #40565 - Patch by TerraFrost)</li>
+		<li>[Fix] Friend/foe system displays posts made by foes while composing (Bug #40325 - Patch by TerraFrost and Highway of Life)</li>
+		<li>[Fix] Check forum_image whether it exists (Bug #39005 - Patch by TerraFrost)</li>
+		<li>[Fix] The sql query in acp_users.php lacks a condition (Bug #40275 - Patch by grimskies)</li>
+		<li>[Fix] Added missing read permission information for some phpbb_chmod() calls</li>
+		<li>[Fix] Correctly display future dates (Bug #38755)</li>
+		<li>[Fix] Fix guest/bot session problems with apache authentication plugin (Bug #41085)</li>
+		<li>[Fix] Whois now works reliably for RIRs other than APNIC and RIPE. (Bug #40085)</li>
+		<li>[Fix] Correctly convert Niels' Birthday MOD to the date format used in phpBB3. (Bug #32895)</li>
+		<li>[Fix] Changed the success message when requesting a new password to be more accurate. (Bug #41405)</li>
+		<li>[Fix] Add missing anti-abuse email headers to acp_inactive.php and ucp_resend.php.</li>
+		<li>[Fix] Only remind users in the correct inactive states depending on the board account activation level.</li>
+		<li>[Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #41745, #42265 - Patch by nickvergessen, #38465, #43015)</li>
+		<li>[Fix] Log password changes via password reset function. (Bug #41365)</li>
+		<li>[Fix] Poll, negative durations generate error (Bug #41295 - Patch by TerraFrost)</li>
+		<li>[Fix] Visibility of custom field on registration is incorrectly controlled by setting &quot;display&quot; (Bug #41385 - Patch by Eelke and fade2gray)</li>
+		<li>[Fix] Smilies in username are misparsed on [quote=&quot;&quot;] (Bug #41955 - Patch by TerraFrost)</li>
+		<li>[Fix] Deleting all posts in a topic - bad redirect (Bug #41705 - Patch by TerraFrost)</li>
+		<li>[Fix] Deleted users still appear logged in (Bug #41985 - Patch by TerraFrost)</li>
+		<li>[Fix] Removed redundant code and unnecessary queries in forum management. (Bug #42265 - Patch by nickvergessen)</li>
+		<li>[Fix] Correct mbstring regular expression for the allowable username characters, only affects <code>USERNAME_LETTER_NUM_SPACERS</code>. (Bug #42325)</li>
+		<li>[Fix] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675)</li>
+		<li>[Fix] While post is awaiting approval it can still be edited even though it can not be seen (Bug #41435 - Patch by TerraFrost)</li>
+		<li>[Fix] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.</li>
+		<li>[Fix] Use OS-specific line endings for mail headers. (related to Bug #42755)</li>
+		<li>[Fix] Hide font size options which are bigger than the allowed size in the editor. (Bug #42615 - Patch by nickvergessen)</li>
+		<li>[Fix] Better thumbnail quality with imagemagick. (Bug #42565)</li>
+		<li>[Fix] Fix download count increments for image attachments without corresponding thumbnails. (Bug #42505)</li>
+		<li>[Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)</li>
+		<li>[Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)</li>
+		<li>[Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)</li>
+		<li>[Fix] Deleting private message attachments could delete post attachments. (Bug #42815)</li>
+		<li>[Fix] Do not suppress PHP notices/errors in language packs if DEBUG_EXTRA mode enabled. (Bug #41485)</li>
+		<li>[Fix] Flash files do not display anymore after update to flash player 10 (Bug #41315)</li>
+		<li>[Fix] Use FQDN for SMTP EHLO/HELO command. (Bug #41025)</li>
+		<li>[Fix] Mass Email works again for users with empty jabber address but notification set to 'both'. (Bug #39755)</li>
+		<li>[Fix] Fix race condition for updating post/topic/etc. counter. (Reported by BartVB)</li>
+		<li>[Fix] Fix duplicate creation of acl options in acl_add_options() under certain conditions. (Bug #38385, #40225)</li>
+		<li>[Fix] Cancel when replying to global announcement redirects to first forum - not to the current forum (Bug #41225 - Patch by TerraFrost)</li>
+		<li>[Fix] Cursor Jumps on New Topic in IE (Bug #42455 - Patch by TerraFrost)</li>
+		<li>[Fix] Add indicator to be used in code if session was created (user visits the site for the first time).</li>
+		<li>[Fix] Correctly count topic views for guests visiting the website the first time by entering the topic directly (Bug #43445)</li>
+		<li>[Fix] Fix bug in postgresql db layer for LIMIT ALL clauses (Reported by JRSweets)</li>
+		<li>[Fix] Sort backups by date, newest first (Bug #14818)</li>
+		<li>[Fix] Prevent incomplete backups stored if option &quot;store and download&quot; is selected and admin cancel download by removing the option. (Bug #20325)</li>
+		<li>[Fix] Enforce correct case for template variables</li>
+		<li>[Fix] Set topic_last_view_time on post/reply/edit to circumvent race conditions in auto prune and false removal of topics for manual forum prune (Bug #18055, #43515)</li>
+		<li>[Fix] Correctly split long subject lines according to the used RFC. This fixes extra spaces within long subjects. (Bug #43715)</li>
+		<li>[Fix] Fix skipping messages if using next/prev PM in history links. (Bug #22205)</li>
+		<li>[Fix] Messenger now also able to use a custom language path. (Bug #36545)</li>
+		<li>[Fix] PM Export uses ISO 8601 date now. (Bug #32645)</li>
+		<li>[Fix] Apply append_sid() to newest/latest post links in viewforum/search and UCP main module. (Bug #26815)</li>
+		<li>[Fix] Do not create thumbnail if thumbnail would've the same size as the original image. (Bug #30725)</li>
+		<li>[Fix] Ability to vote in poll is now required for the ability to change existing vote. (Bug #38925)</li>
+		<li>[Fix] Search for 'topic title only' and 'first post' should work again for non-mysql dbms. (Bug #40605)</li>
+		<li>[Fix] Make sure additional information for accessibility is always exposed to screen readers (Bug #44335 - Patch by MarcoZ)</li>
+		<li>[Fix] Approving a topic when some of the posts within that topic have already been approved (Bug #42585 - Patch by TerraFrost)</li>
+		<li>[Fix] Online status shown when post hidden (Bug #35505 - Patch by Raimon)</li>
+		<li>[Fix] memberlist.php display formating can be distorted by posting long URL for website (Bug #36675 - Patch by TerraFrost)</li>
+		<li>[Fix] Display the online status of hidden users to users with the u_viewonline permission when viewing PMs.</li>
+		<li>[Fix] &quot;Select all&quot; selects much too much in Opera (Bug #42885 - Patch by TerraFrost and ToonArmy)</li>
+		<li>[Fix] Correct calculation of source/target forum statistics if mass moving topics with global announcements (Bug #44545)</li>
+		<li>[Fix] Fix column handling in db updater, custom profile fields an db tools for firebird DBMS (Bug #44555)</li>
+		<li>[Fix] IE8 textarea issues (Bug #43305)</li>
+		<li>[Fix] Prevent accounts from being activated by users when admin activation is turned on and the correct activation key is known.</li>
+		<li>[Fix] Allow the installer to operate under PHP 5.3. (Bug #45255)</li>
+		<li>[Change] Default difference view is now 'inline' instead of 'side by side'</li>
+		<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>
+		<li>[Change] Add link to user profile in the MCP for user notes and warn user.</li>
+		<li>[Change] Add IN_PHPBB check to generated cache files. (Reported by bantu)</li>
+		<li>[Change] Add topic icons to prosilver UCP main and subscribed templates (Bug #42735 - Patch by Raimon)</li>
+		<li>[Change] Add unique key to ACL options table to prevent duplicate permission options. (Bug #41835)</li>
+		<li>[Change] Redirect to relevant MCP page of multi-page topic if accessing quickmod tools (Split option for example)</li>
+		<li>[Change] Performance improvements for native fulltext search (Patch by Paul)</li>
+		<li>[Change] Changed jumpto() JS function to be more fail-safe. (But #27635 - Patch by peterkclee)</li>
+		<li>[Feature] Added new options for visual confirmation.</li>
+		<li>[Feature] Allow download of conflicting file for later reference in automatic updater</li>
+		<li>[Feature] Allow translation of custom BBCode help messages. (Patch by bantu)</li>
+		<li>[Feature] db_tools now support create table and drop table.</li>
+		<li>[Feature] Database updater checks for incompatible db schema (MySQL 3.x/4.x against MySQL 4.1.x/5.x/6.x)</li>
+		<li>[Feature] New search option: Maximum number of words allowed to search for.</li>
+		<li>[Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)</li>
+	</ul>
+
+	<a name="v303"></a><h3>1.ii. Changes since 3.0.3</h3>
 
 	<ul>
 		<li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li>
@@ -115,7 +205,7 @@
 		<li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li>
 	</ul>
 
-	<a name="v302"></a><h3>1.ii. Changes since 3.0.2</h3>
+	<a name="v302"></a><h3>1.iii. Changes since 3.0.2</h3>
 
 	<ul>
 		<li>[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)</li>
@@ -214,7 +304,7 @@
 		<li>[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)</li>
 	</ul>
 
-	<a name="v301"></a><h3>1.iii. Changes since 3.0.1</h3>
+	<a name="v301"></a><h3>1.iv. Changes since 3.0.1</h3>
 
 	<ul>
 		<li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li>
@@ -262,7 +352,7 @@
 		<li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li>
 	</ul>
 
-	<a name="v300"></a><h3>1.iv. Changes since 3.0.0</h3>
+	<a name="v300"></a><h3>1.v. Changes since 3.0.0</h3>
 
 	<ul>
 		<li>[Change] Validate birthdays (Bug #15004)</li>
@@ -333,7 +423,7 @@
 		<li>[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)</li>
 	</ul>
 
-	<a name="v30rc8"></a><h3>1.v. Changes since 3.0.RC8</h3>
+	<a name="v30rc8"></a><h3>1.vi. Changes since 3.0.RC8</h3>
 
 	<ul>
 		<li>[Fix] Cleaned usernames contain only single spaces, so &quot;a_name&quot; and &quot;a__name&quot; are treated as the same name (Bug #15634)</li>
@@ -342,7 +432,7 @@
 		<li>[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)</li>
 	</ul>
 
-	<a name="v30rc7"></a><h3>1.vi. Changes since 3.0.RC7</h3>
+	<a name="v30rc7"></a><h3>1.vii. Changes since 3.0.RC7</h3>
 
 	<ul>
 		<li>[Fix] Fixed MSSQL related bug in the update system</li>
@@ -377,7 +467,7 @@
 		<li>[Fix] No duplication of active topics (Bug #15474)</li>
 	</ul>
 
-	<a name="v30rc6"></a><h3>1.vii. Changes since 3.0.RC6</h3>
+	<a name="v30rc6"></a><h3>1.viii. Changes since 3.0.RC6</h3>
 
 	<ul>
 		<li>[Fix] Submitting language changes using acp_language (Bug #14736)</li>
@@ -387,7 +477,7 @@
 		<li>[Fix] Able to request new password (Bug #14743)</li>
 	</ul>
 
-	<a name="v30rc5"></a><h3>1.viii. Changes since 3.0.RC5</h3>
+	<a name="v30rc5"></a><h3>1.ix. Changes since 3.0.RC5</h3>
 
 	<ul>
 		<li>[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.</li>
@@ -450,7 +540,7 @@
 		<li>[Sec] New password hashing mechanism for storing passwords (#i42)</li>
 	</ul>
 
-	<a name="v30rc4"></a><h3>1.ix. Changes since 3.0.RC4</h3>
+	<a name="v30rc4"></a><h3>1.x. Changes since 3.0.RC4</h3>
 
 	<ul>
 		<li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li>
@@ -501,7 +591,7 @@
 		<li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li>
 	</ul>
 
-	<a name="v30rc3"></a><h3>1.x. Changes since 3.0.RC3</h3>
+	<a name="v30rc3"></a><h3>1.xi. Changes since 3.0.RC3</h3>
 
 	<ul>
 		<li>[Fix] Fixing some subsilver2 and prosilver style issues</li>
@@ -610,7 +700,7 @@
 
 	</ul>
 
-	<a name="v30rc2"></a><h3>1.xi. Changes since 3.0.RC2</h3>
+	<a name="v30rc2"></a><h3>1.xii. Changes since 3.0.RC2</h3>
 
 	<ul>
 		<li>[Fix] Re-allow searching within the memberlist</li>
@@ -656,7 +746,7 @@
 
 	</ul>
 
-	<a name="v30rc1"></a><h3>1.xii. Changes since 3.0.RC1</h3>
+	<a name="v30rc1"></a><h3>1.xiii. Changes since 3.0.RC1</h3>
 
 	<ul>
 		<li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li>
diff -x .svn -aruN 3.0.4.src/docs/FAQ.html 3.0.5.src/docs/FAQ.html
--- 3.0.4.src/docs/FAQ.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/docs/FAQ.html	2009-05-31 05:58:35.000000000 -0500
@@ -53,7 +53,7 @@
 
 <!-- add entry about common UTF8 problems (for example wrong uploading, editing) -->
 <ul>
-	<li><a href="#install">I cannot install this it is too difficult! Will you do it?</a></li>
+	<li><a href="#install">I am finding phpBB too difficult to install. Will you do it for me?</a></li>
 	<li><a href="#legal">I am having problems with the admin at a certain board, help!</a></li>
 	<li><a href="#legal">A board has ripped off my graphics/software/etc., stop them!</a></li>
 	<li><a href="#legal">A board is dealing in warez/porn/etc., you need to prevent them doing this!</a></li>
@@ -62,7 +62,7 @@
 	<li><a href="#mail">I keep getting Mail sending errors when I (or my users) post/send PM's/etc.!</a></li>
 	<li><a href="#mail_language">My users are complaining that emails are not in their selected language!</a></li>
 	<li><a href="#aol_browser">My AOL based users keep getting logged out!</a></li>
-	<li><a href="#avatars">No matter what I set the uploadable avatars to I cannot upload one from my computer!</a></li>
+	<li><a href="#avatars">I am unable to upload avatars from my computer, regardless of the settings.</a></li>
 	<li><a href="#gallery_avatars">I just cannot get gallery avatars to appear!</a></li>
 	<li><a href="#permissions">How do I use/set permissions?</a></li>
 	<li><a href="#login_issues">I (or my users) cannot stay logged in to the forum!</a></li>
@@ -78,7 +78,7 @@
 
 	<hr />
 
-	<a name="install"></a><h2>I cannot install this it is too difficult! Will you do it?</h2>
+	<a name="install"></a><h2>I am finding phpBB too difficult to install. Will you do it for me?</h2>
 
 	<div class="paragraph">
 		<div class="inner"><span class="corners-top"><span></span></span>
@@ -205,7 +205,7 @@
 
 	<hr />
 
-<a name="avatars"></a><h2>No matter what I set the uploadable avatars to I cannot upload one from my computer!</h2>
+<a name="avatars"></a><h2>I am unable to upload avatars from my computer, regardless of the settings.</h2>
 
 	<div class="paragraph">
 		<div class="inner"><span class="corners-top"><span></span></span>
diff -x .svn -aruN 3.0.4.src/docs/INSTALL.html 3.0.5.src/docs/INSTALL.html
--- 3.0.4.src/docs/INSTALL.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/docs/INSTALL.html	2009-05-31 05:58:35.000000000 -0500
@@ -273,7 +273,7 @@
 
 	<p>This package is meant for those wanting to only replace changed files from a previous version to the latest version. This package normally contains the changed files from up to five previous versions.</p>
 
-	<p>This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have <samp>3.0.3</samp> you should select the phpBB-3.0.3_to_3.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 the latest version. You should select the appropriate archive for your current version, e.g. if you currently have <samp>3.0.4</samp> you should select the phpBB-3.0.4_to_3.0.5.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>
 
@@ -285,7 +285,7 @@
 
 	<p>The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type <strong>patch</strong> application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the <a href="#update_auto">Automatic update package</a> explained below. It is also the preferred update method.</p>
 
-	<p>A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.3 you need the phpBB-3.0.3_to_3.0.4.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <strong>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</strong> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, 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>A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.4 you need the phpBB-3.0.4_to_3.0.5.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: <strong>patch -cl -d [PHPBB DIRECTORY] -p1 &lt; [PATCH NAME]</strong> (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, 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="#update_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 Modifications (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>
 
diff -x .svn -aruN 3.0.4.src/download/file.php 3.0.5.src/download/file.php
--- 3.0.4.src/download/file.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/download/file.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: file.php 8792 2008-08-28 13:10:05Z Kellanved $
+* @version $Id: file.php 9460 2009-04-17 15:18:03Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -16,7 +16,7 @@
 $phpEx = substr(strrchr(__FILE__, '.'), 1);
 
 
-// Thank you sun. 
+// Thank you sun.
 if (isset($_SERVER['CONTENT_TYPE']))
 {
 	if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
@@ -60,7 +60,7 @@
 	$filename = $_GET['avatar'];
 	$avatar_group = false;
 	$exit = false;
-	
+
 	if ($filename[0] === 'g')
 	{
 		$avatar_group = true;
@@ -87,8 +87,8 @@
 		header("HTTP/1.0 403 Forbidden");
 		$exit = true;
 	}
-	
-	
+
+
 	if (!$exit)
 	{
 		if (!$filename)
@@ -266,7 +266,7 @@
 {
 	$attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename'];
 }
-else if (($display_cat == ATTACHMENT_CATEGORY_NONE || $display_cat == ATTACHMENT_CATEGORY_IMAGE) && !$attachment['is_orphan'])
+else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan'])
 {
 	// Update download count
 	$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
@@ -278,6 +278,7 @@
 if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false)))
 {
 	wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']);
+	file_gc();
 }
 else
 {
@@ -375,7 +376,7 @@
 	}
 	else
 	{
-		header('HTTP/1.0 404 not found');
+		header('HTTP/1.0 404 Not Found');
 	}
 }
 
@@ -463,22 +464,35 @@
 
 	// Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer.
 	$is_ie8 = (strpos(strtolower($user->browser), 'msie 8.0') !== false);
-	header('Content-Type: ' . $attachment['mimetype'] . (($is_ie8) ? '; authoritative=true;' : ''));
+	header('Content-Type: ' . $attachment['mimetype']);
 
-	if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false)))
+	if ($is_ie8)
 	{
-		header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename'])));
-		if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false))
-		{
-			header('expires: -1');
-		}
+		header('X-Content-Type-Options: nosniff');
+	}
+
+	if ($category == ATTACHMENT_CATEGORY_FLASH && request_var('view', 0) === 1)
+	{
+		// We use content-disposition: inline for flash files and view=1 to let it correctly play with flash player 10 - any other disposition will fail to play inline
+		header('Content-Disposition: inline');
 	}
 	else
 	{
-		header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename'])));
-		if ($is_ie8 && (strpos($attachment['mimetype'], 'image') !== 0))
+		if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false)))
+		{
+			header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename'])));
+			if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false))
+			{
+				header('expires: -1');
+			}
+		}
+		else
 		{
-			header('X-Download-Options: noopen');
+			header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename'])));
+			if ($is_ie8 && (strpos($attachment['mimetype'], 'image') !== 0))
+			{
+				header('X-Download-Options: noopen');
+			}
 		}
 	}
 
@@ -656,8 +670,9 @@
 	{
 		if ($last_load !== false && $last_load <= $stamp)
 		{
-			if (@php_sapi_name() === 'CGI')
+			if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi')
 			{
+				// in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though
 				header('Status: 304 Not Modified', true, 304);
 			}
 			else
diff -x .svn -aruN 3.0.4.src/includes/acm/acm_file.php 3.0.5.src/includes/acm/acm_file.php
--- 3.0.4.src/includes/acm/acm_file.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acm/acm_file.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acm
-* @version $Id: acm_file.php 9076 2008-11-22 19:06:42Z acydburn $
+* @version $Id: acm_file.php 9363 2009-03-11 12:53:54Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -89,7 +89,7 @@
 		if ($fp = @fopen($this->cache_dir . 'data_global.' . $phpEx, 'wb'))
 		{
 			@flock($fp, LOCK_EX);
-			fwrite($fp, "<?php\n\$this->vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>");
+			fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>");
 			@flock($fp, LOCK_UN);
 			fclose($fp);
 
@@ -99,17 +99,20 @@
 				include($phpbb_root_path . 'includes/functions.' . $phpEx);
 			}
 
-			phpbb_chmod($this->cache_dir . 'data_global.' . $phpEx, CHMOD_WRITE);
+			phpbb_chmod($this->cache_dir . 'data_global.' . $phpEx, CHMOD_READ | CHMOD_WRITE);
 		}
 		else
 		{
 			// Now, this occurred how often? ... phew, just tell the user then...
 			if (!@is_writable($this->cache_dir))
 			{
-				trigger_error($this->cache_dir . ' is NOT writable.', E_USER_ERROR);
+				// We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload())
+				die($this->cache_dir . ' is NOT writable.');
+				exit;
 			}
 
-			trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx, E_USER_ERROR);
+			die('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx);
+			exit;
 		}
 
 		$this->is_modified = false;
@@ -199,7 +202,7 @@
 			if ($fp = @fopen($this->cache_dir . "data{$var_name}.$phpEx", 'wb'))
 			{
 				@flock($fp, LOCK_EX);
-				fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data =  " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>");
+				fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data =  " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();') . "\n\n?>");
 				@flock($fp, LOCK_UN);
 				fclose($fp);
 
@@ -209,7 +212,7 @@
 					include($phpbb_root_path . 'includes/functions.' . $phpEx);
 				}
 
-				phpbb_chmod($this->cache_dir . "data{$var_name}.$phpEx", CHMOD_WRITE);
+				phpbb_chmod($this->cache_dir . "data{$var_name}.$phpEx", CHMOD_READ | CHMOD_WRITE);
 			}
 		}
 		else
@@ -421,7 +424,7 @@
 			}
 			$db->sql_freeresult($query_result);
 
-			$file = "<?php\n\n/* " . str_replace('*/', '*\/', $query) . " */\n";
+			$file = "<?php\nif (!defined('IN_PHPBB')) exit;\n\n/* " . str_replace('*/', '*\/', $query) . " */\n";
 			$file .= "\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n";
 
 			fwrite($fp, $file . "\n\$this->sql_rowset[\$query_id] = " . (sizeof($this->sql_rowset[$query_id]) ? "unserialize(" . var_export(serialize($this->sql_rowset[$query_id]), true) . ");" : 'array();') . "\n\n?>");
@@ -434,7 +437,7 @@
 				include($phpbb_root_path . 'includes/functions.' . $phpEx);
 			}
 
-			phpbb_chmod($filename, CHMOD_WRITE);
+			phpbb_chmod($filename, CHMOD_READ | CHMOD_WRITE);
 
 			$query_result = $query_id;
 		}
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_attachments.php 3.0.5.src/includes/acp/acp_attachments.php
--- 3.0.4.src/includes/acp/acp_attachments.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_attachments.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_attachments.php 9041 2008-11-02 11:19:12Z acydburn $
+* @version $Id: acp_attachments.php 9398 2009-03-19 17:01:59Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -1003,8 +1003,8 @@
 
 						if ($files_added)
 						{
-							set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
-							set_config('num_files', $config['num_files'] + $files_added, true);
+							set_config_count('upload_dir_size', $space_taken, true);
+							set_config_count('num_files', $files_added, true);
 						}
 					}
 				}
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_captcha.php 3.0.5.src/includes/acp/acp_captcha.php
--- 3.0.4.src/includes/acp/acp_captcha.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_captcha.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_captcha.php 8722 2008-07-29 15:13:13Z Kellanved $
+* @version $Id: acp_captcha.php 9475 2009-04-18 18:43:31Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */
@@ -28,22 +28,26 @@
 		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
 
 		$user->add_lang('acp/board');
-
-
 		$captcha_vars = array(
 			'captcha_gd_x_grid'				=> 'CAPTCHA_GD_X_GRID',
 			'captcha_gd_y_grid'				=> 'CAPTCHA_GD_Y_GRID',
 			'captcha_gd_foreground_noise'	=> 'CAPTCHA_GD_FOREGROUND_NOISE',
-			'captcha_gd'					=> 'CAPTCHA_GD_PREVIEWED'
+			'captcha_gd'					=> 'CAPTCHA_GD_PREVIEWED',
+			'captcha_gd_wave'				=> 'CAPTCHA_GD_WAVE',
+			'captcha_gd_3d_noise'			=> 'CAPTCHA_GD_3D_NOISE',
+			'captcha_gd_fonts'				=> 'CAPTCHA_GD_FONTS',
+
 		);
 
 		if (isset($_GET['demo']))
 		{
 			$captcha_vars = array_keys($captcha_vars);
+
 			foreach ($captcha_vars as $captcha_var)
 			{
 				$config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
 			}
+
 			if ($config['captcha_gd'])
 			{
 				include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
@@ -52,14 +56,16 @@
 			{
 				include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
 			}
+
 			$captcha = new captcha();
-			$captcha->execute(gen_rand_string(mt_rand(5, 8)), time());
+			$captcha->execute(gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)), time());
 			exit;
 		}
 
 		$config_vars = array(
 			'enable_confirm'		=> 'REG_ENABLE',
 			'enable_post_confirm'	=> 'POST_ENABLE',
+			'confirm_refresh'		=> 'CONFIRM_REFRESH',
 			'captcha_gd'			=> 'CAPTCHA_GD',
 		);
 
@@ -73,11 +79,14 @@
 		if ($submit && check_form_key($form_key))
 		{
 			$config_vars = array_keys($config_vars);
+
 			foreach ($config_vars as $config_var)
 			{
 				set_config($config_var, request_var($config_var, ''));
 			}
+
 			$captcha_vars = array_keys($captcha_vars);
+
 			foreach ($captcha_vars as $captcha_var)
 			{
 				$value = request_var($captcha_var, 0);
@@ -86,35 +95,39 @@
 					set_config($captcha_var, $value);
 				}
 			}
+
+			add_log('admin', 'LOG_CONFIG_VISUAL');
 			trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
 		}
 		else if ($submit)
 		{
-				trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
+			trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
 		}
 		else
 		{
-
 			$preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;demo=demo"));
+
 			if (@extension_loaded('gd'))
 			{
 				$template->assign_var('GD', true);
 			}
+
 			foreach ($config_vars as $config_var => $template_var)
 			{
 				$template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ;
 			}
+
 			foreach ($captcha_vars as $captcha_var => $template_var)
 			{
 				$var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
 				$template->assign_var($template_var, $var);
 				$preview_image_src .= "&amp;$captcha_var=" . $var;
 			}
+
 			$template->assign_vars(array(
 				'CAPTCHA_PREVIEW'	=> $preview_image_src,
 				'PREVIEW'			=> isset($_POST['preview']),
 			));
-
 		}
 	}
 }
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_database.php 3.0.5.src/includes/acp/acp_database.php
--- 3.0.4.src/includes/acp/acp_database.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_database.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_database.php 8814 2008-09-04 12:01:47Z acydburn $
+* @version $Id: acp_database.php 9417 2009-03-30 13:52:58Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -27,7 +27,7 @@
 	{
 		global $cache, $db, $user, $auth, $template, $table_prefix;
 		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
-		
+
 		$user->add_lang('acp/database');
 
 		$this->tpl_name = 'acp_database';
@@ -82,6 +82,7 @@
 						}
 
 						@set_time_limit(1200);
+						@set_time_limit(0);
 
 						$time = time();
 
@@ -187,7 +188,7 @@
 						$template->assign_vars(array(
 							'U_ACTION'	=> $this->u_action . '&amp;action=download'
 						));
-						
+
 						$available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2');
 
 						foreach ($available_methods as $type => $module)
@@ -424,27 +425,37 @@
 						$dir = $phpbb_root_path . 'store/';
 						$dh = @opendir($dir);
 
+						$backup_files = array();
+
 						if ($dh)
 						{
 							while (($file = readdir($dh)) !== false)
 							{
 								if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
 								{
-									$supported = in_array($matches[2], $methods);
-
-									if ($supported == 'true')
+									if (in_array($matches[2], $methods))
 									{
-										$template->assign_block_vars('files', array(
-											'FILE'		=> $file,
-											'NAME'		=> gmdate("d-m-Y H:i:s", $matches[1]),
-											'SUPPORTED'	=> $supported
-										));
+										$backup_files[gmdate("d-m-Y H:i:s", $matches[1])] = $file;
 									}
 								}
 							}
 							closedir($dh);
 						}
 
+						if (!empty($backup_files))
+						{
+							krsort($backup_files);
+
+							foreach ($backup_files as $name => $file)
+							{
+								$template->assign_block_vars('files', array(
+									'FILE'		=> $file,
+									'NAME'		=> $name,
+									'SUPPORTED'	=> true,
+								));
+							}
+						}
+
 						$template->assign_vars(array(
 							'U_ACTION'	=> $this->u_action . '&amp;action=submit'
 						));
@@ -508,7 +519,7 @@
 			header('Pragma: no-cache');
 			header("Content-Type: $mimetype; name=\"$name\"");
 			header("Content-disposition: attachment; filename=$name");
-	
+
 			switch ($format)
 			{
 				case 'bzip2':
@@ -527,14 +538,14 @@
 				break;
 			}
 		}
-		
+
 		if ($store == true)
 		{
 			global $phpbb_root_path;
 			$file = $phpbb_root_path . 'store/' . $filename . $ext;
-	
+
 			$this->fp = $open($file, 'w');
-	
+
 			if (!$this->fp)
 			{
 				trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR);
@@ -545,6 +556,7 @@
 	function write_end()
 	{
 		static $close;
+
 		if ($this->store)
 		{
 			if ($close === null)
@@ -662,11 +674,11 @@
 		if ($result != false)
 		{
 			$fields_cnt = mysqli_num_fields($result);
-		
+
 			// Get field information
 			$field = mysqli_fetch_fields($result);
 			$field_set = array();
-		
+
 			for ($j = 0; $j < $fields_cnt; $j++)
 			{
 				$field_set[] = $field[$j]->name;
@@ -679,7 +691,7 @@
 			$first_set		= true;
 			$query_len		= 0;
 			$max_len		= get_usable_memory();
-		
+
 			while ($row = mysqli_fetch_row($result))
 			{
 				$values	= array();
@@ -750,7 +762,7 @@
 				$field[] = mysql_fetch_field($result, $i);
 			}
 			$field_set = array();
-			
+
 			for ($j = 0; $j < $fields_cnt; $j++)
 			{
 				$field_set[] = $field[$j]->name;
@@ -966,7 +978,7 @@
 			$ar[] = $row;
 		}
 		$db->sql_freeresult($result);
-		
+
 		foreach ($ar as $value)
 		{
 			if (strpos($value['name'], 'autoindex') !== false)
@@ -1124,7 +1136,7 @@
 			$sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n";
 		}
 		$db->sql_freeresult($result);
-	
+
 		$field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull
 			FROM pg_class c, pg_attribute a, pg_type t
 			WHERE c.relname = '" . $db->sql_escape($table_name) . "'
@@ -1188,7 +1200,7 @@
 			{
 				$line .= ' NOT NULL';
 			}
-			
+
 			$lines[] = $line;
 		}
 		$db->sql_freeresult($result);
@@ -1388,33 +1400,33 @@
 		$sql_data .= "GO\n";
 		$sql_data .= "\nCREATE TABLE [$table_name] (\n";
 		$rows = array();
-	
+
 		$text_flag = false;
-	
+
 		$sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY
 			FROM INFORMATION_SCHEMA.COLUMNS
 			WHERE TABLE_NAME = '$table_name'";
 		$result = $db->sql_query($sql);
-	
+
 		while ($row = $db->sql_fetchrow($result))
 		{
 			$line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]";
-	
+
 			if ($row['DATA_TYPE'] == 'text')
 			{
 				$text_flag = true;
 			}
-	
+
 			if ($row['IS_IDENTITY'])
 			{
 				$line .= ' IDENTITY (1 , 1)';
 			}
-	
+
 			if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text')
 			{
 				$line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')';
 			}
-	
+
 			if ($row['IS_NULLABLE'] == 'YES')
 			{
 				$line .= ' NULL';
@@ -1423,27 +1435,27 @@
 			{
 				$line .= ' NOT NULL';
 			}
-	
+
 			if ($row['COLUMN_DEFAULT'])
 			{
 				$line .= ' DEFAULT ' . $row['COLUMN_DEFAULT'];
 			}
-	
+
 			$rows[] = $line;
 		}
 		$db->sql_freeresult($result);
-	
+
 		$sql_data .= implode(",\n", $rows);
 		$sql_data .= "\n) ON [PRIMARY]";
-	
+
 		if ($text_flag)
 		{
 			$sql_data .= " TEXTIMAGE_ON [PRIMARY]";
 		}
-	
+
 		$sql_data .= "\nGO\n\n";
 		$rows = array();
-	
+
 		$sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME
 			FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
 			WHERE TABLE_NAME = '$table_name'";
@@ -1463,7 +1475,7 @@
 			$sql_data .= "\n\t)  ON [PRIMARY] \nGO\n";
 		}
 		$db->sql_freeresult($result);
-	
+
 		$index = array();
 		$sql = "EXEC sp_statistics '$table_name'";
 		$result = $db->sql_query($sql);
@@ -1475,12 +1487,12 @@
 			}
 		}
 		$db->sql_freeresult($result);
-	
+
 		foreach ($index as $index_name => $column_name)
 		{
 			$index[$index_name] = implode(', ', $column_name);
 		}
-	
+
 		foreach ($index as $index_name => $columns)
 		{
 			$sql_data .= "\nCREATE  INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n";
@@ -1508,7 +1520,7 @@
 		$ary_type = $ary_name = array();
 		$ident_set = false;
 		$sql_data = '';
-		
+
 		// Grab all of the data from current table.
 		$sql = "SELECT *
 			FROM $table_name";
@@ -1602,7 +1614,7 @@
 		$ary_type = $ary_name = array();
 		$ident_set = false;
 		$sql_data = '';
-		
+
 		// Grab all of the data from current table.
 		$sql = "SELECT *
 			FROM $table_name";
@@ -1819,7 +1831,7 @@
 	{
 		global $db;
 		$ary_type = $ary_name = array();
-		
+
 		// Grab all of the data from current table.
 		$sql = "SELECT *
 			FROM $table_name";
@@ -1915,7 +1927,7 @@
 	{
 		global $db;
 		$ary_type = $ary_name = array();
-		
+
 		// Grab all of the data from current table.
 		$sql = "SELECT *
 			FROM $table_name";
@@ -2244,7 +2256,7 @@
 {
 	$record = '';
 	$delim_len = strlen($delim);
-	
+
 	while (!$eof($fp))
 	{
 		$pos = strpos($record, $delim);
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_email.php 3.0.5.src/includes/acp/acp_email.php
--- 3.0.4.src/includes/acp/acp_email.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_email.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_email.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: acp_email.php 9389 2009-03-17 15:50:19Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -108,7 +108,7 @@
 					$db->sql_freeresult($result);
 					trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
 				}
-	
+
 				$i = $j = 0;
 
 				// Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
@@ -121,7 +121,7 @@
 				{
 					if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) ||
 						($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) ||
-						($row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']))
+						($row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])))
 					{
 						if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
 						{
@@ -173,7 +173,7 @@
 					$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
 					$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
 					$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
-			
+
 					$messenger->subject(htmlspecialchars_decode($subject));
 					$messenger->set_mail_priority($priority);
 
@@ -181,7 +181,7 @@
 						'CONTACT_EMAIL' => $config['board_contact'],
 						'MESSAGE'		=> htmlspecialchars_decode($message))
 					);
-	
+
 					if (!($messenger->send($used_method)))
 					{
 						$errored = true;
@@ -239,7 +239,7 @@
 
 		$select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
 		$select_list .= group_select_options($group_id, $exclude);
-		
+
 		$s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
 		$s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
 		$s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_forums.php 3.0.5.src/includes/acp/acp_forums.php
--- 3.0.4.src/includes/acp/acp_forums.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_forums.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_forums.php 8898 2008-09-19 17:07:13Z acydburn $
+* @version $Id: acp_forums.php 9344 2009-02-27 16:29:29Z toonarmy $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -183,7 +183,7 @@
 						$forum_perm_from = request_var('forum_perm_from', 0);
 
 						// Copy permissions?
-						if ($forum_perm_from && !empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] &&
+						if (!empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] &&
 							(($action != 'edit') || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))))
 						{
 							// if we edit a forum delete current permissions first
@@ -560,13 +560,12 @@
 					FROM ' . FORUMS_TABLE . '
 					WHERE forum_type = ' . FORUM_POST . "
 						AND forum_id <> $forum_id";
-				$result = $db->sql_query($sql);
+				$result = $db->sql_query_limit($sql, 1);
 
+				$postable_forum_exists = false;
 				if ($db->sql_fetchrow($result))
 				{
-					$template->assign_vars(array(
-						'S_MOVE_FORUM_OPTIONS'		=> make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
-					);
+					$postable_forum_exists = true;
 				}
 				$db->sql_freeresult($result);
 
@@ -583,25 +582,24 @@
 
 					$forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
 
-					$sql = 'SELECT forum_id
-						FROM ' . FORUMS_TABLE . '
-						WHERE forum_type = ' . FORUM_POST . "
-							AND forum_id <> $forum_id";
-					$result = $db->sql_query($sql);
-
-					if ($db->sql_fetchrow($result))
+					if ($postable_forum_exists)
 					{
 						$template->assign_vars(array(
 							'S_MOVE_FORUM_OPTIONS'		=> make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false???
 						);
 					}
-					$db->sql_freeresult($result);
 
 					$template->assign_vars(array(
 						'S_HAS_SUBFORUMS'		=> ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
 						'S_FORUMS_LIST'			=> $forums_list)
 					);
 				}
+				else if ($postable_forum_exists)
+				{
+					$template->assign_vars(array(
+						'S_MOVE_FORUM_OPTIONS'		=> make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
+					);
+				}
 
 				$s_show_display_on_index = false;
 
@@ -714,7 +712,7 @@
 					FROM ' . FORUMS_TABLE . '
 					WHERE forum_type = ' . FORUM_POST . "
 						AND forum_id <> $forum_id";
-				$result = $db->sql_query($sql);
+				$result = $db->sql_query_limit($sql, 1);
 
 				if ($db->sql_fetchrow($result))
 				{
@@ -807,10 +805,6 @@
 
 				$url = $this->u_action . "&amp;parent_id=$this->parent_id&amp;f={$row['forum_id']}";
 
-				$forum_title = ($forum_type != FORUM_LINK) ? '<a href="' . $this->u_action . '&amp;parent_id=' . $row['forum_id'] . '">' : '';
-				$forum_title .= $row['forum_name'];
-				$forum_title .= ($forum_type != FORUM_LINK) ? '</a>' : '';
-
 				$template->assign_block_vars('forums', array(
 					'FOLDER_IMAGE'		=> $folder_image,
 					'FORUM_IMAGE'		=> ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="" />' : '',
@@ -888,7 +882,7 @@
 	*/
 	function update_forum_data(&$forum_data)
 	{
-		global $db, $user, $cache;
+		global $db, $user, $cache, $phpbb_root_path;
 
 		$errors = array();
 
@@ -926,6 +920,11 @@
 			array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'),
 		);
 
+		if (!file_exists($phpbb_root_path . $forum_data['forum_image']))
+		{
+			$errors[] = $user->lang['FORUM_IMAGE_NO_EXIST'];
+		}
+
 		validate_range($range_test_ary, $errors);
 
 		// Set forum flags
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_inactive.php 3.0.5.src/includes/acp/acp_inactive.php
--- 3.0.4.src/includes/acp/acp_inactive.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_inactive.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_inactive.php 8598 2008-06-04 15:37:06Z naderman $
+* @version $Id: acp_inactive.php 9327 2009-02-15 04:52:32Z toonarmy $
 * @copyright (c) 2006 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -111,6 +111,7 @@
 								$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
 								$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
 								$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
+								$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
 
 								$messenger->assign_vars(array(
 									'USERNAME'	=> htmlspecialchars_decode($row['username']))
@@ -161,7 +162,11 @@
 
 					$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
 						FROM ' . USERS_TABLE . '
-						WHERE ' . $db->sql_in_set('user_id', $mark);
+						WHERE ' . $db->sql_in_set('user_id', $mark) . '
+							AND user_inactive_reason';
+
+					$sql .= ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL;
+
 					$result = $db->sql_query($sql);
 
 					if ($row = $db->sql_fetchrow($result))
@@ -179,9 +184,14 @@
 							$messenger->to($row['user_email'], $row['username']);
 							$messenger->im($row['user_jabber'], $row['username']);
 
+							$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
+							$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
+							$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
+							$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
+
 							$messenger->assign_vars(array(
 								'USERNAME'		=> htmlspecialchars_decode($row['username']),
-								'REGISTER_DATE'	=> $user->format_date($row['user_regdate']),
+								'REGISTER_DATE'	=> $user->format_date($row['user_regdate'], false, true),
 								'U_ACTIVATE'	=> generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
 							);
 
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_jabber.php 3.0.5.src/includes/acp/acp_jabber.php
--- 3.0.4.src/includes/acp/acp_jabber.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_jabber.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_jabber.php 8990 2008-10-09 15:41:19Z acydburn $
+* @version $Id: acp_jabber.php 9389 2009-03-17 15:50:19Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -88,7 +88,8 @@
 			else
 			{
 				// This feature is disabled.
-				// We update the user table to be sure all users that have IM as notify type are set to both  as notify type
+				// We update the user table to be sure all users that have IM as notify type are set to both as notify type
+				// We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled.
 				$sql_ary = array(
 					'user_notify_type'		=> NOTIFY_BOTH,
 				);
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_main.php 3.0.5.src/includes/acp/acp_main.php
--- 3.0.4.src/includes/acp/acp_main.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_main.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_main.php 9171 2008-12-04 14:53:04Z acydburn $
+* @version $Id: acp_main.php 9351 2009-02-28 19:22:27Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -510,6 +510,12 @@
 			$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
 		}
 
+		// Fill dbms version if not yet filled
+		if (empty($config['dbms_version']))
+		{
+			set_config('dbms_version', $db->sql_server_info(true));
+		}
+
 		$this->tpl_name = 'acp_main';
 		$this->page_title = 'ACP_MAIN';
 	}
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_permissions.php 3.0.5.src/includes/acp/acp_permissions.php
--- 3.0.4.src/includes/acp/acp_permissions.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_permissions.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_permissions.php 8710 2008-07-29 13:35:49Z acydburn $
+* @version $Id: acp_permissions.php 9496 2009-04-29 14:52:43Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -23,7 +23,7 @@
 {
 	var $u_action;
 	var $permission_dropdown;
-	
+
 	function main($id, $mode)
 	{
 		global $db, $user, $auth, $template, $cache;
@@ -94,7 +94,7 @@
 			}
 			$db->sql_freeresult($result);
 		}
-		
+
 		// Map usernames to ids and vice versa
 		if ($usernames)
 		{
@@ -112,7 +112,7 @@
 			}
 		}
 		unset($username);
-		
+
 		// Build forum ids (of all forums are checked or subforum listing used)
 		if ($all_forums)
 		{
@@ -528,7 +528,7 @@
 				}
 				continue;
 			}
-			
+
 			if ($branch_there)
 			{
 				$s_options .= ' [' . $user->lang['PLUS_SUBFORUMS'] . ']';
@@ -539,14 +539,14 @@
 
 		return $s_options;
 	}
-	
+
 	/**
 	* Build dropdown field for changing permission types
 	*/
 	function build_permission_dropdown($options, $default_option, $permission_scope)
 	{
 		global $user, $auth;
-		
+
 		$s_dropdown_options = '';
 		foreach ($options as $setting)
 		{
@@ -626,7 +626,7 @@
 		{
 			trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
 		}
-		
+
 		$ug_id = $forum_id = 0;
 
 		// We loop through the auth settings defined in our submit
@@ -762,7 +762,14 @@
 
 		$this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids);
 
-		trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
+		if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
+		{
+			trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_ids)));
+		}
+		else
+		{
+			trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
+		}
 	}
 
 	/**
@@ -809,7 +816,7 @@
 	function remove_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id, &$forum_id)
 	{
 		global $user, $db, $auth;
-			
+
 		// User or group to be set?
 		$ug_type = (sizeof($user_id)) ? 'user' : 'group';
 
@@ -829,7 +836,14 @@
 
 		$this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0)));
 
-		trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
+		if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
+		{
+			trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_id)));
+		}
+		else
+		{
+			trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
+		}
 	}
 
 	/**
@@ -1150,7 +1164,11 @@
 		{
 			$sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')';
 		}
-		else
+		else if (sizeof($role_ids))
+		{
+			$sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids);
+		}
+		else if (sizeof($option_ids))
 		{
 			$sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids);
 		}
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_profile.php 3.0.5.src/includes/acp/acp_profile.php
--- 3.0.4.src/includes/acp/acp_profile.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_profile.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_profile.php 9127 2008-11-26 19:58:35Z acydburn $
+* @version $Id: acp_profile.php 9516 2009-05-14 05:15:27Z terrafrost $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -922,7 +922,7 @@
 
 			case FIELD_TEXT:
 			case FIELD_STRING:
-				if ($cp->vars['lang_default_value'])
+				if (strlen($cp->vars['lang_default_value']))
 				{
 					$options['lang_default_value'] = ($field_type == FIELD_STRING) ? 'string' : 'text';
 				}
@@ -1539,7 +1539,7 @@
 			case 'firebird':
 
 				// We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
-				$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
+				$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' ADD "' . strtoupper($field_ident) . '" ';
 
 				switch ($field_type)
 				{
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_search.php 3.0.5.src/includes/acp/acp_search.php
--- 3.0.4.src/includes/acp/acp_search.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_search.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_search.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: acp_search.php 9502 2009-05-01 09:59:57Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -63,6 +63,7 @@
 			'load_search'				=> 'bool',
 			'limit_search_load'			=> 'float',
 			'min_search_author_chars'	=> 'integer',
+			'max_num_search_keywords'	=> 'integer',
 			'search_store_results'		=> 'integer',
 		);
 
@@ -216,6 +217,7 @@
 			'SEARCH_INTERVAL'		=> (float) $config['search_interval'],
 			'SEARCH_GUEST_INTERVAL'	=> (float) $config['search_anonymous_interval'],
 			'SEARCH_STORE_RESULTS'	=> (int) $config['search_store_results'],
+			'MAX_NUM_SEARCH_KEYWORDS'	=> (int) $config['max_num_search_keywords'],
 
 			'S_SEARCH_TYPES'		=> $search_options,
 			'S_YES_SEARCH'			=> (bool) $config['load_search'],
@@ -591,7 +593,7 @@
 
 		ksort($this->state);
 
-		set_config('search_indexing_state', implode(',', $this->state));
+		set_config('search_indexing_state', implode(',', $this->state), true);
 	}
 
 	/**
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_styles.php 3.0.5.src/includes/acp/acp_styles.php
--- 3.0.4.src/includes/acp/acp_styles.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_styles.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_styles.php 9152 2008-12-02 16:49:59Z acydburn $
+* @version $Id: acp_styles.php 9514 2009-05-13 10:19:43Z Kellanved $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -37,7 +37,10 @@
 		// Hardcoded template bitfield to add for new templates
 		$bitfield = new bitfield();
 		$bitfield->set(0);
+		$bitfield->set(1);
+		$bitfield->set(2);
 		$bitfield->set(3);
+		$bitfield->set(4);
 		$bitfield->set(8);
 		$bitfield->set(9);
 		$bitfield->set(11);
@@ -743,7 +746,7 @@
 				// If it's not stored in the db yet, then update the template setting and store all template files in the db
 				if (!$template_info['template_storedb'])
 				{
-					if ($this->get_super('template', $template_id))
+					if ($super = $this->get_super('template', $template_id))
 					{
 						$this->store_in_db('template', $super['template_id']);
 					}
@@ -1275,139 +1278,143 @@
 
 		$this->page_title = 'EDIT_IMAGESET';
 
-		$update		= (isset($_POST['update'])) ? true : false;
+		if (!$imageset_id)
+		{
+			trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
+		}
 
-		$imgname	= request_var('imgname', '');
-		$imgpath	= request_var('imgpath', '');
-		$imgsize	= request_var('imgsize', false);
-		$imgwidth	= request_var('imgwidth', 0);
-		$imgheight	= request_var('imgheight', 0);
+		$update		= (isset($_POST['update'])) ? true : false;
 
+		$imgname	= request_var('imgname', 'site_logo');
 		$imgname	= preg_replace('#[^a-z0-9\-+_]#i', '', $imgname);
-		$imgpath	= str_replace('..', '.', $imgpath);
+		$sql_extra = $imgnamelang = '';
+
+		$sql = 'SELECT imageset_path, imageset_name
+			FROM ' . STYLES_IMAGESET_TABLE . "
+			WHERE imageset_id = $imageset_id";
+		$result = $db->sql_query($sql);
+		$imageset_row = $db->sql_fetchrow($result);
+		$db->sql_freeresult($result);
 
-		if ($imageset_id)
+		if (!$imageset_row)
 		{
-			$sql = 'SELECT imageset_path, imageset_name
-				FROM ' . STYLES_IMAGESET_TABLE . "
-				WHERE imageset_id = $imageset_id";
-			$result = $db->sql_query($sql);
-			$imageset_row = $db->sql_fetchrow($result);
-			$db->sql_freeresult($result);
+			trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
+		}
 
-			$imageset_path		= $imageset_row['imageset_path'];
-			$imageset_name		= $imageset_row['imageset_name'];
+		$imageset_path		= $imageset_row['imageset_path'];
+		$imageset_name		= $imageset_row['imageset_name'];
 
-			$sql_extra = '';
-			if (strpos($imgname, '-') !== false)
+		if (strpos($imgname, '-') !== false)
+		{
+			list($imgname, $imgnamelang) = explode('-', $imgname);
+			$sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')";
+		}
+
+		$sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id
+			FROM ' . STYLES_IMAGESET_DATA_TABLE . "
+			WHERE imageset_id = $imageset_id
+				AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra";
+		$result = $db->sql_query($sql);
+		$imageset_data_row = $db->sql_fetchrow($result);
+		$db->sql_freeresult($result);
+
+		$image_filename	= $imageset_data_row['image_filename'];
+		$image_width	= $imageset_data_row['image_width'];
+		$image_height	= $imageset_data_row['image_height'];
+		$image_lang		= $imageset_data_row['image_lang'];
+		$image_id		= $imageset_data_row['image_id'];
+		$imgsize		= ($imageset_data_row['image_width'] && $imageset_data_row['image_height']) ? 1 : 0;
+
+		// Check to see whether the selected image exists in the table
+		$valid_name = ($update) ? false : true;
+
+		foreach ($this->imageset_keys as $category => $img_ary)
+		{
+			if (in_array($imgname, $img_ary))
 			{
-				list($imgname, $imgnamelang) = explode('-', $imgname);
-				$sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')";
+				$valid_name = true;
+				break;
 			}
+		}
 
-			$sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id
-				FROM ' . STYLES_IMAGESET_DATA_TABLE . "
-				WHERE imageset_id = $imageset_id
-					AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra";
-			$result = $db->sql_query($sql);
-			$imageset_data_row = $db->sql_fetchrow($result);
-			$db->sql_freeresult($result);
-
-			$image_filename	= $imageset_data_row['image_filename'];
-			$image_width	= $imageset_data_row['image_width'];
-			$image_height	= $imageset_data_row['image_height'];
-			$image_lang		= $imageset_data_row['image_lang'];
-			$image_id		= $imageset_data_row['image_id'];
+		if ($update && isset($_POST['imgpath']) && $valid_name)
+		{
+			// If imgwidth and imgheight are non-zero grab the actual size
+			// from the image itself ... we ignore width settings for the poll center image
+			$imgwidth	= request_var('imgwidth', 0);
+			$imgheight	= request_var('imgheight', 0);
+			$imgsize	= request_var('imgsize', 0);
+			$imgpath	= request_var('imgpath', '');
+			$imgpath	= str_replace('..', '.', $imgpath);
 
-			if (!$imageset_row)
+			// If no dimensions selected, we reset width and height to 0 ;)
+			if (!$imgsize)
 			{
-				trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
+				$imgwidth = $imgheight = 0;
 			}
 
-			// Check to see whether the selected image exists in the table
-			$valid_name = ($update) ? false : true;
+			$imglang = '';
 
-			foreach ($this->imageset_keys as $category => $img_ary)
+			if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"))
 			{
-				if (in_array($imgname, $img_ary))
-				{
-					$valid_name = true;
-					break;
-				}
+				trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
 			}
 
-			if ($update && isset($_POST['imgpath']))
+			// Determine width/height. If dimensions included and no width/height given, we detect them automatically...
+			if ($imgsize && $imgpath)
 			{
-				if ($valid_name)
+				if (!$imgwidth || !$imgheight)
 				{
-					// If imgwidth and imgheight are non-zero grab the actual size
-					// from the image itself ... we ignore width settings for the poll center image
-					$imgwidth	= request_var('imgwidth', 0);
-					$imgheight	= request_var('imgheight', 0);
-					$imglang = '';
-
-					if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"))
-					{
-						trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
-					}
-
-					if ($imgsize && $imgpath)
-					{
-						if (!$imgwidth || !$imgheight)
-						{
-							list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath");
-							$imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file;
-							$imgheight = ($imgheight) ? $imgheight : $imgheight_file;
-						}
-						$imgwidth	= ($imgname != 'poll_center') ? (int) $imgwidth : 0;
-						$imgheight	= (int) $imgheight;
-					}
-
+					list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath");
+					$imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file;
+					$imgheight = ($imgheight) ? $imgheight : $imgheight_file;
+				}
+				$imgwidth	= ($imgname != 'poll_center') ? (int) $imgwidth : 0;
+				$imgheight	= (int) $imgheight;
+			}
 
-					if (strpos($imgpath, '/') !== false)
-					{
-						list($imglang, $imgfilename) = explode('/', $imgpath);
-					}
-					else
-					{
-						$imgfilename = $imgpath;
-					}
+			if (strpos($imgpath, '/') !== false)
+			{
+				list($imglang, $imgfilename) = explode('/', $imgpath);
+			}
+			else
+			{
+				$imgfilename = $imgpath;
+			}
 
-					$sql_ary = array(
-						'image_filename'	=> (string) $imgfilename,
-						'image_width'		=> (int) $imgwidth,
-						'image_height'		=> (int) $imgheight,
-						'image_lang'		=> (string) $imglang,
-					);
+			$sql_ary = array(
+				'image_filename'	=> (string) $imgfilename,
+				'image_width'		=> (int) $imgwidth,
+				'image_height'		=> (int) $imgheight,
+				'image_lang'		=> (string) $imglang,
+			);
 
-					// already exists
-					if ($imageset_data_row)
-					{
-						$sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . '
-							SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
-							WHERE image_id = $image_id";
-						$db->sql_query($sql);
-					}
-					// does not exist
-					else if (!$imageset_data_row)
-					{
-						$sql_ary['image_name']	= $imgname;
-						$sql_ary['imageset_id']	= (int) $imageset_id;
-						$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
-					}
+			// already exists
+			if ($imageset_data_row)
+			{
+				$sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . '
+					SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
+					WHERE image_id = $image_id";
+				$db->sql_query($sql);
+			}
+			// does not exist
+			else if (!$imageset_data_row)
+			{
+				$sql_ary['image_name']	= $imgname;
+				$sql_ary['imageset_id']	= (int) $imageset_id;
+				$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
+			}
 
-					$cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
+			$cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
 
-					add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
+			add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
 
-					$template->assign_var('SUCCESS', true);
+			$template->assign_var('SUCCESS', true);
 
-					$image_filename = $imgfilename;
-					$image_width	= $imgwidth;
-					$image_height	= $imgheight;
-					$image_lang		= $imglang;
-				}
-			}
+			$image_filename = $imgfilename;
+			$image_width	= $imgwidth;
+			$image_height	= $imgheight;
+			$image_lang		= $imglang;
 		}
 
 		$imglang = '';
@@ -1529,6 +1536,8 @@
 			'U_BACK'			=> $this->u_action,
 			'NAME'				=> $imageset_name,
 			'A_NAME'			=> addslashes($imageset_name),
+			'PATH'				=> $imageset_path,
+			'A_PATH'			=> addslashes($imageset_path),
 			'ERROR'				=> !$valid_name,
 			'IMG_SRC'			=> ($image_found) ? '../styles/' . $imageset_path . '/imageset/' . $img_val : 'images/no_image.png',
 			'IMAGE_SELECT'		=> $image_found
@@ -3210,7 +3219,16 @@
 
 		if (isset($cfg_data['inherit_from']) && $cfg_data['inherit_from'])
 		{
-			$sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, {$mode}_storedb
+			if ($mode === 'template')
+			{
+				$select_bf = ', bbcode_bitfield';
+			}
+			else
+			{
+				$select_bf = '';
+			}
+
+			$sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, {$mode}_storedb $select_bf
 				FROM $sql_from
 				WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "'
 					AND {$mode}_inherits_id = 0";
@@ -3225,6 +3243,7 @@
 			{
 				$inherit_id = $row["{$mode}_id"];
 				$inherit_path = $row["{$mode}_path"];
+				$inherit_bf = ($mode === 'template') ? $row["bbcode_bitfield"] : false;
 				$cfg_data['store_db'] = $row["{$mode}_storedb"];
 				$store_db = $row["{$mode}_storedb"];
 			}
@@ -3233,6 +3252,7 @@
 		{
 			$inherit_id = 0;
 			$inherit_path = '';
+			$inherit_bf = false;
 		}
 
 
@@ -3255,6 +3275,10 @@
 				{
 					$sql_ary['bbcode_bitfield'] = $cfg_data['template_bitfield'];
 				}
+				else if ($inherit_bf)
+				{
+					$sql_ary['bbcode_bitfield'] = $inherit_bf;
+				}
 				else
 				{
 					$sql_ary['bbcode_bitfield'] = TEMPLATE_BITFIELD;
diff -x .svn -aruN 3.0.4.src/includes/acp/acp_users.php 3.0.5.src/includes/acp/acp_users.php
--- 3.0.4.src/includes/acp/acp_users.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/acp_users.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: acp_users.php 8831 2008-09-05 19:02:36Z toonarmy $
+* @version $Id: acp_users.php 9492 2009-04-28 11:18:02Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -972,6 +972,7 @@
 					{
 						$sql = 'DELETE FROM ' . LOG_TABLE . '
 							WHERE log_type = ' . LOG_USERS . "
+							AND reportee_id = $user_id
 							$where_sql";
 						$db->sql_query($sql);
 
@@ -1161,7 +1162,8 @@
 
 							foreach ($cp_data as $key => $value)
 							{
-								$cp_data[$left_delim . $key . $right_delim] = $value;
+								// Firebird is case sensitive with delimiter
+								$cp_data[$left_delim . (($db->sql_layer == 'firebird') ? strtoupper($key) : $key) . $right_delim] = $value;
 								unset($cp_data[$key]);
 							}
 
@@ -1846,6 +1848,16 @@
 							}
 
 							$error = array();
+
+							// The delete action was successful - therefore update the user row...
+							$sql = 'SELECT u.*, s.*
+								FROM ' . USERS_TABLE . ' u
+									LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
+								WHERE u.user_id = ' . $user_id . '
+								ORDER BY s.session_time DESC';
+							$result = $db->sql_query($sql);
+							$user_row = $db->sql_fetchrow($result);
+							$db->sql_freeresult($result);
 						}
 						else
 						{
diff -x .svn -aruN 3.0.4.src/includes/acp/auth.php 3.0.5.src/includes/acp/auth.php
--- 3.0.4.src/includes/acp/auth.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/acp/auth.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: auth.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: auth.php 9400 2009-03-20 13:22:19Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -58,7 +58,7 @@
 			$cache->put('_acl_options', $this->acl_options);
 		}
 	}
-	
+
 	/**
 	* Get permission mask
 	* This function only supports getting permissions of one type (for example a_)
@@ -140,7 +140,7 @@
 					$auth2 = &$auth;
 				}
 
-				
+
 				$hold_ary[$userdata['user_id']] = array();
 				foreach ($forum_ids as $f_id)
 				{
@@ -345,7 +345,7 @@
 
 		// Build js roles array (role data assignments)
 		$s_role_js_array = '';
-		
+
 		if (sizeof($roles))
 		{
 			$s_role_js_array = array();
@@ -696,6 +696,7 @@
 
 		$cur_options = array();
 
+		// Determine current options
 		$sql = 'SELECT auth_option, is_global, is_local
 			FROM ' . ACL_OPTIONS_TABLE . '
 			ORDER BY auth_option_id';
@@ -703,15 +704,7 @@
 
 		while ($row = $db->sql_fetchrow($result))
 		{
-			if ($row['is_global'])
-			{
-				$cur_options['global'][] = $row['auth_option'];
-			}
-
-			if ($row['is_local'])
-			{
-				$cur_options['local'][] = $row['auth_option'];
-			}
+			$cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local');
 		}
 		$db->sql_freeresult($result);
 
@@ -726,14 +719,11 @@
 
 			foreach ($option_ary as $option_value)
 			{
-				if (!in_array($option_value, $cur_options[$type]))
-				{
-					$new_options[$type][] = $option_value;
-				}
+				$new_options[$type][] = $option_value;
 
 				$flag = substr($option_value, 0, strpos($option_value, '_') + 1);
 
-				if (!in_array($flag, $cur_options[$type]) && !in_array($flag, $new_options[$type]))
+				if (!in_array($flag, $new_options[$type]))
 				{
 					$new_options[$type][] = $flag;
 				}
@@ -744,23 +734,53 @@
 		$options = array();
 		$options['local'] = array_diff($new_options['local'], $new_options['global']);
 		$options['global'] = array_diff($new_options['global'], $new_options['local']);
-		$options['local_global'] = array_intersect($new_options['local'], $new_options['global']);
+		$options['both'] = array_intersect($new_options['local'], $new_options['global']);
 
-		$sql_ary = array();
+		// Now check which options to add/update
+		$add_options = $update_options = array();
 
+		// First local ones...
 		foreach ($options as $type => $option_ary)
 		{
 			foreach ($option_ary as $option)
 			{
-				$sql_ary[] = array(
-					'auth_option'	=> (string) $option,
-					'is_global'		=> ($type == 'global' || $type == 'local_global') ? 1 : 0,
-					'is_local'		=> ($type == 'local' || $type == 'local_global') ? 1 : 0
-				);
+				if (!isset($cur_options[$option]))
+				{
+					$add_options[] = array(
+						'auth_option'	=> (string) $option,
+						'is_global'		=> ($type == 'global' || $type == 'both') ? 1 : 0,
+						'is_local'		=> ($type == 'local' || $type == 'both') ? 1 : 0
+					);
+
+					continue;
+				}
+
+				// Else, update existing entry if it is changed...
+				if ($type === $cur_options[$option])
+				{
+					continue;
+				}
+
+				// New type is always both:
+				// If is now both, we set both.
+				// If it was global the new one is local and we need to set it to both
+				// If it was local the new one is global and we need to set it to both
+				$update_options[] = $option;
 			}
 		}
 
-		$db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary);
+		if (!empty($add_options))
+		{
+			$db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options);
+		}
+
+		if (!empty($update_options))
+		{
+			$sql = 'UPDATE ' . ACL_OPTIONS_TABLE . '
+				SET is_global = 1, is_local = 1
+				WHERE ' . $db->sql_in_set('auth_option', $update_options);
+			$db->sql_query($sql);
+		}
 
 		$cache->destroy('_acl_options');
 		$this->acl_clear_prefetch();
@@ -802,7 +822,7 @@
 		reset($auth);
 		$flag = key($auth);
 		$flag = substr($flag, 0, strpos($flag, '_') + 1);
-		
+
 		// This ID (the any-flag) is set if one or more permissions are true...
 		$any_option_id = (int) $this->acl_options['id'][$flag];
 
@@ -916,7 +936,7 @@
 		reset($auth);
 		$flag = key($auth);
 		$flag = substr($flag, 0, strpos($flag, '_') + 1);
-		
+
 		// Remove any-flag from auth ary
 		if (isset($auth[$flag]))
 		{
@@ -1067,7 +1087,7 @@
 		{
 			$where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary));
 		}
-		
+
 		$sql = "DELETE FROM $table
 			WHERE " . implode(' AND ', $where_sql);
 		$db->sql_query($sql);
@@ -1090,7 +1110,7 @@
 				'S_YES'		=> ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false,
 				'S_NEVER'	=> ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
 				'S_NO'		=> ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false,
-							
+
 				'CAT_NAME'	=> $user->lang['permission_cat'][$cat])
 			);
 
@@ -1179,9 +1199,9 @@
 						'lang'	=> '{ acl_' . $permission . ' }'
 					);
 				}
-			
+
 				$cat = $user->lang['acl_' . $permission]['cat'];
-			
+
 				// Build our categories array
 				if (!isset($categories[$cat]))
 				{
diff -x .svn -aruN 3.0.4.src/includes/auth/auth_apache.php 3.0.5.src/includes/auth/auth_apache.php
--- 3.0.4.src/includes/auth/auth_apache.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/auth/auth_apache.php	2009-05-31 05:58:35.000000000 -0500
@@ -5,7 +5,7 @@
 * Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
 *
 * @package login
-* @version $Id: auth_apache.php 8602 2008-06-04 16:05:27Z naderman $
+* @version $Id: auth_apache.php 9311 2009-01-29 13:08:44Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -104,7 +104,7 @@
 					'user_row'		=> $row,
 				);
 			}
-	
+
 			// Successful login...
 			return array(
 				'status'		=> LOGIN_SUCCESS,
@@ -227,15 +227,22 @@
 */
 function validate_session_apache(&$user)
 {
-	if (!isset($_SERVER['PHP_AUTH_USER']))
+	// Check if PHP_AUTH_USER is set and handle this case
+	if (isset($_SERVER['PHP_AUTH_USER']))
 	{
-		return false;
+		$php_auth_user = '';
+		set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true);
+
+		return ($php_auth_user === $user['username']) ? true : false;
 	}
 
-	$php_auth_user = '';
-	set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true);
+	// PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not)
+	if ($user['user_type'] == USER_IGNORE)
+	{
+		return true;
+	}
 
-	return ($php_auth_user === $user['username']) ? true : false;
+	return false;
 }
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 3.0.4.src/includes/auth/auth_db.php 3.0.5.src/includes/auth/auth_db.php
--- 3.0.4.src/includes/auth/auth_db.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/auth/auth_db.php	2009-05-31 05:58:35.000000000 -0500
@@ -7,7 +7,7 @@
 * This is for authentication via the integrated user table
 *
 * @package login
-* @version $Id: auth_db.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: auth_db.php 9312 2009-02-06 14:51:26Z Kellanved $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -141,7 +141,9 @@
 			}
 
 			// cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding
-			if (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])
+			// plain md5 support left in for conversions from other systems.
+			if ((strlen($row['user_password']) == 34 && (phpbb_check_hash(md5($password_old_format), $row['user_password']) || phpbb_check_hash(md5(utf8_to_cp1252($password_old_format)), $row['user_password'])))
+				|| (strlen($row['user_password']) == 32  && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])))
 			{
 				$hash = phpbb_hash($password_new_format);
 
@@ -155,7 +157,7 @@
 				$row['user_pass_convert'] = 0;
 				$row['user_password'] = $hash;
 			}
-			else
+			else 
 			{
 				// Although we weren't able to convert this password we have to
 				// increase login attempt count to make sure this cannot be exploited
diff -x .svn -aruN 3.0.4.src/includes/bbcode.php 3.0.5.src/includes/bbcode.php
--- 3.0.4.src/includes/bbcode.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/bbcode.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: bbcode.php 8953 2008-09-28 17:08:09Z acydburn $
+* @version $Id: bbcode.php 9461 2009-04-17 15:23:17Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -134,7 +134,7 @@
 		{
 			$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
 			$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
-			
+
 			if (!@file_exists($this->template_filename))
 			{
 				if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
@@ -410,7 +410,7 @@
 		if (empty($bbcode_hardtpl))
 		{
 			global $user;
-			
+
 			$bbcode_hardtpl = array(
 				'b_open'	=> '<span style="font-weight: bold">',
 				'b_close'	=> '</span>',
@@ -528,12 +528,12 @@
 		else if (is_numeric($type))
 		{
 			$tpl = 'olist_open';
-			$type = 'arabic-numbers';
+			$type = 'decimal';
 		}
 		else
 		{
 			$tpl = 'olist_open';
-			$type = 'arabic-numbers';
+			$type = 'decimal';
 		}
 
 		return str_replace('{LIST_TYPE}', $type, $this->bbcode_tpl($tpl));
diff -x .svn -aruN 3.0.4.src/includes/captcha/captcha_gd.php 3.0.5.src/includes/captcha/captcha_gd.php
--- 3.0.4.src/includes/captcha/captcha_gd.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/captcha/captcha_gd.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package VC
-* @version $Id: captcha_gd.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: captcha_gd.php 9403 2009-03-20 16:34:06Z Kellanved $
 * @copyright (c) 2006 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -27,6 +27,7 @@
 	var $width = 360;
 	var $height = 96;
 
+
 	/**
 	* Create the image containing $code with a seed of $seed
 	*/
@@ -34,7 +35,7 @@
 	{
 		global $config;
 		srand($seed);
-		mt_srand($seed);
+		//mt_srand($seed);
 
 		// Create image
 		$img = imagecreatetruecolor($this->width, $this->height);
@@ -52,11 +53,11 @@
 		$bg_colours = array_splice($scheme, mt_rand(6, 12));
 
 		// Generate code characters
-		$characters = $sizes = $bounding_boxes = array();
+		$characters = $sizes = $bounding_boxes = $noise = array();
 		$width_avail = $this->width - 15;
 		$code_len = strlen($code);
-
 		$captcha_bitmaps = $this->captcha_bitmaps();
+
 		for ($i = 0; $i < $code_len; ++$i)
 		{
 			$characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]);
@@ -69,6 +70,7 @@
 			$bounding_boxes[$i] = $box;
 		}
 
+ 
 		// Redistribute leftover x-space
 		$offset = array();
 		for ($i = 0; $i < $code_len; ++$i)
@@ -98,7 +100,34 @@
 				imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour);
 			}
 		}
+		if ($config['captcha_gd_wave'] && ($config['captcha_gd_y_grid'] || $config['captcha_gd_y_grid']))
+		{
+			$this->wave($img);
+		}
+		
+		
+		if ($config['captcha_gd_3d_noise'])
+		{
+			$xoffset = rand(0,9);
+			$noise_bitmaps = $this->captcha_noise_bg_bitmaps();
+			for ($i = 0; $i < $code_len; ++$i)
+			{
+				$noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data'])));
 
+				list($min, $max) = $noise[$i]->range();
+				//$box = $noise[$i]->dimensions($sizes[$i]);
+			}
+			$xoffset = 0;
+			for ($i = 0; $i < $code_len; ++$i)
+			{
+				$dimm = $bounding_boxes[$i];
+				$xoffset += ($offset[$i] - $dimm[0]);
+				$yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]);
+	 
+				$noise[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
+				$xoffset += $dimm[2];
+			}
+		}
 		$xoffset = 5;
 		for ($i = 0; $i < $code_len; ++$i)
 		{
@@ -109,12 +138,14 @@
 			$characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
 			$xoffset += $dimm[2];
 		}
-		
+		if ($config['captcha_gd_wave'])
+		{
+			$this->wave($img);
+		}
 		if ($config['captcha_gd_foreground_noise'])
 		{
 			$this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours);
 		}
-
 		// Send image
 		header('Content-Type: image/png');
 		header('Cache-control: no-cache, no-store');
@@ -123,6 +154,38 @@
 	}
 
 	/**
+	* Sinus
+	*/
+	function wave($img)
+	{
+		global $config;
+		
+		$period_x = mt_rand(12,18);
+		$period_y = mt_rand(7,14);
+		$amp_x = mt_rand(5,10);
+		$amp_y = mt_rand(2,4); 
+		$socket = mt_rand(0,100);
+		
+		$dampen_x = mt_rand($this->width/5, $this->width/2);
+		$dampen_y = mt_rand($this->height/5, $this->height/2);
+		$direction_x = (mt_rand (0, 1));
+		$direction_y = (mt_rand (0, 1));
+
+		for ($i = 0; $i < $this->width; $i++)
+		{
+			$dir = ($direction_x) ? $i : ($this->width - $i);
+			imagecopy($img, $img, $i-1, sin($socket+ $i/($period_x + $dir/$dampen_x)) * $amp_x, $i, 0, 1, $this->height);
+		}
+		$socket = mt_rand(0,100);
+		for ($i = 0; $i < $this->height; $i++)
+		{
+			$dir = ($direction_y) ? $i : ($this->height - $i);
+			imagecopy($img, $img ,sin($socket + $i/($period_y + ($dir)/$dampen_y)) * $amp_y, $i-1, 0, $i, $this->width, 1);
+		}
+		return $img;
+	}
+	
+	/**
 	* Noise line
 	*/
 	function noise_line($img, $min_x, $min_y, $max_x, $max_y, $bg, $font, $non_font)
@@ -171,458 +234,1468 @@
 		imagesetthickness($img, 1);
 	}
 
+
+	function captcha_noise_bg_bitmaps()
+	{		
+		return array(
+			'width'		=> 15,
+			'height'	=> 5,
+			'data'		=> array(
+
+			1 => array(
+				array(1,0,0,0,1,0,0,0,0,0,0,0,0,0,0),
+				array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0),
+				array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(1,0,0,0,0,1,0,0,0,0,0,0,1,0,0),
+				array(1,0,0,0,0,0,1,0,0,0,0,1,0,0,0),
+			),
+			2 => array(
+				array(1,1,mt_rand(0,1),1,0,1,1,1,1,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,1,1,0,1,1,1),
+			),
+			3 => array(
+				array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1),
+				array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0),
+				array(0,0,0,0,1,0,0,0,0,0,0,0,0,0,1),
+				array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0),
+				array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1),
+			),
+			4 => array(
+				array(1,0,1,0,1,0,0,1,1,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0),
+			),
+			5 => array(
+				array(1,1,1,1,0,0,0,1,1,1,0,0,1,0,1),
+				array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0),
+			),
+			6 => array(
+				array(mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1)),
+				array(0,0,0,0,0,0,0,mt_rand(0,1),0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(mt_rand(0,1),0,mt_rand(0,1),0,0,0,0,0,0,0,0,0,0,0,0),
+			),
+			7 => array(
+				array(0,0,0,0,0,0,0,0,0,0,1,1,0,1,1),
+				array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+				array(0,0,1,1,0,0,0,1,0,0,0,0,0,0,0),
+				array(0,1,0,0,0,1,0,0,0,0,0,0,0,0,0),
+				array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
+			),
+		));
+	}
+	
 	/**
 	* Return bitmaps
 	*/
 	function captcha_bitmaps()
 	{
+		global $config;
+		
+		$chars = array(
+			'A'	=>	array(
+						array(
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,1,1,1,1,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,1,1,0,1,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,1,1,1,1,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,0,0,0,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,1,1),
+							array(0,0,0,0,0,1,1,1,1),
+							array(0,0,0,1,1,1,0,0,1),
+							array(0,1,1,1,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,1,0,0,0,0,1,1,1),
+							array(0,1,1,1,1,1,1,0,1),
+						),
+					),
+		'B'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+						),
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,1,1,1,1,0,0),
+						),
+					),
+		'C'	=>		array(
+						array(
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,1,1,1,1,1,0,1),
+							array(0,1,0,0,0,0,0,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,1),
+							array(0,0,1,1,1,1,1,0,1),
+						),
+					),
+		'D'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+						),
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,1,1,1,1,1,0,1),
+							array(0,1,1,0,0,0,1,1,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,1,0,0,0,1,1,1),
+							array(0,0,1,1,1,1,1,0,1),
+						),
+					),
+		'E'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,1,1,1,1,1,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,1,1,1,1,1,1),
+						),
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,1,1,1,1,1,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,1,1,1,1,1,1,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(0,1,1,1,1,1,1,1,0),
+						),
+					),
+		'F'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+						),
+						array(
+							array(0,1,1,1,1,1,1,1,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(1,1,1,0,0,0,0,0,0),
+						),
+						array(
+							array(0,0,0,1,1,0,0,0,0),
+							array(0,0,1,1,0,0,0,0,0),
+							array(0,1,1,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(1,1,1,1,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+						),
+					),
+		'G'	=>		array(
+						array(
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,1,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,1,1,1,1,1,0,1),
+							array(0,1,0,0,0,0,0,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,1,1,1,1,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,1),
+							array(0,0,1,1,1,1,1,0,1),
+						),
+						array(
+							array(0,0,1,1,1,1,1,0,1),
+							array(0,1,1,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,1,1,0,0,0,0,0,1),
+							array(0,0,1,1,1,1,1,1,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,1,1),
+							array(1,1,1,1,1,1,1,1,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+						),
+					),
+		'H'	=>		array(
+						array(
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,1,1,1,1,1,1,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+						),
+						array(
+							array(1,1,1,0,0,0,1,1,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,1,1,1,1,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,0,0,0,1,1,1),
+						),
+						array(
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,1,1,1,0,0,0),
+							array(1,1,1,1,0,1,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+						),
+					),
+		'I'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(1,1,1,1,1,1,1,1,1),
+						),
+						array(
+							array(0,0,0,1,1,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,1,1,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,1,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,1,1,0,0,0),
+						),
+					),
+		'J'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(0,1,0,0,1,0,0,0,0),
+							array(0,0,1,1,0,0,0,0,0),
+						),
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,1,0,0,1,0,0,0,0),
+							array(1,0,1,1,0,0,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(0,1,0,0,1,0,0,0,0),
+							array(0,0,1,1,0,0,0,0,0),
+						),
+					),
+		'K'	=>		array(
+						array(    // New 'K', supplied by NeoThermic
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,1,0,0,0,0),
+							array(1,0,0,1,0,0,0,0,0),
+							array(1,0,1,0,0,0,0,0,0),
+							array(1,1,0,0,0,0,0,0,0),
+							array(1,0,1,0,0,0,0,0,0),
+							array(1,0,0,1,0,0,0,0,0),
+							array(1,0,0,0,1,0,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+						),
+						array(
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,1,0,0),
+							array(0,1,0,0,0,1,0,0,0),
+							array(0,1,0,0,1,0,0,0,0),
+							array(0,1,0,1,0,0,0,0,0),
+							array(0,1,1,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,1,0,0,0,0,0,0),
+							array(0,1,0,1,0,0,0,0,0),
+							array(0,1,0,0,1,0,0,0,0),
+							array(0,1,0,0,0,1,0,0,0),
+							array(0,1,0,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,0,0,0,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,1,0,0,0),
+							array(0,1,0,0,1,0,0,0,0),
+							array(0,1,0,1,0,0,0,0,0),
+							array(0,1,1,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,1,0,0,0,0,0,0),
+							array(0,1,0,1,0,0,0,0,0),
+							array(0,1,0,0,1,0,0,0,0),
+							array(0,1,0,0,0,1,0,0,0),
+							array(0,1,0,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+						),
+					),
+		'L'	=>		array(
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,1,1,1,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,1),
+							array(1,1,1,1,1,1,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,1,0,0,0,0,0,0),
+							array(0,0,1,1,1,0,0,0,0),
+						),
+					),
+		'M'	=>		array(
+						array(
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,0,1,0,0,0,1,0,1),
+							array(1,0,1,0,0,0,1,0,1),
+							array(1,0,1,0,0,0,1,0,1),
+							array(1,0,0,1,0,1,0,0,1),
+							array(1,0,0,1,0,1,0,0,1),
+							array(1,0,0,1,0,1,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,1,0,1,0,1,0,1,0),
+							array(0,1,0,1,0,1,0,1,0),
+							array(0,1,0,1,0,1,0,1,0),
+							array(0,1,0,0,1,0,0,1,0),
+							array(0,1,0,0,1,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,0,0,0,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,1,1,0,1,1,1,0),
+							array(1,1,0,1,1,1,0,1,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+						),
+					),
+		'N'	=>		array(
+						array(
+							array(1,1,0,0,0,0,0,0,1),
+							array(1,1,0,0,0,0,0,0,1),
+							array(1,0,1,0,0,0,0,0,1),
+							array(1,0,1,0,0,0,0,0,1),
+							array(1,0,0,1,0,0,0,0,1),
+							array(1,0,0,1,0,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,0,1,0,0,1),
+							array(1,0,0,0,0,1,0,0,1),
+							array(1,0,0,0,0,0,1,0,1),
+							array(1,0,0,0,0,0,1,0,1),
+							array(1,0,0,0,0,0,0,1,1),
+							array(1,0,0,0,0,0,0,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,0,0,0,0,1,0),
+							array(0,1,1,0,0,0,0,1,0),
+							array(0,1,1,0,0,0,0,1,0),
+							array(0,1,0,1,0,0,0,1,0),
+							array(0,1,0,1,0,0,0,1,0),
+							array(0,1,0,1,0,0,0,1,0),
+							array(0,1,0,0,1,0,0,1,0),
+							array(0,1,0,0,1,1,0,1,0),
+							array(0,1,0,0,0,1,0,1,0),
+							array(0,1,0,0,0,1,1,1,0),
+							array(0,1,0,0,0,0,1,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,0,0,0,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,0,1,1,1,1,0,0,0),
+							array(1,1,1,0,0,1,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+						),
+					),
+		'O'	=>		array(
+						array(
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,1,1,1,1,0,0,0),
+							array(1,1,1,0,0,1,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,1,0,0,0,1,1,0,0),
+							array(0,1,1,1,1,1,0,0,0),
+						),
+					),
+		'P'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+						),
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(1,1,1,0,0,0,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,1,1,0,0,0,0,0),
+							array(1,1,0,1,1,0,0,0,0),
+							array(1,0,0,0,1,0,0,0,0),
+							array(1,0,0,0,1,0,0,0,0),
+							array(1,0,0,1,1,0,0,0,0),
+							array(1,1,1,1,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+						),
+					),
+		'Q'	=>		array(
+						array(
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,1,0,0,1),
+							array(1,0,0,0,0,0,1,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,1,1,1,1,0,1),
+						),
+						array(
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,1,0,0,1,1,0,1,1),
+							array(0,1,1,1,1,1,1,1,0),
+							array(0,0,0,0,0,0,1,1,0),
+							array(0,0,0,0,0,0,0,1,1),
+							array(0,0,0,0,0,0,0,0,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,1,1,1,1),
+							array(0,0,0,0,1,1,0,0,1),
+							array(0,0,0,0,1,0,0,0,1),
+							array(0,0,0,0,1,0,0,0,1),
+							array(0,0,0,0,1,1,0,1,1),
+							array(0,0,0,0,0,1,1,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+						),
+					),
+		'R'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+							array(1,1,1,0,0,0,0,0,0),
+							array(1,0,0,1,0,0,0,0,0),
+							array(1,0,0,0,1,0,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,0,1,0,0),
+							array(1,0,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+						),
+						array(
+							array(1,1,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,1,1,1,1,0,0),
+							array(0,1,1,0,0,0,0,0,0),
+							array(0,1,1,1,0,0,0,0,0),
+							array(0,1,0,1,1,0,0,0,0),
+							array(0,1,0,0,1,1,0,0,0),
+							array(0,1,0,0,0,1,1,0,0),
+							array(0,1,0,0,0,0,1,1,0),
+							array(1,1,1,0,0,0,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,1,1,0,0,0,0),
+							array(1,1,0,0,1,1,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+						),
+					),
+		'S'	=>		array(
+						array(
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,0,0,0,0,0,0,1,0),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,1,1,1,1,1,0,1),
+							array(0,1,0,0,0,0,0,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,0,0,0,0,0,0,1,0),
+							array(0,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,1,0,0,0,0,0,1,0),
+							array(1,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,1,1,1,0,0,0,0),
+							array(1,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,0,0,0,0,0,0,0),
+							array(0,1,1,1,1,0,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(1,0,0,0,1,1,0,0,0),
+							array(0,1,1,1,1,0,0,0,0),
+						),
+					),
+		'T'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+						),
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,1,1,0,0,0),
+						),
+						array(
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,1,1,1,1,1,1,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,1,0,0,0),
+							array(0,0,0,0,0,1,1,1,0),
+						),
+					),
+		'U'	=>		array(
+						array(
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,0,0,0,1,1,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,0,1,1,1,1,1,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,1,0,0,0,0,0,1),
+							array(0,0,1,0,0,0,0,0,1),
+							array(0,0,1,0,0,0,0,0,1),
+							array(0,0,1,0,0,0,0,0,1),
+							array(0,0,1,0,0,0,0,0,1),
+							array(0,0,1,0,0,0,0,1,1),
+							array(0,0,1,1,0,0,1,1,1),
+							array(0,0,0,1,1,1,1,0,1),
+						),
+					),
+		'V'	=>		array(
+						array(
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,1,1,0,0,0,1,1,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+						),
+					),
+		'W'	=>		array(
+						array(
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,0,1,0,0,0,1),
+							array(1,0,0,1,0,1,0,0,1),
+							array(1,0,0,1,0,1,0,0,1),
+							array(1,0,0,1,0,1,0,0,1),
+							array(1,0,1,0,0,0,1,0,1),
+							array(1,0,1,0,0,0,1,0,1),
+							array(1,0,1,0,0,0,1,0,1),
+							array(1,1,0,0,0,0,0,1,1),
+							array(1,1,0,0,0,0,0,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,1,1,0,0,0,1,1,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,1,0,0,1,0),
+							array(0,1,0,0,1,0,0,1,0),
+							array(0,1,0,1,1,1,0,1,0),
+							array(0,1,0,1,0,1,0,1,0),
+							array(0,1,1,1,0,1,1,1,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,0,0,0,0,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,1,0,0,1,0),
+							array(0,1,0,0,1,0,0,1,0),
+							array(0,1,0,1,1,1,0,1,0),
+							array(0,1,0,1,0,1,0,1,0),
+							array(0,1,1,1,0,1,1,1,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,0,0,0,0,0,0,0),
+						),
+					),
+		'X'	=>		array(
+						array(
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,1,1,0,0,0,1,1,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,1,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(1,1,1,0,0,0,1,1,1),
+							array(0,0,0,0,0,0,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,0,1,1,0,1,1,0,0),
+							array(0,0,0,1,1,1,0,0,0),
+							array(0,0,0,1,1,1,0,0,0),
+							array(0,0,1,1,0,1,1,0,0),
+							array(0,1,1,0,0,0,1,1,0),
+							array(0,0,0,0,0,0,0,0,0),
+						),
+					),
+		'Y'	=>		array(
+						array(
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(1,1,1,0,0,0,1,1,1),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,1,0,0,0,0,0,1,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,1,0,0,0,1,0,0),
+							array(0,0,0,1,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,1,1,0,0,0),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,1,0,0,0,0,1),
+							array(0,0,0,1,1,0,0,0,1),
+							array(0,0,0,0,1,0,0,1,1),
+							array(0,0,0,0,1,1,0,1,0),
+							array(0,0,0,0,0,1,1,1,0),
+							array(0,0,0,0,0,0,1,0,0),
+							array(0,0,0,0,0,1,1,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,1,1,0,0,0),
+							array(0,0,1,1,1,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+						),
+					),
+		'Z'	=>		array(
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(1,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,1,0),
+							array(0,0,0,0,0,0,1,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,1,0,0,0,0),
+							array(0,0,0,1,0,0,0,0,0),
+							array(0,0,0,1,0,0,0,0,0),
+							array(0,0,1,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,1),
+							array(1,1,1,1,1,1,1,1,1),
+						),
+						array(
+							array(1,1,1,1,1,1,1,1,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,0,1),
+							array(0,0,0,0,0,0,0,1,0),
+							array(0,0,0,0,0,0,1,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,0,0,0,1,0,0,0),
+							array(0,0,1,1,1,1,1,0,0),
+							array(0,0,0,1,0,0,0,0,0),
+							array(0,0,0,1,0,0,0,0,0),
+							array(0,0,1,0,0,0,0,0,0),
+							array(0,1,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,0,0,0,0,0,0,0,0),
+							array(1,1,1,1,1,1,1,1,1),
+						),
+						array(
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,0,0,0,0,0,0,0,0),
+							array(0,1,1,1,1,1,1,1,0),
+							array(0,0,0,0,0,1,1,0,0),
+							array(0,0,0,0,1,1,0,0,0),
+							array(0,0,0,1,1,0,0,0,0),
+							array(0,0,1,1,0,0,0,0,0),
+							array(0,0,1,0,0,0,0,0,0),
+							array(0,1,1,1,1,1,1,1,0),
+						),
+					),
+				);
 		return array(
 			'width'		=> 9,
 			'height'	=> 15,
 			'data'		=> array(
 
-			'A' => array(
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,1,1,1,1,1,1,1,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-			),
-			'B' => array(
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,1,1,1,1,1,1,0,0),
-			),
-			'C' => array(
-				array(0,0,1,1,1,1,1,0,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,1,1,1,1,0,0),
-			),
-			'D' => array(
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,1,1,1,1,1,1,0,0),
-			),
-			'E' => array(
-				array(1,1,1,1,1,1,1,1,1),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,1,1,1,1,1,1,1,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,1,1,1,1,1,1,1,1),
-			),
-			'F' => array(
-				array(1,1,1,1,1,1,1,1,1),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-			),
-			'G' => array(
-				array(0,0,1,1,1,1,1,0,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,1,1,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,1,1,1,1,0,0),
-			),
-			'H' => array(
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,1,1,1,1,1,1,1,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-			),
-			'I' => array(
-				array(1,1,1,1,1,1,1,1,1),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(1,1,1,1,1,1,1,1,1),
-			),
-			'J' => array(
-				array(1,1,1,1,1,1,1,1,1),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(1,0,0,0,0,1,0,0,0),
-				array(1,0,0,0,0,1,0,0,0),
-				array(0,1,0,0,1,0,0,0,0),
-				array(0,0,1,1,0,0,0,0,0),
-			),
-			'K' => array(    // New 'K', supplied by NeoThermic
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,1,0,0),
-				array(1,0,0,0,0,1,0,0,0),
-				array(1,0,0,0,1,0,0,0,0),
-				array(1,0,0,1,0,0,0,0,0),
-				array(1,0,1,0,0,0,0,0,0),
-				array(1,1,0,0,0,0,0,0,0),
-				array(1,0,1,0,0,0,0,0,0),
-				array(1,0,0,1,0,0,0,0,0),
-				array(1,0,0,0,1,0,0,0,0),
-				array(1,0,0,0,0,1,0,0,0),
-				array(1,0,0,0,0,0,1,0,0),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-			),
-			'L' => array(
-				array(0,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,1,1,1,1,1,1,1,1),
-			),
-			'M' => array(
-				array(1,1,0,0,0,0,0,1,1),
-				array(1,1,0,0,0,0,0,1,1),
-				array(1,0,1,0,0,0,1,0,1),
-				array(1,0,1,0,0,0,1,0,1),
-				array(1,0,1,0,0,0,1,0,1),
-				array(1,0,0,1,0,1,0,0,1),
-				array(1,0,0,1,0,1,0,0,1),
-				array(1,0,0,1,0,1,0,0,1),
-				array(1,0,0,0,1,0,0,0,1),
-				array(1,0,0,0,1,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-			),
-			'N' => array(
-				array(1,1,0,0,0,0,0,0,1),
-				array(1,1,0,0,0,0,0,0,1),
-				array(1,0,1,0,0,0,0,0,1),
-				array(1,0,1,0,0,0,0,0,1),
-				array(1,0,0,1,0,0,0,0,1),
-				array(1,0,0,1,0,0,0,0,1),
-				array(1,0,0,0,1,0,0,0,1),
-				array(1,0,0,0,1,0,0,0,1),
-				array(1,0,0,0,1,0,0,0,1),
-				array(1,0,0,0,0,1,0,0,1),
-				array(1,0,0,0,0,1,0,0,1),
-				array(1,0,0,0,0,0,1,0,1),
-				array(1,0,0,0,0,0,1,0,1),
-				array(1,0,0,0,0,0,0,1,1),
-				array(1,0,0,0,0,0,0,1,1),
-			),
-			'O' => array(
-				array(0,0,1,1,1,1,1,0,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,1,1,1,1,0,0),
-			),
-			'P' => array(
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-			),
-			'Q' => array(
-				array(0,0,1,1,1,1,1,0,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,1,0,0,1),
-				array(1,0,0,0,0,0,1,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,1,1,1,1,0,1),
-			),
-			'R' => array(
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,1,1,1,1,1,1,0,0),
-				array(1,1,1,0,0,0,0,0,0),
-				array(1,0,0,1,0,0,0,0,0),
-				array(1,0,0,0,1,0,0,0,0),
-				array(1,0,0,0,0,1,0,0,0),
-				array(1,0,0,0,0,0,1,0,0),
-				array(1,0,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-			),
-			'S' => array(
-				array(0,0,1,1,1,1,1,0,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(0,1,0,0,0,0,0,0,0),
-				array(0,0,1,1,1,1,1,0,0),
-				array(0,0,0,0,0,0,0,1,0),
-				array(0,0,0,0,0,0,0,0,1),
-				array(0,0,0,0,0,0,0,0,1),
-				array(0,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,1,1,1,1,0,0),
-			),
-			'T' => array(
-				array(1,1,1,1,1,1,1,1,1),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-			),
-			'U' => array(
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,1,1,1,1,0,0),
-			),
-			'V' => array(
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-			),
-			'W' => array(    // New 'W', supplied by MHobbit
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,1,0,0,0,1),
-				array(1,0,0,0,1,0,0,0,1),
-				array(1,0,0,1,0,1,0,0,1),
-				array(1,0,0,1,0,1,0,0,1),
-				array(1,0,0,1,0,1,0,0,1),
-				array(1,0,1,0,0,0,1,0,1),
-				array(1,0,1,0,0,0,1,0,1),
-				array(1,0,1,0,0,0,1,0,1),
-				array(1,1,0,0,0,0,0,1,1),
-				array(1,1,0,0,0,0,0,1,1),
-			),
-			'X' => array(
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,1,0,0,0,0,1,0,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-			),
-			'Y' => array(
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,1,0,0,0,0,0,1,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,1,0,0,0,1,0,0),
-				array(0,0,0,1,0,1,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-			),
-			'Z' => array(    // New 'Z' supplied by Anon
-				array(1,1,1,1,1,1,1,1,1),
-				array(1,0,0,0,0,0,0,0,1),
-				array(0,0,0,0,0,0,0,0,1),
-				array(0,0,0,0,0,0,0,1,0),
-				array(0,0,0,0,0,0,1,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,0,1,0,0,0),
-				array(0,0,0,0,1,0,0,0,0),
-				array(0,0,0,1,0,0,0,0,0),
-				array(0,0,0,1,0,0,0,0,0),
-				array(0,0,1,0,0,0,0,0,0),
-				array(0,1,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,0),
-				array(1,0,0,0,0,0,0,0,1),
-				array(1,1,1,1,1,1,1,1,1),
-			),
+			'A' =>	$chars['A'][mt_rand(0, min(count($chars['A']), $config['captcha_gd_fonts']) -1)],
+			'B' =>	$chars['B'][mt_rand(0, min(count($chars['B']), $config['captcha_gd_fonts']) -1)],
+			'C' =>	$chars['C'][mt_rand(0, min(count($chars['C']), $config['captcha_gd_fonts']) -1)],
+			'D' =>	$chars['D'][mt_rand(0, min(count($chars['D']), $config['captcha_gd_fonts']) -1)],
+			'E' =>	$chars['E'][mt_rand(0, min(count($chars['E']), $config['captcha_gd_fonts']) -1)],
+			'F' =>	$chars['F'][mt_rand(0, min(count($chars['F']), $config['captcha_gd_fonts']) -1)],
+			'G' =>	$chars['G'][mt_rand(0, min(count($chars['G']), $config['captcha_gd_fonts']) -1)],
+			'H' =>	$chars['H'][mt_rand(0, min(count($chars['H']), $config['captcha_gd_fonts']) -1)],
+			'I' =>	$chars['I'][mt_rand(0, min(count($chars['I']), $config['captcha_gd_fonts']) -1)],
+			'J' =>	$chars['J'][mt_rand(0, min(count($chars['J']), $config['captcha_gd_fonts']) -1)],
+			'K' =>	$chars['K'][mt_rand(0, min(count($chars['K']), $config['captcha_gd_fonts']) -1)],
+			'L' =>	$chars['L'][mt_rand(0, min(count($chars['L']), $config['captcha_gd_fonts']) -1)],
+			'M' =>	$chars['M'][mt_rand(0, min(count($chars['M']), $config['captcha_gd_fonts']) -1)],  
+			'N' =>	$chars['N'][mt_rand(0, min(count($chars['N']), $config['captcha_gd_fonts']) -1)],
+			'O' =>	$chars['O'][mt_rand(0, min(count($chars['O']), $config['captcha_gd_fonts']) -1)],
+			'P' =>	$chars['P'][mt_rand(0, min(count($chars['P']), $config['captcha_gd_fonts']) -1)],
+			'Q' =>	$chars['Q'][mt_rand(0, min(count($chars['Q']), $config['captcha_gd_fonts']) -1)],
+			'R' =>	$chars['R'][mt_rand(0, min(count($chars['R']), $config['captcha_gd_fonts']) -1)],
+			'S' =>	$chars['S'][mt_rand(0, min(count($chars['S']), $config['captcha_gd_fonts']) -1)],
+			'T' =>	$chars['T'][mt_rand(0, min(count($chars['T']), $config['captcha_gd_fonts']) -1)],
+			'U' =>	$chars['U'][mt_rand(0, min(count($chars['U']), $config['captcha_gd_fonts']) -1)],
+			'V' =>	$chars['V'][mt_rand(0, min(count($chars['V']), $config['captcha_gd_fonts']) -1)],
+			'W' =>	$chars['W'][mt_rand(0, min(count($chars['W']), $config['captcha_gd_fonts']) -1)],
+			'X' =>	$chars['X'][mt_rand(0, min(count($chars['X']), $config['captcha_gd_fonts']) -1)],
+			'Y' =>	$chars['Y'][mt_rand(0, min(count($chars['Y']), $config['captcha_gd_fonts']) -1)],
+			'Z' =>	$chars['Z'][mt_rand(0, min(count($chars['Z']), $config['captcha_gd_fonts']) -1)],
+
 			'1' => array(
 				array(0,0,0,1,1,0,0,0,0),
 				array(0,0,1,0,1,0,0,0,0),
diff -x .svn -aruN 3.0.4.src/includes/constants.php 3.0.5.src/includes/constants.php
--- 3.0.4.src/includes/constants.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/constants.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: constants.php 9187 2008-12-12 14:47:03Z acydburn $
+* @version $Id: constants.php 9521 2009-05-31 10:46:40Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -25,7 +25,7 @@
 */
 
 // phpBB Version
-define('PHPBB_VERSION', '3.0.4');
+define('PHPBB_VERSION', '3.0.5');
 
 // QA-related
 // define('PHPBB_QA', 1);
@@ -185,6 +185,10 @@
 @define('CHMOD_WRITE', 2);
 @define('CHMOD_EXECUTE', 1);
 
+// Captcha code length
+define('CAPTCHA_MIN_CHARS', 4);
+define('CAPTCHA_MAX_CHARS', 7);
+
 // Additional constants
 define('VOTE_CONVERTED', 127);
 
diff -x .svn -aruN 3.0.4.src/includes/db/db_tools.php 3.0.5.src/includes/db/db_tools.php
--- 3.0.4.src/includes/db/db_tools.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/db/db_tools.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package dbal
-* @version $Id: db_tools.php 8814 2008-09-04 12:01:47Z acydburn $
+* @version $Id: db_tools.php 9495 2009-04-29 13:41:49Z acydburn $
 * @copyright (c) 2007 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -30,6 +30,15 @@
 	*/
 	var $sql_layer = '';
 
+	/**
+	* @var object DB object
+	*/
+	var $db = NULL;
+
+	/**
+	* The Column types for every database we support
+	* @var array
+	*/
 	var $dbms_type_map = array(
 		'mysql_41'	=> array(
 			'INT:'		=> 'int(%d)',
@@ -242,20 +251,34 @@
 		),
 	);
 
-	// A list of types being unsigned for better reference in some db's
+	/**
+	* A list of types being unsigned for better reference in some db's
+	* @var array
+	*/
 	var $unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
+
+	/**
+	* A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules.
+	* @var array
+	*/
 	var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite');
 
 	/**
-	* Set this to true if you only want to return the 'to-be-executed' SQL statement(s) (as an array).
+	* This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array).
+	* This mode has no effect on some methods (inserting of data for example). This is expressed within the methods command.
 	*/
 	var $return_statements = false;
 
 	/**
+	* Constructor. Set DB Object and set {@link $return_statements return_statements}.
+	*
+	* @param phpbb_dbal	$db					DBAL object
+	* @param bool		$return_statements	True if only statements should be returned and no SQL being executed
 	*/
-	function phpbb_db_tools(&$db)
+	function phpbb_db_tools(&$db, $return_statements = false)
 	{
 		$this->db = $db;
+		$this->return_statements = $return_statements;
 
 		// Determine mapping database type
 		switch ($this->db->sql_layer)
@@ -291,6 +314,245 @@
 	}
 
 	/**
+	* Check if table exists
+	*
+	*
+	* @param string	$table_name	The table name to check for
+	* @return bool true if table exists, else false
+	*/
+	function sql_table_exists($table_name)
+	{
+		$this->db->sql_return_on_error(true);
+		$result = $this->db->sql_query_limit('SELECT * FROM ' . $table_name, 1);
+		$this->db->sql_return_on_error(false);
+
+		if ($result)
+		{
+			$this->db->sql_freeresult($result);
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	* Create SQL Table
+	*
+	* @param string	$table_name	The table name to create
+	* @param array	$table_data	Array containing table data.
+	* @return array	Statements if $return_statements is true.
+	*/
+	function sql_create_table($table_name, $table_data)
+	{
+		// holds the DDL for a column
+		$columns = $statements = array();
+
+		// Begin transaction
+		$statements[] = 'begin';
+
+		// Determine if we have created a PRIMARY KEY in the earliest
+		$primary_key_gen = false;
+
+		// Determine if the table must be created with TEXTIMAGE
+		$create_textimage = false;
+
+		// Determine if the table requires a sequence
+		$create_sequence = false;
+
+		// Begin table sql statement
+		switch ($this->sql_layer)
+		{
+			case 'mssql':
+				$table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n";
+			break;
+
+			default:
+				$table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n";
+			break;
+		}
+
+		// Iterate through the columns to create a table
+		foreach ($table_data['COLUMNS'] as $column_name => $column_data)
+		{
+			// here lies an array, filled with information compiled on the column's data
+			$prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data);
+
+			// here we add the definition of the new column to the list of columns
+			switch ($this->sql_layer)
+			{
+				case 'mssql':
+					$columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default'];
+				break;
+
+				default:
+					$columns[] = "\t {$column_name} " . $prepared_column['column_type_sql'];
+				break;
+			}
+
+			// see if we have found a primary key set due to a column definition if we have found it, we can stop looking
+			if (!$primary_key_gen)
+			{
+				$primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set'];
+			}
+
+			// create textimage DDL based off of the existance of certain column types
+			if (!$create_textimage)
+			{
+				$create_textimage = isset($prepared_column['textimage']) && $prepared_column['textimage'];
+			}
+
+			// create sequence DDL based off of the existance of auto incrementing columns
+			if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'])
+			{
+				$create_sequence = $column_name;
+			}
+		}
+
+		// this makes up all the columns in the create table statement
+		$table_sql .= implode(",\n", $columns);
+
+		// Close the table for two DBMS and add to the statements
+		switch ($this->sql_layer)
+		{
+			case 'firebird':
+				$table_sql .= "\n);";
+				$statements[] = $table_sql;
+			break;
+
+			case 'mssql':
+				$table_sql .= "\n) ON [PRIMARY]" . (($create_textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : '');
+				$statements[] = $table_sql;
+			break;
+		}
+
+		// we have yet to create a primary key for this table,
+		// this means that we can add the one we really wanted instead
+		if (!$primary_key_gen)
+		{
+			// Write primary key
+			if (isset($table_data['PRIMARY_KEY']))
+			{
+				if (!is_array($table_data['PRIMARY_KEY']))
+				{
+					$table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']);
+				}
+
+				switch ($this->sql_layer)
+				{
+					case 'mysql_40':
+					case 'mysql_41':
+					case 'postgres':
+					case 'sqlite':
+						$table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')';
+					break;
+
+					case 'firebird':
+					case 'mssql':
+						$primary_key_stmts = $this->sql_create_primary_key($table_name, $table_data['PRIMARY_KEY']);
+						foreach ($primary_key_stmts as $pk_stmt)
+						{
+							$statements[] = $pk_stmt;
+						}
+					break;
+
+					case 'oracle':
+						$table_sql .= ",\n\t CONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')';
+					break;
+				}
+			}
+		}
+
+		// close the table
+		switch ($this->sql_layer)
+		{
+			case 'mysql_41':
+				// make sure the table is in UTF-8 mode
+				$table_sql .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;";
+				$statements[] = $table_sql;
+			break;
+
+			case 'mysql_40':
+			case 'sqlite':
+				$table_sql .= "\n);";
+				$statements[] = $table_sql;
+			break;
+
+			case 'postgres':
+				// do we need to add a sequence for auto incrementing columns?
+				if ($create_sequence)
+				{
+					$statements[] = "CREATE SEQUENCE {$table_name}_seq;";
+				}
+
+				$table_sql .= "\n);";
+				$statements[] = $table_sql;
+			break;
+
+			case 'oracle':
+				$table_sql .= "\n);";
+				$statements[] = $table_sql;
+
+				// do we need to add a sequence and a tigger for auto incrementing columns?
+				if ($create_sequence)
+				{
+					// create the actual sequence
+					$statements[] = "CREATE SEQUENCE {$table_name}_seq";
+
+					// the trigger is the mechanism by which we increment the counter
+					$trigger = "CREATE OR REPLACE TRIGGER t_{$table_name}\n";
+					$trigger .= "BEFORE INSERT ON {$table_name}\n";
+					$trigger .= "FOR EACH ROW WHEN (\n";
+					$trigger .= "\tnew.{$create_sequence} IS NULL OR new.{$create_sequence} = 0\n";
+					$trigger .= ")\n";
+					$trigger .= "BEGIN\n";
+					$trigger .= "\tSELECT {$table_name}_seq.nextval\n";
+					$trigger .= "\tINTO :new.{$create_sequence}\n";
+					$trigger .= "\tFROM dual\n";
+					$trigger .= "END;";
+
+					$statements[] = $trigger;
+				}
+			break;
+
+			case 'firebird':
+				if ($create_sequence)
+				{
+					$statements[] = "CREATE SEQUENCE {$table_name}_seq;";
+				}
+			break;
+		}
+
+		// Write Keys
+		if (isset($table_data['KEYS']))
+		{
+			foreach ($table_data['KEYS'] as $key_name => $key_data)
+			{
+				if (!is_array($key_data[1]))
+				{
+					$key_data[1] = array($key_data[1]);
+				}
+
+				$old_return_statements = $this->return_statements;
+				$this->return_statements = true;
+
+				$key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]);
+
+				foreach ($key_stmts as $key_stmt)
+				{
+					$statements[] = $key_stmt;
+				}
+
+				$this->return_statements = $old_return_statements;
+			}
+		}
+
+		// Commit Transaction
+		$statements[] = 'commit';
+
+		return $this->_sql_run_sql($statements);
+	}
+
+	/**
 	* Handle passed database update array.
 	* Expected structure...
 	* Key being one of the following
@@ -308,7 +570,7 @@
 	*			{KEY/INDEX NAME}	=> array({COLUMN NAMES}),
 	*		)
 	*
-	* For more information have a look at /develop/create_schema_files.php (only available through CVS)
+	* For more information have a look at /develop/create_schema_files.php (only available through SVN)
 	*/
 	function perform_schema_changes($schema_changes)
 	{
@@ -326,7 +588,15 @@
 			{
 				foreach ($columns as $column_name => $column_data)
 				{
-					$result = $this->sql_column_change($table, $column_name, $column_data);
+					// If the column exists we change it, else we add it ;)
+					if ($this->sql_column_exists($table, $column_name))
+					{
+						$result = $this->sql_column_change($table, $column_name, $column_data);
+					}
+					else
+					{
+						$result = $this->sql_column_add($table, $column_name, $column_data);
+					}
 
 					if ($this->return_statements)
 					{
@@ -343,15 +613,19 @@
 			{
 				foreach ($columns as $column_name => $column_data)
 				{
-					// Only add the column if it does not exist yet
-					if (!$this->sql_column_exists($table, $column_name))
+					// Only add the column if it does not exist yet, else change it (to be consistent)
+					if ($this->sql_column_exists($table, $column_name))
+					{
+						$result = $this->sql_column_change($table, $column_name, $column_data);
+					}
+					else
 					{
 						$result = $this->sql_column_add($table, $column_name, $column_data);
+					}
 
-						if ($this->return_statements)
-						{
-							$statements = array_merge($statements, $result);
-						}
+					if ($this->return_statements)
+					{
+						$statements = array_merge($statements, $result);
 					}
 				}
 			}
@@ -381,11 +655,15 @@
 			{
 				foreach ($columns as $column)
 				{
-					$result = $this->sql_column_remove($table, $column);
-
-					if ($this->return_statements)
+					// Only remove the column if it exists...
+					if ($this->sql_column_exists($table, $column))
 					{
-						$statements = array_merge($statements, $result);
+						$result = $this->sql_column_remove($table, $column);
+
+						if ($this->return_statements)
+						{
+							$statements = array_merge($statements, $result);
+						}
 					}
 				}
 			}
@@ -447,6 +725,10 @@
 
 	/**
 	* Check if a specified column exist
+	*
+	* @param string	$table			Table to check the column at
+	* @param string	$column_name	The column to check
+	*
 	* @return bool True if column exists, else false
 	*/
 	function sql_column_exists($table, $column_name)
@@ -632,7 +914,6 @@
 		if (strpos($column_data[0], ':') !== false)
 		{
 			list($orig_column_type, $column_length) = explode(':', $column_data[0]);
-
 			if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']))
 			{
 				$column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length);
@@ -705,6 +986,12 @@
 					$sql .= ' COLLATE UNICODE';
 				}
 
+				$return_array['auto_increment'] = false;
+				if (isset($column_data[2]) && $column_data[2] == 'auto_increment')
+				{
+					$return_array['auto_increment'] = true;
+				}
+
 			break;
 
 			case 'mssql':
@@ -725,10 +1012,19 @@
 					}
 				}
 
+				if (isset($column_data[2]) && $column_data[2] == 'auto_increment')
+				{
+//					$sql .= 'IDENTITY (1, 1) ';
+					$sql_default .= 'IDENTITY (1, 1) ';
+				}
+
+				$return_array['textimage'] = $column_type === '[text]';
+
 				$sql .= 'NOT NULL';
 				$sql_default .= 'NOT NULL';
 
 				$return_array['column_type_sql_default'] = $sql_default;
+
 			break;
 
 			case 'mysql_40':
@@ -763,10 +1059,17 @@
 				// In Oracle empty strings ('') are treated as NULL.
 				// Therefore in oracle we allow NULL's for all DEFAULT '' entries
 				// Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields)
-				if (preg_match('/number/i', $column_type))
+				if (!preg_match('/number/i', $column_type))
 				{
 					$sql .= ($column_data[1] === '') ? '' : 'NOT NULL';
 				}
+
+				$return_array['auto_increment'] = false;
+				if (isset($column_data[2]) && $column_data[2] == 'auto_increment')
+				{
+					$return_array['auto_increment'] = true;
+				}
+
 			break;
 
 			case 'postgres':
@@ -774,9 +1077,11 @@
 
 				$sql .= " {$column_type} ";
 
+				$return_array['auto_increment'] = false;
 				if (isset($column_data[2]) && $column_data[2] == 'auto_increment')
 				{
 					$default_val = "nextval('{$table_name}_seq')";
+					$return_array['auto_increment'] = true;
 				}
 				else if (!is_null($column_data[1]))
 				{
@@ -795,12 +1100,15 @@
 					$return_array['constraint'] = "CHECK ({$column_name} >= 0)";
 					$sql .= " CHECK ({$column_name} >= 0)";
 				}
+
 			break;
 
 			case 'sqlite':
+				$return_array['primary_key_set'] = false;
 				if (isset($column_data[2]) && $column_data[2] == 'auto_increment')
 				{
 					$sql .= ' INTEGER PRIMARY KEY';
+					$return_array['primary_key_set'] = true;
 				}
 				else
 				{
@@ -809,6 +1117,7 @@
 
 				$sql .= ' NOT NULL ';
 				$sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : '';
+
 			break;
 		}
 
@@ -828,7 +1137,7 @@
 		switch ($this->sql_layer)
 		{
 			case 'firebird':
-				$statements[] = 'ALTER TABLE "' . $table_name . '" ADD "' . $column_name . '" ' . $column_data['column_type_sql'];
+				$statements[] = 'ALTER TABLE ' . $table_name . ' ADD "' . strtoupper($column_name) . '" ' . $column_data['column_type_sql'];
 			break;
 
 			case 'mssql':
@@ -920,7 +1229,7 @@
 		switch ($this->sql_layer)
 		{
 			case 'firebird':
-				$statements[] = 'ALTER TABLE "' . $table_name . '" DROP "' . $column_name . '"';
+				$statements[] = 'ALTER TABLE ' . $table_name . ' DROP "' . strtoupper($column_name) . '"';
 			break;
 
 			case 'mssql':
@@ -1032,6 +1341,68 @@
 	}
 
 	/**
+	* Drop Table
+	*/
+	function sql_table_drop($table_name)
+	{
+		$statements = array();
+
+		// the most basic operation, get rid of the table
+		$statements[] = 'DROP TABLE ' . $table_name;
+
+		switch ($this->sql_layer)
+		{
+			case 'firebird':
+				$sql = 'SELECT RDB$GENERATOR_NAME as gen
+					FROM RDB$GENERATORS
+					WHERE RDB$SYSTEM_FLAG = 0
+						AND RDB$GENERATOR_NAME = \'' . strtoupper($table_name) . "_GEN'";
+				$result = $this->db->sql_query($sql);
+
+				// does a generator exist?
+				if ($row = $this->db->sql_fetchrow($result))
+				{
+					$statements[] = "DROP GENERATOR {$row['gen']};";
+				}
+				$this->db->sql_freeresult($result);
+			break;
+
+			case 'oracle':
+				$sql = 'SELECT A.REFERENCED_NAME
+					FROM USER_DEPENDENCIES A, USER_TRIGGERS B
+					WHERE A.REFERENCED_TYPE = \'SEQUENCE\'
+						AND A.NAME = B.TRIGGER_NAME
+						AND B.TABLE_NAME = \'' . strtoupper($table_name) . "'";
+				$result = $this->db->sql_query($sql);
+
+				// any sequences ref'd to this table's triggers?
+				while ($row = $this->db->sql_fetchrow($result))
+				{
+					$statements[] = "DROP SEQUENCE {$row['referenced_name']}";
+				}
+				$this->db->sql_freeresult($result);
+
+			case 'postgres':
+				// PGSQL does not "tightly" bind sequences and tables, we must guess...
+				$sql = "SELECT relname
+					FROM pg_class
+					WHERE relkind = 'S'
+						AND relname = '{$table_name}_seq'";
+				$result = $this->db->sql_query($sql);
+
+				// We don't even care about storing the results. We already know the answer if we get rows back.
+				if ($this->db->sql_fetchrow($result))
+				{
+					$statements[] =  "DROP SEQUENCE {$table_name}_seq;\n";
+				}
+				$this->db->sql_freeresult($result);
+			break;
+		}
+
+		return $this->_sql_run_sql($statements);
+	}
+
+	/**
 	* Add primary key
 	*/
 	function sql_create_primary_key($table_name, $column)
@@ -1042,6 +1413,8 @@
 		{
 			case 'firebird':
 			case 'postgres':
+			case 'mysql_40':
+			case 'mysql_41':
 				$statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')';
 			break;
 
@@ -1054,11 +1427,6 @@
 				$statements[] = $sql;
 			break;
 
-			case 'mysql_40':
-			case 'mysql_41':
-				$statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')';
-			break;
-
 			case 'oracle':
 				$statements[] = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')';
 			break;
@@ -1233,6 +1601,7 @@
 						FROM user_indexes
 						WHERE table_name = '" . $table_name . "'
 							AND generated = 'N'";
+					$col = 'index_name';
 				break;
 
 				case 'sqlite':
@@ -1279,7 +1648,7 @@
 		{
 			case 'firebird':
 				// Change type...
-				$statements[] = 'ALTER TABLE "' . $table_name . '" ALTER COLUMN "' . $column_name . '" TYPE ' . ' ' . $column_data['column_type_sql'];
+				$statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" TYPE ' . ' ' . $column_data['column_type_sql'];
 			break;
 
 			case 'mssql':
diff -x .svn -aruN 3.0.4.src/includes/db/mysql.php 3.0.5.src/includes/db/mysql.php
--- 3.0.4.src/includes/db/mysql.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/db/mysql.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package dbal
-* @version $Id: mysql.php 8815 2008-09-04 13:37:01Z acydburn $
+* @version $Id: mysql.php 9378 2009-03-16 17:08:28Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -51,7 +51,7 @@
 			if (@mysql_select_db($this->dbname, $this->db_connect_id))
 			{
 				// Determine what version we are using and if it natively supports UNICODE
-				if (version_compare($this->sql_server_info(true), '4.1.3', '>='))
+				if (version_compare($this->sql_server_info(true), '4.1.0', '>='))
 				{
 					@mysql_query("SET NAMES 'utf8'", $this->db_connect_id);
 
@@ -341,7 +341,7 @@
 
 		return $data;
 	}
-	
+
 	/**
 	* return sql error array
 	* @access private
diff -x .svn -aruN 3.0.4.src/includes/db/postgres.php 3.0.5.src/includes/db/postgres.php
--- 3.0.4.src/includes/db/postgres.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/db/postgres.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package dbal
-* @version $Id: postgres.php 8814 2008-09-04 12:01:47Z acydburn $
+* @version $Id: postgres.php 9412 2009-03-30 10:44:18Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -26,7 +26,7 @@
 class dbal_postgres extends dbal
 {
 	var $last_query_text = '';
-	
+
 	/**
 	* Connect to server
 	*/
@@ -55,7 +55,7 @@
 			{
 				$connect_string .= "host=$sqlserver ";
 			}
-		
+
 			if ($port)
 			{
 				$connect_string .= "port=$port ";
@@ -224,7 +224,7 @@
 		// if $total is set to 0 we do not want to limit the number of rows
 		if ($total == 0)
 		{
-			$total = -1;
+			$total = 'ALL';
 		}
 
 		$query .= "\n LIMIT $total OFFSET $offset";
diff -x .svn -aruN 3.0.4.src/includes/diff/diff.php 3.0.5.src/includes/diff/diff.php
--- 3.0.4.src/includes/diff/diff.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/diff/diff.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package diff
-* @version $Id: diff.php 8765 2008-08-16 22:18:25Z aptx $
+* @version $Id: diff.php 9505 2009-05-01 11:08:48Z acydburn $
 * @copyright (c) 2006 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -17,7 +17,7 @@
 }
 
 /**
-* Code from pear.php.net, Text_Diff-1.0.0 package
+* Code from pear.php.net, Text_Diff-1.1.0 package
 * http://pear.php.net/package/Text_Diff/
 *
 * Modified by phpBB Group to meet our coding standards
@@ -61,6 +61,48 @@
 	}
 
 	/**
+	* returns the number of new (added) lines in a given diff.
+	*
+	* @since Text_Diff 1.1.0
+	*
+	* @return integer The number of new lines
+	*/
+	function count_added_lines()
+	{
+		$count = 0;
+
+		foreach ($this->_edits as $edit)
+		{
+			if (is_a($edit, 'diff_op_add') || is_a($edit, 'diff_op_change'))
+			{
+				$count += $edit->nfinal();
+			}
+		}
+		return $count;
+	}
+
+	/**
+	* Returns the number of deleted (removed) lines in a given diff.
+	*
+	* @since Text_Diff 1.1.0
+	*
+	* @return integer The number of deleted lines
+	*/
+	function count_deleted_lines()
+	{
+		$count = 0;
+
+		foreach ($this->_edits as $edit)
+		{
+			if (is_a($edit, 'diff_op_delete') || is_a($edit, 'diff_op_change'))
+			{
+				$count += $edit->norig();
+			}
+		}
+		return $count;
+	}
+
+	/**
 	* Computes a reversed diff.
 	*
 	* Example:
@@ -427,33 +469,37 @@
 	}
 
 	/**
-	* Return merged output
+	* Return number of conflicts
+	*/
+	function get_num_conflicts()
+	{
+		$conflicts = 0;
+
+		foreach ($this->_edits as $edit)
+		{
+			if ($edit->is_conflict())
+			{
+				$conflicts++;
+			}
+		}
+
+		return $conflicts;
+	}
+
+	/**
+	* Get conflicts content for download. This is generally a merged file, but preserving conflicts and adding explanations to it.
+	* A user could then go through this file, search for the conflicts and changes the code accordingly.
 	*
 	* @param string $label1 the cvs file version/label from the original set of lines
 	* @param string $label2 the cvs file version/label from the new set of lines
 	* @param string $label_sep the explanation between label1 and label2 - more of a helper for the user
-	* @param bool $get_conflicts if set to true only the number of conflicts is returned
-	* @param bool $merge_new if set to true the merged output will have the new file contents on a conflicting merge
 	*
 	* @return mixed the merged output
 	*/
-	function merged_output($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN', $get_conflicts = false, $merge_new = false)
+	function get_conflicts_content($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN')
 	{
 		global $user;
 
-		if ($get_conflicts)
-		{
-			foreach ($this->_edits as $edit)
-			{
-				if ($edit->is_conflict())
-				{
-					$this->_conflicting_blocks++;
-				}
-			}
-
-			return $this->_conflicting_blocks;
-		}
-
 		$label1 = (!empty($user->lang[$label1])) ? $user->lang[$label1] : $label1;
 		$label2 = (!empty($user->lang[$label2])) ? $user->lang[$label2] : $label2;
 		$label_sep = (!empty($user->lang[$label_sep])) ? $user->lang[$label_sep] : $label_sep;
@@ -464,14 +510,12 @@
 		{
 			if ($edit->is_conflict())
 			{
-				if (!$merge_new)
-				{
-					$lines = array_merge($lines, array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), $edit->final1, array('=======' . ($label_sep ? ' ' . $label_sep : '')), $edit->final2, array('>>>>>>>' . ($label2 ? ' ' . $label2 : '')));
-				}
-				else
-				{
-					$lines = array_merge($lines, $edit->final1);
-				}
+				// Start conflict label
+				$label_start	= array('<<<<<<< ' . $label1);
+				$label_mid		= array('======= ' . $label_sep);
+				$label_end		= array('>>>>>>> ' . $label2);
+
+				$lines = array_merge($lines, $label_start, $edit->final1, $label_mid, $edit->final2, $label_end);
 				$this->_conflicting_blocks++;
 			}
 			else
@@ -484,6 +528,16 @@
 	}
 
 	/**
+	* Return merged output (used by the renderer)
+	*
+	* @return mixed the merged output
+	*/
+	function merged_output()
+	{
+		return $this->get_conflicts_content();
+	}
+
+	/**
 	* Merge the output and use the new file code for conflicts
 	*/
 	function merged_new_output()
diff -x .svn -aruN 3.0.4.src/includes/diff/engine.php 3.0.5.src/includes/diff/engine.php
--- 3.0.4.src/includes/diff/engine.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/diff/engine.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package diff
-* @version $Id: engine.php 8765 2008-08-16 22:18:25Z aptx $
+* @version $Id: engine.php 9251 2009-01-12 16:47:58Z acydburn $
 * @copyright (c) 2006 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -17,7 +17,7 @@
 }
 
 /**
-* Code from pear.php.net, Text_Diff-1.0.0 package
+* Code from pear.php.net, Text_Diff-1.1.0 package
 * http://pear.php.net/package/Text_Diff/ (native engine)
 *
 * Modified by phpBB Group to meet our coding standards
diff -x .svn -aruN 3.0.4.src/includes/diff/renderer.php 3.0.5.src/includes/diff/renderer.php
--- 3.0.4.src/includes/diff/renderer.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/diff/renderer.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package diff
-* @version $Id: renderer.php 8766 2008-08-16 22:24:54Z aptx $
+* @version $Id: renderer.php 9254 2009-01-13 10:55:04Z acydburn $
 * @copyright (c) 2006 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -17,7 +17,7 @@
 }
 
 /**
-* Code from pear.php.net, Text_Diff-1.0.0 package
+* Code from pear.php.net, Text_Diff-1.1.0 package
 * http://pear.php.net/package/Text_Diff/
 *
 * Modified by phpBB Group to meet our coding standards
diff -x .svn -aruN 3.0.4.src/includes/functions_admin.php 3.0.5.src/includes/functions_admin.php
--- 3.0.4.src/includes/functions_admin.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_admin.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package acp
-* @version $Id: functions_admin.php 9065 2008-11-13 17:32:55Z toonarmy $
+* @version $Id: functions_admin.php 9441 2009-04-12 13:21:25Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -619,7 +619,7 @@
 
 	if ($approved_topics)
 	{
-		set_config('num_topics', $config['num_topics'] - $approved_topics, true);
+		set_config_count('num_topics', $approved_topics * (-1), true);
 	}
 
 	return $return;
@@ -652,7 +652,23 @@
 			return false;
 		}
 
-		$where_clause = $db->sql_in_set($where_type, array_map('intval', $where_ids));
+		$where_ids = array_map('intval', $where_ids);
+
+/*		Possible code for splitting post deletion
+		if (sizeof($where_ids) >= 1001)
+		{
+			// Split into chunks of 1000
+			$chunks = array_chunk($where_ids, 1000);
+
+			foreach ($chunks as $_where_ids)
+			{
+				delete_posts($where_type, $_where_ids, $auto_sync, $posted_sync, $post_count_sync, $call_delete_topics);
+			}
+
+			return;
+		}*/
+
+		$where_clause = $db->sql_in_set($where_type, $where_ids);
 	}
 
 	$approved_posts = 0;
@@ -665,10 +681,10 @@
 
 	while ($row = $db->sql_fetchrow($result))
 	{
-		$post_ids[] = $row['post_id'];
-		$poster_ids[] = $row['poster_id'];
-		$topic_ids[] = $row['topic_id'];
-		$forum_ids[] = $row['forum_id'];
+		$post_ids[] = (int) $row['post_id'];
+		$poster_ids[] = (int) $row['poster_id'];
+		$topic_ids[] = (int) $row['topic_id'];
+		$forum_ids[] = (int) $row['forum_id'];
 
 		if ($row['post_postcount'] && $post_count_sync && $row['post_approved'])
 		{
@@ -776,7 +792,7 @@
 
 	if ($approved_posts)
 	{
-		set_config('num_posts', $config['num_posts'] - $approved_posts, true);
+		set_config_count('num_posts', $approved_posts * (-1), true);
 	}
 
 	// We actually remove topics now to not be inconsistent (the delete_topics function calls this function too)
@@ -814,11 +830,14 @@
 		return false;
 	}
 
+	$sql_where = '';
+
 	switch ($mode)
 	{
 		case 'post':
 		case 'message':
 			$sql_id = 'post_msg_id';
+			$sql_where = ' AND in_message = ' . ($mode == 'message' ? 1 : 0);
 		break;
 
 		case 'topic':
@@ -842,6 +861,9 @@
 	$sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan
 			FROM ' . ATTACHMENTS_TABLE . '
 			WHERE ' . $db->sql_in_set($sql_id, $ids);
+
+	$sql .= $sql_where;
+
 	$result = $db->sql_query($sql);
 
 	while ($row = $db->sql_fetchrow($result))
@@ -867,6 +889,9 @@
 	// Delete attachments
 	$sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
 		WHERE ' . $db->sql_in_set($sql_id, $ids);
+
+	$sql .= $sql_where;
+
 	$db->sql_query($sql);
 	$num_deleted = $db->sql_affectedrows();
 
@@ -894,8 +919,8 @@
 
 	if ($space_removed || $files_removed)
 	{
-		set_config('upload_dir_size', $config['upload_dir_size'] - $space_removed, true);
-		set_config('num_files', $config['num_files'] - $files_removed, true);
+		set_config_count('upload_dir_size', $space_removed * (-1), true);
+		set_config_count('num_files', $files_removed * (-1), true);
 	}
 
 	// If we do not resync, we do not need to adjust any message, post, topic or user entries
diff -x .svn -aruN 3.0.4.src/includes/functions_content.php 3.0.5.src/includes/functions_content.php
--- 3.0.4.src/includes/functions_content.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_content.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_content.php 9184 2008-12-11 14:46:38Z acydburn $
+* @version $Id: functions_content.php 9515 2009-05-13 10:42:44Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -261,6 +261,11 @@
 			{
 				if (preg_match('#(?:[^\w]|^)(' . $word . ')(?:[^\w]|$)#i', $text, $match))
 				{
+					if (empty($match[1]))
+					{
+						continue;
+					}
+
 					$pos = utf8_strpos($text, $match[1]);
 					if ($pos !== false)
 					{
@@ -950,6 +955,8 @@
 						'S_THUMBNAIL'		=> true,
 						'THUMB_IMAGE'		=> $thumbnail_link,
 					);
+
+					$update_count[] = $attachment['attach_id'];
 				break;
 
 				// Windows Media Streams
@@ -996,6 +1003,7 @@
 						'S_FLASH_FILE'	=> true,
 						'WIDTH'			=> $width,
 						'HEIGHT'		=> $height,
+						'U_VIEW_LINK'	=> $download_link . '&amp;view=1',
 					);
 
 					// Viewed/Heared File ... update the download count
@@ -1126,7 +1134,7 @@
 			array_pop($chars);
 			$string = implode('', $chars);
 		}
-		while (utf8_strlen($string) > $max_store_length || !sizeof($chars));
+		while (!empty($chars) && utf8_strlen($string) > $max_store_length);
 	}
 
 	if ($strip_reply)
@@ -1159,72 +1167,87 @@
 function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false)
 {
 	static $_profile_cache;
-	static $_base_profile_url;
-
-	$cache_key = $user_id;
 
-	// If the get_username_string() function had been executed once with an (to us) unkown mode, all modes are pre-filled and we can just grab it.
-	if ($user_id && $user_id != ANONYMOUS && isset($_profile_cache[$cache_key][$mode]))
+	// We cache some common variables we need within this function
+	if (empty($_profile_cache))
 	{
-		// If the mode is 'no_profile', we simply construct the TPL code due to calls to this mode being very very rare
-		if ($mode == 'no_profile')
-		{
-			$tpl = (!$_profile_cache[$cache_key]['colour']) ? '{USERNAME}' : '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>';
-			return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($_profile_cache[$cache_key]['colour'], $_profile_cache[$cache_key]['username']), $tpl);
-		}
+		global $phpbb_root_path, $phpEx;
 
-		return $_profile_cache[$cache_key][$mode];
+		$_profile_cache['base_url'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u={USER_ID}');
+		$_profile_cache['tpl_noprofile'] = '{USERNAME}';
+		$_profile_cache['tpl_noprofile_colour'] = '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>';
+		$_profile_cache['tpl_profile'] = '<a href="{PROFILE_URL}">{USERNAME}</a>';
+		$_profile_cache['tpl_profile_colour'] = '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>';
 	}
 
-	global $phpbb_root_path, $phpEx, $user, $auth;
-
-	$username_colour = ($username_colour) ? '#' . $username_colour : '';
+	global $user, $auth;
 
-	if ($guest_username === false)
-	{
-		$username = ($username) ? $username : $user->lang['GUEST'];
-	}
-	else
+	// This switch makes sure we only run code required for the mode
+	switch ($mode)
 	{
-		$username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']);
-	}
+		case 'full':
+		case 'no_profile':
+		case 'colour':
 
-	// Build cache for all modes
-	$_profile_cache[$cache_key]['colour'] = $username_colour;
-	$_profile_cache[$cache_key]['username'] = $username;
-	$_profile_cache[$cache_key]['no_profile'] = true;
+			// Build correct username colour
+			$username_colour = ($username_colour) ? '#' . $username_colour : '';
 
-	// Profile url - only show if not anonymous and permission to view profile if registered user
-	// For anonymous the link leads to a login page.
-	if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile')))
-	{
-		if (empty($_base_profile_url))
-		{
-			$_base_profile_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u={USER_ID}');
-		}
+			// Return colour
+			if ($mode == 'colour')
+			{
+				return $username_colour;
+			}
 
-		$profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&amp;u=' . (int) $user_id : str_replace('={USER_ID}', '=' . (int) $user_id, $_base_profile_url);
-		$tpl = (!$username_colour) ? '<a href="{PROFILE_URL}">{USERNAME}</a>' : '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>';
-		$_profile_cache[$cache_key]['full'] = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), $tpl);
-	}
-	else
-	{
-		$tpl = (!$username_colour) ? '{USERNAME}' : '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>';
-		$_profile_cache[$cache_key]['full'] = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), $tpl);
-		$profile_url = '';
-	}
+		// no break;
 
-	// Use the profile url from above
-	$_profile_cache[$cache_key]['profile'] = $profile_url;
+		case 'username':
+
+			// Build correct username
+			if ($guest_username === false)
+			{
+				$username = ($username) ? $username : $user->lang['GUEST'];
+			}
+			else
+			{
+				$username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']);
+			}
+
+			// Return username
+			if ($mode == 'username')
+			{
+				return $username;
+			}
+
+		// no break;
+
+		case 'profile':
+
+			// Build correct profile url - only show if not anonymous and permission to view profile if registered user
+			// For anonymous the link leads to a login page.
+			if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile')))
+			{
+				$profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&amp;u=' . (int) $user_id : str_replace(array('={USER_ID}', '=%7BUSER_ID%7D'), '=' . (int) $user_id, $_profile_cache['base_url']);
+			}
+			else
+			{
+				$profile_url = '';
+			}
+
+			// Return profile
+			if ($mode == 'profile')
+			{
+				return $profile_url;
+			}
+
+		// no break;
+	}
 
-	// If - by any chance - no_profile is called before any other mode, we need to do the calculation here
-	if ($mode == 'no_profile')
+	if (($mode == 'full' && !$profile_url) || $mode == 'no_profile')
 	{
-		$tpl = (!$_profile_cache[$cache_key]['colour']) ? '{USERNAME}' : '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>';
-		return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($_profile_cache[$cache_key]['colour'], $_profile_cache[$cache_key]['username']), $tpl);
+		return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']);
 	}
 
-	return $_profile_cache[$cache_key][$mode];
+	return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
 }
 
 /**
diff -x .svn -aruN 3.0.4.src/includes/functions_display.php 3.0.5.src/includes/functions_display.php
--- 3.0.4.src/includes/functions_display.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_display.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_display.php 9082 2008-11-22 20:26:09Z acydburn $
+* @version $Id: functions_display.php 9467 2009-04-17 16:10:39Z Kellanved $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -237,7 +237,7 @@
 	// Handle marking posts
 	if ($mark_read == 'forums' || $mark_read == 'all')
 	{
-		$redirect = build_url('mark', 'hash');
+		$redirect = build_url(array('mark', 'hash'));
 		$token = request_var('hash', '');
 		if (check_link_hash($token, 'global'))
 		{
@@ -846,7 +846,7 @@
 */
 function display_custom_bbcodes()
 {
-	global $db, $template;
+	global $db, $template, $user;
 
 	// Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing)
 	$num_predefined_bbcodes = 22;
@@ -860,6 +860,12 @@
 	$i = 0;
 	while ($row = $db->sql_fetchrow($result))
 	{
+		// If the helpline is defined within the language file, we will use the localised version, else just use the database entry...
+		if (isset($user->lang[strtoupper($row['bbcode_helpline'])]))
+		{
+			$row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])];
+		}
+
 		$template->assign_block_vars('custom_tags', array(
 			'BBCODE_NAME'		=> "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'",
 			'BBCODE_ID'			=> $num_predefined_bbcodes + ($i * 2),
diff -x .svn -aruN 3.0.4.src/includes/functions_install.php 3.0.5.src/includes/functions_install.php
--- 3.0.4.src/includes/functions_install.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_install.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package install
-* @version $Id: functions_install.php 8507 2008-04-20 04:57:29Z davidmj $
+* @version $Id: functions_install.php 9518 2009-05-20 12:37:35Z toonarmy $
 * @copyright (c) 2006 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -21,7 +21,7 @@
 */
 function can_load_dll($dll)
 {
-	return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && @dl($dll . '.' . PHP_SHLIB_SUFFIX)) ? true : false;
+	return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && function_exists('dl') && @dl($dll . '.' . PHP_SHLIB_SUFFIX)) ? true : false;
 }
 
 /**
diff -x .svn -aruN 3.0.4.src/includes/functions_messenger.php 3.0.5.src/includes/functions_messenger.php
--- 3.0.4.src/includes/functions_messenger.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_messenger.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_messenger.php 9078 2008-11-22 19:55:00Z acydburn $
+* @version $Id: functions_messenger.php 9450 2009-04-17 09:08:34Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -28,6 +28,7 @@
 	var $mail_priority = MAIL_NORMAL_PRIORITY;
 	var $use_queue = true;
 	var $tpl_msg = array();
+	var $eol = "\n";
 
 	/**
 	* Constructor
@@ -38,6 +39,10 @@
 
 		$this->use_queue = (!$config['email_package_size']) ? false : $use_queue;
 		$this->subject = '';
+
+		// Determine EOL character (\n for UNIX, \r\n for Windows and \r for Mac)
+		$this->eol = (!defined('PHP_EOL')) ? (($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win') ? "\r\n" : (($eol == 'mac') ? "\r" : "\n") : PHP_EOL;
+		$this->eol = (!$this->eol) ? "\n" : $this->eol;
 	}
 
 	/**
@@ -57,6 +62,11 @@
 	{
 		global $config;
 
+		if (!trim($address))
+		{
+			return;
+		}
+
 		$pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0;
 
 		$this->addresses['to'][$pos]['email'] = trim($address);
@@ -77,6 +87,11 @@
 	*/
 	function cc($address, $realname = '')
 	{
+		if (!trim($address))
+		{
+			return;
+		}
+
 		$pos = isset($this->addresses['cc']) ? sizeof($this->addresses['cc']) : 0;
 		$this->addresses['cc'][$pos]['email'] = trim($address);
 		$this->addresses['cc'][$pos]['name'] = trim($realname);
@@ -87,6 +102,11 @@
 	*/
 	function bcc($address, $realname = '')
 	{
+		if (!trim($address))
+		{
+			return;
+		}
+
 		$pos = isset($this->addresses['bcc']) ? sizeof($this->addresses['bcc']) : 0;
 		$this->addresses['bcc'][$pos]['email'] = trim($address);
 		$this->addresses['bcc'][$pos]['name'] = trim($realname);
@@ -98,7 +118,7 @@
 	function im($address, $realname = '')
 	{
 		// IM-Addresses could be empty
-		if (!$address)
+		if (!trim($address))
 		{
 			return;
 		}
@@ -153,7 +173,7 @@
 	*/
 	function template($template_file, $template_lang = '')
 	{
-		global $config, $phpbb_root_path;
+		global $config, $phpbb_root_path, $user;
 
 		if (!trim($template_file))
 		{
@@ -167,7 +187,8 @@
 
 		if (empty($this->tpl_msg[$template_lang . $template_file]))
 		{
-			$tpl_file = "{$phpbb_root_path}language/$template_lang/email/$template_file.txt";
+			$tpl_file = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';
+			$tpl_file .= $template_lang . "/email/$template_file.txt";
 
 			if (!file_exists($tpl_file))
 			{
@@ -309,6 +330,7 @@
 	{
 		global $config;
 
+		// We could use keys here, but we won't do this for 3.0.x to retain backwards compatibility
 		$headers = array();
 
 		$headers[] = 'From: ' . $this->from;
@@ -338,15 +360,12 @@
 		$headers[] = 'X-MimeOLE: phpBB3';
 		$headers[] = 'X-phpBB-Origin: phpbb://' . str_replace(array('http://', 'https://'), array('', ''), generate_board_url());
 
-		// We use \n here instead of \r\n because our smtp mailer is adjusting it to \r\n automatically, whereby the php mail function only works
-		// if using \n.
-
 		if (sizeof($this->extra_headers))
 		{
-			$headers[] = implode("\n", $this->extra_headers);
+			$headers = array_merge($headers, $this->extra_headers);
 		}
 
-		return implode("\n", $headers);
+		return $headers;
 	}
 
 	/**
@@ -361,6 +380,13 @@
 			return false;
 		}
 
+		// Addresses to send to?
+		if (empty($this->addresses) || (empty($this->addresses['to']) && empty($this->addresses['cc']) && empty($this->addresses['bcc'])))
+		{
+			// Send was successful. ;)
+			return true;
+		}
+
 		$use_queue = false;
 		if ($config['email_package_size'] && $this->use_queue)
 		{
@@ -412,6 +438,10 @@
 			}
 			else
 			{
+				// We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used...
+				// Reference: http://bugs.php.net/bug.php?id=15841
+				$headers = implode($this->eol, $headers);
+
 				ob_start();
 				$result = $config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers);
 				$err_msg = ob_get_clean();
@@ -451,7 +481,8 @@
 
 		if (empty($this->addresses['im']))
 		{
-			return false;
+			// Send was successful. ;)
+			return true;
 		}
 
 		$use_queue = false;
@@ -519,6 +550,7 @@
 	var $queue_data = array();
 	var $package_size = 0;
 	var $cache_file = '';
+	var $eol = "\n";
 
 	/**
 	* constructor
@@ -529,6 +561,10 @@
 
 		$this->data = array();
 		$this->cache_file = "{$phpbb_root_path}cache/queue.$phpEx";
+
+		// Determine EOL character (\n for UNIX, \r\n for Windows and \r for Mac)
+		$this->eol = (!defined('PHP_EOL')) ? (($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win') ? "\r\n" : (($eol == 'mac') ? "\r" : "\n") : PHP_EOL;
+		$this->eol = (!$this->eol) ? "\n" : $this->eol;
 	}
 
 	/**
@@ -652,7 +688,7 @@
 						else
 						{
 							ob_start();
-							$result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers);
+							$result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), implode($this->eol, $headers));
 							$err_msg = ob_get_clean();
 						}
 
@@ -704,11 +740,11 @@
 			if ($fp = @fopen($this->cache_file, 'wb'))
 			{
 				@flock($fp, LOCK_EX);
-				fwrite($fp, "<?php\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>");
+				fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>");
 				@flock($fp, LOCK_UN);
 				fclose($fp);
 
-				phpbb_chmod($this->cache_file, CHMOD_WRITE);
+				phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
 			}
 		}
 
@@ -745,11 +781,11 @@
 		if ($fp = @fopen($this->cache_file, 'w'))
 		{
 			@flock($fp, LOCK_EX);
-			fwrite($fp, "<?php\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
+			fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
 			@flock($fp, LOCK_UN);
 			fclose($fp);
 
-			phpbb_chmod($this->cache_file, CHMOD_WRITE);
+			phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
 		}
 	}
 }
@@ -757,40 +793,37 @@
 /**
 * Replacement or substitute for PHP's mail command
 */
-function smtpmail($addresses, $subject, $message, &$err_msg, $headers = '')
+function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false)
 {
 	global $config, $user;
 
 	// Fix any bare linefeeds in the message to make it RFC821 Compliant.
 	$message = preg_replace("#(?<!\r)\n#si", "\r\n", $message);
 
-	if ($headers != '')
+	if ($headers !== false)
 	{
-		if (is_array($headers))
+		if (!is_array($headers))
 		{
-			$headers = (sizeof($headers) > 1) ? join("\n", $headers) : $headers[0];
+			// Make sure there are no bare linefeeds in the headers
+			$headers = preg_replace('#(?<!\r)\n#si', "\n", $headers);
+			$headers = explode("\n", $headers);
 		}
-		$headers = chop($headers);
-
-		// Make sure there are no bare linefeeds in the 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);
-		$headers = '';
+		$headers_used = array();
 
-		foreach ($header_array as $header)
+		foreach ($headers as $header)
 		{
 			if (strpos(strtolower($header), 'cc:') === 0 || strpos(strtolower($header), 'bcc:') === 0)
 			{
-				$header = '';
+				continue;
 			}
-			$headers .= ($header != '') ? $header . "\r\n" : '';
+			$headers_used[] = trim($header);
 		}
 
-		$headers = chop($headers);
+		$headers = chop(implode("\r\n", $headers_used));
 	}
 
 	if (trim($subject) == '')
@@ -946,7 +979,10 @@
 	}
 
 	// Now any custom headers....
-	$smtp->server_send("$headers\r\n");
+	if ($headers !== false)
+	{
+		$smtp->server_send("$headers\r\n");
+	}
 
 	// Ok now we are ready for the message...
 	$smtp->server_send($message);
@@ -1067,7 +1103,7 @@
 		global $user;
 
 		$err_msg = '';
-		$local_host = (function_exists('php_uname')) ? php_uname('n') : $user->host;
+		$local_host = (function_exists('php_uname')) ? gethostbyaddr(gethostbyname(php_uname('n'))) : $user->host;
 
 		// If we are authenticating through pop-before-smtp, we
 		// have to login ones before we get authenticated
@@ -1411,9 +1447,10 @@
 	// define start delimimter, end delimiter and spacer
 	$start = "=?UTF-8?B?";
 	$end = "?=";
-	$spacer = $end . ' ' . $start;
-	$split_length = 64;
+	$delimiter = "\r\n ";
 
+	// Maximum length is 75. $split_length *must* be a multiple of 4, but <= 75 - strlen($start . $delimiter . $end)!!!
+	$split_length = 60;
 	$encoded_str = base64_encode($str);
 
 	// If encoded string meets the limits, we just return with the correct data.
@@ -1425,7 +1462,7 @@
 	// If there is only ASCII data, we just return what we want, correctly splitting the lines.
 	if (strlen($str) === utf8_strlen($str))
 	{
-		return $start . implode($spacer, str_split($encoded_str, $split_length)) . $end;
+		return $start . implode($end . $delimiter . $start, str_split($encoded_str, $split_length)) . $end;
 	}
 
 	// UTF-8 data, compose encoded lines
@@ -1441,10 +1478,10 @@
 			$text .= array_shift($array);
 		}
 
-		$str .= $start . base64_encode($text) . $end . ' ';
+		$str .= $start . base64_encode($text) . $end . $delimiter;
 	}
 
-	return substr($str, 0, -1);
+	return substr($str, 0, -strlen($delimiter));
 }
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 3.0.4.src/includes/functions.php 3.0.5.src/includes/functions.php
--- 3.0.4.src/includes/functions.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions.php 9153 2008-12-02 17:02:56Z acydburn $
+* @version $Id: functions.php 9519 2009-05-23 16:11:40Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -165,6 +165,37 @@
 }
 
 /**
+* Set dynamic config value with arithmetic operation.
+*/
+function set_config_count($config_name, $increment, $is_dynamic = false)
+{
+	global $db, $cache;
+
+	switch ($db->sql_layer)
+	{
+		case 'firebird':
+			$sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as CHAR)';
+		break;
+
+		case 'postgres':
+			$sql_update = 'int4(config_value) + ' . (int) $increment;
+		break;
+
+		// MySQL, SQlite, mssql, mssql_odbc, oracle
+		default:
+			$sql_update = 'config_value + ' . (int) $increment;
+		break;
+	}
+
+	$db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $sql_update . " WHERE config_name = '" . $db->sql_escape($config_name) . "'");
+
+	if (!$is_dynamic)
+	{
+		$cache->destroy('config');
+	}
+}
+
+/**
 * Generates an alphanumeric random string of given length
 */
 function gen_rand_string($num_chars = 8)
@@ -205,6 +236,11 @@
 {
 	global $user;
 
+	if ($bytes >= pow(2, 30))
+	{
+		return ($add_size_lang) ? round($bytes / 1024 / 1024 / 1024, 2) . ' ' . $user->lang['GIB'] : round($bytes / 1024 / 1024 / 1024, 2);
+	}
+
 	if ($bytes >= pow(2, 20))
 	{
 		return ($add_size_lang) ? round($bytes / 1024 / 1024, 2) . ' ' . $user->lang['MIB'] : round($bytes / 1024 / 1024, 2);
@@ -461,8 +497,9 @@
 
 /**
 * Global function for chmodding directories and files for internal use
+*
 * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions.
-* The function determines owner and group from common.php file and sets the same to the provided file. Permissions are mapped to the group, user always has rw(x) permission.
+* The function determines owner and group from common.php file and sets the same to the provided file.
 * The function uses bit fields to build the permissions.
 * The function sets the appropiate execute bit on directories.
 *
@@ -475,76 +512,106 @@
 *
 * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions.
 *
-* @param $filename The file/directory to be chmodded
-* @param $perms Permissions to set
-* @return true on success, otherwise false
+* @param string	$filename	The file/directory to be chmodded
+* @param int	$perms		Permissions to set
 *
+* @return bool	true on success, otherwise false
 * @author faw, phpBB Group
 */
 function phpbb_chmod($filename, $perms = CHMOD_READ)
 {
+	static $_chmod_info;
+
 	// Return if the file no longer exists.
 	if (!file_exists($filename))
 	{
 		return false;
 	}
 
-	if (!function_exists('fileowner') || !function_exists('filegroup'))
-	{
-		$file_uid = $file_gid = false;
-		$common_php_owner = $common_php_group = false;
-	}
-	else
+	// Determine some common vars
+	if (empty($_chmod_info))
 	{
-		global $phpbb_root_path, $phpEx;
+		if (!function_exists('fileowner') || !function_exists('filegroup'))
+		{
+			// No need to further determine owner/group - it is unknown
+			$_chmod_info['process'] = false;
+		}
+		else
+		{
+			global $phpbb_root_path, $phpEx;
 
-		// Determine owner/group of common.php file and the filename we want to change here
-		$common_php_owner = fileowner($phpbb_root_path . 'common.' . $phpEx);
-		$common_php_group = filegroup($phpbb_root_path . 'common.' . $phpEx);
+			// Determine owner/group of common.php file and the filename we want to change here
+			$common_php_owner = @fileowner($phpbb_root_path . 'common.' . $phpEx);
+			$common_php_group = @filegroup($phpbb_root_path . 'common.' . $phpEx);
 
-		$file_uid = fileowner($filename);
-		$file_gid = filegroup($filename);
+			// And the owner and the groups PHP is running under.
+			$php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false;
+			$php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false;
 
-		// Try to set the owner to the same common.php has
-		if ($common_php_owner !== $file_uid && $common_php_owner !== false && $file_uid !== false)
-		{
-			// Will most likely not work
-			if (@chown($filename, $common_php_owner));
+			// If we are unable to get owner/group, then do not try to set them by guessing
+			if (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group)
 			{
-				clearstatcache();
-				$file_uid = fileowner($filename);
+				$_chmod_info['process'] = false;
 			}
-		}
-
-		// Try to set the group to the same common.php has
-		if ($common_php_group !== $file_gid && $common_php_group !== false && $file_gid !== false)
-		{
-			if (@chgrp($filename, $common_php_group));
+			else
 			{
-				clearstatcache();
-				$file_gid = filegroup($filename);
+				$_chmod_info = array(
+					'process'		=> true,
+					'common_owner'	=> $common_php_owner,
+					'common_group'	=> $common_php_group,
+					'php_uid'		=> $php_uid,
+					'php_gids'		=> $php_gids,
+				);
 			}
 		}
 	}
 
-	// And the owner and the groups PHP is running under.
-	$php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false;
-	$php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false;
-
-	// Who is PHP?
-	if ($file_uid === false || $file_gid === false || $php_uid === false || $php_gids === false)
-	{
-		$php = NULL;
-	}
-	else if ($file_uid == $php_uid /* && $common_php_owner !== false && $common_php_owner === $file_uid*/)
+	if ($_chmod_info['process'])
 	{
-		$php = 'owner';
+		$file_uid = @fileowner($filename);
+		$file_gid = @filegroup($filename);
+
+		// Change owner
+		if (@chown($filename, $_chmod_info['common_owner']))
+		{
+			clearstatcache();
+			$file_uid = @fileowner($filename);
+		}
+
+		// Change group
+		if (@chgrp($filename, $_chmod_info['common_group']))
+		{
+			clearstatcache();
+			$file_gid = @filegroup($filename);
+		}
+
+		// If the file_uid/gid now match the one from common.php we can process further, else we are not able to change something
+		if ($file_uid != $_chmod_info['common_owner'] || $file_gid != $_chmod_info['common_group'])
+		{
+			$_chmod_info['process'] = false;
+		}
 	}
-	else if (in_array($file_gid, $php_gids))
+
+	// Still able to process?
+	if ($_chmod_info['process'])
 	{
-		$php = 'group';
+		if ($file_uid == $_chmod_info['php_uid'])
+		{
+			$php = 'owner';
+		}
+		else if (in_array($file_gid, $_chmod_info['php_gids']))
+		{
+			$php = 'group';
+		}
+		else
+		{
+			// Since we are setting the everyone bit anyway, no need to do expensive operations
+			$_chmod_info['process'] = false;
+		}
 	}
-	else
+
+	// We are not able to determine or change something
+	if (!$_chmod_info['process'])
 	{
 		$php = 'other';
 	}
@@ -564,26 +631,22 @@
 
 	switch ($php)
 	{
-		case null:
 		case 'owner':
-			/* ATTENTION: if php is owner or NULL we set it to group here. This is the most failsafe combination for the vast majority of server setups.
-
 			$result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0));
 
 			clearstatcache();
 
-			if (!is_null($php) || (is_readable($filename) && is_writable($filename)))
+			if (is_readable($filename) && is_writable($filename))
 			{
 				break;
 			}
-		*/
 
 		case 'group':
 			$result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0));
 
 			clearstatcache();
 
-			if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))))
+			if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))
 			{
 				break;
 			}
@@ -593,7 +656,7 @@
 
 			clearstatcache();
 
-			if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))))
+			if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))
 			{
 				break;
 			}
@@ -703,7 +766,7 @@
 */
 function is_absolute($path)
 {
-	return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:/#i', $path))) ? true : false;
+	return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:[/\\\]#i', $path))) ? true : false;
 }
 
 /**
@@ -1065,7 +1128,7 @@
 			$sql_update = array();
 			while ($row = $db->sql_fetchrow($result))
 			{
-				$sql_update[] = $row['forum_id'];
+				$sql_update[] = (int) $row['forum_id'];
 			}
 			$db->sql_freeresult($result);
 
@@ -2574,7 +2637,7 @@
 				$db->sql_query($sql);
 
 				// Generate code
-				$code = gen_rand_string(mt_rand(5, 8));
+				$code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
 				$confirm_id = md5(unique_id($user->ip));
 				$seed = hexdec(substr(unique_id(), 4, 10));
 
@@ -3182,6 +3245,7 @@
 				$msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);
 
 				echo '<b>[phpBB Debug] PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n";
+				// echo '<br /><br />BACKTRACE<br />' . get_backtrace() . '<br />' . "\n";
 			}
 
 			return;
@@ -3369,7 +3433,7 @@
 				AND s.session_time >= ' . ($time - ((int) ($time % 60))) .
 			$reading_sql;
 	}
-	$result = $db->sql_query($sql, 60);
+	$result = $db->sql_query($sql);
 	$guests_online = (int) $db->sql_fetchfield('num_guests');
 	$db->sql_freeresult($result);
 
diff -x .svn -aruN 3.0.4.src/includes/functions_posting.php 3.0.5.src/includes/functions_posting.php
--- 3.0.4.src/includes/functions_posting.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_posting.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_posting.php 9166 2008-12-03 16:40:53Z acydburn $
+* @version $Id: functions_posting.php 9462 2009-04-17 15:35:56Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -614,7 +614,7 @@
 	list($new_width, $new_height) = get_img_size_format($width, $height);
 
 	// Do not create a thumbnail if the resulting width/height is bigger than the original one
-	if ($new_width > $width && $new_height > $height)
+	if ($new_width >= $width && $new_height >= $height)
 	{
 		return false;
 	}
@@ -629,7 +629,7 @@
 			$config['img_imagick'] .= '/';
 		}
 
-		@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -antialias -sample ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" +profile "*" "' . str_replace('\\', '/', $destination) . '"');
+		@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -geometry ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"');
 
 		if (file_exists($destination))
 		{
@@ -963,13 +963,20 @@
 	}
 
 	$sql = $db->sql_build_query('SELECT', array(
-		'SELECT'	=> 'u.username, u.user_id, u.user_colour, p.*',
+		'SELECT'	=> 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe',
 
 		'FROM'		=> array(
 			USERS_TABLE		=> 'u',
 			POSTS_TABLE		=> 'p',
 		),
 
+		'LEFT_JOIN'	=> array(
+			array(
+				'FROM'	=> array(ZEBRA_TABLE => 'z'),
+				'ON'	=> 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id'
+			)
+		),
+
 		'WHERE'		=> $db->sql_in_set('p.post_id', $post_list) . '
 			AND u.user_id = p.poster_id'
 	));
@@ -1060,6 +1067,9 @@
 
 		$post_subject = censor_text($post_subject);
 
+		$post_anchor = ($mode == 'post_review') ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id'];
+		$u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f=$forum_id&amp;t=$topic_id&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}");
+
 		$template->assign_block_vars($mode . '_row', array(
 			'POST_AUTHOR_FULL'		=> get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
 			'POST_AUTHOR_COLOUR'	=> get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
@@ -1067,6 +1077,9 @@
 			'U_POST_AUTHOR'			=> get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
 
 			'S_HAS_ATTACHMENTS'	=> (!empty($attachments[$row['post_id']])) ? true : false,
+			'S_FRIEND'			=> ($row['friend']) ? true : false,
+			'S_IGNORE_POST'		=> ($row['foe']) ? true : false,
+			'L_IGNORE_POST'		=> ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"dE('{$post_anchor}', 1); return false;\">", '</a>') : '',
 
 			'POST_SUBJECT'		=> $post_subject,
 			'MINI_POST_IMG'		=> $user->img('icon_post_target', $user->lang['POST']),
@@ -1113,7 +1126,7 @@
 
 	if (!$topic_notification && !$forum_notification)
 	{
-		trigger_error('WRONG_NOTIFICATION_MODE');
+		trigger_error('NO_MODE');
 	}
 
 	if (($topic_notification && !$config['allow_topic_notify']) || ($forum_notification && !$config['allow_forum_notify']))
@@ -1725,6 +1738,7 @@
 			$sql_data[TOPICS_TABLE]['sql'] = array(
 				'topic_poster'				=> (int) $user->data['user_id'],
 				'topic_time'				=> $current_time,
+				'topic_last_view_time'		=> $current_time,
 				'forum_id'					=> ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
 				'icon_id'					=> $data['icon_id'],
 				'topic_approved'			=> $post_approval,
@@ -1738,11 +1752,23 @@
 
 			if (isset($poll['poll_options']) && !empty($poll['poll_options']))
 			{
+				$poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time;
+				$poll_length = $poll['poll_length'] * 86400;
+				if ($poll_length < 0)
+				{
+					$poll_start = $poll_start + $poll_length;
+					if ($poll_start < 0)
+					{
+						$poll_start = 0;
+					}
+					$poll_length = 1;
+				}
+
 				$sql_data[TOPICS_TABLE]['sql'] = array_merge($sql_data[TOPICS_TABLE]['sql'], array(
 					'poll_title'		=> $poll['poll_title'],
-					'poll_start'		=> ($poll['poll_start']) ? $poll['poll_start'] : $current_time,
+					'poll_start'		=> $poll_start,
 					'poll_max_options'	=> $poll['poll_max_options'],
-					'poll_length'		=> ($poll['poll_length'] * 86400),
+					'poll_length'		=> $poll_length,
 					'poll_vote_change'	=> $poll['poll_vote_change'])
 				);
 			}
@@ -1760,7 +1786,13 @@
 		break;
 
 		case 'reply':
-			$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies_real = topic_replies_real + 1, topic_bumped = 0, topic_bumper = 0' . (($post_approval) ? ', topic_replies = topic_replies + 1' : '') . ((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
+			$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_view_time = ' . $current_time . ',
+				topic_replies_real = topic_replies_real + 1,
+				topic_bumped = 0,
+				topic_bumper = 0' .
+				(($post_approval) ? ', topic_replies = topic_replies + 1' : '') .
+				((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
+
 			$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
 
 			if ($post_approval && $topic_type != POST_GLOBAL)
@@ -1771,6 +1803,20 @@
 
 		case 'edit_topic':
 		case 'edit_first_post':
+			if (isset($poll['poll_options']) && !empty($poll['poll_options']))
+			{
+				$poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time;
+				$poll_length = $poll['poll_length'] * 86400;
+				if ($poll_length < 0)
+				{
+					$poll_start = $poll_start + $poll_length;
+					if ($poll_start < 0)
+					{
+						$poll_start = 0;
+					}
+					$poll_length = 1;
+				}
+			}
 
 			$sql_data[TOPICS_TABLE]['sql'] = array(
 				'forum_id'					=> ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
@@ -1781,10 +1827,11 @@
 				'topic_type'				=> $topic_type,
 				'topic_time_limit'			=> ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0,
 				'poll_title'				=> (isset($poll['poll_options'])) ? $poll['poll_title'] : '',
-				'poll_start'				=> (isset($poll['poll_options'])) ? (($poll['poll_start']) ? $poll['poll_start'] : $current_time) : 0,
+				'poll_start'				=> (isset($poll['poll_options'])) ? $poll_start : 0,
 				'poll_max_options'			=> (isset($poll['poll_options'])) ? $poll['poll_max_options'] : 1,
-				'poll_length'				=> (isset($poll['poll_options'])) ? ($poll['poll_length'] * 86400) : 0,
+				'poll_length'				=> (isset($poll['poll_options'])) ? $poll_length : 0,
 				'poll_vote_change'			=> (isset($poll['poll_vote_change'])) ? $poll['poll_vote_change'] : 0,
+				'topic_last_view_time'		=> $current_time,
 
 				'topic_attachment'			=> (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0),
 			);
@@ -1810,8 +1857,8 @@
 				$sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics = forum_topics - 1';
 				$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1);
 
-				set_config('num_topics', $config['num_topics'] - 1, true);
-				set_config('num_posts', $config['num_posts'] - ($topic_row['topic_replies'] + 1), true);
+				set_config_count('num_topics', -1, true);
+				set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true);
 
 				// Only decrement this post, since this is the one non-approved now
 				if ($auth->acl_get('f_postcount', $data['forum_id']))
@@ -1828,10 +1875,10 @@
 			// Correctly set back the topic replies and forum posts... but only if the post was approved before.
 			if (!$post_approval && $data['post_approved'])
 			{
-				$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1';
+				$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time;
 				$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1';
 
-				set_config('num_posts', $config['num_posts'] - 1, true);
+				set_config_count('num_posts', -1, true);
 
 				if ($auth->acl_get('f_postcount', $data['forum_id']))
 				{
@@ -2098,8 +2145,8 @@
 
 		if ($space_taken && $files_added)
 		{
-			set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
-			set_config('num_files', $config['num_files'] + $files_added, true);
+			set_config_count('upload_dir_size', $space_taken, true);
+			set_config_count('num_files', $files_added, true);
 		}
 	}
 
@@ -2332,13 +2379,13 @@
 	{
 		if ($post_mode == 'post')
 		{
-			set_config('num_topics', $config['num_topics'] + 1, true);
-			set_config('num_posts', $config['num_posts'] + 1, true);
+			set_config_count('num_topics', 1, true);
+			set_config_count('num_posts', 1, true);
 		}
 
 		if ($post_mode == 'reply')
 		{
-			set_config('num_posts', $config['num_posts'] + 1, true);
+			set_config_count('num_posts', 1, true);
 		}
 	}
 
diff -x .svn -aruN 3.0.4.src/includes/functions_privmsgs.php 3.0.5.src/includes/functions_privmsgs.php
--- 3.0.4.src/includes/functions_privmsgs.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_privmsgs.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_privmsgs.php 8993 2008-10-10 17:38:17Z toonarmy $
+* @version $Id: functions_privmsgs.php 9441 2009-04-12 13:21:25Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -1350,7 +1350,7 @@
 				WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . '
 					AND ug.user_pending = 0
 					AND u.user_id = ug.user_id
-					AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . 
+					AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' .
 					$sql_allow_pm;
 			$result = $db->sql_query($sql);
 
@@ -1571,8 +1571,8 @@
 
 		if ($space_taken && $files_added)
 		{
-			set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
-			set_config('num_files', $config['num_files'] + $files_added, true);
+			set_config_count('upload_dir_size', $space_taken, true);
+			set_config_count('num_files', $files_added, true);
 		}
 	}
 
@@ -1763,8 +1763,14 @@
 	$url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm');
 	$next_history_pm = $previous_history_pm = $prev_id = 0;
 
-	foreach ($rowset as $id => $row)
+	// Re-order rowset to be able to get the next/prev message rows...
+	$rowset = array_values($rowset);
+
+	for ($i = 0, $size = sizeof($rowset); $i < $size; $i++)
 	{
+		$row = &$rowset[$i];
+		$id = (int) $row['msg_id'];
+
 		$author_id	= $row['author_id'];
 		$folder_id	= (int) $row['folder_id'];
 
@@ -1795,8 +1801,7 @@
 
 		if ($id == $msg_id)
 		{
-			$next_history_pm = next($rowset);
-			$next_history_pm = (sizeof($next_history_pm)) ? (int) $next_history_pm['msg_id'] : 0;
+			$next_history_pm = (isset($rowset[$i + 1])) ? (int) $rowset[$i + 1]['msg_id'] : 0;
 			$previous_history_pm = $prev_id;
 		}
 
diff -x .svn -aruN 3.0.4.src/includes/functions_profile_fields.php 3.0.5.src/includes/functions_profile_fields.php
--- 3.0.4.src/includes/functions_profile_fields.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_profile_fields.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_profile_fields.php 9127 2008-11-26 19:58:35Z acydburn $
+* @version $Id: functions_profile_fields.php 9504 2009-05-01 10:10:35Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -39,8 +39,8 @@
 		switch ($mode)
 		{
 			case 'register':
-				// If the field is required we show it on the registration page and do not show hidden fields
-				$sql_where .= ' AND f.field_show_on_reg = 1 AND f.field_no_view = 0';
+				// If the field is required we show it on the registration page
+				$sql_where .= ' AND f.field_show_on_reg = 1';
 			break;
 
 			case 'profile':
@@ -270,8 +270,8 @@
 		switch ($mode)
 		{
 			case 'register':
-				// If the field is required we show it on the registration page and do not show hidden fields
-				$sql_where .= ' AND f.field_show_on_reg = 1 AND f.field_no_view = 0';
+				// If the field is required we show it on the registration page
+				$sql_where .= ' AND f.field_show_on_reg = 1';
 			break;
 
 			case 'profile':
@@ -1086,4 +1086,4 @@
 	}
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 3.0.4.src/includes/functions_template.php 3.0.5.src/includes/functions_template.php
--- 3.0.4.src/includes/functions_template.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_template.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_template.php 8813 2008-09-04 11:52:01Z aptx $
+* @version $Id: functions_template.php 9419 2009-03-31 12:21:36Z toonarmy $
 * @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -223,9 +223,12 @@
 		// There will be a number of occasions where we switch into and out of
 		// PHP mode instantaneously. Rather than "burden" the parser with this
 		// we'll strip out such occurences, minimising such switching
-		$template_php = str_replace(' ?><?php ', ' ', $template_php);
+		if ($no_echo)
+		{
+			return "\$$echo_var .= '" . str_replace(' ?><?php ', ' ', $template_php) . "'";
+		}
 
-		return (!$no_echo) ? $template_php : "\$$echo_var .= '" . $template_php . "'";
+		return str_replace(' ?><?php ', ' ', $template_php);
 	}
 
 	/**
@@ -253,19 +256,19 @@
 		// transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array
 		if (strpos($text_blocks, '{L_') !== false)
 		{
-			$text_blocks = preg_replace('#\{L_([a-z0-9\-_]*)\}#is', "<?php echo ((isset(\$this->_rootref['L_\\1'])) ? \$this->_rootref['L_\\1'] : ((isset(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '{ \\1 }')); ?>", $text_blocks);
+			$text_blocks = preg_replace('#\{L_([A-Z0-9\-_]+)\}#', "<?php echo ((isset(\$this->_rootref['L_\\1'])) ? \$this->_rootref['L_\\1'] : ((isset(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '{ \\1 }')); ?>", $text_blocks);
 		}
 
 		// Handle addslashed language variables prefixed with LA_
 		// If a template variable already exist, it will be used in favor of it...
 		if (strpos($text_blocks, '{LA_') !== false)
 		{
-			$text_blocks = preg_replace('#\{LA_([a-z0-9\-_]*)\}#is', "<?php echo ((isset(\$this->_rootref['LA_\\1'])) ? \$this->_rootref['LA_\\1'] : ((isset(\$this->_rootref['L_\\1'])) ? addslashes(\$this->_rootref['L_\\1']) : ((isset(\$user->lang['\\1'])) ? addslashes(\$user->lang['\\1']) : '{ \\1 }'))); ?>", $text_blocks);
+			$text_blocks = preg_replace('#\{LA_([A-Z0-9\-_]+)\}#', "<?php echo ((isset(\$this->_rootref['LA_\\1'])) ? \$this->_rootref['LA_\\1'] : ((isset(\$this->_rootref['L_\\1'])) ? addslashes(\$this->_rootref['L_\\1']) : ((isset(\$user->lang['\\1'])) ? addslashes(\$user->lang['\\1']) : '{ \\1 }'))); ?>", $text_blocks);
 		}
 
 		// Handle remaining varrefs
-		$text_blocks = preg_replace('#\{([a-z0-9\-_]+)\}#is', "<?php echo (isset(\$this->_rootref['\\1'])) ? \$this->_rootref['\\1'] : ''; ?>", $text_blocks);
-		$text_blocks = preg_replace('#\{\$([a-z0-9\-_]+)\}#is', "<?php echo (isset(\$this->_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks);
+		$text_blocks = preg_replace('#\{([A-Z0-9\-_]+)\}#', "<?php echo (isset(\$this->_rootref['\\1'])) ? \$this->_rootref['\\1'] : ''; ?>", $text_blocks);
+		$text_blocks = preg_replace('#\{\$([A-Z0-9\-_]+)\}#', "<?php echo (isset(\$this->_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks);
 
 		return;
 	}
@@ -748,6 +751,8 @@
 
 		$filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.' . $phpEx;
 
+		$data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
+
 		if ($fp = @fopen($filename, 'wb'))
 		{
 			@flock($fp, LOCK_EX);
@@ -755,7 +760,7 @@
 			@flock($fp, LOCK_UN);
 			@fclose($fp);
 
-			phpbb_chmod($filename, CHMOD_WRITE);
+			phpbb_chmod($filename, CHMOD_READ | CHMOD_WRITE);
 		}
 
 		return;
diff -x .svn -aruN 3.0.4.src/includes/functions_transfer.php 3.0.5.src/includes/functions_transfer.php
--- 3.0.4.src/includes/functions_transfer.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_transfer.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_transfer.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: functions_transfer.php 9433 2009-04-10 10:13:20Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -206,7 +206,7 @@
 		$directory = $this->root_path . str_replace($phpbb_root_path, '', $directory);
 
 		$this->_chdir($directory);
-		$result = $this->_ls('');
+		$result = $this->_ls();
 
 		if ($result !== false && is_array($result))
 		{
@@ -460,7 +460,24 @@
 	*/
 	function _ls($dir = './')
 	{
-		return @ftp_nlist($this->connection, $dir);
+		$list = @ftp_nlist($this->connection, $dir);
+
+		// Remove path if prepended
+		foreach ($list as $key => $item)
+		{
+			// Use same separator for item and dir
+			$item = str_replace('\\', '/', $item);
+			$dir = str_replace('\\', '/', $dir);
+
+			if (strpos($item, $dir) === 0)
+			{
+				$item = substr($item, strlen($dir));
+			}
+
+			$list[$key] = $item;
+		}
+
+		return $list;
 	}
 
 	/**
@@ -710,6 +727,24 @@
 		}
 		$this->_close_data_connection();
 
+		// Clear buffer
+		$this->_check_command();
+
+		// Remove path if prepended
+		foreach ($list as $key => $item)
+		{
+			// Use same separator for item and dir
+			$item = str_replace('\\', '/', $item);
+			$dir = str_replace('\\', '/', $dir);
+
+			if (strpos($item, $dir) === 0)
+			{
+				$item = substr($item, strlen($dir));
+			}
+
+			$list[$key] = $item;
+		}
+
 		return $list;
 	}
 
diff -x .svn -aruN 3.0.4.src/includes/functions_upload.php 3.0.5.src/includes/functions_upload.php
--- 3.0.4.src/includes/functions_upload.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_upload.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_upload.php 8783 2008-08-23 17:23:40Z acydburn $
+* @version $Id: functions_upload.php 9464 2009-04-17 15:52:40Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -594,7 +594,18 @@
 		// PHP Upload filesize exceeded
 		if ($file->get('filename') == 'none')
 		{
-			$file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
+			$max_filesize = @ini_get('upload_max_filesize');
+			$unit = 'MB';
+
+			if (!empty($max_filesize))
+			{
+				$unit = strtolower(substr($max_filesize, -1, 1));
+				$max_filesize = (int) $max_filesize;
+
+				$unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
+			}
+
+			$file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
 			return $file;
 		}
 
@@ -670,7 +681,18 @@
 		// PHP Upload filesize exceeded
 		if ($file->get('filename') == 'none')
 		{
-			$file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
+			$max_filesize = @ini_get('upload_max_filesize');
+			$unit = 'MB';
+
+			if (!empty($max_filesize))
+			{
+				$unit = strtolower(substr($max_filesize, -1, 1));
+				$max_filesize = (int) $max_filesize;
+
+				$unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
+			}
+
+			$file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
 			return $file;
 		}
 
@@ -818,7 +840,18 @@
 		switch ($errorcode)
 		{
 			case 1:
-				$error = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
+				$max_filesize = @ini_get('upload_max_filesize');
+				$unit = 'MB';
+
+				if (!empty($max_filesize))
+				{
+					$unit = strtolower(substr($max_filesize, -1, 1));
+					$max_filesize = (int) $max_filesize;
+
+					$unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
+				}
+
+				$error = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
 			break;
 
 			case 2:
diff -x .svn -aruN 3.0.4.src/includes/functions_user.php 3.0.5.src/includes/functions_user.php
--- 3.0.4.src/includes/functions_user.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/functions_user.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: functions_user.php 8949 2008-09-26 21:29:05Z toonarmy $
+* @version $Id: functions_user.php 9409 2009-03-27 16:39:19Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -280,7 +280,7 @@
 	{
 		set_config('newest_user_id', $user_id, true);
 		set_config('newest_username', $user_row['username'], true);
-		set_config('num_users', $config['num_users'] + 1, true);
+		set_config_count('num_users', 1, true);
 
 		$sql = 'SELECT group_colour
 			FROM ' . GROUPS_TABLE . '
@@ -490,7 +490,7 @@
 
 	$db->sql_transaction('begin');
 
-	$table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE);
+	$table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE);
 
 	foreach ($table_ary as $table)
 	{
@@ -501,6 +501,16 @@
 
 	$cache->destroy('sql', MODERATOR_CACHE_TABLE);
 
+	// Delete the user_id from the banlist
+	$sql = 'DELETE FROM ' . BANLIST_TABLE . '
+		WHERE ban_userid = ' . $user_id;
+	$db->sql_query($sql);
+
+	// Delete the user_id from the session table
+	$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
+		WHERE session_user_id = ' . $user_id;
+	$db->sql_query($sql);
+
 	// Remove any undelivered mails...
 	$sql = 'SELECT msg_id, user_id
 		FROM ' . PRIVMSGS_TO_TABLE . '
@@ -569,7 +579,7 @@
 	// Decrement number of users if this user is active
 	if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE)
 	{
-		set_config('num_users', $config['num_users'] - 1, true);
+		set_config_count('num_users', -1, true);
 	}
 
 	return false;
@@ -650,12 +660,12 @@
 
 	if ($deactivated)
 	{
-		set_config('num_users', $config['num_users'] - $deactivated, true);
+		set_config_count('num_users', $deactivated * (-1), true);
 	}
 
 	if ($activated)
 	{
-		set_config('num_users', $config['num_users'] + $activated, true);
+		set_config_count('num_users', $activated, true);
 	}
 
 	// Update latest username
@@ -1134,6 +1144,8 @@
 
 /**
 * Whois facility
+*
+* @link http://tools.ietf.org/html/rfc3912 RFC3912: WHOIS Protocol Specification
 */
 function user_ipwhois($ip)
 {
@@ -1146,16 +1158,10 @@
 		return '';
 	}
 
-	$match = array(
-		'#RIPE\.NET#is'				=> 'whois.ripe.net',
-		'#whois\.apnic\.net#is'		=> 'whois.apnic.net',
-		'#nic\.ad\.jp#is'			=> 'whois.nic.ad.jp',
-		'#whois\.registro\.br#is'	=> 'whois.registro.br'
-	);
-
 	if (($fsk = @fsockopen('whois.arin.net', 43)))
 	{
-		fputs($fsk, "$ip\n");
+		// CRLF as per RFC3912
+		fputs($fsk, "$ip\r\n");
 		while (!feof($fsk))
 		{
 			$ipwhois .= fgets($fsk, 1024);
@@ -1163,22 +1169,38 @@
 		@fclose($fsk);
 	}
 
-	foreach (array_keys($match) as $server)
+	$match = array();
+
+	// Test for referrals from ARIN to other whois databases, roll on rwhois
+	if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match))
 	{
-		if (preg_match($server, $ipwhois))
+		if (strpos($match[1], ':') !== false)
+		{
+			$pos	= strrpos($match[1], ':');
+			$server	= substr($match[1], 0, $pos);
+			$port	= (int) substr($match[1], $pos + 1);
+			unset($pos);
+		}
+		else
+		{
+			$server	= $match[1];
+			$port	= 43;
+		}
+
+		$buffer = '';
+
+		if (($fsk = @fsockopen($server, $port)))
 		{
-			$ipwhois = '';
-			if (($fsk = @fsockopen($match[$server], 43)))
+			fputs($fsk, "$ip\r\n");
+			while (!feof($fsk))
 			{
-				fputs($fsk, "$ip\n");
-				while (!feof($fsk))
-				{
-					$ipwhois .= fgets($fsk, 1024);
-				}
-				@fclose($fsk);
+				$buffer .= fgets($fsk, 1024);
 			}
-			break;
+			@fclose($fsk);
 		}
+
+		// Use the result from ARIN if we don't get any result here
+		$ipwhois = (empty($buffer)) ? $ipwhois : $buffer;
 	}
 
 	$ipwhois = htmlspecialchars($ipwhois);
@@ -1414,7 +1436,7 @@
 			}
 			else if ($mbstring)
 			{
-				$regex = '[-\]_+ [[:upper:][:lower:][:digit:]]+';
+				$regex = '[-\]_+ \[[:upper:][:lower:][:digit:]]+';
 			}
 			else
 			{
@@ -1439,8 +1461,7 @@
 	}
 	else if ($mbstring)
 	{
-		$matches = array();
-		mb_ereg_search_init('^' . $username . '$', $regex, $matches);
+		mb_ereg_search_init($username, '^' . $regex . '$');
 		if (!mb_ereg_search())
 		{
 			return 'INVALID_CHARS';
@@ -2713,9 +2734,16 @@
 */
 function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false)
 {
-	global $db, $auth;
+	global $db, $auth, $config;
 
-	$group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS');
+	if ($config['coppa_enable'])
+	{
+		$group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS');
+	}
+	else
+	{
+		$group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED', 'BOTS', 'GUESTS');
+	}
 
 	// We need both username and user_id info
 	$result = user_get_id_name($user_id_ary, $username_ary);
@@ -2779,13 +2807,14 @@
 	$temp_ary = array();
 	while ($row = $db->sql_fetchrow($result))
 	{
-		if ($default_groups[$row['user_id']] == $group_id && (!isset($temp_ary[$row['user_id']]) || array_search($row['group_name'], $group_order) < $temp_ary[$row['user_id']]))
+		if ($default_groups[$row['user_id']] == $group_id && (!isset($temp_ary[$row['user_id']]) || $group_order_id[$row['group_name']] < $temp_ary[$row['user_id']]))
 		{
 			$temp_ary[$row['user_id']] = $row['group_id'];
 		}
 	}
 	$db->sql_freeresult($result);
 
+	// sql_where_ary holds the new default groups and their users
 	$sql_where_ary = array();
 	foreach ($temp_ary as $uid => $gid)
 	{
@@ -2797,7 +2826,7 @@
 	{
 		if (isset($sql_where_ary[$gid]) && sizeof($sql_where_ary[$gid]))
 		{
-			remove_default_rank($group_id, $sql_where_ary[$gid]);
+			remove_default_rank($gid, $sql_where_ary[$gid]);
 			remove_default_avatar($group_id, $sql_where_ary[$gid]);
 			group_set_user_default($gid, $sql_where_ary[$gid], $default_data_ary);
 		}
diff -x .svn -aruN 3.0.4.src/includes/mcp/mcp_main.php 3.0.5.src/includes/mcp/mcp_main.php
--- 3.0.4.src/includes/mcp/mcp_main.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/mcp/mcp_main.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package mcp
-* @version $Id: mcp_main.php 8950 2008-09-27 10:59:25Z toonarmy $
+* @version $Id: mcp_main.php 9491 2009-04-28 09:35:36Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -594,44 +594,67 @@
 		$topic_data = get_topic_data($topic_ids);
 		$leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false;
 
-		$topics_moved = sizeof($topic_ids);
-		$topics_authed_moved = 0;
 		$forum_sync_data = array();
 
 		$forum_sync_data[$forum_id] = current($topic_data);
 		$forum_sync_data[$to_forum_id] = $forum_data;
 
+		// Real topics added to target forum
+		$topics_moved = sizeof($topic_data);
+
+		// Approved topics added to target forum
+		$topics_authed_moved = 0;
+
+		// Posts (topic replies + topic post if approved) added to target forum
+		$topic_posts_added = 0;
+
+		// Posts (topic replies + topic post if approved and not global announcement) removed from source forum
+		$topic_posts_removed = 0;
+
+		// Real topics removed from source forum (all topics without global announcements)
+		$topics_removed = 0;
+
+		// Approved topics removed from source forum (except global announcements)
+		$topics_authed_removed = 0;
+
 		foreach ($topic_data as $topic_id => $topic_info)
 		{
-			if ($topic_info['topic_approved'] == '1')
+			if ($topic_info['topic_approved'])
 			{
 				$topics_authed_moved++;
+				$topic_posts_added++;
+			}
+
+			$topic_posts_added += $topic_info['topic_replies'];
+
+			if ($topic_info['topic_type'] != POST_GLOBAL)
+			{
+				$topics_removed++;
+				$topic_posts_removed += $topic_info['topic_replies'];
+
+				if ($topic_info['topic_approved'])
+				{
+					$topics_authed_removed++;
+					$topic_posts_removed++;
+				}
 			}
 		}
 
 		$db->sql_transaction('begin');
 
-		$sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts
-			FROM ' . TOPICS_TABLE . ' t
-			WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids);
-		$result = $db->sql_query($sql);
-		$row_data = $db->sql_fetchrow($result);
-		$db->sql_freeresult($result);
-
 		$sync_sql = array();
 
-		if ($row_data['topic_posts'])
+		if ($topic_posts_added)
 		{
-			$sync_sql[$forum_id][]		= 'forum_posts = forum_posts - ' . (int) $row_data['topic_posts'];
-			$sync_sql[$to_forum_id][]	= 'forum_posts = forum_posts + ' . (int) $row_data['topic_posts'];
+			$sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . $topic_posts_added;
 		}
 
 		if ($topics_authed_moved)
 		{
-			$sync_sql[$to_forum_id][]	= 'forum_topics = forum_topics + ' . (int) $topics_authed_moved;
+			$sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . (int) $topics_authed_moved;
 		}
 
-		$sync_sql[$to_forum_id][]	= 'forum_topics_real = forum_topics_real + ' . (int) $topics_moved;
+		$sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . (int) $topics_moved;
 
 		// Move topics, but do not resync yet
 		move_topics($topic_ids, $to_forum_id, false);
@@ -692,17 +715,26 @@
 
 				$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
 
-				$topics_authed_moved--;
-				$topics_moved--;
+				// Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts
+				$topics_removed--;
+				$topics_authed_removed--;
 			}
 		}
 		unset($topic_data);
 
-		$sync_sql[$forum_id][]	= 'forum_topics_real = forum_topics_real - ' . (int) $topics_moved;
+		if ($topic_posts_removed)
+		{
+			$sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . $topic_posts_removed;
+		}
 
-		if ($topics_authed_moved)
+		if ($topics_removed)
 		{
-			$sync_sql[$forum_id][]	= 'forum_topics = forum_topics - ' . (int) $topics_authed_moved;
+			$sync_sql[$forum_id][]	= 'forum_topics_real = forum_topics_real - ' . (int) $topics_removed;
+		}
+
+		if ($topics_authed_removed)
+		{
+			$sync_sql[$forum_id][]	= 'forum_topics = forum_topics - ' . (int) $topics_authed_removed;
 		}
 
 		$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';
@@ -929,6 +961,11 @@
 	}
 	else
 	{
+		if ($affected_topics != 1 || $deleted_topics || !$topic_id)
+		{
+			$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", false);
+		}
+
 		meta_refresh(3, $redirect);
 		trigger_error($success_msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . '<br /><br />' . implode('<br /><br />', $return_link));
 	}
@@ -1189,8 +1226,8 @@
 		}
 
 		sync('forum', 'forum_id', $to_forum_id);
-		set_config('num_topics', $config['num_topics'] + sizeof($new_topic_id_list), true);
-		set_config('num_posts', $config['num_posts'] + $total_posts, true);
+		set_config_count('num_topics', sizeof($new_topic_id_list), true);
+		set_config_count('num_posts', $total_posts, true);
 
 		foreach ($new_topic_id_list as $topic_id => $new_topic_id)
 		{
diff -x .svn -aruN 3.0.4.src/includes/mcp/mcp_notes.php 3.0.5.src/includes/mcp/mcp_notes.php
--- 3.0.4.src/includes/mcp/mcp_notes.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/mcp/mcp_notes.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package mcp
-* @version $Id: mcp_notes.php 8598 2008-06-04 15:37:06Z naderman $
+* @version $Id: mcp_notes.php 9343 2009-02-27 10:54:57Z toonarmy $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -226,13 +226,16 @@
 			'PAGINATION'		=> generate_pagination($this->u_action . "&amp;st=$st&amp;sk=$sk&amp;sd=$sd", $log_count, $config['posts_per_page'], $start),
 			'TOTAL_REPORTS'		=> ($log_count == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $log_count),
 
-			'USERNAME'			=> $userrow['username'],
-			'USER_COLOR'		=> (!empty($userrow['user_colour'])) ? $userrow['user_colour'] : '',
 			'RANK_TITLE'		=> $rank_title,
 			'JOINED'			=> $user->format_date($userrow['user_regdate']),
 			'POSTS'				=> ($userrow['user_posts']) ? $userrow['user_posts'] : 0,
 			'WARNINGS'			=> ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0,
 
+			'USERNAME_FULL'		=> get_username_string('full', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
+			'USERNAME_COLOUR'	=> get_username_string('colour', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
+			'USERNAME'			=> get_username_string('username', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
+			'U_PROFILE'			=> get_username_string('profile', $userrow['user_id'], $userrow['username'], $userrow['user_colour']),
+
 			'AVATAR_IMG'		=> $avatar_img,
 			'RANK_IMG'			=> $rank_img,
 			)
diff -x .svn -aruN 3.0.4.src/includes/mcp/mcp_queue.php 3.0.5.src/includes/mcp/mcp_queue.php
--- 3.0.4.src/includes/mcp/mcp_queue.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/mcp/mcp_queue.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package mcp
-* @version $Id: mcp_queue.php 9133 2008-11-30 12:03:43Z acydburn $
+* @version $Id: mcp_queue.php 9482 2009-04-24 17:27:10Z terrafrost $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -492,12 +492,18 @@
 
 		$total_topics = $total_posts = 0;
 		$forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
-		$user_posts_sql = array();
+		$user_posts_sql = $post_approved_list = array();
 
 		$update_forum_information = false;
 
 		foreach ($post_info as $post_id => $post_data)
 		{
+			if ($post_data['post_approved'])
+			{
+				$post_approved_list[] = $post_id;
+				continue;
+			}
+
 			$topic_id_list[$post_data['topic_id']] = 1;
 
 			if ($post_data['forum_id'])
@@ -539,12 +545,6 @@
 			}
 			else
 			{
-				if (!isset($topic_replies_sql[$post_data['topic_id']]))
-				{
-					$topic_replies_sql[$post_data['topic_id']] = 0;
-				}
-				$topic_replies_sql[$post_data['topic_id']]++;
-
 				$approve_log[] = array(
 					'type'			=> 'post',
 					'post_subject'	=> $post_data['post_subject'],
@@ -553,6 +553,15 @@
 				);
 			}
 
+			if ($post_data['topic_replies_real'] > 0)
+			{
+				if (!isset($topic_replies_sql[$post_data['topic_id']]))
+				{
+					$topic_replies_sql[$post_data['topic_id']] = 0;
+				}
+				$topic_replies_sql[$post_data['topic_id']]++;
+			}
+
 			if ($post_data['forum_id'])
 			{
 				if (!isset($forum_topics_posts[$post_data['forum_id']]))
@@ -583,6 +592,11 @@
 				$update_forum_information = true;
 			}
 		}
+		$post_id_list = array_values(array_diff($post_id_list, $post_approved_list));
+		for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++)
+		{
+			unset($post_info[$post_approved_list[$i]]);
+		}
 
 		if (sizeof($topic_approve_sql))
 		{
@@ -652,12 +666,12 @@
 
 		if ($total_topics)
 		{
-			set_config('num_topics', $config['num_topics'] + $total_topics, true);
+			set_config_count('num_topics', $total_topics, true);
 		}
 
 		if ($total_posts)
 		{
-			set_config('num_posts', $config['num_posts'] + $total_posts, true);
+			set_config_count('num_posts', $total_posts, true);
 		}
 		unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql);
 
@@ -733,7 +747,7 @@
 		}
 		else
 		{
-			$success_msg = (sizeof($post_id_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
+			$success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
 		}
 	}
 	else
diff -x .svn -aruN 3.0.4.src/includes/mcp/mcp_topic.php 3.0.5.src/includes/mcp/mcp_topic.php
--- 3.0.4.src/includes/mcp/mcp_topic.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/mcp/mcp_topic.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package mcp
-* @version $Id: mcp_topic.php 9030 2008-10-19 18:32:11Z acydburn $
+* @version $Id: mcp_topic.php 9398 2009-03-19 17:01:59Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -501,7 +501,7 @@
 		$success_msg = 'TOPIC_SPLIT_SUCCESS';
 
 		// Update forum statistics
-		set_config('num_topics', $config['num_topics'] + 1, true);
+		set_config_count('num_topics', 1, true);
 
 		// Link back to both topics
 		$return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
diff -x .svn -aruN 3.0.4.src/includes/mcp/mcp_warn.php 3.0.5.src/includes/mcp/mcp_warn.php
--- 3.0.4.src/includes/mcp/mcp_warn.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/mcp/mcp_warn.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package mcp
-* @version $Id: mcp_warn.php 9002 2008-10-11 17:01:43Z toonarmy $
+* @version $Id: mcp_warn.php 9343 2009-02-27 10:54:57Z toonarmy $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -420,13 +420,16 @@
 		$template->assign_vars(array(
 			'U_POST_ACTION'		=> $this->u_action,
 
-			'USERNAME'			=> $user_row['username'],
-			'USER_COLOR'		=> (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
 			'RANK_TITLE'		=> $rank_title,
 			'JOINED'			=> $user->format_date($user_row['user_regdate']),
 			'POSTS'				=> ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
 			'WARNINGS'			=> ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
 
+			'USERNAME_FULL'		=> get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
+			'USERNAME_COLOUR'	=> get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
+			'USERNAME'			=> get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
+			'U_PROFILE'			=> get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']),
+
 			'AVATAR_IMG'		=> $avatar_img,
 			'RANK_IMG'			=> $rank_img,
 
diff -x .svn -aruN 3.0.4.src/includes/message_parser.php 3.0.5.src/includes/message_parser.php
--- 3.0.4.src/includes/message_parser.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/message_parser.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: message_parser.php 9034 2008-10-24 00:49:30Z toonarmy $
+* @version $Id: message_parser.php 9453 2009-04-17 13:07:51Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -695,6 +695,7 @@
 		* [quote="[i]test[/i]"]test[/quote] (correct: parsed)
 		* [quote="[quote]test[/quote]"]test[/quote] (correct: parsed - Username displayed as [quote]test[/quote])
 		* #20735 - [quote]test[/[/b]quote] test [/quote][/quote] test - (correct: quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted)
+		* #40565 - [quote="a"]a[/quote][quote="a]a[/quote] (correct: first quote tag parsed, second quote tag unparsed)
 		*/
 
 		$in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));
@@ -705,7 +706,7 @@
 		}
 
 		// To let the parser not catch tokens within quote_username quotes we encode them before we start this...
-		$in = preg_replace('#quote=&quot;(.*?)&quot;\]#ie', "'quote=&quot;' . str_replace(array('[', ']'), array('&#91;', '&#93;'), '\$1') . '&quot;]'", $in);
+		$in = preg_replace('#quote=&quot;(.*?)&quot;\]#ie', "'quote=&quot;' . str_replace(array('[', ']', '\\\"'), array('&#91;', '&#93;', '\"'), '\$1') . '&quot;]'", $in);
 
 		$tok = ']';
 		$out = '[';
@@ -858,6 +859,8 @@
 		}
 		while ($in);
 
+		$out .= $buffer;
+
 		if (sizeof($close_tags))
 		{
 			$out .= '[' . implode('][', $close_tags) . ']';
@@ -1049,11 +1052,7 @@
 	{
 		// Init BBCode UID
 		$this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN);
-
-		if ($message)
-		{
-			$this->message = $message;
-		}
+		$this->message = $message;
 	}
 
 	/**
@@ -1102,13 +1101,6 @@
 			}
 		}
 
-		// Check for "empty" message
-		if ($mode !== 'sig' && utf8_clean_string($this->message) === '')
-		{
-			$this->warn_msg[] = $user->lang['TOO_FEW_CHARS'];
-			return (!$update_this_message) ? $return_message : $this->warn_msg;
-		}
-
 		// Prepare BBcode (just prepares some tags for better parsing)
 		if ($allow_bbcode && strpos($this->message, '[') !== false)
 		{
@@ -1151,6 +1143,14 @@
 			}
 		}
 
+		// Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length.
+		// The maximum length check happened before any parsings.
+		if ($mode !== 'sig' && utf8_clean_string($this->message) === '')
+		{
+			$this->warn_msg[] = $user->lang['TOO_FEW_CHARS'];
+			return (!$update_this_message) ? $return_message : $this->warn_msg;
+		}
+
 		// Check number of links
 		if ($config['max_' . $mode . '_urls'] && $num_urls > $config['max_' . $mode . '_urls'])
 		{
diff -x .svn -aruN 3.0.4.src/includes/search/fulltext_mysql.php 3.0.5.src/includes/search/fulltext_mysql.php
--- 3.0.4.src/includes/search/fulltext_mysql.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/search/fulltext_mysql.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package search
-* @version $Id: fulltext_mysql.php 8814 2008-09-04 12:01:47Z acydburn $
+* @version $Id: fulltext_mysql.php 9438 2009-04-11 11:09:45Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -118,7 +118,7 @@
 	*/
 	function split_keywords(&$keywords, $terms)
 	{
-		global $config;
+		global $config, $user;
 
 		if ($terms == 'all')
 		{
@@ -167,6 +167,12 @@
 			$this->split_words = $matches[1];
 		}
 
+		// We limit the number of allowed keywords to minimize load on the database
+		if ($config['max_num_search_keywords'] && sizeof($this->split_words) > $config['max_num_search_keywords'])
+		{
+			trigger_error($user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', $config['max_num_search_keywords'], sizeof($this->split_words)));
+		}
+
 		// to allow phrase search, we need to concatenate quoted words
 		$tmp_split_words = array();
 		$phrase = '';
diff -x .svn -aruN 3.0.4.src/includes/search/fulltext_native.php 3.0.5.src/includes/search/fulltext_native.php
--- 3.0.4.src/includes/search/fulltext_native.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/search/fulltext_native.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package search
-* @version $Id: fulltext_native.php 9173 2008-12-04 17:01:39Z naderman $
+* @version $Id: fulltext_native.php 9473 2009-04-18 17:46:34Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -81,7 +81,7 @@
 	*/
 	function split_keywords($keywords, $terms)
 	{
-		global $db, $user;
+		global $db, $user, $config;
 
 		$keywords = trim($this->cleanup($keywords, '+-|()*'));
 
@@ -167,6 +167,13 @@
 		);
 
 		$keywords = preg_replace($match, $replace, $keywords);
+		$num_keywords = sizeof(explode(' ', $keywords));
+
+		// We limit the number of allowed keywords to minimize load on the database
+		if ($config['max_num_search_keywords'] && $num_keywords > $config['max_num_search_keywords'])
+		{
+			trigger_error($user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', $config['max_num_search_keywords'], $num_keywords));
+		}
 
 		// $keywords input format: each word separated by a space, words in a bracket are not separated
 
@@ -638,13 +645,21 @@
 			$sql = '';
 			$sql_array_count = $sql_array;
 
+			if ($left_join_topics)
+			{
+				$sql_array_count['LEFT_JOIN'][] = array(
+					'FROM'	=> array(TOPICS_TABLE => 't'),
+					'ON'	=> 'p.topic_id = t.topic_id'
+				);
+			}
+
 			switch ($db->sql_layer)
 			{
 				case 'mysql4':
 				case 'mysqli':
 
 					// 3.x does not support SQL_CALC_FOUND_ROWS
-					$sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT'];
+					// $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT'];
 					$is_mysql = true;
 
 				break;
@@ -693,10 +708,10 @@
 				$sql_where[] = 'f.forum_id = p.forum_id';
 			break;
 		}
-		
+
 		if ($left_join_topics)
 		{
-			$sql_array['LEFT_JOIN'][$left_join_topics] = array(
+			$sql_array['LEFT_JOIN'][] = array(
 				'FROM'	=> array(TOPICS_TABLE => 't'),
 				'ON'	=> 'p.topic_id = t.topic_id'
 			);
@@ -725,6 +740,16 @@
 		// if we use mysql and the total result count is not cached yet, retrieve it from the db
 		if (!$total_results && $is_mysql)
 		{
+			// Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it.
+			$sql_array_copy = $sql_array;
+			$sql_array_copy['SELECT'] = 'SQL_CALC_FOUND_ROWS p.post_id ';
+
+			$sql = $db->sql_build_query('SELECT', $sql_array_copy);
+			unset($sql_array_copy);
+
+			$db->sql_query($sql);
+			$db->sql_freeresult($result);
+
 			$sql = 'SELECT FOUND_ROWS() as total_results';
 			$result = $db->sql_query($sql);
 			$total_results = (int) $db->sql_fetchfield('total_results');
@@ -848,7 +873,7 @@
 			{
 				case 'mysql4':
 				case 'mysqli':
-					$select = 'SQL_CALC_FOUND_ROWS ' . $select;
+//					$select = 'SQL_CALC_FOUND_ROWS ' . $select;
 					$is_mysql = true;
 				break;
 
@@ -941,6 +966,12 @@
 
 		if (!$total_results && $is_mysql)
 		{
+			// Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it.
+			$sql = str_replace('SELECT ' . $select, 'SELECT DISTINCT SQL_CALC_FOUND_ROWS p.post_id', $sql);
+
+			$db->sql_query($sql);
+			$db->sql_freeresult($result);
+
 			$sql = 'SELECT FOUND_ROWS() as total_results';
 			$result = $db->sql_query($sql);
 			$total_results = (int) $db->sql_fetchfield('total_results');
@@ -1110,7 +1141,7 @@
 
 		// Get unique words from the above arrays
 		$unique_add_words = array_unique(array_merge($words['add']['post'], $words['add']['title']));
-		
+
 		// We now have unique arrays of all words to be added and removed and
 		// individual arrays of added and removed words for text and title. What
 		// we need to do now is add the new words (if they don't already exist)
diff -x .svn -aruN 3.0.4.src/includes/session.php 3.0.5.src/includes/session.php
--- 3.0.4.src/includes/session.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/session.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: session.php 9170 2008-12-04 12:56:12Z toonarmy $
+* @version $Id: session.php 9490 2009-04-28 08:34:30Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -182,7 +182,7 @@
 			else
 			{
 				// Set to OS hostname or localhost
-				$host = (function_exists('php_uname')) ? php_uname('n') : 'localhost';
+				$host = (function_exists('php_uname')) ? gethostbyaddr(gethostbyname(php_uname('n'))) : 'localhost';
 			}
 		}
 
@@ -480,6 +480,13 @@
 
 				foreach (explode(',', $row['bot_ip']) as $bot_ip)
 				{
+					$bot_ip = trim($bot_ip);
+
+					if (!$bot_ip)
+					{
+						continue;
+					}
+
 					if (strpos($this->ip, $bot_ip) === 0)
 					{
 						$bot = (int) $row['user_id'];
@@ -719,6 +726,15 @@
 		// Commented out because it will not allow forums to update correctly
 //		$db->sql_return_on_error(false);
 
+		// Something quite important: session_page always holds the *last* page visited, except for the *first* visit.
+		// We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case.
+		// If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later.
+		if (empty($this->data['session_id']))
+		{
+			// This is a temporary variable, only set for the very first visit
+			$this->data['session_created'] = true;
+		}
+
 		$this->session_id = $this->data['session_id'] = md5(unique_id());
 
 		$sql_ary['session_id'] = (string) $this->session_id;
@@ -1204,7 +1220,7 @@
 		}
 
 		$dnsbl_check = array(
-			'sbl-xbl.spamhaus.org'	=> 'http://www.spamhaus.org/query/bl?ip=',
+			'sbl.spamhaus.org'	=> 'http://www.spamhaus.org/query/bl?ip=',
 		);
 
 		if ($mode == 'register')
@@ -1377,7 +1393,7 @@
 		$host = htmlspecialchars($this->host);
 		$ref = substr($this->referer, strpos($this->referer, '://') + 3);
 
-		if (!(stripos($ref, $host) === 0))
+		if (!(stripos($ref, $host) === 0) && (!$config['force_server'] || !(stripos($ref, $config['server_name']) === 0)))
 		{
 			return false;
 		}
@@ -1527,7 +1543,10 @@
 		// We include common language file here to not load it every time a custom language file is included
 		$lang = &$this->lang;
 
-		if ((@include $this->lang_path . $this->lang_name . "/common.$phpEx") === false)
+		// Do not suppress error if in DEBUG_EXTRA mode
+		$include_result = (defined('DEBUG_EXTRA')) ? (include $this->lang_path . $this->lang_name . "/common.$phpEx") : (@include $this->lang_path . $this->lang_name . "/common.$phpEx");
+
+		if ($include_result === false)
 		{
 			die('Language file ' . $this->lang_path . $this->lang_name . "/common.$phpEx" . " couldn't be opened.");
 		}
@@ -1657,7 +1676,8 @@
 
 		$this->img_lang = (file_exists($phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . $this->lang_name)) ? $this->lang_name : $config['default_lang'];
 
-		$sql = 'SELECT image_name, image_filename, image_lang, image_height, image_width
+		// Same query in style.php
+		$sql = 'SELECT *
 			FROM ' . STYLES_IMAGESET_DATA_TABLE . '
 			WHERE imageset_id = ' . $this->theme['imageset_id'] . "
 			AND image_filename <> ''
@@ -1773,7 +1793,10 @@
 		// Is board disabled and user not an admin or moderator?
 		if ($config['board_disable'] && !defined('IN_LOGIN') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
 		{
-			header('HTTP/1.1 503 Service Unavailable');
+			if ($this->data['is_bot'])
+			{
+				header('HTTP/1.1 503 Service Unavailable');
+			}
 
 			$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
 			trigger_error($message);
@@ -1789,7 +1812,10 @@
 
 				if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
 				{
-					header('HTTP/1.1 503 Service Unavailable');
+					if ($this->data['is_bot'])
+					{
+						header('HTTP/1.1 503 Service Unavailable');
+					}
 					trigger_error('BOARD_UNAVAILABLE');
 				}
 			}
@@ -2000,7 +2026,10 @@
 				$language_filename = $this->lang_path . $this->lang_name . '/' . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx;
 			}
 
-			if ((@include $language_filename) === false)
+			// Do not suppress error if in DEBUG_EXTRA mode
+			$include_result = (defined('DEBUG_EXTRA')) ? (include $language_filename) : (@include $language_filename);
+
+			if ($include_result === false)
 			{
 				trigger_error('Language file ' . $language_filename . ' couldn\'t be opened.', E_USER_ERROR);
 			}
@@ -2036,7 +2065,6 @@
 			// Is the user requesting a friendly date format (i.e. 'Today 12:42')?
 			$date_cache[$format] = array(
 				'is_short'		=> strpos($format, '|'),
-				'zone_offset'	=> $this->timezone + $this->dst,
 				'format_short'	=> substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1),
 				'format_long'	=> str_replace('|', '', $format),
 				'lang'			=> $this->lang['datetime'],
@@ -2049,8 +2077,11 @@
 			}
 		}
 
+		// Zone offset
+		$zone_offset = $this->timezone + $this->dst;
+
 		// Show date <= 1 hour ago as 'xx min ago'
-		// A small tolerence is given for times in the future and times in the future but in the same minute are displayed as '< than a minute ago'
+		// A small tolerence is given for times in the future but in the same minute are displayed as '< than a minute ago'
 		if ($delta <= 3600 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO']))
 		{
 			return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
@@ -2058,11 +2089,11 @@
 
 		if (!$midnight)
 		{
-			list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $date_cache[$format]['zone_offset']));
-			$midnight = gmmktime(0, 0, 0, $m, $d, $y) - $date_cache[$format]['zone_offset'];
+			list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $zone_offset));
+			$midnight = gmmktime(0, 0, 0, $m, $d, $y) - $zone_offset;
 		}
 
-		if ($date_cache[$format]['is_short'] !== false && !$forcedate)
+		if ($date_cache[$format]['is_short'] !== false && !$forcedate && !($gmepoch < $midnight - 86400 || $gmepoch > $midnight + 172800))
 		{
 			$day = false;
 
@@ -2081,11 +2112,11 @@
 
 			if ($day !== false)
 			{
-				return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']));
+				return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $zone_offset), $date_cache[$format]['lang']));
 			}
 		}
 
-		return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']);
+		return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']);
 	}
 
 	/**
@@ -2155,7 +2186,7 @@
 				return $img_data;
 			}
 
-			$img_data['src'] = $phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename'];
+			$img_data['src'] = $phpbb_root_path . 'styles/' . rawurlencode($this->theme['imageset_path']) . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename'];
 			$img_data['width'] = $this->img_array[$img]['image_width'];
 			$img_data['height'] = $this->img_array[$img]['image_height'];
 		}
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_activate.php 3.0.5.src/includes/ucp/ucp_activate.php
--- 3.0.4.src/includes/ucp/ucp_activate.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_activate.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_activate.php 9067 2008-11-21 13:21:53Z Kellanved $
+* @version $Id: ucp_activate.php 9520 2009-05-29 19:55:42Z toonarmy $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -56,6 +56,18 @@
 			trigger_error('WRONG_ACTIVATION');
 		}
 
+		// Do not allow activating by non administrators when admin activation is on
+		// Only activation type the user should be able to do is INACTIVE_REMIND
+		// or activate a new password which is not an activation state :@
+		if (!$user_row['user_newpasswd'] && $user_row['user_inactive_reason'] != INACTIVE_REMIND && $config['require_activation'] == USER_ACTIVATION_ADMIN && !$auth->acl_get('a_user'))
+		{
+			if (!$user->data['is_registered'])
+			{
+				login_box('', $user->lang['NO_AUTH_OPERATION']);
+			}
+			trigger_error('NO_AUTH_OPERATION');
+		}
+
 		$update_password = ($user_row['user_newpasswd']) ? true : false;
 
 		if ($update_password)
@@ -72,6 +84,8 @@
 				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
 				WHERE user_id = ' . $user_row['user_id'];
 			$db->sql_query($sql);
+
+			add_log('user', $user_row['user_id'], 'LOG_USER_NEW_PASSWORD', $user_row['username']);
 		}
 
 		if (!$update_password)
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_attachments.php 3.0.5.src/includes/ucp/ucp_attachments.php
--- 3.0.4.src/includes/ucp/ucp_attachments.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_attachments.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_attachments.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: ucp_attachments.php 9500 2009-04-30 08:30:01Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -184,7 +184,7 @@
 			'U_SORT_FILESIZE'		=> $this->u_action . "&amp;sk=d&amp;sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
 			'U_SORT_DOWNLOADS'		=> $this->u_action . "&amp;sk=e&amp;sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
 			'U_SORT_POST_TIME'		=> $this->u_action . "&amp;sk=f&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
-			'U_SORT_TOPIC_TITLE'	=> $this->u_action . "&amp;sk=g&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
+			'U_SORT_TOPIC_TITLE'	=> $this->u_action . "&amp;sk=g&amp;sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
 
 			'S_DISPLAY_MARK_ALL'	=> ($num_attachments) ? true : false,
 			'S_DISPLAY_PAGINATION'	=> ($num_attachments) ? true : false,
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_groups.php 3.0.5.src/includes/ucp/ucp_groups.php
--- 3.0.4.src/includes/ucp/ucp_groups.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_groups.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_groups.php 9067 2008-11-21 13:21:53Z Kellanved $
+* @version $Id: ucp_groups.php 9396 2009-03-19 13:28:15Z Kellanved $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -340,7 +340,7 @@
 						'S_ROW_COUNT'		=> ${$block . '_count'}++)
 					);
 
-					$group_id_ary[] = $row['group_id'];
+					$group_id_ary[] = (int) $row['group_id'];
 				}
 				$db->sql_freeresult($result);
 
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_main.php 3.0.5.src/includes/ucp/ucp_main.php
--- 3.0.4.src/includes/ucp/ucp_main.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_main.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_main.php 9136 2008-11-30 14:36:59Z acydburn $
+* @version $Id: ucp_main.php 9459 2009-04-17 15:08:09Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -633,11 +633,14 @@
 	*/
 	function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
 	{
-		global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx;
+		global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx;
 
 		$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
 		$start = request_var('start', 0);
 
+		// Grab icons
+		$icons = $cache->obtain_icons();
+
 		$sql_array = array(
 			'SELECT'	=> 'COUNT(t.topic_id) as topics_count',
 
@@ -776,7 +779,8 @@
 			$folder_img = $folder_alt = $topic_type = '';
 			topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
 
-			$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id");
+			$view_topic_url_params = "f=$forum_id&amp;t=$topic_id";
+			$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
 
 			// Send vars to template
 			$template->assign_block_vars('topicrow', array(
@@ -809,6 +813,7 @@
 
 				'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
 				'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),
+				'TOPIC_FOLDER_IMG_ALT'	=> $user->lang[$folder_alt],
 				'TOPIC_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
 				'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
 				'TOPIC_ICON_IMG_HEIGHT'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
@@ -818,8 +823,8 @@
 				'S_USER_POSTED'			=> (!empty($row['topic_posted'])) ? true : false,
 				'S_UNREAD_TOPIC'		=> $unread_topic,
 
-				'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
-				'U_LAST_POST'			=> $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
+				'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;view=unread') . '#unread',
+				'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
 				'U_VIEW_TOPIC'			=> $view_topic_url,
 				'U_VIEW_FORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
 			));
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_pm_compose.php 3.0.5.src/includes/ucp/ucp_pm_compose.php
--- 3.0.4.src/includes/ucp/ucp_pm_compose.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_pm_compose.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_pm_compose.php 9168 2008-12-03 16:48:06Z acydburn $
+* @version $Id: ucp_pm_compose.php 9494 2009-04-28 16:16:24Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -850,7 +850,7 @@
 		$forward_text = array();
 		$forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE'];
 		$forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject));
-		$forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time));
+		$forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time, false, true));
 		$forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text);
 		$forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to']));
 
@@ -1039,6 +1039,7 @@
 		'FLASH_STATUS'			=> ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
 		'SMILIES_STATUS'		=> ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
 		'URL_STATUS'			=> ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
+		'MAX_FONT_SIZE'			=> (int) $config['max_post_font_size'],
 		'MINI_POST_IMG'			=> $user->img('icon_post_target', $user->lang['PM']),
 		'ERROR'					=> (sizeof($error)) ? implode('<br />', $error) : '',
 		'MAX_RECIPIENTS'		=> ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0,
@@ -1124,7 +1125,9 @@
 	$group_list = request_var('group_list', array(0));
 
 	// Build usernames to add
-	$usernames = (isset($_REQUEST['username'])) ? array(request_var('username', '', true)) : array();
+	$usernames = request_var('username', '', true);
+	$usernames = (empty($usernames)) ? array() : array($usernames);
+
 	$username_list = request_var('username_list', '', true);
 	if ($username_list)
 	{
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_pm_viewfolder.php 3.0.5.src/includes/ucp/ucp_pm_viewfolder.php
--- 3.0.4.src/includes/ucp/ucp_pm_viewfolder.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_pm_viewfolder.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_pm_viewfolder.php 8795 2008-08-29 11:50:01Z Kellanved $
+* @version $Id: ucp_pm_viewfolder.php 9454 2009-04-17 13:15:44Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -328,7 +328,8 @@
 				$data[] = array(
 					'subject'	=> censor_text($row['message_subject']),
 					'sender'	=> $row['username'],
-					'date'		=> $user->format_date($row['message_time']),
+					// ISO 8601 date. For PHP4 we are able to hardcode the timezone because $user->format_date() does not set it.
+					'date'		=> $user->format_date($row['message_time'], (PHP_VERSION >= 5) ? 'c' : "Y-m-d\TH:i:s+00:00", true),
 					'to'		=> ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? $address[$message_id] : '',
 					'message'	=> $message_row['message_text']
 				);
@@ -502,7 +503,7 @@
 		'PAGE_NUMBER'		=> on_page($pm_count, $config['topics_per_page'], $start),
 		'TOTAL_MESSAGES'	=> (($pm_count == 1) ? $user->lang['VIEW_PM_MESSAGE'] : sprintf($user->lang['VIEW_PM_MESSAGES'], $pm_count)),
 
-		'POST_IMG'		=> (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'PM_LOCKED') : $user->img('button_pm_new', 'POST_PM'),
+		'POST_IMG'		=> (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
 
 		'L_NO_MESSAGES'	=> (!$auth->acl_get('u_sendpm')) ? $user->lang['POST_PM_LOCKED'] : $user->lang['NO_MESSAGES'],
 
@@ -511,7 +512,7 @@
 		'S_SELECT_SORT_DAYS'	=> $s_limit_days,
 		'S_TOPIC_ICONS'			=> ($config['enable_pm_icons']) ? true : false,
 
-		'U_POST_NEW_TOPIC'	=> ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose') : '', 
+		'U_POST_NEW_TOPIC'	=> ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose') : '',
 		'S_PM_ACTION'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;mode=view&amp;action=view_folder&amp;f=$folder_id" . (($start !== 0) ? "&amp;start=$start" : '')),
 	));
 
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_pm_viewmessage.php 3.0.5.src/includes/ucp/ucp_pm_viewmessage.php
--- 3.0.4.src/includes/ucp/ucp_pm_viewmessage.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_pm_viewmessage.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_pm_viewmessage.php 9174 2008-12-04 19:58:42Z toonarmy $
+* @version $Id: ucp_pm_viewmessage.php 9483 2009-04-24 20:52:00Z toonarmy $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -286,7 +286,7 @@
 		$update_time = $config['load_online_time'] * 60;
 		if ($row)
 		{
-			$user_row['online'] = (time() - $update_time < $row['online_time'] && ($row['viewonline'])) ? true : false;
+			$user_row['online'] = (time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline'))) ? true : false;
 		}
 	}
 
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_profile.php 3.0.5.src/includes/ucp/ucp_profile.php
--- 3.0.4.src/includes/ucp/ucp_profile.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_profile.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_profile.php 8990 2008-10-09 15:41:19Z acydburn $
+* @version $Id: ucp_profile.php 9389 2009-03-17 15:50:19Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -349,11 +349,11 @@
 					{
 						$data['notify'] = $user->data['user_notify_type'];
 
-						if (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml'))
+						if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')))
 						{
 							// User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled)
 							// Disable notify by Jabber now for this user.
-							$data['notify'] = NOTIFY_BOTH;
+							$data['notify'] = NOTIFY_EMAIL;
 						}
 
 						$sql_ary = array(
@@ -549,6 +549,7 @@
 					'IMG_STATUS'			=> ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
 					'FLASH_STATUS'			=> ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
 					'URL_STATUS'			=> ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
+					'MAX_FONT_SIZE'			=> (int) $config['max_sig_font_size'],
 
 					'L_SIGNATURE_EXPLAIN'	=> sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
 
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_register.php 3.0.5.src/includes/ucp/ucp_register.php
--- 3.0.4.src/includes/ucp/ucp_register.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_register.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_register.php 8782 2008-08-23 17:20:55Z acydburn $
+* @version $Id: ucp_register.php 9511 2009-05-08 11:48:51Z Kellanved $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -37,12 +37,13 @@
 
 		include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
 
-		$confirm_id		= request_var('confirm_id', '');
-		$coppa			= (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
-		$agreed			= (!empty($_POST['agreed'])) ? 1 : 0;
-		$submit			= (isset($_POST['submit'])) ? true : false;
-		$change_lang	= request_var('change_lang', '');
-		$user_lang		= request_var('lang', $user->lang_name);
+		$confirm_id			= request_var('confirm_id', '');
+		$confirm_refresh	= (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false;
+		$coppa				= (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
+		$agreed				= (!empty($_POST['agreed'])) ? 1 : 0;
+		$submit				= (isset($_POST['submit'])) ? true : false;
+		$change_lang		= request_var('change_lang', '');
+		$user_lang			= request_var('lang', $user->lang_name);
 
 		if ($agreed)
 		{
@@ -187,7 +188,7 @@
 					array('string', false, 6, 60),
 					array('email')),
 				'email_confirm'		=> array('string', false, 6, 60),
-				'confirm_code'		=> array('string', !$config['enable_confirm'], 5, 8),
+				'confirm_code'		=> array('string', !$config['enable_confirm'], CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS),
 				'tz'				=> array('num', false, -14, 14),
 				'lang'				=> array('match', false, '#^[a-z_\-]{2,}$#i'),
 			));
@@ -448,7 +449,7 @@
 
 		if ($config['enable_confirm'])
 		{
-			if ($change_lang)
+			if ($change_lang || $confirm_refresh)
 			{
 				$str = '&amp;change_lang=' . $change_lang;
 				$sql = 'SELECT code
@@ -467,7 +468,7 @@
 			{
 				$str = '';
 			}
-			if (!$change_lang || !$confirm_id)
+			if (!$change_lang || !$confirm_id || !$confirm_refresh)
 			{
 				$user->confirm_gc(CONFIRM_REG);
 
@@ -484,7 +485,7 @@
 					trigger_error('TOO_MANY_REGISTERS');
 				}
 
-				$code = gen_rand_string(mt_rand(5, 8));
+				$code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
 				$confirm_id = md5(unique_id($user->ip));
 				$seed = hexdec(substr(unique_id(), 4, 10));
 
@@ -500,6 +501,23 @@
 				);
 				$db->sql_query($sql);
 			}
+			else if ($confirm_refresh)
+			{
+				$code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
+				$confirm_id = md5(unique_id($user->ip));
+				$seed = hexdec(substr(unique_id(), 4, 10));
+					// compute $seed % 0x7fffffff
+				$seed -= 0x7fffffff * floor($seed / 0x7fffffff);
+				$sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
+					'confirm_type'	=> (int) CONFIRM_REG,
+					'code'			=> (string) $code,
+					'seed'			=> (int) $seed)) . "
+					WHERE
+					confirm_id = '" . $db->sql_escape($confirm_id) . "' AND
+					session_id = '" . $db->sql_escape($session_id) . "' AND
+					confirm_type = " . (int) CONFIRM_REG;
+				$db->sql_query($sql);
+			}
 			$confirm_image = '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&amp;id=' . $confirm_id . '&amp;type=' . CONFIRM_REG . $str) . '" alt="" title="" />';
 			$s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
 		}
@@ -534,6 +552,7 @@
 			'S_LANG_OPTIONS'	=> language_select($data['lang']),
 			'S_TZ_OPTIONS'		=> tz_select($data['tz']),
 			'S_CONFIRM_CODE'	=> ($config['enable_confirm']) ? true : false,
+			'S_CONFIRM_REFRESH'	=> ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,
 			'S_COPPA'			=> $coppa,
 			'S_HIDDEN_FIELDS'	=> $s_hidden_fields,
 			'S_UCP_ACTION'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
diff -x .svn -aruN 3.0.4.src/includes/ucp/ucp_resend.php 3.0.5.src/includes/ucp/ucp_resend.php
--- 3.0.4.src/includes/ucp/ucp_resend.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/includes/ucp/ucp_resend.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package ucp
-* @version $Id: ucp_resend.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: ucp_resend.php 9339 2009-02-23 17:53:24Z toonarmy $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -133,6 +133,11 @@
 					$messenger->to($row['user_email'], $row['username']);
 					$messenger->im($row['user_jabber'], $row['username']);
 
+					$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
+					$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
+					$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
+					$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
+
 					$messenger->assign_vars(array(
 						'USERNAME'			=> htmlspecialchars_decode($user_row['username']),
 						'U_USER_DETAILS'	=> generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}",
@@ -146,7 +151,7 @@
 
 			meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
 
-			$message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
+			$message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
 			$message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
 			trigger_error($message);
 		}
diff -x .svn -aruN 3.0.4.src/language/en/acp/board.php 3.0.5.src/language/en/acp/board.php
--- 3.0.4.src/language/en/acp/board.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/acp/board.php	2009-05-31 05:58:36.000000000 -0500
@@ -4,7 +4,7 @@
 * acp_board [English]
 *
 * @package language
-* @version $Id: board.php 9037 2008-10-26 10:52:43Z acydburn $
+* @version $Id: board.php 9497 2009-04-29 16:00:59Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -243,6 +243,16 @@
 	'CAPTCHA_GD_X_GRID_EXPLAIN'				=> 'Use lower settings of this to make the GD based CAPTCHA harder. 0 will disable x-axis background noise.',
 	'CAPTCHA_GD_Y_GRID'						=> 'GD CAPTCHA background noise y-axis',
 	'CAPTCHA_GD_Y_GRID_EXPLAIN'				=> 'Use lower settings of this to make the GD based CAPTCHA harder. 0 will disable y-axis background noise.',
+	'CAPTCHA_GD_WAVE'						=> 'GD CAPTCHA wave distortion',
+	'CAPTCHA_GD_WAVE_EXPLAIN'				=> 'This applies a wave distortion to the CAPTCHA.',
+	'CAPTCHA_GD_3D_NOISE'					=> 'Add 3D-noise objects',
+	'CAPTCHA_GD_3D_NOISE_EXPLAIN'			=> 'This adds additional objects to the CAPTCHA, over the letters.',
+	'CAPTCHA_GD_FONTS'						=> 'Use different fonts',
+	'CAPTCHA_GD_FONTS_EXPLAIN'				=> 'This setting controls how many different letter shapes are used. You can just use the default shapes or introduce altered letters. Adding lowercase letters is also possible.',
+	'CAPTCHA_FONT_DEFAULT'					=> 'Default',
+	'CAPTCHA_FONT_NEW'						=> 'New Shapes',
+	'CAPTCHA_FONT_LOWER'					=> 'Also use lowercase',
+
 
 	'CAPTCHA_PREVIEW_MSG'					=> 'Your changes to the visual confirmation setting were not saved. This is just a preview.',
 	'CAPTCHA_PREVIEW_EXPLAIN'				=> 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.',
@@ -250,6 +260,8 @@
 	'VISUAL_CONFIRM_POST_EXPLAIN'			=> 'Requires anonymous users to enter a random code matching an image to help prevent mass postings.',
 	'VISUAL_CONFIRM_REG'					=> 'Enable visual confirmation for registrations',
 	'VISUAL_CONFIRM_REG_EXPLAIN'			=> 'Requires new users to enter a random code matching an image to help prevent mass registrations.',
+	'VISUAL_CONFIRM_REFRESH'				=> 'Enable users to refresh the confirmation image',
+	'VISUAL_CONFIRM_REFRESH_EXPLAIN'		=> 'Allows users to request new confirmation codes, if they are unable to solve the VC during registration.',
 ));
 
 // Cookie Settings
diff -x .svn -aruN 3.0.4.src/language/en/acp/common.php 3.0.5.src/language/en/acp/common.php
--- 3.0.4.src/language/en/acp/common.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/acp/common.php	2009-05-31 05:58:35.000000000 -0500
@@ -4,7 +4,7 @@
 * acp_common [English]
 *
 * @package language
-* @version $Id: common.php 9049 2008-11-05 22:03:16Z toonarmy $
+* @version $Id: common.php 9382 2009-03-17 11:54:26Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -201,7 +201,7 @@
 	'ADMIN_INDEX'			=> 'Admin index',
 	'ADMIN_PANEL'			=> 'Administration Control Panel',
 
-	'ADM_LOGOUT'			=> 'ACP Logout',
+	'ADM_LOGOUT'			=> 'ACP&nbsp;Logout',
 	'ADM_LOGGED_OUT'		=> 'Successfully logged out from Administration Control Panel',
 
 	'BACK'					=> 'Back',
@@ -515,11 +515,11 @@
 	'LOG_FORUM_DEL_FORUMS'					=> '<strong>Deleted forum and its subforums</strong><br />» %s',
 	'LOG_FORUM_DEL_MOVE_FORUMS'				=> '<strong>Deleted forum and moved subforums</strong> to %1$s<br />» %2$s',
 	'LOG_FORUM_DEL_MOVE_POSTS'				=> '<strong>Deleted forum and moved posts </strong> to %1$s<br />» %2$s',
-	'LOG_FORUM_DEL_MOVE_POSTS_FORUMS'		=> '<strong>Deleted forum and its subforums, moved messages</strong> to %1$s<br />» %2$s',
+	'LOG_FORUM_DEL_MOVE_POSTS_FORUMS'		=> '<strong>Deleted forum and its subforums, moved posts</strong> to %1$s<br />» %2$s',
 	'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS'	=> '<strong>Deleted forum, moved posts</strong> to %1$s <strong>and subforums</strong> to %2$s<br />» %3$s',
-	'LOG_FORUM_DEL_POSTS'					=> '<strong>Deleted forum and its messages</strong><br />» %s',
-	'LOG_FORUM_DEL_POSTS_FORUMS'			=> '<strong>Deleted forum, its messages and subforums</strong><br />» %s',
-	'LOG_FORUM_DEL_POSTS_MOVE_FORUMS'		=> '<strong>Deleted forum and its messages, moved subforums</strong> to %1$s<br />» %2$s',
+	'LOG_FORUM_DEL_POSTS'					=> '<strong>Deleted forum and its posts</strong><br />» %s',
+	'LOG_FORUM_DEL_POSTS_FORUMS'			=> '<strong>Deleted forum, its posts and subforums</strong><br />» %s',
+	'LOG_FORUM_DEL_POSTS_MOVE_FORUMS'		=> '<strong>Deleted forum and its posts, moved subforums</strong> to %1$s<br />» %2$s',
 	'LOG_FORUM_EDIT'						=> '<strong>Edited forum details</strong><br />» %s',
 	'LOG_FORUM_MOVE_DOWN'					=> '<strong>Moved forum</strong> %1$s <strong>below</strong> %2$s',
 	'LOG_FORUM_MOVE_UP'						=> '<strong>Moved forum</strong> %1$s <strong>above</strong> %2$s',
diff -x .svn -aruN 3.0.4.src/language/en/acp/forums.php 3.0.5.src/language/en/acp/forums.php
--- 3.0.4.src/language/en/acp/forums.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/acp/forums.php	2009-05-31 05:58:35.000000000 -0500
@@ -4,7 +4,7 @@
 * acp_forums [English]
 *
 * @package language
-* @version $Id: forums.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: forums.php 9309 2009-01-27 19:16:29Z terrafrost $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -81,6 +81,7 @@
 	'FORUM_EDIT_EXPLAIN'				=> 'The form below will allow you to customise this forum. Please note that moderation and post count controls are set via forum permissions for each user or usergroup.',
 	'FORUM_IMAGE'						=> 'Forum image',
 	'FORUM_IMAGE_EXPLAIN'				=> 'Location, relative to the phpBB root directory, of an additional image to associate with this forum.',
+	'FORUM_IMAGE_NO_EXIST'				=> 'The specified forum image does not exist',
 	'FORUM_LINK_EXPLAIN'				=> 'Full URL (including the protocol, i.e.: <samp>http://</samp>) to the destination location that clicking this forum will take the user, e.g.: <samp>http://www.phpbb.com/</samp>.',
 	'FORUM_LINK_TRACK'					=> 'Track link redirects',
 	'FORUM_LINK_TRACK_EXPLAIN'			=> 'Records the number of times a forum link was clicked.',
diff -x .svn -aruN 3.0.4.src/language/en/acp/permissions.php 3.0.5.src/language/en/acp/permissions.php
--- 3.0.4.src/language/en/acp/permissions.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/acp/permissions.php	2009-05-31 05:58:36.000000000 -0500
@@ -4,7 +4,7 @@
 * acp_permissions [English]
 *
 * @package language
-* @version $Id: permissions.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: permissions.php 9443 2009-04-12 13:28:12Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -50,7 +50,7 @@
 
 		<h2>Permission Masks</h2>
 		<p>These are used to view the effective permissions assigned to Users, Moderators (Local and Global), Administrators or Forums.</p>
-	
+
 		<br />
 
 		<p>For further information on setting up and managing permissions on your phpBB3 board, please see <a href="http://www.phpbb.com/support/documentation/3.0/quickstart/quick_permissions.html">Chapter 1.5 of our Quick Start Guide</a>.</p>
@@ -71,7 +71,7 @@
 	'ACL_TYPE_GLOBAL_M_'	=> 'Global Moderator permissions',
 	'ACL_TYPE_LOCAL_M_'		=> 'Forum Moderator permissions',
 	'ACL_TYPE_LOCAL_F_'		=> 'Forum permissions',
-	
+
 	'ACL_NO'				=> 'No',
 	'ACL_VIEW'				=> 'Viewing permissions',
 	'ACL_VIEW_EXPLAIN'		=> 'Here you can see the effective permissions the user/group is having. A red square indicates that the user/group does not have the permission, a green square indicates that the user/group does have the permission.',
@@ -83,10 +83,10 @@
 	'ACP_GLOBAL_MODERATORS_EXPLAIN'				=> 'Here you can assign global moderator permissions to users or groups. These moderators are like ordinary moderators except they have access to every forum on your board.',
 	'ACP_GROUPS_FORUM_PERMISSIONS_EXPLAIN'		=> 'Here you can assign forum permissions to groups.',
 	'ACP_GROUPS_PERMISSIONS_EXPLAIN'			=> 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual users permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group’s permissions.',
-	'ACP_ADMIN_ROLES_EXPLAIN'					=> 'Here you are able to manage the roles for administrative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change it’s permissions too.',
-	'ACP_FORUM_ROLES_EXPLAIN'					=> 'Here you are able to manage the roles for forum permissions. Roles are effective permissions, if you change a role the items having this role assigned will change it’s permissions too.',
-	'ACP_MOD_ROLES_EXPLAIN'						=> 'Here you are able to manage the roles for moderative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change it’s permissions too.',
-	'ACP_USER_ROLES_EXPLAIN'					=> 'Here you are able to manage the roles for user permissions. Roles are effective permissions, if you change a role the items having this role assigned will change it’s permissions too.',
+	'ACP_ADMIN_ROLES_EXPLAIN'					=> 'Here you are able to manage the roles for administrative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.',
+	'ACP_FORUM_ROLES_EXPLAIN'					=> 'Here you are able to manage the roles for forum permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.',
+	'ACP_MOD_ROLES_EXPLAIN'						=> 'Here you are able to manage the roles for moderative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.',
+	'ACP_USER_ROLES_EXPLAIN'					=> 'Here you are able to manage the roles for user permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.',
 	'ACP_USERS_FORUM_PERMISSIONS_EXPLAIN'		=> 'Here you can assign forum permissions to users.',
 	'ACP_USERS_PERMISSIONS_EXPLAIN'				=> 'Here you can assign global permissions to users - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. To alter these settings for large numbers of users the Group permissions system is the preferred method. User’s permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group’s permissions.',
 	'ACP_VIEW_ADMIN_PERMISSIONS_EXPLAIN'		=> 'Here you can view the effective administrative permissions assigned to the selected users/groups.',
@@ -196,7 +196,7 @@
 	'ROLE_DESCRIPTION_USER_NOAVATAR'		=> 'Has a limited feature set and is not allowed to use the Avatar feature.',
 	'ROLE_DESCRIPTION_USER_NOPM'			=> 'Has a limited feature set, and is not allowed to use Private Messages.',
 	'ROLE_DESCRIPTION_USER_STANDARD'		=> 'Can access most but not all user features. Cannot change user name or ignore the flood limit, for instance.',
-	
+
 	'ROLE_DESCRIPTION_EXPLAIN'		=> 'You are able to enter a short explanation of what the role is doing or for what it is meant for. The text you enter here will be displayed within the permissions screens too.',
 	'ROLE_DESCRIPTION_LONG'			=> 'The role description is too long, please limit it to 4000 characters.',
 	'ROLE_DETAILS'					=> 'Role details',
diff -x .svn -aruN 3.0.4.src/language/en/acp/posting.php 3.0.5.src/language/en/acp/posting.php
--- 3.0.4.src/language/en/acp/posting.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/acp/posting.php	2009-05-31 05:58:35.000000000 -0500
@@ -4,7 +4,7 @@
 * acp_posting [English]
 *
 * @package language
-* @version $Id: posting.php 8743 2008-08-12 16:03:18Z Kellanved $
+* @version $Id: posting.php 9375 2009-03-16 16:47:16Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -185,7 +185,7 @@
 
 // Word censors
 $lang = array_merge($lang, array(
-	'ACP_WORDS_EXPLAIN'		=> 'From this control panel you can add, edit, and remove words that will be automatically censored on your forums. In addition people will not be allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field, e.g. *test* will match detestable, test* would match testing, *test would match detest.',
+	'ACP_WORDS_EXPLAIN'		=> 'From this control panel you can add, edit, and remove words that will be automatically censored on your forums. People are still allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field, e.g. *test* will match detestable, test* would match testing, *test would match detest.',
 	'ADD_WORD'				=> 'Add new word',
 
 	'EDIT_WORD'		=> 'Edit word censor',
diff -x .svn -aruN 3.0.4.src/language/en/acp/profile.php 3.0.5.src/language/en/acp/profile.php
--- 3.0.4.src/language/en/acp/profile.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/acp/profile.php	2009-05-31 05:58:36.000000000 -0500
@@ -4,7 +4,7 @@
 * acp_profile [English]
 *
 * @package language
-* @version $Id: profile.php 9128 2008-11-26 20:10:29Z acydburn $
+* @version $Id: profile.php 9342 2009-02-26 23:46:46Z terrafrost $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -66,7 +66,7 @@
 	'DISPLAY_AT_PROFILE_EXPLAIN'	=> 'The user is able to change this profile field within the user control panel.',
 	'DISPLAY_AT_REGISTER'			=> 'Display on registration screen',
 	'DISPLAY_AT_REGISTER_EXPLAIN'	=> 'If this option is enabled, the field will be displayed on registration.',
-	'DISPLAY_PROFILE_FIELD'			=> 'Display profile field',
+	'DISPLAY_PROFILE_FIELD'			=> 'Publicly display profile field',
 	'DISPLAY_PROFILE_FIELD_EXPLAIN'	=> 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.',
 	'DROPDOWN_ENTRIES_EXPLAIN'		=> 'Enter your options now, every option in one line.',
 
diff -x .svn -aruN 3.0.4.src/language/en/acp/search.php 3.0.5.src/language/en/acp/search.php
--- 3.0.4.src/language/en/acp/search.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/acp/search.php	2009-05-31 05:58:36.000000000 -0500
@@ -4,7 +4,7 @@
 * acp_search [English]
 *
 * @package language
-* @version $Id: search.php 9126 2008-11-26 19:17:52Z naderman $
+* @version $Id: search.php 9438 2009-04-11 11:09:45Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -72,6 +72,8 @@
 
 	'MAX_SEARCH_CHARS'						=> 'Max characters indexed by search',
 	'MAX_SEARCH_CHARS_EXPLAIN'				=> 'Words with no more than this many characters will be indexed for searching.',
+	'MAX_NUM_SEARCH_KEYWORDS'				=> 'Maximum number of allowed keywords',
+	'MAX_NUM_SEARCH_KEYWORDS_EXPLAIN'		=> 'Maximum number of words the user is able to search for. A value of 0 allows an unlimited number of words.',
 	'MIN_SEARCH_CHARS'						=> 'Min characters indexed by search',
 	'MIN_SEARCH_CHARS_EXPLAIN'				=> 'Words with at least this many characters will be indexed for searching.',
 	'MIN_SEARCH_AUTHOR_CHARS'				=> 'Min author name characters',
diff -x .svn -aruN 3.0.4.src/language/en/common.php 3.0.5.src/language/en/common.php
--- 3.0.4.src/language/en/common.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/common.php	2009-05-31 05:58:35.000000000 -0500
@@ -4,7 +4,7 @@
 * common [English]
 *
 * @package language
-* @version $Id: common.php 9162 2008-12-03 11:18:31Z acydburn $
+* @version $Id: common.php 9464 2009-04-17 15:52:40Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -87,7 +87,7 @@
 	'AVATAR_NO_SIZE'				=> 'The width or height of the linked avatar could not be determined. Please enter them manually.',
 	'AVATAR_PARTIAL_UPLOAD'			=> 'The specified file was only partially uploaded.',
 	'AVATAR_PHP_SIZE_NA'			=> 'The avatar’s filesize is too large.<br />The maximum allowed filesize set in php.ini could not be determined.',
-	'AVATAR_PHP_SIZE_OVERRUN'		=> 'The avatar’s filesize is too large. The maximum allowed upload size is %d MB.<br />Please note this is set in php.ini and cannot be overridden.',
+	'AVATAR_PHP_SIZE_OVERRUN'		=> 'The avatar’s filesize is too large. The maximum allowed upload size is %1$d %2$s.<br />Please note this is set in php.ini and cannot be overridden.',
 	'AVATAR_URL_INVALID'			=> 'The URL you specified is invalid.',
 	'AVATAR_URL_NOT_FOUND'			=> 'The file specified could not be found.',
 	'AVATAR_WRONG_FILESIZE'			=> 'The avatar’s filesize must be between 0 and %1d %2s.',
@@ -158,7 +158,7 @@
 	'VIEWED_COUNT_NONE'		=> 'Not viewed yet',
 
 	'EDIT_POST'							=> 'Edit post',
-	'EMAIL'								=> 'E-mail',
+	'EMAIL'								=> 'E-mail', // Short form for EMAIL_ADDRESS
 	'EMAIL_ADDRESS'						=> 'E-mail address',
 	'EMAIL_SMTP_ERROR_RESPONSE'			=> 'Ran into problems sending e-mail at <strong>Line %1$s</strong>. Response: %2$s.',
 	'EMPTY_SUBJECT'						=> 'You must specify a subject when posting a new topic.',
@@ -228,6 +228,8 @@
 	'FTP_USERNAME_EXPLAIN'		=> 'Username used to connect to your server.',
 
 	'GENERAL_ERROR'				=> 'General Error',
+	'GB'						=> 'GB',
+	'GIB'						=> 'GiB',
 	'GO'						=> 'Go',
 	'GOTO_PAGE'					=> 'Go to page',
 	'GROUP'						=> 'Group',
@@ -520,7 +522,7 @@
 	'SELECT_ALL_CODE'			=> 'Select all',
 	'SELECT_DESTINATION_FORUM'	=> 'Please select a destination forum',
 	'SELECT_FORUM'				=> 'Select a forum',
-	'SEND_EMAIL'				=> 'E-mail',
+	'SEND_EMAIL'				=> 'E-mail',				// Used for submit buttons
 	'SEND_EMAIL_USER'			=> 'E-mail',				// Used as: {L_SEND_EMAIL_USER} {USERNAME} -> E-mail UserX
 	'SEND_PRIVATE_MESSAGE'		=> 'Send private message',
 	'SETTINGS'					=> 'Settings',
diff -x .svn -aruN 3.0.4.src/language/en/email/newtopic_notify.txt 3.0.5.src/language/en/email/newtopic_notify.txt
--- 3.0.4.src/language/en/email/newtopic_notify.txt	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/email/newtopic_notify.txt	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 
 Hello {USERNAME},
 
-You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic since your last visit, "{TOPIC_TITLE}". You can use the following link to view forum, no more notifications will be sent until you visit the forum.
+You are receiving this notification because you are watching the forum, "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum.
 
 {U_FORUM}
 
diff -x .svn -aruN 3.0.4.src/language/en/help_bbcode.php 3.0.5.src/language/en/help_bbcode.php
--- 3.0.4.src/language/en/help_bbcode.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/help_bbcode.php	2009-05-31 05:58:36.000000000 -0500
@@ -4,7 +4,7 @@
 * help_bbcode [English]
 *
 * @package language
-* @version $Id: help_bbcode.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: help_bbcode.php 9461 2009-04-17 15:23:17Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -76,7 +76,7 @@
 	),
 	array(
 		0 => 'Creating an Ordered list',
-		1 => 'The second type of list, an ordered list, gives you control over what is output before each item. To create an ordered list you use <strong>[list=1][/list]</strong> to create a numbered list or alternatively <strong>[list=a][/list]</strong> for an alphabetical list. As with the unordered list, items are specified using <strong>[*]</strong>. For example:<br /><br /><strong>[list=1]</strong><br /><strong>[*]</strong>Go to the shops<br /><strong>[*]</strong>Buy a new computer<br /><strong>[*]</strong>Swear at computer when it crashes<br /><strong>[/list]</strong><br /><br />will generate the following:<ol style="list-style-type: arabic-numbers"><li>Go to the shops</li><li>Buy a new computer</li><li>Swear at computer when it crashes</li></ol>Whereas for an alphabetical list you would use:<br /><br /><strong>[list=a]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: lower-alpha"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol>'
+		1 => 'The second type of list, an ordered list, gives you control over what is output before each item. To create an ordered list you use <strong>[list=1][/list]</strong> to create a numbered list or alternatively <strong>[list=a][/list]</strong> for an alphabetical list. As with the unordered list, items are specified using <strong>[*]</strong>. For example:<br /><br /><strong>[list=1]</strong><br /><strong>[*]</strong>Go to the shops<br /><strong>[*]</strong>Buy a new computer<br /><strong>[*]</strong>Swear at computer when it crashes<br /><strong>[/list]</strong><br /><br />will generate the following:<ol style="list-style-type: decimal;"><li>Go to the shops</li><li>Buy a new computer</li><li>Swear at computer when it crashes</li></ol>Whereas for an alphabetical list you would use:<br /><br /><strong>[list=a]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: lower-alpha"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol>'
 	),
 	array(
 		0 => '--',
diff -x .svn -aruN 3.0.4.src/language/en/install.php 3.0.5.src/language/en/install.php
--- 3.0.4.src/language/en/install.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/install.php	2009-05-31 05:58:36.000000000 -0500
@@ -4,7 +4,7 @@
 * install [English]
 *
 * @package language
-* @version $Id: install.php 9177 2008-12-05 11:36:51Z acydburn $
+* @version $Id: install.php 9508 2009-05-03 11:18:08Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -269,6 +269,8 @@
 	'MAKE_FOLDER_WRITABLE'		=> 'Please make sure that this folder exists and is writable by the webserver then try again:<br />»<strong>%s</strong>.',
 	'MAKE_FOLDERS_WRITABLE'		=> 'Please make sure that these folders exist and are writable by the webserver then try again:<br />»<strong>%s</strong>.',
 
+	'MYSQL_SCHEMA_UPDATE_REQUIRED'	=> 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.<br /><strong>Before you proceed the update, you need to upgrade the schema.</strong><br /><br />Please refer to the <a href="http://www.phpbb.com/kb/article/doesnt-have-a-default-value-errors/">Knowledge Base article about upgrading the MySQL schema</a>. If you encounter problems, please use <a href="http://www.phpbb.com/community/viewforum.php?f=46">our support forums</a>.',
+
 	'NAMING_CONFLICT'			=> 'Naming conflict: %s and %s are both aliases<br /><br />%s',
 	'NEXT_STEP'					=> 'Proceed to next step',
 	'NOT_FOUND'					=> 'Cannot find',
@@ -381,7 +383,7 @@
 	'COMPLETE_LOGIN_TO_BOARD'		=> 'You should now <a href="../ucp.php?mode=login">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory!',
 	'CONTINUE_UPDATE_NOW'			=> 'Continue the update process now',		// Shown within the database update script at the end if called from the updater
 	'CONTINUE_UPDATE'				=> 'Continue update now',					// Shown after file upload to indicate the update process is not yet finished
-	'CURRENT_FILE'					=> 'Beginning of current original file',
+	'CURRENT_FILE'					=> 'Begin of Conflict - Original File code before update',
 	'CURRENT_VERSION'				=> 'Current version',
 
 	'DATABASE_TYPE'						=> 'Database type',
@@ -391,7 +393,7 @@
 	'DESTINATION'						=> 'Destination file',
 	'DIFF_INLINE'						=> 'Inline',
 	'DIFF_RAW'							=> 'Raw unified diff',
-	'DIFF_SEP_EXPLAIN'					=> 'End of current original file / Beginning of new updated file',
+	'DIFF_SEP_EXPLAIN'					=> 'Code block used within the updated/new file',
 	'DIFF_SIDE_BY_SIDE'					=> 'Side by Side',
 	'DIFF_UNIFIED'						=> 'Unified diff',
 	'DO_NOT_UPDATE'						=> 'Do not update this file',
@@ -399,6 +401,8 @@
 	'DOWNLOAD'							=> 'Download',
 	'DOWNLOAD_AS'						=> 'Download as',
 	'DOWNLOAD_UPDATE_METHOD_BUTTON'		=> 'Download modified files archive (recommended)',
+	'DOWNLOAD_CONFLICTS'				=> 'Download conflicts for this file',
+	'DOWNLOAD_CONFLICTS_EXPLAIN'		=> 'Search for &lt;&lt;&lt; to spot conflicts',
 	'DOWNLOAD_UPDATE_METHOD'			=> 'Download modified files archive',
 	'DOWNLOAD_UPDATE_METHOD_EXPLAIN'	=> 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.',
 
@@ -443,13 +447,13 @@
 
 	'MERGE_NO_MERGE_NEW_OPTION'	=> 'Do not merge - use new file',
 	'MERGE_NO_MERGE_MOD_OPTION'	=> 'Do not merge - use currently installed file',
-	'MERGE_MOD_FILE_OPTION'		=> 'Merge differences and use modified code within conflicting block',
-	'MERGE_NEW_FILE_OPTION'		=> 'Merge differences and use new file code within conflicting block',
+	'MERGE_MOD_FILE_OPTION'		=> 'Merge modifications (Loose new phpBB code within conflicting block)',
+	'MERGE_NEW_FILE_OPTION'		=> 'Merge modifications (Loose modified code within conflicting block)',
 	'MERGE_SELECT_ERROR'		=> 'Conflicting file merge modes are not correctly selected.',
 	'MERGING_FILES'				=> 'Merging differences',
 	'MERGING_FILES_EXPLAIN'		=> 'Currently collecting final file changes.<br /><br />Please wait until phpBB has completed all operations on changed files.',
 
-	'NEW_FILE'						=> 'End of new updated file',
+	'NEW_FILE'						=> 'End of Conflict',
 	'NEW_USERNAME'					=> 'New username',
 	'NO_AUTH_UPDATE'				=> 'Not authorised to update',
 	'NO_ERRORS'						=> 'No errors',
diff -x .svn -aruN 3.0.4.src/language/en/posting.php 3.0.5.src/language/en/posting.php
--- 3.0.4.src/language/en/posting.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/posting.php	2009-05-31 05:58:35.000000000 -0500
@@ -4,7 +4,7 @@
 * posting [English]
 *
 * @package language
-* @version $Id: posting.php 8555 2008-05-15 14:10:11Z Kellanved $
+* @version $Id: posting.php 9464 2009-04-17 15:52:40Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -141,7 +141,7 @@
 
 	'PARTIAL_UPLOAD'			=> 'The uploaded file was only partially uploaded.',
 	'PHP_SIZE_NA'				=> 'The attachment’s file size is too large.<br />Could not determine the maximum size defined by PHP in php.ini.',
-	'PHP_SIZE_OVERRUN'			=> 'The attachment’s file size is too large, the maximum upload size is %d MB.<br />Please note this is set in php.ini and cannot be overridden.',
+	'PHP_SIZE_OVERRUN'			=> 'The attachment’s file size is too large, the maximum upload size is %1$d %2$s.<br />Please note this is set in php.ini and cannot be overridden.',
 	'PLACE_INLINE'				=> 'Place inline',
 	'POLL_DELETE'				=> 'Delete poll',
 	'POLL_FOR'					=> 'Run poll for',
diff -x .svn -aruN 3.0.4.src/language/en/search.php 3.0.5.src/language/en/search.php
--- 3.0.4.src/language/en/search.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/search.php	2009-05-31 05:58:36.000000000 -0500
@@ -4,7 +4,7 @@
 * search [English]
 *
 * @package language
-* @version $Id: search.php 8479 2008-03-29 00:22:48Z naderman $
+* @version $Id: search.php 9438 2009-04-11 11:09:45Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -54,6 +54,8 @@
 
 	'LOGIN_EXPLAIN_EGOSEARCH'	=> 'The board requires you to be registered and logged in to view your own posts.',
 
+	'MAX_NUM_SEARCH_KEYWORDS_REFINE'	=> 'You specified too many words to search for. Please do not enter more than %1$d words.',
+
 	'NO_KEYWORDS'			=> 'You must specify at least one word to search for. Each word must consist of at least %d characters and must not contain more than %d characters excluding wildcards.',
 	'NO_RECENT_SEARCHES'	=> 'No searches have been carried out recently.',
 	'NO_SEARCH'				=> 'Sorry but you are not permitted to use the search system.',
diff -x .svn -aruN 3.0.4.src/language/en/ucp.php 3.0.5.src/language/en/ucp.php
--- 3.0.4.src/language/en/ucp.php	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/language/en/ucp.php	2009-05-31 05:58:35.000000000 -0500
@@ -4,7 +4,7 @@
 * ucp [English]
 *
 * @package language
-* @version $Id: ucp.php 9162 2008-12-03 11:18:31Z acydburn $
+* @version $Id: ucp.php 9478 2009-04-22 13:08:23Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -122,6 +122,9 @@
 	'CONFIRM_EMAIL'				=> 'Confirm e-mail address',
 	'CONFIRM_EMAIL_EXPLAIN'		=> 'You only need to specify this if you are changing your e-mail address.',
 	'CONFIRM_EXPLAIN'			=> 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.',
+	'VC_REFRESH'				=> 'Refresh confirmation code',
+	'VC_REFRESH_EXPLAIN'		=> 'If you cannot read the code you can request a new one by clicking the button.',
+
 	'CONFIRM_PASSWORD'			=> 'Confirm password',
 	'CONFIRM_PASSWORD_EXPLAIN'	=> 'You only need to confirm your password if you changed it above.',
 	'COPPA_BIRTHDAY'			=> 'To continue with the registration procedure please tell us when you were born.',
@@ -325,7 +328,7 @@
 	'PASS_TYPE_SYMBOL_EXPLAIN'	=> 'Password must be between %1$d and %2$d characters long, must contain letters in mixed case, must contain numbers and must contain symbols.',
 	'PASSWORD'					=> 'Password',
 	'PASSWORD_ACTIVATED'		=> 'Your new password has been activated.',
-	'PASSWORD_UPDATED'			=> 'Your password has been sent successfully to your original e-mail address.',
+	'PASSWORD_UPDATED'			=> 'A new password was sent to your registered e-mail address.',
 	'PERMISSIONS_RESTORED'		=> 'Successfully restored original permissions.',
 	'PERMISSIONS_TRANSFERRED'	=> 'Successfully transferred permissions from <strong>%s</strong>, you are now able to browse the board with this user’s permissions.<br />Please note that admin permissions were not transferred. You are able to revert to your permission set at any time.',
 	'PM_DISABLED'				=> 'Private messaging has been disabled on this board.',
diff -x .svn -aruN 3.0.4.src/mcp.php 3.0.5.src/mcp.php
--- 3.0.4.src/mcp.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/mcp.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package mcp
-* @version $Id: mcp.php 9015 2008-10-14 18:29:50Z toonarmy $
+* @version $Id: mcp.php 9414 2009-03-30 11:09:51Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -170,6 +170,12 @@
 		break;
 
 		case 'topic_logs':
+			// Reset start parameter if we jumped from the quickmod dropdown
+			if (request_var('start', 0))
+			{
+				$_REQUEST['start'] = 0;
+			}
+
 			$module->set_active('logs', 'topic_logs');
 		break;
 
diff -x .svn -aruN 3.0.4.src/memberlist.php 3.0.5.src/memberlist.php
--- 3.0.4.src/memberlist.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/memberlist.php	2009-05-31 05:58:34.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: memberlist.php 9156 2008-12-02 18:48:25Z toonarmy $
+* @version $Id: memberlist.php 9482 2009-04-24 17:27:10Z terrafrost $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -890,7 +890,10 @@
 		}
 
 		$template->assign_vars(array(
-			'ERROR_MESSAGE'		=> (sizeof($error)) ? implode('<br />', $error) : '')
+			'ERROR_MESSAGE'		=> (sizeof($error)) ? implode('<br />', $error) : '',
+			'SUBJECT'			=> $subject,
+			'MESSAGE'			=> $message,
+			)
 		);
 
 	break;
@@ -1623,6 +1626,7 @@
 		'U_PM'			=> ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;u=' . $user_id) : '',
 		'U_EMAIL'		=> $email,
 		'U_WWW'			=> (!empty($data['user_website'])) ? $data['user_website'] : '',
+		'U_SHORT_WWW'			=> (!empty($data['user_website'])) ? ((strlen($data['user_website']) > 55) ? substr($data['user_website'], 0, 39) . ' ... ' . substr($data['user_website'], -10) : $data['user_website']) : '',
 		'U_ICQ'			=> ($data['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($data['user_icq']) : '',
 		'U_AIM'			=> ($data['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=aim&amp;u=' . $user_id) : '',
 		'U_YIM'			=> ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($data['user_yim']) . '&amp;.src=pg' : '',
diff -x .svn -aruN 3.0.4.src/posting.php 3.0.5.src/posting.php
--- 3.0.4.src/posting.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/posting.php	2009-05-31 05:58:34.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: posting.php 9048 2008-11-04 15:54:43Z toonarmy $
+* @version $Id: posting.php 9499 2009-04-30 08:15:32Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -49,7 +49,8 @@
 // Was cancel pressed? If so then redirect to the appropriate page
 if ($cancel || ($current_time - $lastclick < 2 && $submit))
 {
-	$redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx")));
+	$f = ($forum_id) ? 'f=' . $forum_id . '&amp;' : '';
+	$redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx")));
 	redirect($redirect);
 }
 
@@ -74,6 +75,16 @@
 			trigger_error('NO_TOPIC');
 		}
 
+		// Force forum id
+		$sql = 'SELECT forum_id
+			FROM ' . TOPICS_TABLE . '
+			WHERE topic_id = ' . $topic_id;
+		$result = $db->sql_query($sql);
+		$f_id = (int) $db->sql_fetchfield('forum_id');
+		$db->sql_freeresult($result);
+
+		$forum_id = (!$f_id) ? $forum_id : $f_id;
+
 		$sql = 'SELECT f.*, t.*
 			FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
 			WHERE t.topic_id = $topic_id
@@ -90,13 +101,24 @@
 			trigger_error('NO_POST');
 		}
 
+		// Force forum id
+		$sql = 'SELECT forum_id
+			FROM ' . POSTS_TABLE . '
+			WHERE post_id = ' . $post_id;
+		$result = $db->sql_query($sql);
+		$f_id = (int) $db->sql_fetchfield('forum_id');
+		$db->sql_freeresult($result);
+
+		$forum_id = (!$f_id) ? $forum_id : $f_id;
+
 		$sql = 'SELECT f.*, t.*, p.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield
 			FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . " u
 			WHERE p.post_id = $post_id
 				AND t.topic_id = p.topic_id
 				AND u.user_id = p.poster_id
 				AND (f.forum_id = t.forum_id
-					OR f.forum_id = $forum_id)";
+					OR f.forum_id = $forum_id)" .
+				(($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1');
 	break;
 
 	case 'smilies':
@@ -646,7 +668,7 @@
 		$post_data['poll_length']		= request_var('poll_length', 0);
 		$post_data['poll_option_text']	= utf8_normalize_nfc(request_var('poll_option_text', '', true));
 		$post_data['poll_max_options']	= request_var('poll_max_options', 1);
-		$post_data['poll_vote_change']	= ($auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
+		$post_data['poll_vote_change']	= ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
 	}
 
 	// If replying/quoting and last post id has changed
@@ -1227,7 +1249,7 @@
 	$db->sql_query($sql);
 
 	// Generate code
-	$code = gen_rand_string(mt_rand(5, 8));
+	$code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
 	$confirm_id = md5(unique_id($user->ip));
 	$seed = hexdec(substr(unique_id(), 4, 10));
 
@@ -1286,6 +1308,7 @@
 	'FLASH_STATUS'			=> ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
 	'SMILIES_STATUS'		=> ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
 	'URL_STATUS'			=> ($bbcode_status && $url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
+	'MAX_FONT_SIZE'			=> (int) $config['max_post_font_size'],
 	'MINI_POST_IMG'			=> $user->img('icon_post_target', $user->lang['POST']),
 	'POST_DATE'				=> ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '',
 	'ERROR'					=> (sizeof($error)) ? implode('<br />', $error) : '',
@@ -1340,7 +1363,7 @@
 {
 	$template->assign_vars(array(
 		'S_SHOW_POLL_BOX'		=> true,
-		'S_POLL_VOTE_CHANGE'	=> ($auth->acl_get('f_votechg', $forum_id)),
+		'S_POLL_VOTE_CHANGE'	=> ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),
 		'S_POLL_DELETE'			=> ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
 		'S_POLL_DELETE_CHECKED'	=> (!empty($poll_delete)) ? true : false,
 
diff -x .svn -aruN 3.0.4.src/search.php 3.0.5.src/search.php
--- 3.0.4.src/search.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/search.php	2009-05-31 05:58:36.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: search.php 9040 2008-11-01 19:00:50Z naderman $
+* @version $Id: search.php 9488 2009-04-26 15:12:54Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -372,6 +372,20 @@
 							' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
 							' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
 						$sql_sort";
+/*
+		[Fix] queued replies missing from "view new posts" (Bug #42705 - Patch by Paul)
+		- Creates temporary table, query is far from optimized
+
+					$sql = 'SELECT t.topic_id
+						FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
+						WHERE p.post_time > ' . $user->data['user_lastvisit'] . '
+							AND t.topic_id = p.topic_id
+							AND t.topic_moved_id = 0
+							' . $m_approve_fid_sql . '
+							' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
+						GROUP BY t.topic_id
+						$sql_sort";
+*/
 					$field = 'topic_id';
 				}
 			break;
@@ -395,7 +409,7 @@
 
 			while ($row = $db->sql_fetchrow($result))
 			{
-				$id_ary[] = $row[$field];
+				$id_ary[] = (int) $row[$field];
 			}
 			$db->sql_freeresult($result);
 
@@ -767,7 +781,8 @@
 				$u_forum_id = $forum_id;
 			}
 
-			$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : ''));
+			$view_topic_url_params = "f=$u_forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
+			$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
 
 			$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
 
@@ -825,10 +840,10 @@
 					'S_TOPIC_UNAPPROVED'	=> $topic_unapproved,
 					'S_POSTS_UNAPPROVED'	=> $posts_unapproved,
 
-					'U_LAST_POST'			=> $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
+					'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
 					'U_LAST_POST_AUTHOR'	=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 					'U_TOPIC_AUTHOR'		=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
-					'U_NEWEST_POST'			=> $view_topic_url . '&amp;view=unread#unread',
+					'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;view=unread') . '#unread',
 					'U_MCP_REPORT'			=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=reports&amp;t=' . $result_topic_id, true, $user->session_id),
 					'U_MCP_QUEUE'			=> $u_mcp_queue,
 				);
diff -x .svn -aruN 3.0.4.src/store/index.htm 3.0.5.src/store/index.htm
--- 3.0.4.src/store/index.htm	1969-12-31 18:00:00.000000000 -0600
+++ 3.0.5.src/store/index.htm	2009-05-31 05:58:35.000000000 -0500
@@ -0,0 +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>
diff -x .svn -aruN 3.0.4.src/style.php 3.0.5.src/style.php
--- 3.0.4.src/style.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/style.php	2009-05-31 05:58:36.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: style.php 8780 2008-08-22 12:52:48Z acydburn $
+* @version $Id: style.php 9366 2009-03-11 17:47:31Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -118,10 +118,11 @@
 
 	$user_image_lang = (file_exists($phpbb_root_path . 'styles/' . $theme['imageset_path'] . '/imageset/' . $user['user_lang'])) ? $user['user_lang'] : $config['default_lang'];
 
+	// Same query in session.php
 	$sql = 'SELECT *
 		FROM ' . STYLES_IMAGESET_DATA_TABLE . '
 		WHERE imageset_id = ' . $theme['imageset_id'] . "
-		AND image_filename <> '' 
+		AND image_filename <> ''
 		AND image_lang IN ('" . $db->sql_escape($user_image_lang) . "', '')";
 	$result = $db->sql_query($sql, 3600);
 
@@ -257,11 +258,11 @@
 				case 'SRC':
 					$replace[] = $imgs[$img]['src'];
 				break;
-				
+
 				case 'WIDTH':
 					$replace[] = $imgs[$img]['width'];
 				break;
-	
+
 				case 'HEIGHT':
 					$replace[] = $imgs[$img]['height'];
 				break;
diff -x .svn -aruN 3.0.4.src/styles/prosilver/imageset/imageset.cfg 3.0.5.src/styles/prosilver/imageset/imageset.cfg
--- 3.0.4.src/styles/prosilver/imageset/imageset.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/imageset/imageset.cfg	2009-05-31 05:58:34.000000000 -0500
@@ -19,7 +19,7 @@
 # General Information about this style
 name = prosilver
 copyright = &copy; phpBB Group, 2007
-version = 3.0.4
+version = 3.0.5
 
 # Images
 img_site_logo = site_logo.gif*52*139
diff -x .svn -aruN 3.0.4.src/styles/prosilver/style.cfg 3.0.5.src/styles/prosilver/style.cfg
--- 3.0.4.src/styles/prosilver/style.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/style.cfg	2009-05-31 05:58:34.000000000 -0500
@@ -19,4 +19,4 @@
 # General Information about this style
 name = prosilver
 copyright = &copy; phpBB Group, 2007
-version = 3.0.4
\ No newline at end of file
+version = 3.0.5
\ No newline at end of file
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/attachment.html 3.0.5.src/styles/prosilver/template/attachment.html
--- 3.0.4.src/styles/prosilver/template/attachment.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/attachment.html	2009-05-31 05:58:35.000000000 -0500
@@ -61,13 +61,13 @@
 
 		<!-- ELSEIF _file.S_FLASH_FILE -->
 			<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{_file.WIDTH}" height="{_file.HEIGHT}">
-				<param name="movie" value="{_file.U_DOWNLOAD_LINK}" />
+				<param name="movie" value="{_file.U_VIEW_LINK}" />
 				<param name="play" value="true" />
 				<param name="loop" value="true" />
 				<param name="quality" value="high" />
 				<param name="allowScriptAccess" value="never" />
 				<param name="allowNetworking" value="internal" />
-				<embed src="{_file.U_DOWNLOAD_LINK}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{_file.WIDTH}" height="{_file.HEIGHT}" play="true" loop="true" quality="high" allowscriptaccess="never" allownetworking="internal"></embed>
+				<embed src="{_file.U_VIEW_LINK}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{_file.WIDTH}" height="{_file.HEIGHT}" play="true" loop="true" quality="high" allowscriptaccess="never" allownetworking="internal"></embed>
 			</object>
 		<!-- ELSEIF _file.S_QUICKTIME_FILE -->
 			<object id="qtstream_{_file.ATTACH_ID}" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="0" height="16">
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/editor.js 3.0.5.src/styles/prosilver/template/editor.js
--- 3.0.4.src/styles/prosilver/template/editor.js	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/editor.js	2009-05-31 05:58:35.000000000 -0500
@@ -16,7 +16,6 @@
 var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
 
 var baseHeight;
-onload_functions.push('initInsertions()');
 
 /**
 * Shows the help messages in the helpline window
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/forum_fn.js 3.0.5.src/styles/prosilver/template/forum_fn.js
--- 3.0.4.src/styles/prosilver/template/forum_fn.js	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/forum_fn.js	2009-05-31 05:58:35.000000000 -0500
@@ -23,9 +23,16 @@
 {
 	var page = prompt(jump_page, on_page);
 
-	if (page !== null && !isNaN(page) && page > 0)
+	if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0)
 	{
-		document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+		if (base_url.indexOf('?') == -1)
+		{
+			document.location.href = base_url + '?start=' + ((page - 1) * per_page);
+		}
+		else
+		{
+			document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+		}
 	}
 }
 
@@ -200,6 +207,12 @@
 		// Firefox and Opera
 		else
 		{
+			// workaround for bug # 42885
+			if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
+			{
+				e.innerHTML = e.innerHTML + '&nbsp;';
+			}
+
 			var r = document.createRange();
 			r.selectNodeContents(e);
 			s.removeAllRanges();
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/mcp_notes_user.html 3.0.5.src/styles/prosilver/template/mcp_notes_user.html
--- 3.0.4.src/styles/prosilver/template/mcp_notes_user.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/mcp_notes_user.html	2009-05-31 05:58:35.000000000 -0500
@@ -7,7 +7,7 @@
 <div class="panel">
 	<div class="inner"><span class="corners-top"><span></span></span>
 
-	<h3><!-- IF USER_COLOR --><span style="color: #{USER_COLOR}">{USERNAME}</span><!-- ELSE -->{USERNAME}<!-- ENDIF --></h3>
+	<h3>{USERNAME_FULL}</h3>
 
 	<div>
 		<div class="column1">
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/mcp_topic.html 3.0.5.src/styles/prosilver/template/mcp_topic.html
--- 3.0.4.src/styles/prosilver/template/mcp_topic.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/mcp_topic.html	2009-05-31 05:58:35.000000000 -0500
@@ -160,7 +160,7 @@
 		<!-- IF S_CAN_SPLIT --><option value="split_all"<!-- IF S_SPLIT_VIEW --> selected="selected"<!-- ENDIF -->>{L_SPLIT_POSTS}</option><option value="split_beyond">{L_SPLIT_AFTER}</option><!-- ENDIF -->
 	</select>&nbsp;
 	<input class="button1" type="submit" name="mcp_topic_submit" value="{L_SUBMIT}" />
-	<div><a href="#" onclick="marklist('mcp', '', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', '', false); return false;">{L_UNMARK_ALL}</a></div>
+	<div><a href="#" onclick="marklist('mcp', 'post', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'post', false); return false;">{L_UNMARK_ALL}</a></div>
 {S_HIDDEN_FIELDS}
 {S_FORM_TOKEN}
 </fieldset>
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/mcp_warn_user.html 3.0.5.src/styles/prosilver/template/mcp_warn_user.html
--- 3.0.4.src/styles/prosilver/template/mcp_warn_user.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/mcp_warn_user.html	2009-05-31 05:58:35.000000000 -0500
@@ -7,7 +7,7 @@
 <div class="panel">
 	<div class="inner"><span class="corners-top"><span></span></span>
 
-	<h3><!-- IF USER_COLOR --><span style="color: #{USER_COLOR}">{USERNAME}</span><!-- ELSE -->{USERNAME}<!-- ENDIF --></h3>
+	<h3>{USERNAME_FULL}</h3>
 
 	<div>
 		<div class="column1">
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/memberlist_body.html 3.0.5.src/styles/prosilver/template/memberlist_body.html
--- 3.0.4.src/styles/prosilver/template/memberlist_body.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/memberlist_body.html	2009-05-31 05:58:35.000000000 -0500
@@ -132,7 +132,7 @@
 	<tr class="<!-- IF memberrow.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
 		<td><!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF --><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF -->{memberrow.USERNAME_FULL}<!-- IF S_SELECT_SINGLE --><br />[&nbsp;<a href="#" onclick="insert_single('{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a>&nbsp;]<!-- ENDIF --></td>
 		<td class="posts"><!-- IF memberrow.POSTS --><a href="{memberrow.U_SEARCH_USER}" title="{L_SEARCH_USER_POSTS}">{memberrow.POSTS}</a><!-- ELSE -->{memberrow.POSTS}<!-- ENDIF --></td>
-		<td class="info"><!-- IF memberrow.U_WWW or memberrow.LOCATION --><!-- IF memberrow.U_WWW --><div><a href="{memberrow.U_WWW}" title="{L_VISIT_WEBSITE}: {memberrow.U_WWW}">{memberrow.U_WWW}</a></div><!-- ENDIF --><!-- IF memberrow.LOCATION --><div>{memberrow.LOCATION}</div><!-- ENDIF --><!-- ELSE -->&nbsp;<!-- ENDIF --></td>
+		<td class="info"><!-- IF memberrow.U_WWW or memberrow.LOCATION --><!-- IF memberrow.U_WWW --><div><a href="{memberrow.U_WWW}" title="{L_VISIT_WEBSITE}: {memberrow.U_WWW}">{memberrow.U_SHORT_WWW}</a></div><!-- ENDIF --><!-- IF memberrow.LOCATION --><div>{memberrow.LOCATION}</div><!-- ENDIF --><!-- ELSE -->&nbsp;<!-- ENDIF --></td>
 		<td>{memberrow.JOINED}</td>
 		<!-- IF S_VIEWONLINE --><td>{memberrow.VISITED}&nbsp;</td><!-- ENDIF -->
 	</tr>
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/overall_header.html 3.0.5.src/styles/prosilver/template/overall_header.html
--- 3.0.4.src/styles/prosilver/template/overall_header.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/overall_header.html	2009-05-31 05:58:35.000000000 -0500
@@ -11,6 +11,7 @@
 <meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" />
 <meta name="keywords" content="" />
 <meta name="description" content="" />
+<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
 {META}
 <title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>
 
@@ -102,7 +103,7 @@
 				<a href="{U_INDEX}" title="{L_INDEX}" id="logo">{SITE_LOGO_IMG}</a>
 				<h1>{SITENAME}</h1>
 				<p>{SITE_DESCRIPTION}</p>
-				<p style="display: none;"><a href="#start_here">{L_SKIP}</a></p>
+				<p class="skiplink"><a href="#start_here">{L_SKIP}</a></p>
 			</div>
 
 		<!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/posting_buttons.html 3.0.5.src/styles/prosilver/template/posting_buttons.html
--- 3.0.4.src/styles/prosilver/template/posting_buttons.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/posting_buttons.html	2009-05-31 05:58:35.000000000 -0500
@@ -93,8 +93,12 @@
 		<option value="50">{L_FONT_TINY}</option>
 		<option value="85">{L_FONT_SMALL}</option>
 		<option value="100" selected="selected">{L_FONT_NORMAL}</option>
-		<option value="150">{L_FONT_LARGE}</option>
-		<option value="200">{L_FONT_HUGE}</option>
+		<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 150 -->
+			<option value="150">{L_FONT_LARGE}</option>
+			<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 200 -->
+				<option value="200">{L_FONT_HUGE}</option>
+			<!-- ENDIF -->
+		<!-- ENDIF -->
 	</select>
 	<input type="button" class="button2" name="bbpalette" id="bbpalette" value="{L_FONT_COLOR}" onclick="change_palette();" title="{L_BBCODE_S_HELP}" />
 	<!-- BEGIN custom_tags -->
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/posting_editor.html 3.0.5.src/styles/prosilver/template/posting_editor.html
--- 3.0.4.src/styles/prosilver/template/posting_editor.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/posting_editor.html	2009-05-31 05:58:35.000000000 -0500
@@ -61,7 +61,7 @@
 		<!-- IF S_GROUP_OPTIONS -->
 			<div class="column2">
 				<dl>
-					<dd><label for="group_list">{L_USERGROUPS}:</label> <select name="group_list[]" id="group_list "multiple="true" size="4" class="inputbox">{S_GROUP_OPTIONS}</select></dd>
+					<dd><label for="group_list">{L_USERGROUPS}:</label> <select name="group_list[]" id="group_list" multiple="multiple" size="4" class="inputbox">{S_GROUP_OPTIONS}</select></dd>
 				</dl>
 			</div>
 		<!-- ENDIF -->
@@ -139,7 +139,7 @@
 	</div>
 
 	<div id="message-box">
-		<textarea <!-- IF S_UCP_ACTION and not S_PRIVMSGS and not S_EDIT_DRAFT -->name="signature" id="signature" style="height: 9em;"<!-- ELSE -->name="message" id="message"<!-- ENDIF --> rows="15" cols="76" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" class="inputbox">{MESSAGE}{DRAFT_MESSAGE}{SIGNATURE}</textarea>
+		<textarea <!-- IF S_UCP_ACTION and not S_PRIVMSGS and not S_EDIT_DRAFT -->name="signature" id="signature" style="height: 9em;"<!-- ELSE -->name="message" id="message"<!-- ENDIF --> rows="15" cols="76" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();" class="inputbox">{MESSAGE}{DRAFT_MESSAGE}{SIGNATURE}</textarea>
 	</div>
 </fieldset>
 
@@ -160,8 +160,8 @@
 			<!-- BEGIN attach_row -->
 			<dl>
 
-				<dt><label for="comment_list[{attach_row.ASSOC_INDEX}]">{L_FILE_COMMENT}:</label></dt>
-				<dd><textarea name="comment_list[{attach_row.ASSOC_INDEX}]" id="comment_list[{attach_row.ASSOC_INDEX}]" rows="1" cols="35" class="inputbox">{attach_row.FILE_COMMENT}</textarea></dd>
+				<dt><label for="comment_list_{attach_row.ASSOC_INDEX}">{L_FILE_COMMENT}:</label></dt>
+				<dd><textarea name="comment_list[{attach_row.ASSOC_INDEX}]" id="comment_list_{attach_row.ASSOC_INDEX}" rows="1" cols="35" class="inputbox">{attach_row.FILE_COMMENT}</textarea></dd>
 				<dd><a href="{attach_row.U_VIEW_ATTACHMENT}" class="{S_CONTENT_FLOW_END}">{attach_row.FILENAME}</a></dd>
 				<dd style="margin-top: 5px;">
 					<!-- IF S_INLINE_ATTACHMENT_OPTIONS --><input type="button" value="{L_PLACE_INLINE}" onclick="attach_inline({attach_row.ASSOC_INDEX}, '{attach_row.A_FILENAME}');" class="button2" />&nbsp; <!-- ENDIF -->
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/posting_review.html 3.0.5.src/styles/prosilver/template/posting_review.html
--- 3.0.4.src/styles/prosilver/template/posting_review.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/posting_review.html	2009-05-31 05:58:35.000000000 -0500
@@ -3,10 +3,16 @@
 <p>{L_POST_REVIEW_EXPLAIN}</p>
 
 <!-- BEGIN post_review_row -->
-<div id="ppr{post_review_row.POST_ID}" class="post <!-- IF post_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF post_review_row.ONLINE_STATUS --> online<!-- ENDIF -->">
+<!-- IF post_review_row.S_IGNORE_POST -->
+<div class="post bg3 post-ignore">
 	<div class="inner"><span class="corners-top"><span></span></span>
+		{post_review_row.L_IGNORE_POST}
+<!-- ELSE -->
+<div class="post <!-- IF post_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF post_review_row.ONLINE_STATUS --> online<!-- ENDIF -->">
+	<div class="inner"><span class="corners-top"><span></span></span>
+<!-- ENDIF -->
 
-	<div class="postbody">
+	<div class="postbody" id="ppr{post_review_row.POST_ID}">
 		<h3><a href="#ppr{post_review_row.POST_ID}">{post_review_row.POST_SUBJECT}</a></h3>
 		<p class="author"><!-- IF S_IS_BOT -->{post_review_row.MINI_POST_IMG}<!-- ELSE --><a href="{post_review_row.U_MINI_POST}">{post_review_row.MINI_POST_IMG}</a><!-- ENDIF --> {L_POST_BY_AUTHOR}<strong>  {post_review_row.POST_AUTHOR_FULL}</strong> &raquo; {post_review_row.POST_DATE}</p>
 		<div class="content">{post_review_row.MESSAGE}</div>
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/posting_topic_review.html 3.0.5.src/styles/prosilver/template/posting_topic_review.html
--- 3.0.4.src/styles/prosilver/template/posting_topic_review.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/posting_topic_review.html	2009-05-31 05:58:35.000000000 -0500
@@ -6,8 +6,15 @@
 
 <div id="topicreview">
 	<!-- BEGIN topic_review_row -->
+
+	<!-- IF topic_review_row.S_IGNORE_POST -->
+	<div class="post bg3 post-ignore">
+		<div class="inner"><span class="corners-top"><span></span></span>
+			{topic_review_row.L_IGNORE_POST}
+	<!-- ELSE -->
 	<div class="post <!-- IF topic_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
 		<div class="inner"><span class="corners-top"><span></span></span>
+	<!-- ENDIF -->
 
 		<div class="postbody" id="pr{topic_review_row.POST_ID}">
 			<!-- IF topic_review_row.POSTER_QUOTE and topic_review_row.DECODED_MESSAGE -->
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/simple_header.html 3.0.5.src/styles/prosilver/template/simple_header.html
--- 3.0.4.src/styles/prosilver/template/simple_header.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/simple_header.html	2009-05-31 05:58:35.000000000 -0500
@@ -17,6 +17,11 @@
 <script type="text/javascript">
 // <![CDATA[
 
+	var jump_page = '{LA_JUMP_PAGE}:';
+	var on_page = '{ON_PAGE}';
+	var per_page = '{PER_PAGE}';
+	var base_url = '{A_BASE_URL}';
+	var style_cookie = 'phpBBstyle';
 	var onload_functions = new Array();
 	var onunload_functions = new Array();
 	var style_cookie_settings = '{A_COOKIE_SETTINGS}';
@@ -43,6 +48,7 @@
 // ]]>
 </script>
 <script type="text/javascript" src="{T_TEMPLATE_PATH}/styleswitcher.js"></script>
+<script type="text/javascript" src="{T_TEMPLATE_PATH}/forum_fn.js"></script>
 
 <link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
 <link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/template.cfg 3.0.5.src/styles/prosilver/template/template.cfg
--- 3.0.4.src/styles/prosilver/template/template.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/template.cfg	2009-05-31 05:58:35.000000000 -0500
@@ -19,7 +19,7 @@
 # General Information about this template
 name = prosilver
 copyright = &copy; phpBB Group, 2007
-version = 3.0.4
+version = 3.0.5
 
 # Defining a different template bitfield
 template_bitfield = lNg=
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/ucp_main_bookmarks.html 3.0.5.src/styles/prosilver/template/ucp_main_bookmarks.html
--- 3.0.4.src/styles/prosilver/template/ucp_main_bookmarks.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/ucp_main_bookmarks.html	2009-05-31 05:58:35.000000000 -0500
@@ -32,7 +32,7 @@
 				</dl>
 			<!-- ELSE -->
 			<dl class="icon" style="background-image: url({topicrow.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
-				<dt style="<!-- IF topicrow.TOPIC_ICON_IMG -->background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
+				<dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
 					<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
 					<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
 					<!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/ucp_main_subscribed.html 3.0.5.src/styles/prosilver/template/ucp_main_subscribed.html
--- 3.0.4.src/styles/prosilver/template/ucp_main_subscribed.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/ucp_main_subscribed.html	2009-05-31 05:58:35.000000000 -0500
@@ -52,7 +52,7 @@
 	<!-- BEGIN topicrow -->
 		<li class="row<!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ELSEIF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
 			<dl class="icon" style="background-image: url({topicrow.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
-				<dt style="<!-- IF topicrow.TOPIC_ICON_IMG -->background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
+				<dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
 					<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
 					<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
 					<!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/ucp_pm_viewmessage.html 3.0.5.src/styles/prosilver/template/ucp_pm_viewmessage.html
--- 3.0.4.src/styles/prosilver/template/ucp_pm_viewmessage.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/ucp_pm_viewmessage.html	2009-05-31 05:58:35.000000000 -0500
@@ -75,7 +75,7 @@
 		<dd>
 			<ul class="profile-icons">
 			<!-- IF U_PM --><li class="pm-icon"><a href="{U_PM}" title="{L_PRIVATE_MESSAGE}"><span>{L_PRIVATE_MESSAGE}</span></a></li><!-- ENDIF -->
-			<!-- IF U_EMAIL --><li class="email-icon"><a href="{U_EMAIL}" title="{L_EMAIL}"><span>{L_EMAIL}</span></a></li><!-- ENDIF -->
+			<!-- IF U_EMAIL --><li class="email-icon"><a href="{U_EMAIL}" title="{L_SEND_EMAIL_USER} {MESSAGE_AUTHOR}"><span>{L_SEND_EMAIL_USER} {MESSAGE_AUTHOR}</span></a></li><!-- ENDIF -->
 			<!-- IF U_WWW --><li class="web-icon"><a href="{U_WWW}" title="{L_VISIT_WEBSITE}: {U_WWW}"><span>{L_WEBSITE}</span></a></li><!-- ENDIF -->
 			<!-- IF U_MSN --><li class="msnm-icon"><a href="{U_MSN}" onclick="popup(this.href, 550, 320); return false;" title="{L_MSNM}"><span>{L_MSNM}</span></a></li><!-- ENDIF -->
 			<!-- IF U_ICQ --><li class="icq-icon"><a href="{U_ICQ}" onclick="popup(this.href, 550, 320); return false;" title="{L_ICQ}"><span>{L_ICQ}</span></a></li><!-- ENDIF -->
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/ucp_register.html 3.0.5.src/styles/prosilver/template/ucp_register.html
--- 3.0.4.src/styles/prosilver/template/ucp_register.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/ucp_register.html	2009-05-31 05:58:35.000000000 -0500
@@ -87,7 +87,8 @@
 		<dt><label for="confirm_code">{L_CONFIRM_CODE}:</label></dt>
 		<dd>{CONFIRM_IMG}</dd>
 		<dd><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" class="inputbox narrow" title="{L_CONFIRM_CODE}" /></dd>
-		<dd>{L_CONFIRM_CODE_EXPLAIN}</dd>
+		<dd>{L_CONFIRM_CODE_EXPLAIN}<!-- IF S_CONFIRM_REFRESH --> {L_VC_REFRESH_EXPLAIN}<!-- ENDIF --></dd>
+		<!-- IF S_CONFIRM_REFRESH --><dd><input type="submit" value="{L_VC_REFRESH}" class="button2" /></dd> <!-- ENDIF -->
 	</dl>
 	</fieldset>
 <!-- ENDIF -->
@@ -113,7 +114,7 @@
 	<fieldset class="submit-buttons">
 		{S_HIDDEN_FIELDS}
 		<input type="reset" value="{L_RESET}" name="reset" class="button2" />&nbsp;
-		<input type="submit" name="submit" id ="submit" value="{L_SUBMIT}" class="button1" />
+		<input type="submit" name="submit" id="submit" value="{L_SUBMIT}" class="button1" />
 		{S_FORM_TOKEN}
 	</fieldset>
 
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/viewforum_body.html 3.0.5.src/styles/prosilver/template/viewforum_body.html
--- 3.0.4.src/styles/prosilver/template/viewforum_body.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/viewforum_body.html	2009-05-31 05:58:35.000000000 -0500
@@ -75,7 +75,7 @@
 		<span class="corners-bottom"><span></span></span></div>
 	</div>
 
-	<!-- IF not S_USER_LOGGED_IN -->
+	<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
 
 		<form action="{S_LOGIN_ACTION}" method="post">
 
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/viewtopic_body.html 3.0.5.src/styles/prosilver/template/viewtopic_body.html
--- 3.0.4.src/styles/prosilver/template/viewtopic_body.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/viewtopic_body.html	2009-05-31 05:58:35.000000000 -0500
@@ -114,7 +114,7 @@
 
 <!-- BEGIN postrow -->
 	<!-- IF postrow.S_FIRST_UNREAD --><a id="unread"></a><!-- ENDIF -->
-	<div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_ONLINE --> online<!-- ENDIF -->">
+	<div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_IGNORE_POST --> online<!-- ENDIF -->">
 		<div class="inner"><span class="corners-top"><span></span></span>
 
 		<div class="postbody">
@@ -200,7 +200,7 @@
 			<dd>
 				<ul class="profile-icons">
 					<!-- IF postrow.U_PM --><li class="pm-icon"><a href="{postrow.U_PM}" title="{L_PRIVATE_MESSAGE}"><span>{L_PRIVATE_MESSAGE}</span></a></li><!-- ENDIF -->
-					<!-- IF postrow.U_EMAIL --><li class="email-icon"><a href="{postrow.U_EMAIL}" title="{L_EMAIL}"><span>{L_EMAIL}</span></a></li><!-- ENDIF -->
+					<!-- IF postrow.U_EMAIL --><li class="email-icon"><a href="{postrow.U_EMAIL}" title="{L_SEND_EMAIL_USER} {postrow.POST_AUTHOR}"><span>{L_SEND_EMAIL_USER} {postrow.POST_AUTHOR}</span></a></li><!-- ENDIF -->
 					<!-- IF postrow.U_WWW --><li class="web-icon"><a href="{postrow.U_WWW}" title="{L_VISIT_WEBSITE}: {postrow.U_WWW}"><span>{L_WEBSITE}</span></a></li><!-- ENDIF -->
 					<!-- IF postrow.U_MSN --><li class="msnm-icon"><a href="{postrow.U_MSN}" onclick="popup(this.href, 550, 320); return false;" title="{L_MSNM}"><span>{L_MSNM}</span></a></li><!-- ENDIF -->
 					<!-- IF postrow.U_ICQ --><li class="icq-icon"><a href="{postrow.U_ICQ}" onclick="popup(this.href, 550, 320); return false;" title="{L_ICQ}"><span>{L_ICQ}</span></a></li><!-- ENDIF -->
diff -x .svn -aruN 3.0.4.src/styles/prosilver/template/viewtopic_print.html 3.0.5.src/styles/prosilver/template/viewtopic_print.html
--- 3.0.4.src/styles/prosilver/template/viewtopic_print.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/template/viewtopic_print.html	2009-05-31 05:58:35.000000000 -0500
@@ -11,7 +11,7 @@
 <meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" />
 <meta name="keywords" content="" />
 <meta name="description" content="" />
-<meta name="robots" CONTENT="noindex" />
+<meta name="robots" content="noindex" />
 {META}
 <title>{SITENAME} &bull; {PAGE_TITLE}</title>
 
diff -x .svn -aruN 3.0.4.src/styles/prosilver/theme/bidi.css 3.0.5.src/styles/prosilver/theme/bidi.css
--- 3.0.4.src/styles/prosilver/theme/bidi.css	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/theme/bidi.css	2009-05-31 05:58:35.000000000 -0500
@@ -719,4 +719,7 @@
 * tweaks.css
 */
 
-
+/** Reference: Bug #27155 */
+.rtl #wrap, .rtl .headerbar, .rtl #site-description, .rtl .navbar {
+	position: relative;
+}
diff -x .svn -aruN 3.0.4.src/styles/prosilver/theme/colours.css 3.0.5.src/styles/prosilver/theme/colours.css
--- 3.0.4.src/styles/prosilver/theme/colours.css	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/theme/colours.css	2009-05-31 05:58:34.000000000 -0500
@@ -882,7 +882,7 @@
 	border-color: #5D8FBD;
 }
 
-pmlist li.pm_foe_colour, .pm_foe_colour {
+.pmlist li.pm_foe_colour, .pm_foe_colour {
 	border-color: #000000;
 }
 
@@ -906,6 +906,7 @@
 select {
 	border-color: #666666;
 	background-color: #FAFAFA;
+	color: #000;
 }
 
 label {
diff -x .svn -aruN 3.0.4.src/styles/prosilver/theme/common.css 3.0.5.src/styles/prosilver/theme/common.css
--- 3.0.4.src/styles/prosilver/theme/common.css	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/theme/common.css	2009-05-31 05:58:35.000000000 -0500
@@ -397,7 +397,7 @@
 table.table1 .active	{ text-align: left; width: 15%; }
 table.table1 .mark		{ text-align: center; width: 7%; }
 table.table1 .info		{ text-align: left; width: 30%; }
-table.table1 .info div	{ width: 100%; white-space: nowrap; overflow: hidden; }
+table.table1 .info div	{ width: 100%; white-space: normal; overflow: hidden; }
 table.table1 .autocol	{ line-height: 2em; white-space: nowrap; }
 table.table1 thead .autocol { padding-left: 1em; }
 
@@ -599,7 +599,7 @@
 	font-size: 1.1em;
 }
 
-div.rules ul {
+div.rules ul, div.rules ol {
 	margin-left: 20px;
 }
 
diff -x .svn -aruN 3.0.4.src/styles/prosilver/theme/content.css 3.0.5.src/styles/prosilver/theme/content.css
--- 3.0.4.src/styles/prosilver/theme/content.css	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/theme/content.css	2009-05-31 05:58:34.000000000 -0500
@@ -44,7 +44,9 @@
 
 ul.topiclist dfn {
 	/* Labels for post/view counts */
-	display: none;
+	position: absolute;
+	left: -999px;
+	width: 990px;
 }
 
 ul.topiclist li.row dt a.subforum {
@@ -280,6 +282,10 @@
 	border-bottom-width: 0;
 }
 
+.post-ignore .postbody {
+	display: none;
+}
+
 /* Content container styles
 ----------------------------------------*/
 .content {
@@ -750,4 +756,4 @@
 dl.pmlist dd {
 	margin-left: 61% !important;
 	margin-bottom: 2px;
-}
+}
\ No newline at end of file
diff -x .svn -aruN 3.0.4.src/styles/prosilver/theme/links.css 3.0.5.src/styles/prosilver/theme/links.css
--- 3.0.4.src/styles/prosilver/theme/links.css	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/theme/links.css	2009-05-31 05:58:35.000000000 -0500
@@ -198,3 +198,10 @@
 	text-decoration: none;
 	background-position: 100% 60%;
 }
+
+/* invisible skip link, used for accessibility  */
+.skiplink {
+	position: absolute;
+	left: -999px;
+	width: 990px;
+}
diff -x .svn -aruN 3.0.4.src/styles/prosilver/theme/theme.cfg 3.0.5.src/styles/prosilver/theme/theme.cfg
--- 3.0.4.src/styles/prosilver/theme/theme.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/theme/theme.cfg	2009-05-31 05:58:35.000000000 -0500
@@ -21,7 +21,7 @@
 # General Information about this theme
 name = prosilver
 copyright = &copy; phpBB Group, 2007
-version = 3.0.4
+version = 3.0.5
 
 # Some configuration options
 
diff -x .svn -aruN 3.0.4.src/styles/prosilver/theme/tweaks.css 3.0.5.src/styles/prosilver/theme/tweaks.css
--- 3.0.4.src/styles/prosilver/theme/tweaks.css	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/prosilver/theme/tweaks.css	2009-05-31 05:58:35.000000000 -0500
@@ -82,3 +82,6 @@
 	float: none;
 }
 
+* html .forumbg table.table1 {
+	margin: 0 -2px 0px -1px;
+}
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/imageset/imageset.cfg 3.0.5.src/styles/subsilver2/imageset/imageset.cfg
--- 3.0.4.src/styles/subsilver2/imageset/imageset.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/imageset/imageset.cfg	2009-05-31 05:58:35.000000000 -0500
@@ -19,7 +19,7 @@
 # General Information about this style
 name = subsilver2
 copyright = &copy; phpBB Group, 2003
-version = 3.0.4
+version = 3.0.5
 
 # Images 
 img_site_logo = site_logo.gif*94*170
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/style.cfg 3.0.5.src/styles/subsilver2/style.cfg
--- 3.0.4.src/styles/subsilver2/style.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/style.cfg	2009-05-31 05:58:35.000000000 -0500
@@ -19,4 +19,4 @@
 # General Information about this style
 name = subsilver2
 copyright = &copy; 2005 phpBB Group
-version = 3.0.4
+version = 3.0.5
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/editor.js 3.0.5.src/styles/subsilver2/template/editor.js
--- 3.0.4.src/styles/subsilver2/template/editor.js	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/editor.js	2009-05-31 05:58:35.000000000 -0500
@@ -16,7 +16,6 @@
 var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
 
 var baseHeight;
-window.onload = initInsertions;
 
 /**
 * Shows the help messages in the helpline window
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/index_body.html 3.0.5.src/styles/subsilver2/template/index_body.html
--- 3.0.4.src/styles/subsilver2/template/index_body.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/index_body.html	2009-05-31 05:58:35.000000000 -0500
@@ -67,11 +67,11 @@
 </tr>
 </table>
 
-<!-- IF not S_USER_LOGGED_IN -->
+<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
 	<br clear="all" />
 
 	<form method="post" action="{S_LOGIN_ACTION}">
-	
+
 	<table class="tablebg" width="100%" cellspacing="1">
 	<tr>
 		<td class="cat"><h4><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h4></td>
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/mcp_notes_user.html 3.0.5.src/styles/subsilver2/template/mcp_notes_user.html
--- 3.0.4.src/styles/subsilver2/template/mcp_notes_user.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/mcp_notes_user.html	2009-05-31 05:58:35.000000000 -0500
@@ -10,7 +10,7 @@
 	<td class="row1" align="center">
 		<table cellspacing="1" cellpadding="2" border="0">
 		<tr>
-			<td class="gen" align="center"><!-- IF USER_COLOR --><b style="color: #{USER_COLOR}"><!-- ELSE --><b><!-- ENDIF -->{USERNAME}</b></td>
+			<td class="gen" align="center"><b>{USERNAME_FULL}</b></td>
 		</tr>
 		<!-- IF RANK_TITLE -->
 			<tr>
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/mcp_warn_user.html 3.0.5.src/styles/subsilver2/template/mcp_warn_user.html
--- 3.0.4.src/styles/subsilver2/template/mcp_warn_user.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/mcp_warn_user.html	2009-05-31 05:58:35.000000000 -0500
@@ -8,7 +8,7 @@
 	<td class="row1" align="center">
 		<table cellspacing="1" cellpadding="2" border="0">
 		<tr>
-			<td class="gen" align="center"><!-- IF USER_COLOR --><b style="color: #{USER_COLOR}"><!-- ELSE --><b><!-- ENDIF -->{USERNAME}</b></td>
+			<td class="gen" align="center"><b>{USERNAME_FULL}</b></td>
 		</tr>
 		<!-- IF RANK_TITLE -->
 			<tr>
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/overall_header.html 3.0.5.src/styles/subsilver2/template/overall_header.html
--- 3.0.4.src/styles/subsilver2/template/overall_header.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/overall_header.html	2009-05-31 05:58:35.000000000 -0500
@@ -11,6 +11,7 @@
 <meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" />
 <meta name="keywords" content="" />
 <meta name="description" content="" />
+<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
 {META}
 <title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>
 
@@ -39,12 +40,19 @@
 function jumpto()
 {
 	var page = prompt('{LA_JUMP_PAGE}:', '{ON_PAGE}');
-	var perpage = '{PER_PAGE}';
+	var per_page = '{PER_PAGE}';
 	var base_url = '{A_BASE_URL}';
 
-	if (page !== null && !isNaN(page) && page > 0)
+	if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0)
 	{
-		document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * perpage);
+		if (base_url.indexOf('?') == -1)
+		{
+			document.location.href = base_url + '?start=' + ((page - 1) * per_page);
+		}
+		else
+		{
+			document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+		}
 	}
 }
 
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/posting_body.html 3.0.5.src/styles/subsilver2/template/posting_body.html
--- 3.0.4.src/styles/subsilver2/template/posting_body.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/posting_body.html	2009-05-31 05:58:35.000000000 -0500
@@ -210,7 +210,7 @@
 		<table width="100%" cellspacing="0" cellpadding="0" border="0">
 		<!-- INCLUDE posting_buttons.html -->
 		<tr>
-			<td valign="top" style="width: 100%;"><textarea name="message" rows="15" cols="76" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" style="width: 98%;">{MESSAGE}</textarea></td>
+			<td valign="top" style="width: 100%;"><textarea name="message" rows="15" cols="76" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();" style="width: 98%;">{MESSAGE}</textarea></td>
 			<!-- IF S_BBCODE_ALLOWED -->
 			<td width="80" align="center" valign="top">
 				<script type="text/javascript">
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/posting_buttons.html 3.0.5.src/styles/subsilver2/template/posting_buttons.html
--- 3.0.4.src/styles/subsilver2/template/posting_buttons.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/posting_buttons.html	2009-05-31 05:58:35.000000000 -0500
@@ -58,8 +58,12 @@
 			<option value="50">{L_FONT_TINY}</option>
 			<option value="85">{L_FONT_SMALL}</option>
 			<option value="100" selected="selected">{L_FONT_NORMAL}</option>
-			<option value="150">{L_FONT_LARGE}</option>
-			<option value="200">{L_FONT_HUGE}</option>
+			<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 150 -->
+				<option value="150">{L_FONT_LARGE}</option>
+				<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 200 -->
+					<option value="200">{L_FONT_HUGE}</option>
+				<!-- ENDIF -->
+			<!-- ENDIF -->
 		</select></span>
 <!-- ENDIF -->
 	</td>
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/posting_review.html 3.0.5.src/styles/subsilver2/template/posting_review.html
--- 3.0.4.src/styles/subsilver2/template/posting_review.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/posting_review.html	2009-05-31 05:58:35.000000000 -0500
@@ -19,6 +19,9 @@
 		<!-- BEGIN post_review_row -->
 
 			<!-- IF post_review_row.S_ROW_COUNT is even -->	<tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
+				<!-- IF post_review_row.S_IGNORE_POST -->
+				<td colspan="2">{post_review_row.L_IGNORE_POST}</td>
+				<!-- ELSE -->
 
 				<td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{post_review_row.POST_ID}"></a>
 					<table width="150" cellspacing="0" cellpadding="4" border="0">
@@ -82,6 +85,7 @@
 					</tr>
 					</table>
 				</td>
+			<!-- ENDIF -->
 			</tr>
 			<tr>
 				<td class="spacer" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/posting_topic_review.html 3.0.5.src/styles/subsilver2/template/posting_topic_review.html
--- 3.0.4.src/styles/subsilver2/template/posting_topic_review.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/posting_topic_review.html	2009-05-31 05:58:35.000000000 -0500
@@ -15,6 +15,9 @@
 
 			<!-- IF topic_review_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
 
+				<!-- IF topic_review_row.S_IGNORE_POST -->
+				<td colspan="2">{topic_review_row.L_IGNORE_POST}</td>
+				<!-- ELSE -->
 				<td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{topic_review_row.POST_ID}"></a>
 					<table width="150" cellspacing="0">
 					<tr>
@@ -81,6 +84,7 @@
 					</tr>
 					</table>
 				</td>
+				<!-- ENDIF -->
 			</tr>
 			<tr>
 				<td class="spacer" colspan="2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
@@ -91,4 +95,4 @@
 </tr>
 </table>
 
-<br clear="all" />
+<br clear="all" />
\ No newline at end of file
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/template.cfg 3.0.5.src/styles/subsilver2/template/template.cfg
--- 3.0.4.src/styles/subsilver2/template/template.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/template.cfg	2009-05-31 05:58:35.000000000 -0500
@@ -19,5 +19,5 @@
 # General Information about this template
 name = subsilver2
 copyright = &copy; phpBB Group, 2003
-version = 3.0.4
+version = 3.0.5
 
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/ucp_header.html 3.0.5.src/styles/subsilver2/template/ucp_header.html
--- 3.0.4.src/styles/subsilver2/template/ucp_header.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/ucp_header.html	2009-05-31 05:58:35.000000000 -0500
@@ -36,7 +36,7 @@
 			<td class="row1"><b class="genmed">{L_USERGROUPS}:</b></td>
 		</tr>
 		<tr>
-			<td class="row2"><select name="group_list[]" multiple="true" size="5" style="width:150px">{S_GROUP_OPTIONS}</select></td>
+			<td class="row2"><select name="group_list[]" multiple="multiple" size="5" style="width:150px">{S_GROUP_OPTIONS}</select></td>
 		</tr>
 	<!-- ENDIF -->
 	<!-- IF S_ALLOW_MASS_PM -->
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/ucp_register.html 3.0.5.src/styles/subsilver2/template/ucp_register.html
--- 3.0.4.src/styles/subsilver2/template/ucp_register.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/ucp_register.html	2009-05-31 05:58:35.000000000 -0500
@@ -88,8 +88,8 @@
 		<td class="row1" colspan="2" align="center">{CONFIRM_IMG}</td>
 	</tr>
 	<tr>
-		<td class="row1"><b class="genmed">{L_CONFIRM_CODE}: </b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td>
-		<td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8" /></td>
+		<td class="row1"><b class="genmed">{L_CONFIRM_CODE}: </b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN} <!-- IF S_CONFIRM_REFRESH -->{L_VC_REFRESH_EXPLAIN}<!-- ENDIF --></span></td>
+		<td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8" /><!-- IF S_CONFIRM_REFRESH -->&nbsp;<input type="submit" value="{L_VC_REFRESH}" class="btnlite" /><!-- ENDIF --></td>
 	</tr>
 <!-- ENDIF -->
 
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/ucp_zebra_foes.html 3.0.5.src/styles/subsilver2/template/ucp_zebra_foes.html
--- 3.0.4.src/styles/subsilver2/template/ucp_zebra_foes.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/ucp_zebra_foes.html	2009-05-31 05:58:35.000000000 -0500
@@ -24,7 +24,5 @@
 	<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
 </tr>
 </table>
-<!-- TEST -->
-
 
 <!-- INCLUDE ucp_footer.html -->
\ No newline at end of file
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/template/viewforum_body.html 3.0.5.src/styles/subsilver2/template/viewforum_body.html
--- 3.0.4.src/styles/subsilver2/template/viewforum_body.html	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/template/viewforum_body.html	2009-05-31 05:58:35.000000000 -0500
@@ -111,7 +111,7 @@
 	</tr>
 	</table>
 
-	<!-- IF not S_USER_LOGGED_IN -->
+	<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
 
 		<br /><br />
 
@@ -125,7 +125,7 @@
 			<td class="row1" align="center"><span class="genmed">{L_USERNAME}:</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}:</span> <input class="post" type="password" name="password" size="10" /><!-- IF S_AUTOLOGIN_ENABLED -->&nbsp; <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
 		</tr>
 		</table>
-		
+
 		</form>
 
 	<!-- ENDIF -->
@@ -298,7 +298,7 @@
 				<td class="gensmall">{L_NO_NEW_POSTS_HOT}</td>
 				<td>&nbsp;&nbsp;</td>
 				<td style="text-align: center;">{FOLDER_STICKY_IMG}</td>
-				<td class="gensmall">{L_ICON_STICKY}</td>			
+				<td class="gensmall">{L_ICON_STICKY}</td>
 			</tr>
 			<tr>
 				<td style="text-align: center;">{FOLDER_LOCKED_NEW_IMG}</td>
diff -x .svn -aruN 3.0.4.src/styles/subsilver2/theme/theme.cfg 3.0.5.src/styles/subsilver2/theme/theme.cfg
--- 3.0.4.src/styles/subsilver2/theme/theme.cfg	2009-01-12 11:51:45.000000000 -0600
+++ 3.0.5.src/styles/subsilver2/theme/theme.cfg	2009-05-31 05:58:35.000000000 -0500
@@ -21,7 +21,7 @@
 # General Information about this theme
 name = subsilver2
 copyright = &copy; phpBB Group, 2003
-version = 3.0.4
+version = 3.0.5
 
 # Some configuration options
 
diff -x .svn -aruN 3.0.4.src/viewforum.php 3.0.5.src/viewforum.php
--- 3.0.4.src/viewforum.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/viewforum.php	2009-05-31 05:58:36.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: viewforum.php 9003 2008-10-11 18:23:12Z toonarmy $
+* @version $Id: viewforum.php 9459 2009-04-17 15:08:09Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -612,7 +612,8 @@
 		topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
 
 		// Generate all the URIs ...
-		$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&amp;t=' . $topic_id);
+		$view_topic_url_params = 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&amp;t=' . $topic_id;
+		$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
 
 		$topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
 		$posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
@@ -664,8 +665,8 @@
 			'S_TOPIC_LOCKED'		=> ($row['topic_status'] == ITEM_LOCKED) ? true : false,
 			'S_TOPIC_MOVED'			=> ($row['topic_status'] == ITEM_MOVED) ? true : false,
 
-			'U_NEWEST_POST'			=> $view_topic_url . '&amp;view=unread#unread',
-			'U_LAST_POST'			=> $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
+			'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;view=unread') . '#unread',
+			'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
 			'U_LAST_POST_AUTHOR'	=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 			'U_TOPIC_AUTHOR'		=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 			'U_VIEW_TOPIC'			=> $view_topic_url,
diff -x .svn -aruN 3.0.4.src/viewonline.php 3.0.5.src/viewonline.php
--- 3.0.4.src/viewonline.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/viewonline.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: viewonline.php 8705 2008-07-28 16:55:00Z Kellanved $
+* @version $Id: viewonline.php 9428 2009-04-08 17:33:51Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -139,7 +139,7 @@
 	{
 		$view_online = $s_user_hidden = false;
 		$user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : '';
-		
+
 		$username_full = ($row['user_type'] != USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '<span' . $user_colour . '>' . $row['username'] . '</span>';
 
 		if (!$row['session_viewonline'])
@@ -187,7 +187,7 @@
 		continue;
 	}
 
-	preg_match('#^([a-z/]+)#i', $row['session_page'], $on_page);
+	preg_match('#^([a-z/_]+)#i', $row['session_page'], $on_page);
 	if (!sizeof($on_page))
 	{
 		$on_page[1] = '';
@@ -334,7 +334,7 @@
 		'U_USER_IP'			=> append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=lookup' . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&amp;s=' . $row['session_id'] : '') . "&amp;sg=$show_guests&amp;start=$start&amp;sk=$sort_key&amp;sd=$sort_dir"),
 		'U_WHOIS'			=> append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=whois&amp;s=' . $row['session_id']),
 		'U_FORUM_LOCATION'	=> $location_url,
-		
+
 		'S_USER_HIDDEN'		=> $s_user_hidden,
 		'S_GUEST'			=> ($row['user_id'] == ANONYMOUS) ? true : false,
 		'S_USER_TYPE'		=> $row['user_type'],
diff -x .svn -aruN 3.0.4.src/viewtopic.php 3.0.5.src/viewtopic.php
--- 3.0.4.src/viewtopic.php	2009-01-12 11:51:46.000000000 -0600
+++ 3.0.5.src/viewtopic.php	2009-05-31 05:58:35.000000000 -0500
@@ -2,7 +2,7 @@
 /**
 *
 * @package phpBB3
-* @version $Id: viewtopic.php 9138 2008-11-30 16:53:36Z acydburn $
+* @version $Id: viewtopic.php 9470 2009-04-18 17:22:41Z acydburn $
 * @copyright (c) 2005 phpBB Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
@@ -262,9 +262,9 @@
 if (!$topic_data)
 {
 	// If post_id was submitted, we try at least to display the topic as a last resort...
-	if ($post_id && $forum_id && $topic_id)
+	if ($post_id && $topic_id)
 	{
-		redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id"));
+		redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&amp;f=$forum_id" : '')));
 	}
 
 	trigger_error('NO_TOPIC');
@@ -604,7 +604,7 @@
 	'S_SINGLE_MODERATOR'	=> (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true,
 	'S_TOPIC_ACTION' 		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;start=$start"),
 	'S_TOPIC_MOD' 			=> ($topic_mod != '') ? '<select name="action" id="quick-mod-select">' . $topic_mod . '</select>' : '',
-	'S_MOD_ACTION' 			=> append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;quickmod=1&amp;redirect=" . urlencode(str_replace('&amp;', '&', $viewtopic_url)), true, $user->session_id),
+	'S_MOD_ACTION' 			=> append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;start=$start&amp;quickmod=1&amp;redirect=" . urlencode(str_replace('&amp;', '&', $viewtopic_url)), true, $user->session_id),
 
 	'S_VIEWTOPIC'			=> true,
 	'S_DISPLAY_SEARCHBOX'	=> ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
@@ -679,8 +679,8 @@
 		}
 	}
 
-	$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
-		($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change'])) &&
+	// Can not vote at all if no vote permission
+	$s_can_vote = ($auth->acl_get('f_vote', $forum_id) &&
 		(($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
 		$topic_data['topic_status'] != ITEM_LOCKED &&
 		$topic_data['forum_status'] != ITEM_LOCKED) ? true : false;
@@ -898,7 +898,7 @@
 $i = ($store_reverse) ? $sql_limit - 1 : 0;
 while ($row = $db->sql_fetchrow($result))
 {
-	$post_list[$i] = $row['post_id'];
+	$post_list[$i] = (int) $row['post_id'];
 	($store_reverse) ? $i-- : $i++;
 }
 $db->sql_freeresult($result);
@@ -952,12 +952,12 @@
 		$max_post_time = $row['post_time'];
 	}
 
-	$poster_id = $row['poster_id'];
+	$poster_id = (int) $row['poster_id'];
 
 	// Does post have an attachment? If so, add it to the list
 	if ($row['post_attachment'] && $config['allow_attachments'])
 	{
-		$attach_list[] = $row['post_id'];
+		$attach_list[] = (int) $row['post_id'];
 
 		if ($row['post_approved'])
 		{
@@ -1143,7 +1143,10 @@
 // Load custom profile fields
 if ($config['load_cpf_viewtopic'])
 {
-	include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
+	if (!class_exists('custom_profile'))
+	{
+		include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
+	}
 	$cp = new custom_profile();
 
 	// Grab all profile fields from users in id cache for later use - similar to the poster cache
@@ -1381,7 +1384,7 @@
 		// It is safe to grab the username from the user cache array, we are at the last
 		// post and only the topic poster and last poster are allowed to bump.
 		// Admins and mods are bound to the above rules too...
-		$l_bumped_by = '<br /><br />' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time']));
+		$l_bumped_by = '<br /><br />' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'], false, true));
 	}
 	else
 	{
@@ -1421,7 +1424,7 @@
 		'POSTER_WARNINGS'	=> $user_cache[$poster_id]['warnings'],
 		'POSTER_AGE'		=> $user_cache[$poster_id]['age'],
 
-		'POST_DATE'			=> $user->format_date($row['post_time']),
+		'POST_DATE'			=> $user->format_date($row['post_time'], false, ($view == 'print') ? true : false),
 		'POST_SUBJECT'		=> $row['post_subject'],
 		'MESSAGE'			=> $message,
 		'SIGNATURE'			=> ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '',
@@ -1514,7 +1517,7 @@
 unset($rowset, $user_cache);
 
 // Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view'
-if (isset($user->data['session_page']) && !$user->data['is_bot'] && strpos($user->data['session_page'], '&t=' . $topic_id) === false)
+if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($user->data['session_page'], '&t=' . $topic_id) === false || isset($user->data['session_created'])))
 {
 	$sql = 'UPDATE ' . TOPICS_TABLE . '
 		SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . "
