diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html
index f293c31147..e1c0fa9a05 100644
--- a/phpBB/adm/style/acp_main.html
+++ b/phpBB/adm/style/acp_main.html
@@ -4,6 +4,13 @@
 
 <p>{L_ADMIN_INTRO}</p>
 
+<!-- IF S_DEBUG_EXTRA -->
+	<div class="errorbox">
+		<h3>{L_WARNING}</h3>
+		<p>{L_DEBUG_EXTRA_WARNING}</p>
+	</div>
+<!-- ENDIF -->
+
 <table cellspacing="1">
 	<caption>{L_FORUM_STATS}</caption>
 	<col class="col1" /><col class="col2" /><col class="col1" /><col class="col2" />
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index 0db02be9cb..69b37c2427 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -485,13 +485,15 @@ class acp_icons
 				while ($row = $db->sql_fetchrow($result))
 				{
 					$pak .= "'" . addslashes($row[$fields . '_url']) . "', ";
-					$pak .= "'" . addslashes($row[$fields . '_height']) . "', ";
 					$pak .= "'" . addslashes($row[$fields . '_width']) . "', ";
+					$pak .= "'" . addslashes($row[$fields . '_height']) . "', ";
+
 					if ($mode == 'smilies')
 					{
 						$pak .= "'" . addslashes($row['emotion']) . "', ";
 						$pak .= "'" . addslashes($row['code']) . "', ";
 					}
+
 					$pak .= "\n";
 				}
 				$db->sql_freeresult($result);
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index af48ea700c..3cc00db36e 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -264,6 +264,85 @@ class acp_main
 				set_config('board_startdate', time() - 1);
 				add_log('admin', 'LOG_RESET_DATE');
 			break;
+		
+			case 'db_track':
+				$db->sql_query(((SQL_LAYER != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM ') . TOPICS_POSTED_TABLE);
+
+				// This can get really nasty... therefore we only do the last six months
+				$get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60);
+
+				// Select forum ids, do not include categories
+				$sql = 'SELECT forum_id
+					FROM ' . FORUMS_TABLE . '
+					WHERE forum_type <> ' . FORUM_CAT;
+				$result = $db->sql_query($sql);
+		
+				$forum_ids = array();
+				while ($row = $db->sql_fetchrow($result))
+				{
+					$forum_ids[] = $row['forum_id'];
+				}
+				$db->sql_freeresult($result);
+
+				// Any global announcements? ;)
+				$forum_ids[] = 0;
+
+				// Now go through the forums and get us some topics...
+				foreach ($forum_ids as $forum_id)
+				{
+					$sql = 'SELECT p.poster_id, p.topic_id
+						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
+						WHERE t.forum_id = ' . $forum_id . '
+							AND t.topic_moved_id = 0
+							AND t.topic_last_post_time > ' . $get_from_time . '
+							AND t.topic_id = p.topic_id
+							AND p.poster_id <> ' . ANONYMOUS . '
+						GROUP BY p.poster_id, p.topic_id';
+					$result = $db->sql_query($sql);
+
+					$posted = array();
+					while ($row = $db->sql_fetchrow($result))
+					{
+						$posted[$row['poster_id']][] = $row['topic_id'];
+					}
+					$db->sql_freeresult($result);
+
+					$sql_ary = array();
+					foreach ($posted as $user_id => $topic_row)
+					{
+						foreach ($topic_row as $topic_id)
+						{
+							$sql_ary[] = array(
+								'user_id'		=> $user_id,
+								'topic_id'		=> $topic_id,
+								'topic_posted'	=> 1,
+							);
+						}
+					}
+					unset($posted);
+
+					if (sizeof($sql_ary))
+					{
+						switch (SQL_LAYER)
+						{
+							case 'mysql':
+							case 'mysql4':
+							case 'mysqli':
+								$db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
+							break;
+
+							default:
+								foreach ($sql_ary as $ary)
+								{
+									$db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
+								}
+							break;
+						}
+					}
+				}
+	
+				add_log('admin', 'LOG_RESYNC_POST_MARKING');
+			break;
 		}
 
 		// Get forum statistics
@@ -328,7 +407,7 @@ class acp_main
 		}
 
 		$dbsize = get_database_size();
