install/convertors/convert_phpbb20.php
changeset 0 ceef6d64c21d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/install/convertors/convert_phpbb20.php	Wed Mar 07 16:41:10 2012 +0400
     1.3 @@ -0,0 +1,944 @@
     1.4 +<?php
     1.5 +/**
     1.6 +*
     1.7 +* @package install
     1.8 +* @version $Id$
     1.9 +* @copyright (c) 2006 phpBB Group
    1.10 +* @license http://opensource.org/licenses/gpl-license.php GNU Public License
    1.11 +*
    1.12 +*/
    1.13 +
    1.14 +/**
    1.15 +* NOTE to potential convertor authors. Please use this file to get
    1.16 +* familiar with the structure since we added some bare explanations here.
    1.17 +*
    1.18 +* Since this file gets included more than once on one page you are not able to add functions to it.
    1.19 +* Instead use a functions_ file.
    1.20 +*
    1.21 +* @ignore
    1.22 +*/
    1.23 +if (!defined('IN_PHPBB'))
    1.24 +{
    1.25 +	exit;
    1.26 +}
    1.27 +
    1.28 +include($phpbb_root_path . 'config.' . $phpEx);
    1.29 +unset($dbpasswd);
    1.30 +
    1.31 +/**
    1.32 +* $convertor_data provides some basic information about this convertor which is
    1.33 +* used on the initial list of convertors and to populate the default settings
    1.34 +*/
    1.35 +$convertor_data = array(
    1.36 +	'forum_name'	=> 'phpBB 2.0.x',
    1.37 +	'version'		=> '1.0.3',
    1.38 +	'phpbb_version'	=> '3.0.10',
    1.39 +	'author'		=> '<a href="http://www.phpbb.com/">phpBB Group</a>',
    1.40 +	'dbms'			=> $dbms,
    1.41 +	'dbhost'		=> $dbhost,
    1.42 +	'dbport'		=> $dbport,
    1.43 +	'dbuser'		=> $dbuser,
    1.44 +	'dbpasswd'		=> '',
    1.45 +	'dbname'		=> $dbname,
    1.46 +	'table_prefix'	=> 'phpbb_',
    1.47 +	'forum_path'	=> '../forums',
    1.48 +	'author_notes'	=> '',
    1.49 +);
    1.50 +
    1.51 +/**
    1.52 +* $tables is a list of the tables (minus prefix) which we expect to find in the
    1.53 +* source forum. It is used to guess the prefix if the specified prefix is incorrect
    1.54 +*/
    1.55 +$tables = array(
    1.56 +	'auth_access',
    1.57 +	'banlist',
    1.58 +	'categories',
    1.59 +	'disallow',
    1.60 +	'forum_prune',
    1.61 +	'forums',
    1.62 +	'groups',
    1.63 +	'posts',
    1.64 +	'posts_text',
    1.65 +	'privmsgs',
    1.66 +	'privmsgs_text',
    1.67 +	'ranks',
    1.68 +	'smilies',
    1.69 +	'topics',
    1.70 +	'topics_watch',
    1.71 +	'user_group',
    1.72 +	'users',
    1.73 +	'vote_desc',
    1.74 +	'vote_results',
    1.75 +	'vote_voters',
    1.76 +	'words'
    1.77 +);
    1.78 +
    1.79 +/**
    1.80 +* $config_schema details how the board configuration information is stored in the source forum.
    1.81 +*
    1.82 +* 'table_format' can take the value 'file' to indicate a config file. In this case array_name
    1.83 +* is set to indicate the name of the array the config values are stored in
    1.84 +* Example of using a file:
    1.85 +* $config_schema = array(
    1.86 +* 	'table_format'	=>	'file',
    1.87 +* 	'filename'	=>	'NAME OF FILE', // If the file is not in the root directory, the path needs to be added with no leading slash
    1.88 +* 	'array_name' => 'NAME OF ARRAY', // Only used if the configuration file stores the setting in an array.
    1.89 +* 	'settings'		=>	array(
    1.90 +*        'board_email' => 'SUPPORT_EMAIL', // target config name => source target name
    1.91 +* 	)
    1.92 +* );
    1.93 +* 'table_format' can be an array if the values are stored in a table which is an assosciative array
    1.94 +* (as per phpBB 2.0.x)
    1.95 +* If left empty, values are assumed to be stored in a table where each config setting is
    1.96 +* a column (as per phpBB 1.x)
    1.97 +*
    1.98 +* In either of the latter cases 'table_name' indicates the name of the table in the database
    1.99 +*
   1.100 +* 'settings' is an array which maps the name of the config directive in the source forum
   1.101 +* to the config directive in phpBB3. It can either be a direct mapping or use a function.
   1.102 +* Please note that the contents of the old config value are passed to the function, therefore
   1.103 +* an in-built function requiring the variable passed by reference is not able to be used. Since
   1.104 +* empty() is such a function we created the function is_empty() to be used instead.
   1.105 +*/
   1.106 +$config_schema = array(
   1.107 +	'table_name'	=>	'config',
   1.108 +	'table_format'	=>	array('config_name' => 'config_value'),
   1.109 +	'settings'		=>	array(
   1.110 +		'allow_bbcode'			=> 'allow_bbcode',
   1.111 +		'allow_smilies'			=> 'allow_smilies',
   1.112 +		'allow_sig'				=> 'allow_sig',
   1.113 +		'allow_namechange'		=> 'allow_namechange',
   1.114 +		'allow_avatar_local'	=> 'allow_avatar_local',
   1.115 +		'allow_avatar_remote'	=> 'allow_avatar_remote',
   1.116 +		'allow_avatar_upload'	=> 'allow_avatar_upload',
   1.117 +		'board_disable'			=> 'board_disable',
   1.118 +		'sitename'				=> 'phpbb_set_encoding(sitename)',
   1.119 +		'site_desc'				=> 'phpbb_set_encoding(site_desc)',
   1.120 +		'session_length'		=> 'session_length',
   1.121 +		'board_email_sig'		=> 'phpbb_set_encoding(board_email_sig)',
   1.122 +		'posts_per_page'		=> 'posts_per_page',
   1.123 +		'topics_per_page'		=> 'topics_per_page',
   1.124 +		'enable_confirm'		=> 'enable_confirm',
   1.125 +		'board_email_form'		=> 'board_email_form',
   1.126 +		'override_user_style'	=> 'override_user_style',
   1.127 +		'hot_threshold'			=> 'hot_threshold',
   1.128 +		'max_poll_options'		=> 'max_poll_options',
   1.129 +		'max_sig_chars'			=> 'max_sig_chars',
   1.130 +		'pm_max_msgs'			=> 'max_inbox_privmsgs',
   1.131 +		'smtp_delivery'			=> 'smtp_delivery',
   1.132 +		'smtp_host'				=> 'smtp_host',
   1.133 +		'smtp_username'			=> 'smtp_username',
   1.134 +		'smtp_password'			=> 'smtp_password',
   1.135 +		'require_activation'	=> 'require_activation',
   1.136 +		'flood_interval'		=> 'flood_interval',
   1.137 +		'avatar_filesize'		=> 'avatar_filesize',
   1.138 +		'avatar_max_width'		=> 'avatar_max_width',
   1.139 +		'avatar_max_height'		=> 'avatar_max_height',
   1.140 +		'default_dateformat'	=> 'phpbb_set_encoding(default_dateformat)',
   1.141 +		'board_timezone'		=> 'board_timezone',
   1.142 +		'allow_privmsg'			=> 'not(privmsg_disable)',
   1.143 +		'gzip_compress'			=> 'gzip_compress',
   1.144 +		'coppa_enable'			=> '!is_empty(coppa_mail)',
   1.145 +		'coppa_fax'				=> 'coppa_fax',
   1.146 +		'coppa_mail'			=> 'coppa_mail',
   1.147 +		'record_online_users'	=> 'record_online_users',
   1.148 +		'record_online_date'	=> 'record_online_date',
   1.149 +		'board_startdate'		=> 'board_startdate',
   1.150 +	)
   1.151 +);
   1.152 +
   1.153 +/**
   1.154 +* $test_file is the name of a file which is present on the source
   1.155 +* forum which can be used to check that the path specified by the
   1.156 +* user was correct
   1.157 +*/
   1.158 +$test_file = 'modcp.php';
   1.159 +
   1.160 +/**
   1.161 +* If this is set then we are not generating the first page of information but getting the conversion information.
   1.162 +*/
   1.163 +if (!$get_info)
   1.164 +{
   1.165 +	// Test to see if the birthday MOD is installed on the source forum
   1.166 +	// Niels' birthday mod
   1.167 +	if (get_config_value('birthday_required') !== false || get_config_value('bday_require') !== false)
   1.168 +	{
   1.169 +		define('MOD_BIRTHDAY', true);
   1.170 +	}
   1.171 +
   1.172 +	// TerraFrost's validated birthday mod
   1.173 +	if (get_config_value('bday_require') !== false)
   1.174 +	{
   1.175 +		define('MOD_BIRTHDAY_TERRA', true);
   1.176 +	}
   1.177 +
   1.178 +	// Test to see if the attachment MOD is installed on the source forum
   1.179 +	// If it is, we will convert this data as well
   1.180 +	$src_db->sql_return_on_error(true);
   1.181 +
   1.182 +	$sql = "SELECT config_value
   1.183 +		FROM {$convert->src_table_prefix}attachments_config
   1.184 +		WHERE config_name = 'upload_dir'";
   1.185 +	$result = $src_db->sql_query($sql);
   1.186 +
   1.187 +	if ($result && $row = $src_db->sql_fetchrow($result))
   1.188 +	{
   1.189 +		// Here the constant is defined
   1.190 +		define('MOD_ATTACHMENT', true);
   1.191 +
   1.192 +		// Here i add more tables to be checked in the old forum
   1.193 +		$tables += array(
   1.194 +			'attachments',
   1.195 +			'attachments_desc',
   1.196 +			'extensions',
   1.197 +			'extension_groups'
   1.198 +		);
   1.199 +
   1.200 +		$src_db->sql_freeresult($result);
   1.201 +	}
   1.202 +	else if ($result)
   1.203 +	{
   1.204 +		$src_db->sql_freeresult($result);
   1.205 +	}
   1.206 +
   1.207 +
   1.208 +	/**
   1.209 +	* Tests for further MODs can be included here.
   1.210 +	* Please use constants for this, prefixing them with MOD_
   1.211 +	*/
   1.212 +
   1.213 +	$src_db->sql_return_on_error(false);
   1.214 +
   1.215 +	// Now let us set a temporary config variable for user id incrementing
   1.216 +	$sql = "SELECT user_id
   1.217 +		FROM {$convert->src_table_prefix}users
   1.218 +		WHERE user_id = 1";
   1.219 +	$result = $src_db->sql_query($sql);
   1.220 +	$user_id = (int) $src_db->sql_fetchfield('user_id');
   1.221 +	$src_db->sql_freeresult($result);
   1.222 +
   1.223 +	// If there is a user id 1, we need to increment user ids. :/
   1.224 +	if ($user_id === 1)
   1.225 +	{
   1.226 +		// Try to get the maximum user id possible...
   1.227 +		$sql = "SELECT MAX(user_id) AS max_user_id
   1.228 +			FROM {$convert->src_table_prefix}users";
   1.229 +		$result = $src_db->sql_query($sql);
   1.230 +		$user_id = (int) $src_db->sql_fetchfield('max_user_id');
   1.231 +		$src_db->sql_freeresult($result);
   1.232 +
   1.233 +		set_config('increment_user_id', ($user_id + 1), true);
   1.234 +	}
   1.235 +	else
   1.236 +	{
   1.237 +		set_config('increment_user_id', 0, true);
   1.238 +	}
   1.239 +
   1.240 +	// Overwrite maximum avatar width/height
   1.241 +	@define('DEFAULT_AVATAR_X_CUSTOM', get_config_value('avatar_max_width'));
   1.242 +	@define('DEFAULT_AVATAR_Y_CUSTOM', get_config_value('avatar_max_height'));
   1.243 +
   1.244 +	// additional table used only during conversion
   1.245 +	@define('USERCONV_TABLE', $table_prefix . 'userconv');
   1.246 +
   1.247 +/**
   1.248 +*	Description on how to use the convertor framework.
   1.249 +*
   1.250 +*	'schema' Syntax Description
   1.251 +*		-> 'target'			=> Target Table. If not specified the next table will be handled
   1.252 +*		-> 'primary'		=> Primary Key. If this is specified then this table is processed in batches
   1.253 +*		-> 'query_first'	=> array('target' or 'src', Query to execute before beginning the process
   1.254 +*								(if more than one then specified as array))
   1.255 +*		-> 'function_first'	=> Function to execute before beginning the process (if more than one then specified as array)
   1.256 +*								(This is mostly useful if variables need to be given to the converting process)
   1.257 +*		-> 'test_file'		=> This is not used at the moment but should be filled with a file from the old installation
   1.258 +*
   1.259 +*		// DB Functions
   1.260 +*		'distinct'	=> Add DISTINCT to the select query
   1.261 +*		'where'		=> Add WHERE to the select query
   1.262 +*		'group_by'	=> Add GROUP BY to the select query
   1.263 +*		'left_join'	=> Add LEFT JOIN to the select query (if more than one joins specified as array)
   1.264 +*		'having'	=> Add HAVING to the select query
   1.265 +*
   1.266 +*		// DB INSERT array
   1.267 +*		This one consist of three parameters
   1.268 +*		First Parameter:
   1.269 +*							The key need to be filled within the target table
   1.270 +*							If this is empty, the target table gets not assigned the source value
   1.271 +*		Second Parameter:
   1.272 +*							Source value. If the first parameter is specified, it will be assigned this value.
   1.273 +*							If the first parameter is empty, this only gets added to the select query
   1.274 +*		Third Parameter:
   1.275 +*							Custom Function. Function to execute while storing source value into target table.
   1.276 +*							The functions return value get stored.
   1.277 +*							The function parameter consist of the value of the second parameter.
   1.278 +*
   1.279 +*							types:
   1.280 +*								- empty string == execute nothing
   1.281 +*								- string == function to execute
   1.282 +*								- array == complex execution instructions
   1.283 +*
   1.284 +*		Complex execution instructions:
   1.285 +*		@todo test complex execution instructions - in theory they will work fine
   1.286 +*
   1.287 +*							By defining an array as the third parameter you are able to define some statements to be executed. The key
   1.288 +*							is defining what to execute, numbers can be appended...
   1.289 +*
   1.290 +*							'function' => execute function
   1.291 +*							'execute' => run code, whereby all occurrences of {VALUE} get replaced by the last returned value.
   1.292 +*										The result *must* be assigned/stored to {RESULT}.
   1.293 +*							'typecast'	=> typecast value
   1.294 +*
   1.295 +*							The returned variables will be made always available to the next function to continue to work with.
   1.296 +*
   1.297 +*							example (variable inputted is an integer of 1):
   1.298 +*
   1.299 +*							array(
   1.300 +*								'function1'		=> 'increment_by_one',		// returned variable is 2
   1.301 +*								'typecast'		=> 'string',				// typecast variable to be a string
   1.302 +*								'execute'		=> '{RESULT} = {VALUE} . ' is good';', // returned variable is '2 is good'
   1.303 +*								'function2'		=> 'replace_good_with_bad',				// returned variable is '2 is bad'
   1.304 +*							),
   1.305 +*
   1.306 +*/
   1.307 +
   1.308 +	$convertor = array(
   1.309 +		'test_file'				=> 'viewtopic.php',
   1.310 +
   1.311 +		'avatar_path'			=> get_config_value('avatar_path') . '/',
   1.312 +		'avatar_gallery_path'	=> get_config_value('avatar_gallery_path') . '/',
   1.313 +		'smilies_path'			=> get_config_value('smilies_path') . '/',
   1.314 +		'upload_path'			=> (defined('MOD_ATTACHMENT')) ? phpbb_get_files_dir() . '/' : '',
   1.315 +		'thumbnails'			=> (defined('MOD_ATTACHMENT')) ? array('thumbs/', 't_') : '',
   1.316 +		'ranks_path'			=> false, // phpBB 2.0.x had no config value for a ranks path
   1.317 +
   1.318 +		// We empty some tables to have clean data available
   1.319 +		'query_first'			=> array(
   1.320 +			array('target', $convert->truncate_statement . SEARCH_RESULTS_TABLE),
   1.321 +			array('target', $convert->truncate_statement . SEARCH_WORDLIST_TABLE),
   1.322 +			array('target', $convert->truncate_statement . SEARCH_WORDMATCH_TABLE),
   1.323 +			array('target', $convert->truncate_statement . LOG_TABLE),
   1.324 +		),
   1.325 +
   1.326 +//	with this you are able to import all attachment files on the fly. For large boards this is not an option, therefore commented out by default.
   1.327 +//	Instead every file gets copied while processing the corresponding attachment entry.
   1.328 +//		if (defined("MOD_ATTACHMENT")) { import_attachment_files(); phpbb_copy_thumbnails(); }
   1.329 +
   1.330 +		// phpBB2 allowed some similar usernames to coexist which would have the same
   1.331 +		// username_clean in phpBB3 which is not possible, so we'll give the admin a list
   1.332 +		// of user ids and usernames and let him deicde what he wants to do with them
   1.333 +		'execute_first'	=> '
   1.334 +			phpbb_create_userconv_table();
   1.335 +			import_avatar_gallery();
   1.336 +			if (defined("MOD_ATTACHMENT")) phpbb_import_attach_config();
   1.337 +			phpbb_insert_forums();
   1.338 +		',
   1.339 +
   1.340 +		'execute_last'	=> array('
   1.341 +			add_bots();
   1.342 +		', '
   1.343 +			update_folder_pm_count();
   1.344 +		', '
   1.345 +			update_unread_count();
   1.346 +		', '
   1.347 +			phpbb_convert_authentication(\'start\');
   1.348 +		', '
   1.349 +			phpbb_convert_authentication(\'first\');
   1.350 +		', '
   1.351 +			phpbb_convert_authentication(\'second\');
   1.352 +		', '
   1.353 +			phpbb_convert_authentication(\'third\');
   1.354 +		'),
   1.355 +
   1.356 +		'schema' => array(
   1.357 +			array(
   1.358 +				'target'	=> USERCONV_TABLE,
   1.359 +				'query_first'   => array('target', $convert->truncate_statement . USERCONV_TABLE),
   1.360 +
   1.361 +
   1.362 +				array('user_id',			'users.user_id', 	''),
   1.363 +				array('username_clean',		'users.username',	array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_clean_string')),
   1.364 +			),
   1.365 +
   1.366 +			array(
   1.367 +				'target'		=> (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
   1.368 +				'primary'		=> 'attachments.attach_id',
   1.369 +				'query_first'	=> (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . ATTACHMENTS_TABLE) : '',
   1.370 +				'autoincrement'	=> 'attach_id',
   1.371 +
   1.372 +				array('attach_id',				'attachments.attach_id',				''),
   1.373 +				array('post_msg_id',			'attachments.post_id',					''),
   1.374 +				array('topic_id',				'posts.topic_id',						''),
   1.375 +				array('in_message',				0,										''),
   1.376 +				array('is_orphan',				0,										''),
   1.377 +				array('poster_id',				'attachments.user_id_1 AS poster_id',	'phpbb_user_id'),
   1.378 +				array('physical_filename',		'attachments_desc.physical_filename',	'import_attachment'),
   1.379 +				array('real_filename',			'attachments_desc.real_filename',		'phpbb_set_encoding'),
   1.380 +				array('download_count',			'attachments_desc.download_count',		''),
   1.381 +				array('attach_comment',			'attachments_desc.comment',				array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
   1.382 +				array('extension',				'attachments_desc.extension',			''),
   1.383 +				array('mimetype',				'attachments_desc.mimetype',			''),
   1.384 +				array('filesize',				'attachments_desc.filesize',			''),
   1.385 +				array('filetime',				'attachments_desc.filetime',			''),
   1.386 +				array('thumbnail',				'attachments_desc.thumbnail',			''),
   1.387 +
   1.388 +				'where'			=> 'attachments_desc.attach_id = attachments.attach_id AND attachments.privmsgs_id = 0 AND posts.post_id = attachments.post_id',
   1.389 +				'group_by'		=> 'attachments.attach_id'
   1.390 +			),
   1.391 +
   1.392 +			array(
   1.393 +				'target'		=> (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
   1.394 +				'primary'		=> 'attachments.attach_id',
   1.395 +				'autoincrement'	=> 'attach_id',
   1.396 +
   1.397 +				array('attach_id',				'attachments.attach_id',				''),
   1.398 +				array('post_msg_id',			'attachments.privmsgs_id',				''),
   1.399 +				array('topic_id',				0,										''),
   1.400 +				array('in_message',				1,										''),
   1.401 +				array('is_orphan',				0,										''),
   1.402 +				array('poster_id',				'attachments.user_id_1 AS poster_id',	'phpbb_user_id'),
   1.403 +				array('physical_filename',		'attachments_desc.physical_filename',	'import_attachment'),
   1.404 +				array('real_filename',			'attachments_desc.real_filename',		''),
   1.405 +				array('download_count',			'attachments_desc.download_count',		''),
   1.406 +				array('attach_comment',			'attachments_desc.comment',				array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
   1.407 +				array('extension',				'attachments_desc.extension',			''),
   1.408 +				array('mimetype',				'attachments_desc.mimetype',			''),
   1.409 +				array('filesize',				'attachments_desc.filesize',			''),
   1.410 +				array('filetime',				'attachments_desc.filetime',			''),
   1.411 +				array('thumbnail',				'attachments_desc.thumbnail',			''),
   1.412 +
   1.413 +				'where'			=> 'attachments_desc.attach_id = attachments.attach_id AND attachments.post_id = 0',
   1.414 +				'group_by'		=> 'attachments.attach_id'
   1.415 +			),
   1.416 +
   1.417 +			array(
   1.418 +				'target'		=> (defined('MOD_ATTACHMENT')) ? EXTENSIONS_TABLE : '',
   1.419 +				'query_first'	=> (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSIONS_TABLE) : '',
   1.420 +				'autoincrement'	=> 'extension_id',
   1.421 +
   1.422 +				array('extension_id',			'extensions.ext_id',				''),
   1.423 +				array('group_id',				'extensions.group_id',				''),
   1.424 +				array('extension',				'extensions.extension',				''),
   1.425 +			),
   1.426 +
   1.427 +			array(
   1.428 +				'target'		=> (defined('MOD_ATTACHMENT')) ? EXTENSION_GROUPS_TABLE : '',
   1.429 +				'query_first'	=> (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSION_GROUPS_TABLE) : '',
   1.430 +				'autoincrement'	=> 'group_id',
   1.431 +
   1.432 +				array('group_id',				'extension_groups.group_id',			''),
   1.433 +				array('group_name',				'extension_groups.group_name',			array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
   1.434 +				array('cat_id',					'extension_groups.cat_id',				'phpbb_attachment_category'),
   1.435 +				array('allow_group',			'extension_groups.allow_group',			''),
   1.436 +				array('download_mode',			1,										''),
   1.437 +				array('upload_icon',			'',										''),
   1.438 +				array('max_filesize',			'extension_groups.max_filesize',		''),
   1.439 +				array('allowed_forums',			'extension_groups.forum_permissions',	'phpbb_attachment_forum_perms'),
   1.440 +				array('allow_in_pm',			1,										''),
   1.441 +			),
   1.442 +
   1.443 +			array(
   1.444 +				'target'		=> BANLIST_TABLE,
   1.445 +				'execute_first'	=> 'phpbb_check_username_collisions();',
   1.446 +				'query_first'	=> array('target', $convert->truncate_statement . BANLIST_TABLE),
   1.447 +
   1.448 +				array('ban_ip',					'banlist.ban_ip',					'decode_ban_ip'),
   1.449 +				array('ban_userid',				'banlist.ban_userid',				'phpbb_user_id'),
   1.450 +				array('ban_email',				'banlist.ban_email',				''),
   1.451 +				array('ban_reason',				'',									''),
   1.452 +				array('ban_give_reason',		'',									''),
   1.453 +
   1.454 +				'where'			=> "banlist.ban_ip NOT LIKE '%.%'",
   1.455 +			),
   1.456 +
   1.457 +			array(
   1.458 +				'target'		=> BANLIST_TABLE,
   1.459 +
   1.460 +				array('ban_ip',					'banlist.ban_ip',	''),
   1.461 +				array('ban_userid',				0,					''),
   1.462 +				array('ban_email',				'',					''),
   1.463 +				array('ban_reason',				'',					''),
   1.464 +				array('ban_give_reason',		'',					''),
   1.465 +
   1.466 +				'where'			=> "banlist.ban_ip LIKE '%.%'",
   1.467 +			),
   1.468 +
   1.469 +			array(
   1.470 +				'target'		=> DISALLOW_TABLE,
   1.471 +				'query_first'	=> array('target', $convert->truncate_statement . DISALLOW_TABLE),
   1.472 +
   1.473 +				array('disallow_username',		'disallow.disallow_username',				'phpbb_disallowed_username'),
   1.474 +			),
   1.475 +
   1.476 +			array(
   1.477 +				'target'		=> RANKS_TABLE,
   1.478 +				'query_first'	=> array('target', $convert->truncate_statement . RANKS_TABLE),
   1.479 +				'autoincrement'	=> 'rank_id',
   1.480 +
   1.481 +				array('rank_id',					'ranks.rank_id',				''),
   1.482 +				array('rank_title',					'ranks.rank_title',				array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_htmlspecialchars')),
   1.483 +				array('rank_min',					'ranks.rank_min',				array('typecast' => 'int', 'execute' => '{RESULT} = ({VALUE}[0] < 0) ? 0 : {VALUE}[0];')),
   1.484 +				array('rank_special',				'ranks.rank_special',			''),
   1.485 +				array('rank_image',					'ranks.rank_image',				'import_rank'),
   1.486 +			),
   1.487 +
   1.488 +			array(
   1.489 +				'target'		=> TOPICS_TABLE,
   1.490 +				'query_first'	=> array('target', $convert->truncate_statement . TOPICS_TABLE),
   1.491 +				'primary'		=> 'topics.topic_id',
   1.492 +				'autoincrement'	=> 'topic_id',
   1.493 +
   1.494 +				array('topic_id',				'topics.topic_id',					''),
   1.495 +				array('forum_id',				'topics.forum_id',					''),
   1.496 +				array('icon_id',				0,									''),
   1.497 +				array('topic_poster',			'topics.topic_poster AS poster_id',	'phpbb_user_id'),
   1.498 +				array('topic_attachment',		((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
   1.499 +				array('topic_title',			'topics.topic_title',				'phpbb_set_encoding'),
   1.500 +				array('topic_time',				'topics.topic_time',				''),
   1.501 +				array('topic_views',			'topics.topic_views',				''),
   1.502 +				array('topic_replies',			'topics.topic_replies',				''),
   1.503 +				array('topic_replies_real',		'topics.topic_replies',				''),
   1.504 +				array('topic_last_post_id',		'topics.topic_last_post_id',		''),
   1.505 +				array('topic_status',			'topics.topic_status',				'is_topic_locked'),
   1.506 +				array('topic_moved_id',			0,									''),
   1.507 +				array('topic_type',				'topics.topic_type',				'phpbb_convert_topic_type'),
   1.508 +				array('topic_first_post_id',	'topics.topic_first_post_id',		''),
   1.509 +				array('topic_last_view_time',	'posts.post_time',					'intval'),
   1.510 +				array('poll_title',				'vote_desc.vote_text',				array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'htmlspecialchars_decode', 'function4' => 'utf8_htmlspecialchars')),
   1.511 +				array('poll_start',				'vote_desc.vote_start',				'null_to_zero'),
   1.512 +				array('poll_length',			'vote_desc.vote_length',			'null_to_zero'),
   1.513 +				array('poll_max_options',		1,									''),
   1.514 +				array('poll_vote_change',		0,									''),
   1.515 +
   1.516 +				'left_join'		=>	array (	'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
   1.517 +											'topics LEFT JOIN posts ON topics.topic_last_post_id = posts.post_id',
   1.518 +									),
   1.519 +				'where'			=> 'topics.topic_moved_id = 0',
   1.520 +			),
   1.521 +
   1.522 +			array(
   1.523 +				'target'		=> TOPICS_TABLE,
   1.524 +				'primary'		=> 'topics.topic_id',
   1.525 +				'autoincrement'	=> 'topic_id',
   1.526 +
   1.527 +				array('topic_id',				'topics.topic_id',					''),
   1.528 +				array('forum_id',				'topics.forum_id',					''),
   1.529 +				array('icon_id',				0,									''),
   1.530 +				array('topic_poster',			'topics.topic_poster AS poster_id',	'phpbb_user_id'),
   1.531 +				array('topic_attachment',		((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
   1.532 +				array('topic_title',			'topics.topic_title',				'phpbb_set_encoding'),
   1.533 +				array('topic_time',				'topics.topic_time',				''),
   1.534 +				array('topic_views',			'topics.topic_views',				''),
   1.535 +				array('topic_replies',			'topics.topic_replies',				''),
   1.536 +				array('topic_replies_real',		'topics.topic_replies',				''),
   1.537 +				array('topic_last_post_id',		'topics.topic_last_post_id',		''),
   1.538 +				array('topic_status',			ITEM_MOVED,							''),
   1.539 +				array('topic_moved_id',			'topics.topic_moved_id',			''),
   1.540 +				array('topic_type',				'topics.topic_type',				'phpbb_convert_topic_type'),
   1.541 +				array('topic_first_post_id',	'topics.topic_first_post_id',		''),
   1.542 +
   1.543 +				array('poll_title',				'vote_desc.vote_text',				array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'htmlspecialchars_decode', 'function4' => 'utf8_htmlspecialchars')),
   1.544 +				array('poll_start',				'vote_desc.vote_start',				'null_to_zero'),
   1.545 +				array('poll_length',			'vote_desc.vote_length',			'null_to_zero'),
   1.546 +				array('poll_max_options',		1,									''),
   1.547 +				array('poll_vote_change',		0,									''),
   1.548 +
   1.549 +				'left_join'		=> 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
   1.550 +				'where'			=> 'topics.topic_moved_id <> 0',
   1.551 +			),
   1.552 +
   1.553 +			array(
   1.554 +				'target'		=> TOPICS_WATCH_TABLE,
   1.555 +				'primary'		=> 'topics_watch.topic_id',
   1.556 +				'query_first'	=> array('target', $convert->truncate_statement . TOPICS_WATCH_TABLE),
   1.557 +
   1.558 +				array('topic_id',				'topics_watch.topic_id',			''),
   1.559 +				array('user_id',				'topics_watch.user_id',				'phpbb_user_id'),
   1.560 +				array('notify_status',			'topics_watch.notify_status',		''),
   1.561 +			),
   1.562 +
   1.563 +			array(
   1.564 +				'target'		=> SMILIES_TABLE,
   1.565 +				'query_first'	=> array('target', $convert->truncate_statement . SMILIES_TABLE),
   1.566 +				'autoincrement'	=> 'smiley_id',
   1.567 +
   1.568 +				array('smiley_id',				'smilies.smilies_id',				''),
   1.569 +				array('code',					'smilies.code',						array('function1' => 'phpbb_smilie_html_decode', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
   1.570 +				array('emotion',				'smilies.emoticon',					'phpbb_set_encoding'),
   1.571 +				array('smiley_url',				'smilies.smile_url',				'import_smiley'),
   1.572 +				array('smiley_width',			'smilies.smile_url',				'get_smiley_width'),
   1.573 +				array('smiley_height',			'smilies.smile_url',				'get_smiley_height'),
   1.574 +				array('smiley_order',			'smilies.smilies_id',				''),
   1.575 +				array('display_on_posting',		'smilies.smilies_id',				'get_smiley_display'),
   1.576 +
   1.577 +				'order_by'		=> 'smilies.smilies_id ASC',
   1.578 +			),
   1.579 +
   1.580 +			array(
   1.581 +				'target'		=> POLL_OPTIONS_TABLE,
   1.582 +				'primary'		=> 'vote_results.vote_option_id',
   1.583 +				'query_first'	=> array('target', $convert->truncate_statement . POLL_OPTIONS_TABLE),
   1.584 +
   1.585 +				array('poll_option_id',			'vote_results.vote_option_id',		''),
   1.586 +				array('topic_id',				'vote_desc.topic_id',				''),
   1.587 +				array('',						'topics.topic_poster AS poster_id',	'phpbb_user_id'),
   1.588 +				array('poll_option_text',		'vote_results.vote_option_text',	array('function1' => 'phpbb_set_encoding', 'function2' => 'htmlspecialchars_decode', 'function3' => 'utf8_htmlspecialchars')),
   1.589 +				array('poll_option_total',		'vote_results.vote_result',			''),
   1.590 +
   1.591 +				'where'			=> 'vote_results.vote_id = vote_desc.vote_id',
   1.592 +				'left_join'		=> 'vote_desc LEFT JOIN topics ON topics.topic_id = vote_desc.topic_id',
   1.593 +			),
   1.594 +
   1.595 +			array(
   1.596 +				'target'		=> POLL_VOTES_TABLE,
   1.597 +				'primary'		=> 'vote_desc.topic_id',
   1.598 +				'query_first'	=> array('target', $convert->truncate_statement . POLL_VOTES_TABLE),
   1.599 +
   1.600 +				array('poll_option_id',			VOTE_CONVERTED,						''),
   1.601 +				array('topic_id',				'vote_desc.topic_id',				''),
   1.602 +				array('vote_user_id',			'vote_voters.vote_user_id',			'phpbb_user_id'),
   1.603 +				array('vote_user_ip',			'vote_voters.vote_user_ip',			'decode_ip'),
   1.604 +
   1.605 +				'where'			=> 'vote_voters.vote_id = vote_desc.vote_id',
   1.606 +			),
   1.607 +
   1.608 +			array(
   1.609 +				'target'		=> WORDS_TABLE,
   1.610 +				'primary'		=> 'words.word_id',
   1.611 +				'query_first'	=> array('target', $convert->truncate_statement . WORDS_TABLE),
   1.612 +				'autoincrement'	=> 'word_id',
   1.613 +
   1.614 +				array('word_id',				'words.word_id',					''),
   1.615 +				array('word',					'words.word',						'phpbb_set_encoding'),
   1.616 +				array('replacement',			'words.replacement',				'phpbb_set_encoding'),
   1.617 +			),
   1.618 +
   1.619 +			array(
   1.620 +				'target'		=> POSTS_TABLE,
   1.621 +				'primary'		=> 'posts.post_id',
   1.622 +				'autoincrement'	=> 'post_id',
   1.623 +				'query_first'	=> array('target', $convert->truncate_statement . POSTS_TABLE),
   1.624 +				'execute_first'	=> '
   1.625 +					$config["max_post_chars"] = 0;
   1.626 +					$config["min_post_chars"] = 0;
   1.627 +					$config["max_quote_depth"] = 0;
   1.628 +				',
   1.629 +
   1.630 +				array('post_id',				'posts.post_id',					''),
   1.631 +				array('topic_id',				'posts.topic_id',					''),
   1.632 +				array('forum_id',				'posts.forum_id',					''),
   1.633 +				array('poster_id',				'posts.poster_id',					'phpbb_user_id'),
   1.634 +				array('icon_id',				0,									''),
   1.635 +				array('poster_ip',				'posts.poster_ip',					'decode_ip'),
   1.636 +				array('post_time',				'posts.post_time',					''),
   1.637 +				array('enable_bbcode',			'posts.enable_bbcode',				''),
   1.638 +				array('',						'posts.enable_html',				''),
   1.639 +				array('enable_smilies',			'posts.enable_smilies',				''),
   1.640 +				array('enable_sig',				'posts.enable_sig',					''),
   1.641 +				array('enable_magic_url',		1,									''),
   1.642 +				array('post_username',			'posts.post_username',				'phpbb_set_encoding'),
   1.643 +				array('post_subject',			'posts_text.post_subject',			'phpbb_set_encoding'),
   1.644 +				array('post_attachment',		((defined('MOD_ATTACHMENT')) ? 'posts.post_attachment' : 0), ''),
   1.645 +				array('post_edit_time',			'posts.post_edit_time',				array('typecast' => 'int')),
   1.646 +				array('post_edit_count',		'posts.post_edit_count',			''),
   1.647 +				array('post_edit_reason',		'',									''),
   1.648 +				array('post_edit_user',			'',									'phpbb_post_edit_user'),
   1.649 +
   1.650 +				array('bbcode_uid',				'posts.post_time',					'make_uid'),
   1.651 +				array('post_text',				'posts_text.post_text',				'phpbb_prepare_message'),
   1.652 +				array('',						'posts_text.bbcode_uid AS old_bbcode_uid',			''),
   1.653 +				array('bbcode_bitfield',		'',									'get_bbcode_bitfield'),
   1.654 +				array('post_checksum',			'',									''),
   1.655 +
   1.656 +				// Commented out inline search indexing, this takes up a LOT of time. :D
   1.657 +				// @todo We either need to enable this or call the rebuild search functionality post convert
   1.658 +/*				array('',						'',									'search_indexing'),
   1.659 +				array('',						'posts_text.post_text AS message',	''),
   1.660 +				array('',						'posts_text.post_subject AS title',	''),*/
   1.661 +
   1.662 +				'where'			=>	'posts.post_id = posts_text.post_id'
   1.663 +			),
   1.664 +
   1.665 +			array(
   1.666 +				'target'		=> PRIVMSGS_TABLE,
   1.667 +				'primary'		=> 'privmsgs.privmsgs_id',
   1.668 +				'autoincrement'	=> 'msg_id',
   1.669 +				'query_first'	=> array(
   1.670 +					array('target', $convert->truncate_statement . PRIVMSGS_TABLE),
   1.671 +					array('target', $convert->truncate_statement . PRIVMSGS_RULES_TABLE),
   1.672 +				),
   1.673 +
   1.674 +				'execute_first'	=> '
   1.675 +					$config["max_post_chars"] = 0;
   1.676 +					$config["min_post_chars"] = 0;
   1.677 +					$config["max_quote_depth"] = 0;
   1.678 +				',
   1.679 +
   1.680 +				array('msg_id',					'privmsgs.privmsgs_id',				''),
   1.681 +				array('root_level',				0,									''),
   1.682 +				array('author_id',				'privmsgs.privmsgs_from_userid AS poster_id',	'phpbb_user_id'),
   1.683 +				array('icon_id',				0,									''),
   1.684 +				array('author_ip',				'privmsgs.privmsgs_ip',				'decode_ip'),
   1.685 +				array('message_time',			'privmsgs.privmsgs_date',			''),
   1.686 +				array('enable_bbcode',			'privmsgs.privmsgs_enable_bbcode AS enable_bbcode',	''),
   1.687 +				array('',						'privmsgs.privmsgs_enable_html AS enable_html',	''),
   1.688 +				array('enable_smilies',			'privmsgs.privmsgs_enable_smilies AS enable_smilies',	''),
   1.689 +				array('enable_magic_url',		1,									''),
   1.690 +				array('enable_sig',				'privmsgs.privmsgs_attach_sig',		''),
   1.691 +				array('message_subject',		'privmsgs.privmsgs_subject',		'phpbb_set_encoding'), // Already specialchared in 2.0.x
   1.692 +				array('message_attachment',		((defined('MOD_ATTACHMENT')) ? 'privmsgs.privmsgs_attachment' : 0), ''),
   1.693 +				array('message_edit_reason',	'',									''),
   1.694 +				array('message_edit_user',		0,									''),
   1.695 +				array('message_edit_time',		0,									''),
   1.696 +				array('message_edit_count',		0,									''),
   1.697 +
   1.698 +				array('bbcode_uid',				'privmsgs.privmsgs_date AS post_time',	'make_uid'),
   1.699 +				array('message_text',			'privmsgs_text.privmsgs_text',			'phpbb_prepare_message'),
   1.700 +				array('',						'privmsgs_text.privmsgs_bbcode_uid AS old_bbcode_uid',			''),
   1.701 +				array('bbcode_bitfield',		'',										'get_bbcode_bitfield'),
   1.702 +				array('to_address',				'privmsgs.privmsgs_to_userid',			'phpbb_privmsgs_to_userid'),
   1.703 +				array('bcc_address',			'',										''),
   1.704 +
   1.705 +				'where'			=>	'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id'
   1.706 +			),
   1.707 +
   1.708 +			array(
   1.709 +				'target'		=> PRIVMSGS_FOLDER_TABLE,
   1.710 +				'primary'		=> 'users.user_id',
   1.711 +				'query_first'	=> array('target', $convert->truncate_statement . PRIVMSGS_FOLDER_TABLE),
   1.712 +
   1.713 +				array('user_id',				'users.user_id',						'phpbb_user_id'),
   1.714 +				array('folder_name',			$user->lang['CONV_SAVED_MESSAGES'],		''),
   1.715 +				array('pm_count',				0,										''),
   1.716 +
   1.717 +				'where'			=> 'users.user_id <> -1',
   1.718 +			),
   1.719 +
   1.720 +			// Inbox
   1.721 +			array(
   1.722 +				'target'		=> PRIVMSGS_TO_TABLE,
   1.723 +				'primary'		=> 'privmsgs.privmsgs_id',
   1.724 +				'query_first'	=> array('target', $convert->truncate_statement . PRIVMSGS_TO_TABLE),
   1.725 +
   1.726 +				array('msg_id',					'privmsgs.privmsgs_id',					''),
   1.727 +				array('user_id',				'privmsgs.privmsgs_to_userid',			'phpbb_user_id'),
   1.728 +				array('author_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.729 +				array('pm_deleted',				0,										''),
   1.730 +				array('pm_new',					'privmsgs.privmsgs_type',				'phpbb_new_pm'),
   1.731 +				array('pm_unread',				'privmsgs.privmsgs_type',				'phpbb_unread_pm'),
   1.732 +				array('pm_replied',				0,										''),
   1.733 +				array('pm_marked',				0,										''),
   1.734 +				array('pm_forwarded',			0,										''),
   1.735 +				array('folder_id',				PRIVMSGS_INBOX,							''),
   1.736 +
   1.737 +				'where'			=> 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
   1.738 +										AND (privmsgs.privmsgs_type = 0 OR privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
   1.739 +			),
   1.740 +
   1.741 +			// Outbox
   1.742 +			array(
   1.743 +				'target'		=> PRIVMSGS_TO_TABLE,
   1.744 +				'primary'		=> 'privmsgs.privmsgs_id',
   1.745 +
   1.746 +				array('msg_id',					'privmsgs.privmsgs_id',					''),
   1.747 +				array('user_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.748 +				array('author_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.749 +				array('pm_deleted',				0,										''),
   1.750 +				array('pm_new',					0,										''),
   1.751 +				array('pm_unread',				0,										''),
   1.752 +				array('pm_replied',				0,										''),
   1.753 +				array('pm_marked',				0,										''),
   1.754 +				array('pm_forwarded',			0,										''),
   1.755 +				array('folder_id',				PRIVMSGS_OUTBOX,						''),
   1.756 +
   1.757 +				'where'			=> 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
   1.758 +										AND (privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
   1.759 +			),
   1.760 +
   1.761 +			// Sentbox
   1.762 +			array(
   1.763 +				'target'		=> PRIVMSGS_TO_TABLE,
   1.764 +				'primary'		=> 'privmsgs.privmsgs_id',
   1.765 +
   1.766 +				array('msg_id',					'privmsgs.privmsgs_id',					''),
   1.767 +				array('user_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.768 +				array('author_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.769 +				array('pm_deleted',				0,										''),
   1.770 +				array('pm_new',					'privmsgs.privmsgs_type',				'phpbb_new_pm'),
   1.771 +				array('pm_unread',				'privmsgs.privmsgs_type',				'phpbb_unread_pm'),
   1.772 +				array('pm_replied',				0,										''),
   1.773 +				array('pm_marked',				0,										''),
   1.774 +				array('pm_forwarded',			0,										''),
   1.775 +				array('folder_id',				PRIVMSGS_SENTBOX,						''),
   1.776 +
   1.777 +				'where'			=> 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
   1.778 +										AND privmsgs.privmsgs_type = 2',
   1.779 +			),
   1.780 +
   1.781 +			// Savebox (SAVED IN)
   1.782 +			array(
   1.783 +				'target'		=> PRIVMSGS_TO_TABLE,
   1.784 +				'primary'		=> 'privmsgs.privmsgs_id',
   1.785 +
   1.786 +				array('msg_id',					'privmsgs.privmsgs_id',					''),
   1.787 +				array('user_id',				'privmsgs.privmsgs_to_userid',			'phpbb_user_id'),
   1.788 +				array('author_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.789 +				array('pm_deleted',				0,										''),
   1.790 +				array('pm_new',					'privmsgs.privmsgs_type',				'phpbb_new_pm'),
   1.791 +				array('pm_unread',				'privmsgs.privmsgs_type',				'phpbb_unread_pm'),
   1.792 +				array('pm_replied',				0,										''),
   1.793 +				array('pm_marked',				0,										''),
   1.794 +				array('pm_forwarded',			0,										''),
   1.795 +				array('folder_id',				'privmsgs.privmsgs_to_userid',			'phpbb_get_savebox_id'),
   1.796 +
   1.797 +				'where'			=> 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
   1.798 +										AND privmsgs.privmsgs_type = 3',
   1.799 +			),
   1.800 +
   1.801 +			// Savebox (SAVED OUT)
   1.802 +			array(
   1.803 +				'target'		=> PRIVMSGS_TO_TABLE,
   1.804 +				'primary'		=> 'privmsgs.privmsgs_id',
   1.805 +
   1.806 +				array('msg_id',					'privmsgs.privmsgs_id',					''),
   1.807 +				array('user_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.808 +				array('author_id',				'privmsgs.privmsgs_from_userid',		'phpbb_user_id'),
   1.809 +				array('pm_deleted',				0,										''),
   1.810 +				array('pm_new',					'privmsgs.privmsgs_type',				'phpbb_new_pm'),
   1.811 +				array('pm_unread',				'privmsgs.privmsgs_type',				'phpbb_unread_pm'),
   1.812 +				array('pm_replied',				0,										''),
   1.813 +				array('pm_marked',				0,										''),
   1.814 +				array('pm_forwarded',			0,										''),
   1.815 +				array('folder_id',				'privmsgs.privmsgs_from_userid',		'phpbb_get_savebox_id'),
   1.816 +
   1.817 +				'where'			=> 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
   1.818 +										AND privmsgs.privmsgs_type = 4',
   1.819 +			),
   1.820 +
   1.821 +			array(
   1.822 +				'target'		=> GROUPS_TABLE,
   1.823 +				'autoincrement'	=> 'group_id',
   1.824 +				'query_first'	=> array('target', $convert->truncate_statement . GROUPS_TABLE),
   1.825 +
   1.826 +				array('group_id',				'groups.group_id',					''),
   1.827 +				array('group_type',				'groups.group_type',				'phpbb_convert_group_type'),
   1.828 +				array('group_display',			0,									''),
   1.829 +				array('group_legend',			0,									''),
   1.830 +				array('group_name',				'groups.group_name',				'phpbb_convert_group_name'), // phpbb_set_encoding called in phpbb_convert_group_name
   1.831 +				array('group_desc',				'groups.group_description',			'phpbb_set_encoding'),
   1.832 +
   1.833 +				'where'			=> 'groups.group_single_user = 0',
   1.834 +			),
   1.835 +
   1.836 +			array(
   1.837 +				'target'		=> USER_GROUP_TABLE,
   1.838 +				'query_first'	=> array('target', $convert->truncate_statement . USER_GROUP_TABLE),
   1.839 +				'execute_first'	=> '
   1.840 +					add_default_groups();
   1.841 +				',
   1.842 +
   1.843 +				array('group_id',		'groups.group_id',					''),
   1.844 +				array('user_id',		'groups.group_moderator',			'phpbb_user_id'),
   1.845 +				array('group_leader',	1,									''),
   1.846 +				array('user_pending',	0,									''),
   1.847 +
   1.848 +				'where'			=> 'groups.group_single_user = 0 AND groups.group_moderator <> 0',
   1.849 +			),
   1.850 +
   1.851 +			array(
   1.852 +				'target'		=> USER_GROUP_TABLE,
   1.853 +
   1.854 +				array('group_id',		'user_group.group_id',				''),
   1.855 +				array('user_id',		'user_group.user_id',				'phpbb_user_id'),
   1.856 +				array('group_leader',	0,									''),
   1.857 +				array('user_pending',	'user_group.user_pending',			''),
   1.858 +
   1.859 +				'where'			=> 'user_group.group_id = groups.group_id AND groups.group_single_user = 0 AND groups.group_moderator <> user_group.user_id',
   1.860 +			),
   1.861 +
   1.862 +			array(
   1.863 +				'target'		=> USERS_TABLE,
   1.864 +				'primary'		=> 'users.user_id',
   1.865 +				'autoincrement'	=> 'user_id',
   1.866 +				'query_first'	=> array(
   1.867 +					array('target', 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS),
   1.868 +					array('target', $convert->truncate_statement . BOTS_TABLE)
   1.869 +				),
   1.870 +
   1.871 +				'execute_last'	=> '
   1.872 +					remove_invalid_users();
   1.873 +				',
   1.874 +
   1.875 +				array('user_id',				'users.user_id',					'phpbb_user_id'),
   1.876 +				array('',						'users.user_id AS poster_id',		'phpbb_user_id'),
   1.877 +				array('user_type',				'users.user_active',				'set_user_type'),
   1.878 +				array('group_id',				'users.user_level',					'phpbb_set_primary_group'),
   1.879 +				array('user_regdate',			'users.user_regdate',				''),
   1.880 +				array('username',				'users.username',					'phpbb_set_default_encoding'), // recode to utf8 with default lang
   1.881 +				array('username_clean',			'users.username',					array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_clean_string')),
   1.882 +				array('user_password',			'users.user_password',				'phpbb_hash'),
   1.883 +				array('user_pass_convert',		1,									''),
   1.884 +				array('user_posts',				'users.user_posts',					'intval'),
   1.885 +				array('user_email',				'users.user_email',					'strtolower'),
   1.886 +				array('user_email_hash',		'users.user_email',					'gen_email_hash'),
   1.887 +				array('user_birthday',			((defined('MOD_BIRTHDAY')) ? 'users.user_birthday' : ''),	'phpbb_get_birthday'),
   1.888 +				array('user_lastvisit',			'users.user_lastvisit',				'intval'),
   1.889 +				array('user_lastmark',			'users.user_lastvisit',				'intval'),
   1.890 +				array('user_lang',				$config['default_lang'],			''),
   1.891 +				array('',						'users.user_lang',					''),
   1.892 +				array('user_timezone',			'users.user_timezone',				'floatval'),
   1.893 +				array('user_dateformat',		'users.user_dateformat',			array('function1' => 'phpbb_set_encoding', 'function2' => 'fill_dateformat')),
   1.894 +				array('user_inactive_reason',	'',									'phpbb_inactive_reason'),
   1.895 +				array('user_inactive_time',		'',									'phpbb_inactive_time'),
   1.896 +
   1.897 +				array('user_interests',			'users.user_interests',				array('function1' => 'phpbb_set_encoding')),
   1.898 +				array('user_occ',				'users.user_occ',					array('function1' => 'phpbb_set_encoding')),
   1.899 +				array('user_website',			'users.user_website',				'validate_website'),
   1.900 +				array('user_jabber',			'',									''),
   1.901 +				array('user_msnm',				'users.user_msnm',					array('function1' => 'phpbb_set_encoding')),
   1.902 +				array('user_yim',				'users.user_yim',					array('function1' => 'phpbb_set_encoding')),
   1.903 +				array('user_aim',				'users.user_aim',					array('function1' => 'phpbb_set_encoding')),
   1.904 +				array('user_icq',				'users.user_icq',					array('function1' => 'phpbb_set_encoding')),
   1.905 +				array('user_from',				'users.user_from',					array('function1' => 'phpbb_set_encoding')),
   1.906 +				array('user_rank',				'users.user_rank',					'intval'),
   1.907 +				array('user_permissions',		'',									''),
   1.908 +
   1.909 +				array('user_avatar',			'users.user_avatar',				'phpbb_import_avatar'),
   1.910 +				array('user_avatar_type',		'users.user_avatar_type',			'phpbb_avatar_type'),
   1.911 +				array('user_avatar_width',		'users.user_avatar',				'phpbb_get_avatar_width'),
   1.912 +				array('user_avatar_height',		'users.user_avatar',				'phpbb_get_avatar_height'),
   1.913 +
   1.914 +				array('user_new_privmsg',		'users.user_new_privmsg',			''),
   1.915 +				array('user_unread_privmsg',	0,									''), //'users.user_unread_privmsg'
   1.916 +				array('user_last_privmsg',		'users.user_last_privmsg',			'intval'),
   1.917 +				array('user_emailtime',			'users.user_emailtime',				'null_to_zero'),
   1.918 +				array('user_notify',			'users.user_notify',				'intval'),
   1.919 +				array('user_notify_pm',			'users.user_notify_pm',				'intval'),
   1.920 +				array('user_notify_type',		NOTIFY_EMAIL,						''),
   1.921 +				array('user_allow_pm',			'users.user_allow_pm',				'intval'),
   1.922 +				array('user_allow_viewonline',	'users.user_allow_viewonline',		'intval'),
   1.923 +				array('user_allow_viewemail',	'users.user_viewemail',				'intval'),
   1.924 +				array('user_actkey',			'users.user_actkey',				''),
   1.925 +				array('user_newpasswd',			'',									''), // Users need to re-request their password...
   1.926 +				array('user_style',				$config['default_style'],			''),
   1.927 +
   1.928 +				array('user_options',			'',									'set_user_options'),
   1.929 +				array('',						'users.user_popup_pm AS popuppm',	''),
   1.930 +				array('',						'users.user_allowhtml AS html',		''),
   1.931 +				array('',						'users.user_allowbbcode AS bbcode',	''),
   1.932 +				array('',						'users.user_allowsmile AS smile',	''),
   1.933 +				array('',						'users.user_attachsig AS attachsig',''),
   1.934 +
   1.935 +				array('user_sig_bbcode_uid',		'users.user_regdate',							'make_uid'),
   1.936 +				array('user_sig',					'users.user_sig',								'phpbb_prepare_message'),
   1.937 +				array('',							'users.user_sig_bbcode_uid AS old_bbcode_uid',	''),
   1.938 +				array('user_sig_bbcode_bitfield',	'',												'get_bbcode_bitfield'),
   1.939 +				array('',							'users.user_regdate AS post_time',				''),
   1.940 +
   1.941 +				'where'			=> 'users.user_id <> -1',
   1.942 +			),
   1.943 +		),
   1.944 +	);
   1.945 +}
   1.946 +
   1.947 +?>
   1.948 \ No newline at end of file