-		$s_action_options = build_select(array('online' => 'RESET_ONLINE', 'date' => 'RESET_DATE', 'stats' => 'RESYNC_STATS', 'user' => 'RESYNC_POSTCOUNTS'));
+		$s_action_options = build_select(array('online' => 'RESET_ONLINE', 'date' => 'RESET_DATE', 'stats' => 'RESYNC_STATS', 'user' => 'RESYNC_POSTCOUNTS', 'db_track' => 'RESYNC_POST_MARKING'));
 
 		$template->assign_vars(array(
 			'TOTAL_POSTS'		=> $total_posts,
@@ -398,7 +477,13 @@ class acp_main
 				'S_INACTIVE_OPTIONS'	=> build_select($option_ary))
 			);
 		}
-		
+
+		// Display debug_extra notice
+		if (defined('DEBUG_EXTRA'))
+		{
+			$template->assign_var('S_DEBUG_EXTRA', true);
+		}
+
 		$this->tpl_name = 'acp_main';
 		$this->page_title = 'ACP_MAIN';
 	}
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 853d54b14f..9ee89fcf35 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -952,16 +952,16 @@ class acp_profile
 
 		// Save the field
 		$profile_fields = array(
-			'field_length'		=> $cp->vars['field_length'],
-			'field_minlen'		=> $cp->vars['field_minlen'],
-			'field_maxlen'		=> $cp->vars['field_maxlen'],
-			'field_novalue'		=> $cp->vars['field_novalue'],
+			'field_length'			=> $cp->vars['field_length'],
+			'field_minlen'			=> $cp->vars['field_minlen'],
+			'field_maxlen'			=> $cp->vars['field_maxlen'],
+			'field_novalue'			=> $cp->vars['field_novalue'],
 			'field_default_value'	=> $cp->vars['field_default_value'],
-			'field_validation'	=> $cp->vars['field_validation'],
-			'field_required'	=> $cp->vars['field_required'],
-			'field_show_on_reg'	=> $cp->vars['field_show_on_reg'],
-			'field_hide'		=> $cp->vars['field_hide'],
-			'field_no_view'		=> $cp->vars['field_no_view']
+			'field_validation'		=> $cp->vars['field_validation'],
+			'field_required'		=> $cp->vars['field_required'],
+			'field_show_on_reg'		=> $cp->vars['field_show_on_reg'],
+			'field_hide'			=> $cp->vars['field_hide'],
+			'field_no_view'			=> $cp->vars['field_no_view']
 		);
 
 		if ($action == 'create')
@@ -969,6 +969,7 @@ class acp_profile
 			$profile_fields += array(
 				'field_type'		=> $field_type,
 				'field_ident'		=> $field_ident,
+				'field_name'		=> $field_ident,
 				'field_order'		=> $new_field_order + 1,
 				'field_active'		=> 1
 			);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 07783b5876..db612f7aa5 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -668,18 +668,23 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
 			return;
 		}
 
-		$db->sql_return_on_error(true);
+		$use_user_id = (!$user_id) ? $user->data['user_id'] : $user_id;
 
-		$sql_ary = array(
-			'user_id'		=> (!$user_id) ? $user->data['user_id'] : $user_id,
-			'topic_id'		=> $topic_id,
-			'topic_posted'	=> 1
-		);
+		if ($config['load_db_track'] && $use_user_id != ANONYMOUS)
+		{
+			$db->sql_return_on_error(true);
 
-		$db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
-	
-		$db->sql_return_on_error(false);
+			$sql_ary = array(
+				'user_id'		=> $use_user_id,
+				'topic_id'		=> $topic_id,
+				'topic_posted'	=> 1
+			);
+
+			$db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
 		
+			$db->sql_return_on_error(false);
+		}
+
 		return;
 	}
 }
@@ -2024,47 +2029,25 @@ function get_backtrace()
 		// Strip the current directory from path
 		$trace['file'] = str_replace(array($path, '\\'), array('', '/'), $trace['file']);
 		$trace['file'] = substr($trace['file'], 1);
-		
 		$args = array();
-		foreach ($trace['args'] as $argument)
+
+		// If include/require/include_once is not called, do not show arguments - they may contain sensible informations
+		if (!in_array($trace['function'], array('include', 'require', 'include_once')))
 		{
-			switch (gettype($argument)) 
+			unset($trace['args']);
+		}
+		else
+		{
+			// Path...
+			if (!empty($trace['args'][0]))
 			{
-				case 'integer':
-				case 'double':
-					$args[] = $argument;
-				break;
-				
-				case 'string':
-					$argument = htmlspecialchars(substr($argument, 0, 64)) . ((strlen($argument) > 64) ? '...' : '');
-					$args[] = "'{$argument}'";
-				break;
-				
-				case 'array':
-					$args[] = 'Array(' . sizeof($argument) . ')';
-				break;
-				
-				case 'object':
-					$args[] = 'Object(' . get_class($argument) . ')';
-				break;
-				
-				case 'resource':
-					$args[] = 'Resource(' . strstr($argument, '#') . ')';
-				break;
-				
-				case 'boolean':
-					$args[] = ($argument) ? 'true' : 'false';
-				break;
-				
-				case 'NULL':
-					$args[] = 'NULL';
-				break;
-				
-				default:
-					$args[] = 'Unknown';
+				$argument = htmlspecialchars($trace['args'][0]);
+				$argument = str_replace(array($path, '\\'), array('', '/'), $argument);
+				$argument = substr($argument, 1);
+				$args[] = "'{$argument}'";
 			}
 		}
-		
+
 		$trace['class'] = (!isset($trace['class'])) ? '' : $trace['class'];
 		$trace['type'] = (!isset($trace['type'])) ? '' : $trace['type'];
 
@@ -2072,15 +2055,6 @@ function get_backtrace()
 		$output .= '<b>FILE:</b> ' . htmlspecialchars($trace['file']) . '<br />';
 		$output .= '<b>LINE:</b> ' . $trace['line'] . '<br />';
 
-		// Do not display the users password
-		if (strpos($trace['function'], 'login') !== false)
-		{
-			if (isset($args[1]))
-			{
-				$args[1] = "'***'";
-			}
-		}
-
 		$output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']) . '(' . ((sizeof($args)) ? implode(', ', $args) : '') . ')<br />';
 	}
 	$output .= '</div>';
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 15d5ef6a45..977bd3fc1a 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -499,7 +499,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true)
 	}
 
 	$return = array(
-		'posts'	=>	delete_posts($where_type, $where_ids, false)
+		'posts'	=>	delete_posts($where_type, $where_ids, false, false)
 	);
 
 	$sql = 'SELECT topic_id, forum_id
@@ -528,6 +528,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true)
 	$db->sql_transaction('begin');
 
 	$table_ary = array(TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE);
+
 	foreach ($table_ary as $table)
 	{
 		$sql = "DELETE FROM $table 
@@ -554,7 +555,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true)
 /**
 * Remove post(s)
 */
-function delete_posts($where_type, $where_ids, $auto_sync = true)
+function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true)
 {
 	global $db, $config, $phpbb_root_path, $phpEx;
 
@@ -624,6 +625,12 @@ function delete_posts($where_type, $where_ids, $auto_sync = true)
 
 	$db->sql_transaction('commit');
 
+	// Resync topics_posted table
+	if ($posted_sync)
+	{
+		update_posted_info($topic_ids);
+	}
+
 	if ($auto_sync)
 	{
 		sync('topic_reported', 'topic_id', $topic_ids);
@@ -879,11 +886,11 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true)
 /**
 * Update/Sync posted informations for topics
 */
-function update_posted_info($topic_ids)
+function update_posted_info(&$topic_ids)
 {
-	global $db;
+	global $db, $config;
 
-	if (empty($topic_ids))
+	if (empty($topic_ids) || !$config['load_db_track'])
 	{
 		return;
 	}
@@ -894,29 +901,26 @@ function update_posted_info($topic_ids)
 	$db->sql_query($sql);
 
 	// Now, let us collect the user/topic combos for rebuilding the information
-	$sql = 'SELECT topic_id, poster_id
+	$sql = 'SELECT poster_id, topic_id
 		FROM ' . POSTS_TABLE . '
-		WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
+		WHERE topic_id IN (' . implode(', ', $topic_ids) . ')
+			AND poster_id <> ' . ANONYMOUS . '
+		GROUP BY poster_id, topic_id';
 	$result = $db->sql_query($sql);
 
 	$posted = array();
 	while ($row = $db->sql_fetchrow($result))
 	{
-		if (empty($posted[$row['topic_id']]))
-		{
-			$posted[$row['topic_id']] = array();
-		}
-	
 		// Add as key to make them unique (grouping by) and circumvent empty keys on array_unique
-		$posted[$row['topic_id']][$row['poster_id']] = 1;
+		$posted[$row['poster_id']][] = $row['topic_id'];
 	}
 	$db->sql_freeresult($result);
 
 	// Now add the information...
 	$sql_ary = array();
-	foreach ($posted as $topic_id => $poster_row)
+	foreach ($posted as $user_id => $topic_row)
 	{
-		foreach ($poster_row as $user_id => $null)
+		foreach ($topic_row as $topic_id)
 		{
 			$sql_ary[] = array(
 				'user_id'		=> $user_id,
@@ -925,6 +929,7 @@ function update_posted_info($topic_ids)
 			);
 		}
 	}
+	unset($posted);
 
 	if (sizeof($sql_ary))
 	{
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index c187bac96a..b0ccc3b9b1 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -625,7 +625,7 @@ class queue
 		
 		$file = '<?php $this->queue_data = ' . $this->format_array($this->data) . '; ?>';
 
-		if ($fp = fopen($this->cache_file, 'w'))
+		if ($fp = @fopen($this->cache_file, 'w'))
 		{
 			@flock($fp, LOCK_EX);
 			fwrite($fp, $file);
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 9d642457a4..b4b44b8c16 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1118,7 +1118,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
 
 	$db->sql_transaction();
 
-	if (!delete_posts('post_id', array($post_id), false))
+	if (!delete_posts('post_id', array($post_id), false, false))
 	{
 		// Try to delete topic, we may had an previous error causing inconsistency
 		if ($post_mode = 'delete_topic')
@@ -1252,6 +1252,27 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
 
 	$db->sql_transaction('commit');
 
+	// Adjust posted info for this user by looking for a post by him/her within this topic...
+	if ($post_mode != 'delete_topic' && $config['load_db_track'] && $user->data['is_registered'])
+	{
+		$sql = 'SELECT poster_id
+			FROM ' . POSTS_TABLE . '
+			WHERE topic_id = ' . $topic_id . '
+				AND poster_id = ' . $user->data['user_id'];
+		$result = $db->sql_query_limit($sql, 1);
+		$poster_id = (int) $db->sql_fetchfield('poster_id');
+		$db->sql_freeresult($result);
+
+		// The user is not having any more posts within this topic
+		if (!$poster_id)
+		{
+			$sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
+				WHERE topic_id = ' . $topic_id . '
+					AND user_id = ' . $user->data['user_id'];
+			$db->sql_query($sql);
+		}
+	}
+
 	return $next_post_id;
 }
 
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index 4ab5cf39cb..94b7e9a443 100644
--- a/phpBB/includes/functions_profile_fields.php
+++ b/phpBB/includes/functions_profile_fields.php
@@ -520,15 +520,16 @@ class custom_profile
 		global $user;
 
 		$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
+		$user_ident = str_replace('pf_', '', $profile_row['field_ident']);
 
 		// checkbox - only testing for isset
 		if ($profile_row['field_type'] == FIELD_BOOL && $profile_row['field_length'] == 2)
 		{
-			$value = (isset($_REQUEST[$profile_row['field_ident']])) ? true : ((!isset($user->profile_fields[str_replace('pf_', '', $profile_row['field_ident'])]) || $preview) ? $default_value : $user->profile_fields[str_replace('pf_', '', $profile_row['field_ident'])]);
+			$value = (isset($_REQUEST[$profile_row['field_ident']])) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
 		}
 		else
 		{
-			$value = (isset($_REQUEST[$profile_row['field_ident']])) ? request_var($profile_row['field_ident'], $default_value, true) : ((!isset($user->profile_fields[str_replace('pf_', '', $profile_row['field_ident'])]) || $preview) ? $default_value : $user->profile_fields[str_replace('pf_', '', $profile_row['field_ident'])]);
+			$value = (isset($_REQUEST[$profile_row['field_ident']])) ? request_var($profile_row['field_ident'], $default_value, true) : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
 		}
 
 		switch ($field_validation)
@@ -562,6 +563,8 @@ class custom_profile
 		global $user, $template;
 
 		$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
+		$user_ident = str_replace('pf_', '', $profile_row['field_ident']);
+
 		$now = getdate();
 
 		if (!isset($_REQUEST[$profile_row['field_ident'] . '_day']))
@@ -570,14 +573,14 @@ class custom_profile
 			{
 				$profile_row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']);
 			}
-			list($day, $month, $year) = explode('-', ((!isset($user->profile_fields[$profile_row['field_ident']]) || $preview) ? $profile_row['field_default_value'] : $user->profile_fields[$profile_row['field_ident']]));
+			list($day, $month, $year) = explode('-', ((!isset($user->profile_fields[$user_ident]) || $preview) ? $profile_row['field_default_value'] : $user->profile_fields[$user_ident]));
 		}
 		else
 		{
 			if ($preview && $profile_row['field_default_value'] == 'now')
 			{
 				$profile_row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']);
-				list($day, $month, $year) = explode('-', ((!isset($user->profile_fields[$profile_row['field_ident']]) || $preview) ? $profile_row['field_default_value'] : $user->profile_fields[$profile_row['field_ident']]));
+				list($day, $month, $year) = explode('-', ((!isset($user->profile_fields[$user_ident]) || $preview) ? $profile_row['field_default_value'] : $user->profile_fields[$user_ident]));
 			}
 			else
 			{
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index d226a0b545..106af1e2ed 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -362,20 +362,23 @@ function change_poster(&$post_info, $userdata)
 	markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']);
 
 	// Remove the dotted topic option if the old user has no more posts within this topic
-	$sql = 'SELECT topic_id
-		FROM ' . POSTS_TABLE . '
-		WHERE topic_id = ' . $post_info['topic_id'] . '
-			AND poster_id = ' . $post_info['user_id'];
-	$result = $db->sql_query_limit($sql, 1);
-	$topic_id = (int) $db->sql_fetchfield('topic_id');
-	$db->sql_freeresult($result);
-
-	if (!$topic_id)
+	if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS)
 	{
-		$sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
-			WHERE user_id = ' . $post_info['user_id'] . '
-				AND topic_id = ' . $post_info['topic_id'];
-		$db->sql_query($sql);
+		$sql = 'SELECT topic_id
+			FROM ' . POSTS_TABLE . '
+			WHERE topic_id = ' . $post_info['topic_id'] . '
+				AND poster_id = ' . $post_info['user_id'];
+		$result = $db->sql_query_limit($sql, 1);
+		$topic_id = (int) $db->sql_fetchfield('topic_id');
+		$db->sql_freeresult($result);
+
+		if (!$topic_id)
+		{
+			$sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
+				WHERE user_id = ' . $post_info['user_id'] . '
+					AND topic_id = ' . $post_info['topic_id'];
+			$db->sql_query($sql);
+		}
 	}
 
 	// Do not change the poster_id within the attachments table, since they were still posted by the original user
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 7c77a00e3f..bf15a0b3ca 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -700,7 +700,7 @@ class session
 
 		if (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1')
 		{
-			setcookie($config['cookie_name'] . '_' . $name, $cookiedata, $cookietime, $config['cookie_path']);
+			@setcookie($config['cookie_name'] . '_' . $name, $cookiedata, $cookietime, $config['cookie_path']);
 		}
 		else
 		{
@@ -710,7 +710,7 @@ class session
 				$config['cookie_domain'] = '.' . $config['cookie_domain'];
 			}
 
-			setcookie($config['cookie_name'] . '_' . $name, $cookiedata, $cookietime, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
+			@setcookie($config['cookie_name'] . '_' . $name, $cookiedata, $cookietime, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
 		}
 	}
 
diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php
index 0e9ad35d21..83d8cf1701 100644
--- a/phpBB/includes/ucp/ucp_activate.php
+++ b/phpBB/includes/ucp/ucp_activate.php
@@ -26,12 +26,13 @@ class ucp_activate
 			FROM ' . USERS_TABLE . "
 			WHERE user_id = $user_id";
 		$result = $db->sql_query($sql);
+		$row = $db->sql_fetchrow($result);
+		$db->sql_freeresult($result);
 
-		if (!($row = $db->sql_fetchrow($result)))
+		if (!$row)
 		{
 			trigger_error($user->lang['NO_USER']);
 		}
-		$db->sql_freeresult($result);
 
 		if ($row['user_type'] <> USER_INACTIVE && !$row['user_newpasswd'])
 		{
@@ -66,7 +67,7 @@ class ucp_activate
 			// Now we need to demote the user from the inactive group and add him to the registered group
 
 			include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
-			user_active_flip($row['user_id'], $row['user_type'], '', $row['username']);
+			user_active_flip($row['user_id'], $row['user_type'], '', $row['username'], true);
 		}
 
 		if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php
index 4e644dffaa..351e0646a1 100644
--- a/phpBB/includes/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php
@@ -434,7 +434,7 @@ function get_user_informations($user_id, $user_row)
 	
 	if (!empty($user_row['user_rank']))
 	{
-		$user_row['rank_title'] = $ranks['special'][$user_row['user_rank']]['rank_title'];
+		$user_row['rank_title'] = (isset($ranks['special'][$user_row['user_rank']])) ? $ranks['special'][$user_row['user_rank']]['rank_title'] : '';
 		$user_row['rank_image'] = (!empty($ranks['special'][$user_row['user_rank']]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$user_row['user_rank']]['rank_image'] . '" border="0" alt="' . $ranks['special'][$user_row['user_rank']]['rank_title'] . '" title="' . $ranks['special'][$user_row['user_rank']]['rank_title'] . '" /><br />' : '';
 	}
 	else
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index c994f97f95..d4b58a4e7c 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -766,7 +766,6 @@ CREATE INDEX phpbb_privmsgs_to_user_id ON phpbb_privmsgs_to(user_id, folder_id);
 CREATE TABLE phpbb_profile_fields (
   field_id INTEGER NOT NULL,
   field_name VARCHAR(255) NOT NULL,
-  field_desc BLOB SUB_TYPE TEXT,
   field_type INTEGER NOT NULL,
   field_ident VARCHAR(20) DEFAULT '' NOT NULL,
   field_length VARCHAR(20) DEFAULT '' NOT NULL,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index f6c2beae03..5c15794f9e 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -1201,7 +1201,6 @@ GO
 CREATE TABLE [phpbb_profile_fields] (
 	[field_id] [int] IDENTITY (1, 1) NOT NULL ,
 	[field_name] [varchar] (255) NOT NULL ,
-	[field_desc] [varchar] (8000) ,
 	[field_type] [int] NOT NULL ,
 	[field_ident] [varchar] (20) NOT NULL ,
 	[field_length] [varchar] (20) NOT NULL ,
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index ab3f2592c0..e8945eeedb 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -498,7 +498,6 @@ CREATE TABLE phpbb_privmsgs_to (
 CREATE TABLE phpbb_profile_fields (
   field_id mediumint(8) UNSIGNED NOT NULL auto_increment,
   field_name varchar(255) DEFAULT '' NOT NULL,
-  field_desc text,
   field_type mediumint(8) UNSIGNED NOT NULL,
   field_ident varchar(20) DEFAULT '' NOT NULL,
   field_length varchar(20) DEFAULT '' NOT NULL,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 0793f1b8e0..16a22bef59 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1030,7 +1030,6 @@ CREATE INDEX phpbb_privmsgs_to_user_id on phpbb_privmsgs_to (user_id, folder_id)
 CREATE TABLE phpbb_profile_fields (
   field_id number(8) NOT NULL,
   field_name varchar2(255) DEFAULT '' NOT NULL,
-  field_desc clob,
   field_type number(8) NOT NULL,
   field_ident varchar2(20) DEFAULT '' NOT NULL,
   field_length varchar2(20) DEFAULT '' NOT NULL,
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index adae3dcb51..0d9f1d9e78 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -783,7 +783,6 @@ CREATE SEQUENCE phpbb_profile_fields_seq;
 CREATE TABLE phpbb_profile_fields (
   field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'),
   field_name varchar(255) DEFAULT '' NOT NULL,
-  field_desc varchar(8000),
   field_type INT4  NOT NULL,
   field_ident varchar(20) DEFAULT '' NOT NULL,
   field_length varchar(20) DEFAULT '' NOT NULL,
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index 97f4926aa6..bc0f72df0a 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -536,7 +536,6 @@ CREATE INDEX phpbb_privmsgs_to_user_id on phpbb_privmsgs_to (user_id, folder_id)
 CREATE TABLE phpbb_profile_fields (
   field_id INTEGER PRIMARY KEY NOT NULL,
   field_name varchar(255) NOT NULL DEFAULT '',
-  field_desc text(65535),
   field_type mediumint(8) NOT NULL,
   field_ident varchar(20) NOT NULL DEFAULT '',
   field_length varchar(20) NOT NULL DEFAULT '',
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 0621be9f03..a73967d001 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -254,6 +254,8 @@ $lang = array_merge($lang, array(
 	'USER_CONTROL_PANEL'	=> 'User Control Panel',
 
 	'WARNING'				=> 'Warning',
+
+	'DEBUG_EXTRA_WARNING'	=> 'The DEBUG_EXTRA constant is defined which is only meant for development purposes by the developers.<br />The board is running additional code to display sql reports, which slows down the board in a significant manner. Additionally sql errors are always displayed with a full backtrace to all users instead of displaying it solely to administrators, which is the default setting.<br /><br />With this said, please be aware that you are currently running your installation in <b>Debug Mode</b> and should you take this board live, please remove the constant from the config file.',
 ));
 
 // PHP info
@@ -306,10 +308,11 @@ $lang = array_merge($lang, array(
 
 	'POSTS_PER_DAY'		=> 'Posts per day',
 
-	'RESET_DATE'		=> 'Reset Date',
-	'RESET_ONLINE'		=> 'Reset Online',
-	'RESYNC_POSTCOUNTS'	=> 'Resync Postcounts',
-	'RESYNC_STATS'		=> 'Resync Stats',
+	'RESET_DATE'			=> 'Reset Date',
+	'RESET_ONLINE'			=> 'Reset Online',
+	'RESYNC_POSTCOUNTS'		=> 'Resync Postcounts',
+	'RESYNC_POST_MARKING'	=> 'Resync dotted topics',
+	'RESYNC_STATS'			=> 'Resync Stats',
 
 	'STATISTIC'			=> 'Statistic',
 
@@ -522,10 +525,11 @@ $lang = array_merge($lang, array(
 	'LOG_REASON_REMOVED'	=> '<b>Removed report/denial reason</b><br />&#187; %s',
 	'LOG_REASON_UPDATED'	=> '<b>Updated report/denial reason</b><br />&#187; %s',
 
-	'LOG_RESET_DATE'		=> '<b>Board start date reset</b>',
-	'LOG_RESET_ONLINE'		=> '<b>Most users online reset</b>',
-	'LOG_RESYNC_POSTCOUNTS'	=> '<b>User postcounts synced</b>',
-	'LOG_RESYNC_STATS'		=> '<b>Post, topic and user stats reset</b>',
+	'LOG_RESET_DATE'			=> '<b>Board start date reset</b>',
+	'LOG_RESET_ONLINE'			=> '<b>Most users online reset</b>',
+	'LOG_RESYNC_POSTCOUNTS'		=> '<b>User postcounts synced</b>',
+	'LOG_RESYNC_POST_MARKING'	=> '<b>Dotted topics synced</b>',
+	'LOG_RESYNC_STATS'			=> '<b>Post, topic and user stats reset</b>',
 
 	'LOG_STYLE_ADD'				=> '<b>Added new style</b><br />&#187; %s',
 	'LOG_STYLE_DELETE'			=> '<b>Deleted style</b><br />&#187; %s',
diff --git a/phpBB/styles/subSilver/template/posting_preview.html b/phpBB/styles/subSilver/template/posting_preview.html
index 3e1fca3134..704d5a13f0 100644
--- a/phpBB/styles/subSilver/template/posting_preview.html
+++ b/phpBB/styles/subSilver/template/posting_preview.html
@@ -8,7 +8,7 @@
 	</tr>
 	<!-- IF S_HAS_POLL_OPTIONS -->
 	<tr>
-		<td class="row2" colspan="2"><br clear="all" />
+		<td class="row2" colspan="2" align="center"><br clear="all" />
 			<table cellspacing="0" cellpadding="4" border="0" align="center">
 			<tr>
 				<td align="center"><span class="gen"><b>{POLL_QUESTION}</b></span><br /><span class="gensmall">{L_POLL_LENGTH}</span></td>
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index f199bd888e..a4d22d3caa 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -685,21 +685,31 @@ if (!empty($topic_data['poll_start']))
 	{
 		include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
 		$poll_bbcode = new bbcode();
+	}
+	else
+	{
+		$poll_bbcode = false;
+	}
 
-		for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++)
+	for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++)
+	{
+		if ($poll_bbcode !== false)
 		{
 			$poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']);
-			$poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']);
-			$poll_info[$i]['poll_option_text'] = str_replace("\n", '<br />', censor_text($poll_info[$i]['poll_option_text']));
 		}
-
-		$poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']);
-		$poll_title = smiley_text($topic_data['poll_title']);
-		$poll_title = str_replace("\n", '<br />', censor_text($topic_data['poll_title']));
-
-		unset($poll_bbcode);
+		$poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']);
+		$poll_info[$i]['poll_option_text'] = str_replace("\n", '<br />', censor_text($poll_info[$i]['poll_option_text']));
 	}
 
+	if ($poll_bbcode !== false)
+	{
+		$poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']);
+	}
+	$topic_data['poll_title'] = smiley_text($topic_data['poll_title']);
+	$topic_data['poll_title'] = str_replace("\n", '<br />', censor_text($topic_data['poll_title']));
+
+	unset($poll_bbcode);
+
 	foreach ($poll_info as $poll_option)
 	{
 		$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;