Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
convert_phpbb20.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 /**
015 * NOTE to potential convertor authors. Please use this file to get
016 * familiar with the structure since we added some bare explanations here.
017 *
018 * Since this file gets included more than once on one page you are not able to add functions to it.
019 * Instead use a functions_ file.
020 *
021 * @ignore
022 */
023 if (!defined('IN_PHPBB'))
024 {
025 exit;
026 }
027
028 $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
029 extract($phpbb_config_php_file->get_all());
030 unset($dbpasswd);
031
032 $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
033
034 /**
035 * $convertor_data provides some basic information about this convertor which is
036 * used on the initial list of convertors and to populate the default settings
037 */
038 $convertor_data = array(
039 'forum_name' => 'phpBB 2.0.x',
040 'version' => '1.0.3',
041 'phpbb_version' => '3.3.15',
042 'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>',
043 'dbms' => $dbms,
044 'dbhost' => $dbhost,
045 'dbport' => $dbport,
046 'dbuser' => $dbuser,
047 'dbpasswd' => '',
048 'dbname' => $dbname,
049 'table_prefix' => 'phpbb_',
050 'forum_path' => '../forums',
051 'author_notes' => '',
052 );
053
054 /**
055 * $tables is a list of the tables (minus prefix) which we expect to find in the
056 * source forum. It is used to guess the prefix if the specified prefix is incorrect
057 */
058 $tables = array(
059 'auth_access',
060 'banlist',
061 'categories',
062 'disallow',
063 'forum_prune',
064 'forums',
065 'groups',
066 'posts',
067 'posts_text',
068 'privmsgs',
069 'privmsgs_text',
070 'ranks',
071 'smilies',
072 'topics',
073 'topics_watch',
074 'user_group',
075 'users',
076 'vote_desc',
077 'vote_results',
078 'vote_voters',
079 'words'
080 );
081
082 /**
083 * $config_schema details how the board configuration information is stored in the source forum.
084 *
085 * 'table_format' can take the value 'file' to indicate a config file. In this case array_name
086 * is set to indicate the name of the array the config values are stored in
087 * Example of using a file:
088 * $config_schema = array(
089 * 'table_format' => 'file',
090 * 'filename' => 'NAME OF FILE', // If the file is not in the root directory, the path needs to be added with no leading slash
091 * 'array_name' => 'NAME OF ARRAY', // Only used if the configuration file stores the setting in an array.
092 * 'settings' => array(
093 * 'board_email' => 'SUPPORT_EMAIL', // target config name => source target name
094 * )
095 * );
096 * 'table_format' can be an array if the values are stored in a table which is an assosciative array
097 * (as per phpBB 2.0.x)
098 * If left empty, values are assumed to be stored in a table where each config setting is
099 * a column (as per phpBB 1.x)
100 *
101 * In either of the latter cases 'table_name' indicates the name of the table in the database
102 *
103 * 'settings' is an array which maps the name of the config directive in the source forum
104 * to the config directive in phpBB3. It can either be a direct mapping or use a function.
105 * Please note that the contents of the old config value are passed to the function, therefore
106 * an in-built function requiring the variable passed by reference is not able to be used. Since
107 * empty() is such a function we created the function is_empty() to be used instead.
108 */
109 $config_schema = array(
110 'table_name' => 'config',
111 'table_format' => array('config_name' => 'config_value'),
112 'settings' => array(
113 'allow_bbcode' => 'allow_bbcode',
114 'allow_smilies' => 'allow_smilies',
115 'allow_sig' => 'allow_sig',
116 'allow_namechange' => 'allow_namechange',
117 'allow_avatar_local' => 'allow_avatar_local',
118 'allow_avatar_remote' => 'allow_avatar_remote',
119 'allow_avatar_upload' => 'allow_avatar_upload',
120 'board_disable' => 'board_disable',
121 'sitename' => 'phpbb_set_encoding(sitename)',
122 'site_desc' => 'phpbb_set_encoding(site_desc)',
123 'session_length' => 'session_length',
124 'board_email_sig' => 'phpbb_set_encoding(board_email_sig)',
125 'posts_per_page' => 'posts_per_page',
126 'topics_per_page' => 'topics_per_page',
127 'enable_confirm' => 'enable_confirm',
128 'board_email_form' => 'board_email_form',
129 'override_user_style' => 'override_user_style',
130 'hot_threshold' => 'hot_threshold',
131 'max_poll_options' => 'max_poll_options',
132 'max_sig_chars' => 'max_sig_chars',
133 'pm_max_msgs' => 'max_inbox_privmsgs',
134 'smtp_delivery' => 'smtp_delivery',
135 'smtp_host' => 'smtp_host',
136 'smtp_username' => 'smtp_username',
137 'smtp_password' => 'smtp_password',
138 'require_activation' => 'require_activation',
139 'flood_interval' => 'flood_interval',
140 'avatar_filesize' => 'avatar_filesize',
141 'avatar_max_width' => 'avatar_max_width',
142 'avatar_max_height' => 'avatar_max_height',
143 'default_dateformat' => 'phpbb_set_encoding(default_dateformat)',
144 'board_timezone' => 'phpbb_convert_timezone(board_timezone)',
145 'allow_privmsg' => 'not(privmsg_disable)',
146 'gzip_compress' => 'gzip_compress',
147 'coppa_enable' => '!is_empty(coppa_mail)',
148 'coppa_fax' => 'coppa_fax',
149 'coppa_mail' => 'coppa_mail',
150 'record_online_users' => 'record_online_users',
151 'record_online_date' => 'record_online_date',
152 'board_startdate' => 'board_startdate',
153 )
154 );
155
156 /**
157 * $test_file is the name of a file which is present on the source
158 * forum which can be used to check that the path specified by the
159 * user was correct
160 */
161 $test_file = 'modcp.php';
162
163 /**
164 * If this is set then we are not generating the first page of information but getting the conversion information.
165 */
166 if (!$get_info)
167 {
168 // Test to see if the birthday MOD is installed on the source forum
169 // Niels' birthday mod
170 if (get_config_value('birthday_required') !== false || get_config_value('bday_require') !== false)
171 {
172 define('MOD_BIRTHDAY', true);
173 }
174
175 // TerraFrost's validated birthday mod
176 if (get_config_value('bday_require') !== false)
177 {
178 define('MOD_BIRTHDAY_TERRA', true);
179 }
180
181 // Test to see if the attachment MOD is installed on the source forum
182 // If it is, we will convert this data as well
183 $src_db->sql_return_on_error(true);
184
185 $sql = "SELECT config_value
186 FROM {$convert->src_table_prefix}attachments_config
187 WHERE config_name = 'upload_dir'";
188 $result = $src_db->sql_query($sql);
189
190 if ($result && $row = $src_db->sql_fetchrow($result))
191 {
192 // Here the constant is defined
193 define('MOD_ATTACHMENT', true);
194
195 // Here i add more tables to be checked in the old forum
196 $tables += array(
197 'attachments',
198 'attachments_desc',
199 'extensions',
200 'extension_groups'
201 );
202
203 $src_db->sql_freeresult($result);
204 }
205 else if ($result)
206 {
207 $src_db->sql_freeresult($result);
208 }
209
210
211 /**
212 * Tests for further MODs can be included here.
213 * Please use constants for this, prefixing them with MOD_
214 */
215
216 $src_db->sql_return_on_error(false);
217
218 // Now let us set a temporary config variable for user id incrementing
219 $sql = "SELECT user_id
220 FROM {$convert->src_table_prefix}users
221 WHERE user_id = 1";
222 $result = $src_db->sql_query($sql);
223 $user_id = (int) $src_db->sql_fetchfield('user_id');
224 $src_db->sql_freeresult($result);
225
226 // If there is a user id 1, we need to increment user ids. :/
227 if ($user_id === 1)
228 {
229 // Try to get the maximum user id possible...
230 $sql = "SELECT MAX(user_id) AS max_user_id
231 FROM {$convert->src_table_prefix}users";
232 $result = $src_db->sql_query($sql);
233 $user_id = (int) $src_db->sql_fetchfield('max_user_id');
234 $src_db->sql_freeresult($result);
235
236 $config->set('increment_user_id', ($user_id + 1), false);
237 }
238 else
239 {
240 $config->set('increment_user_id', 0, false);
241 }
242
243 // Overwrite maximum avatar width/height
244 @define('DEFAULT_AVATAR_X_CUSTOM', get_config_value('avatar_max_width'));
245 @define('DEFAULT_AVATAR_Y_CUSTOM', get_config_value('avatar_max_height'));
246
247 // additional table used only during conversion
248 @define('USERCONV_TABLE', $table_prefix . 'userconv');
249
250 /**
251 * Description on how to use the convertor framework.
252 *
253 * 'schema' Syntax Description
254 * -> 'target' => Target Table. If not specified the next table will be handled
255 * -> 'primary' => Primary Key. If this is specified then this table is processed in batches
256 * -> 'query_first' => array('target' or 'src', Query to execute before beginning the process
257 * (if more than one then specified as array))
258 * -> 'function_first' => Function to execute before beginning the process (if more than one then specified as array)
259 * (This is mostly useful if variables need to be given to the converting process)
260 * -> 'test_file' => This is not used at the moment but should be filled with a file from the old installation
261 *
262 * // DB Functions
263 * 'distinct' => Add DISTINCT to the select query
264 * 'where' => Add WHERE to the select query
265 * 'group_by' => Add GROUP BY to the select query
266 * 'left_join' => Add LEFT JOIN to the select query (if more than one joins specified as array)
267 * 'having' => Add HAVING to the select query
268 *
269 * // DB INSERT array
270 * This one consist of three parameters
271 * First Parameter:
272 * The key need to be filled within the target table
273 * If this is empty, the target table gets not assigned the source value
274 * Second Parameter:
275 * Source value. If the first parameter is specified, it will be assigned this value.
276 * If the first parameter is empty, this only gets added to the select query
277 * Third Parameter:
278 * Custom Function. Function to execute while storing source value into target table.
279 * The functions return value get stored.
280 * The function parameter consist of the value of the second parameter.
281 *
282 * types:
283 * - empty string == execute nothing
284 * - string == function to execute
285 * - array == complex execution instructions
286 *
287 * Complex execution instructions:
288 * @todo test complex execution instructions - in theory they will work fine
289 *
290 * By defining an array as the third parameter you are able to define some statements to be executed. The key
291 * is defining what to execute, numbers can be appended...
292 *
293 * 'function' => execute function
294 * 'execute' => run code, whereby all occurrences of {VALUE} get replaced by the last returned value.
295 * The result *must* be assigned/stored to {RESULT}.
296 * 'typecast' => typecast value
297 *
298 * The returned variables will be made always available to the next function to continue to work with.
299 *
300 * example (variable inputted is an integer of 1):
301 *
302 * array(
303 * 'function1' => 'increment_by_one', // returned variable is 2
304 * 'typecast' => 'string', // typecast variable to be a string
305 * 'execute' => '{RESULT} = {VALUE} . ' is good';', // returned variable is '2 is good'
306 * 'function2' => 'replace_good_with_bad', // returned variable is '2 is bad'
307 * ),
308 *
309 */
310
311 $convertor = array(
312 'test_file' => 'viewtopic.php',
313
314 'avatar_path' => get_config_value('avatar_path') . '/',
315 'avatar_gallery_path' => get_config_value('avatar_gallery_path') . '/',
316 'smilies_path' => get_config_value('smilies_path') . '/',
317 'upload_path' => (defined('MOD_ATTACHMENT')) ? phpbb_get_files_dir() . '/' : '',
318 'thumbnails' => (defined('MOD_ATTACHMENT')) ? array('thumbs/', 't_') : '',
319 'ranks_path' => false, // phpBB 2.0.x had no config value for a ranks path
320
321 // We empty some tables to have clean data available
322 'query_first' => array(
323 array('target', $convert->truncate_statement . SEARCH_RESULTS_TABLE),
324 array('target', $convert->truncate_statement . SEARCH_WORDLIST_TABLE),
325 array('target', $convert->truncate_statement . SEARCH_WORDMATCH_TABLE),
326 array('target', $convert->truncate_statement . LOG_TABLE),
327 ),
328
329 // 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.
330 // Instead every file gets copied while processing the corresponding attachment entry.
331 // if (defined("MOD_ATTACHMENT")) { import_attachment_files(); phpbb_copy_thumbnails(); }
332
333 // phpBB2 allowed some similar usernames to coexist which would have the same
334 // username_clean in phpBB3 which is not possible, so we'll give the admin a list
335 // of user ids and usernames and let him deicde what he wants to do with them
336 'execute_first' => '
337 phpbb_create_userconv_table();
338 import_avatar_gallery();
339 if (defined("MOD_ATTACHMENT")) phpbb_import_attach_config();
340 phpbb_insert_forums();
341 ',
342
343 'execute_last' => array('
344 add_bots();
345 ', '
346 update_folder_pm_count();
347 ', '
348 update_unread_count();
349 ', (defined('MOD_ATTACHMENT')) ? '
350 phpbb_attachment_extension_group_name();
351 ' : '
352 ', '
353 phpbb_convert_authentication(\'start\');
354 ', '
355 phpbb_convert_authentication(\'first\');
356 ', '
357 phpbb_convert_authentication(\'second\');
358 ', '
359 phpbb_convert_authentication(\'third\');
360 '),
361
362 'schema' => array(
363 array(
364 'target' => USERCONV_TABLE,
365 'query_first' => array('target', $convert->truncate_statement . USERCONV_TABLE),
366
367
368 array('user_id', 'users.user_id', ''),
369 array('username_clean', 'users.username', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_clean_string')),
370 ),
371
372 array(
373 'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
374 'primary' => 'attachments.attach_id',
375 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . ATTACHMENTS_TABLE) : '',
376 'autoincrement' => 'attach_id',
377
378 array('attach_id', 'attachments.attach_id', ''),
379 array('post_msg_id', 'attachments.post_id', ''),
380 array('topic_id', 'posts.topic_id', ''),
381 array('in_message', 0, ''),
382 array('is_orphan', 0, ''),
383 array('poster_id', 'attachments.user_id_1 AS poster_id', 'phpbb_user_id'),
384 array('physical_filename', 'attachments_desc.physical_filename', 'import_attachment'),
385 array('real_filename', 'attachments_desc.real_filename', 'phpbb_set_encoding'),
386 array('download_count', 'attachments_desc.download_count', ''),
387 array('attach_comment', 'attachments_desc.comment', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
388 array('extension', 'attachments_desc.extension', ''),
389 array('mimetype', 'attachments_desc.mimetype', ''),
390 array('filesize', 'attachments_desc.filesize', ''),
391 array('filetime', 'attachments_desc.filetime', ''),
392 array('thumbnail', 'attachments_desc.thumbnail', ''),
393
394 'where' => 'attachments_desc.attach_id = attachments.attach_id AND attachments.privmsgs_id = 0 AND posts.post_id = attachments.post_id',
395 'group_by' => 'attachments.attach_id'
396 ),
397
398 array(
399 'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
400 'primary' => 'attachments.attach_id',
401 'autoincrement' => 'attach_id',
402
403 array('attach_id', 'attachments.attach_id', ''),
404 array('post_msg_id', 'attachments.privmsgs_id', ''),
405 array('topic_id', 0, ''),
406 array('in_message', 1, ''),
407 array('is_orphan', 0, ''),
408 array('poster_id', 'attachments.user_id_1 AS poster_id', 'phpbb_user_id'),
409 array('physical_filename', 'attachments_desc.physical_filename', 'import_attachment'),
410 array('real_filename', 'attachments_desc.real_filename', 'phpbb_set_encoding'),
411 array('download_count', 'attachments_desc.download_count', ''),
412 array('attach_comment', 'attachments_desc.comment', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
413 array('extension', 'attachments_desc.extension', ''),
414 array('mimetype', 'attachments_desc.mimetype', ''),
415 array('filesize', 'attachments_desc.filesize', ''),
416 array('filetime', 'attachments_desc.filetime', ''),
417 array('thumbnail', 'attachments_desc.thumbnail', ''),
418
419 'where' => 'attachments_desc.attach_id = attachments.attach_id AND attachments.post_id = 0',
420 'group_by' => 'attachments.attach_id'
421 ),
422
423 array(
424 'target' => (defined('MOD_ATTACHMENT')) ? EXTENSIONS_TABLE : '',
425 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSIONS_TABLE) : '',
426 'autoincrement' => 'extension_id',
427
428 array('extension_id', 'extensions.ext_id', ''),
429 array('group_id', 'extensions.group_id', ''),
430 array('extension', 'extensions.extension', ''),
431 ),
432
433 array(
434 'target' => (defined('MOD_ATTACHMENT')) ? EXTENSION_GROUPS_TABLE : '',
435 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSION_GROUPS_TABLE) : '',
436 'autoincrement' => 'group_id',
437
438 array('group_id', 'extension_groups.group_id', ''),
439 array('group_name', 'extension_groups.group_name', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
440 array('cat_id', 'extension_groups.cat_id', 'phpbb_attachment_category'),
441 array('allow_group', 'extension_groups.allow_group', ''),
442 array('download_mode', 1, ''),
443 array('upload_icon', '', ''),
444 array('max_filesize', 'extension_groups.max_filesize', ''),
445 array('allowed_forums', 'extension_groups.forum_permissions', 'phpbb_attachment_forum_perms'),
446 array('allow_in_pm', 1, ''),
447 ),
448
449 array(
450 'target' => BANLIST_TABLE,
451 'execute_first' => 'phpbb_check_username_collisions();',
452 'query_first' => array('target', $convert->truncate_statement . BANLIST_TABLE),
453
454 array('ban_ip', 'banlist.ban_ip', 'decode_ban_ip'),
455 array('ban_userid', 'banlist.ban_userid', 'phpbb_user_id'),
456 array('ban_email', 'banlist.ban_email', ''),
457 array('ban_reason', '', ''),
458 array('ban_give_reason', '', ''),
459
460 'where' => "banlist.ban_ip NOT LIKE '%.%'",
461 ),
462
463 array(
464 'target' => BANLIST_TABLE,
465
466 array('ban_ip', 'banlist.ban_ip', ''),
467 array('ban_userid', 0, ''),
468 array('ban_email', '', ''),
469 array('ban_reason', '', ''),
470 array('ban_give_reason', '', ''),
471
472 'where' => "banlist.ban_ip LIKE '%.%'",
473 ),
474
475 array(
476 'target' => DISALLOW_TABLE,
477 'query_first' => array('target', $convert->truncate_statement . DISALLOW_TABLE),
478
479 array('disallow_username', 'disallow.disallow_username', 'phpbb_disallowed_username'),
480 ),
481
482 array(
483 'target' => RANKS_TABLE,
484 'query_first' => array('target', $convert->truncate_statement . RANKS_TABLE),
485 'autoincrement' => 'rank_id',
486
487 array('rank_id', 'ranks.rank_id', ''),
488 array('rank_title', 'ranks.rank_title', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_htmlspecialchars')),
489 array('rank_min', 'ranks.rank_min', array('typecast' => 'int', 'execute' => '{RESULT} = ({VALUE}[0] < 0) ? 0 : {VALUE}[0];')),
490 array('rank_special', 'ranks.rank_special', ''),
491 array('rank_image', 'ranks.rank_image', 'import_rank'),
492 ),
493
494 array(
495 'target' => TOPICS_TABLE,
496 'query_first' => array('target', $convert->truncate_statement . TOPICS_TABLE),
497 'primary' => 'topics.topic_id',
498 'autoincrement' => 'topic_id',
499
500 array('topic_id', 'topics.topic_id', ''),
501 array('forum_id', 'topics.forum_id', ''),
502 array('icon_id', 0, ''),
503 array('topic_poster', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
504 array('topic_attachment', ((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
505 array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
506 array('topic_time', 'topics.topic_time', ''),
507 array('topic_views', 'topics.topic_views', ''),
508 array('topic_posts_approved', 'topics.topic_replies', 'phpbb_topic_replies_to_posts'),
509 array('topic_posts_unapproved', 0, ''),
510 array('topic_posts_softdeleted',0, ''),
511 array('topic_last_post_id', 'topics.topic_last_post_id', ''),
512 array('topic_status', 'topics.topic_status', 'is_topic_locked'),
513 array('topic_moved_id', 0, ''),
514 array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'),
515 array('topic_first_post_id', 'topics.topic_first_post_id', ''),
516 array('topic_last_view_time', 'posts.post_time', 'intval'),
517 array('topic_visibility', ITEM_APPROVED, ''),
518
519 array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'htmlspecialchars_decode', 'function4' => 'utf8_htmlspecialchars')),
520 array('poll_start', 'vote_desc.vote_start', 'null_to_zero'),
521 array('poll_length', 'vote_desc.vote_length', 'null_to_zero'),
522 array('poll_max_options', 1, ''),
523 array('poll_vote_change', 0, ''),
524
525 'left_join' => array ( 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
526 'topics LEFT JOIN posts ON topics.topic_last_post_id = posts.post_id',
527 ),
528 'where' => 'topics.topic_moved_id = 0',
529 ),
530
531 array(
532 'target' => TOPICS_TABLE,
533 'primary' => 'topics.topic_id',
534 'autoincrement' => 'topic_id',
535
536 array('topic_id', 'topics.topic_id', ''),
537 array('forum_id', 'topics.forum_id', ''),
538 array('icon_id', 0, ''),
539 array('topic_poster', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
540 array('topic_attachment', ((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
541 array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
542 array('topic_time', 'topics.topic_time', ''),
543 array('topic_views', 'topics.topic_views', ''),
544 array('topic_posts_approved', 'topics.topic_replies', 'phpbb_topic_replies_to_posts'),
545 array('topic_posts_unapproved', 0, ''),
546 array('topic_posts_softdeleted',0, ''),
547 array('topic_last_post_id', 'topics.topic_last_post_id', ''),
548 array('topic_status', ITEM_MOVED, ''),
549 array('topic_moved_id', 'topics.topic_moved_id', ''),
550 array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'),
551 array('topic_first_post_id', 'topics.topic_first_post_id', ''),
552 array('topic_visibility', ITEM_APPROVED, ''),
553
554 array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'htmlspecialchars_decode', 'function4' => 'utf8_htmlspecialchars')),
555 array('poll_start', 'vote_desc.vote_start', 'null_to_zero'),
556 array('poll_length', 'vote_desc.vote_length', 'null_to_zero'),
557 array('poll_max_options', 1, ''),
558 array('poll_vote_change', 0, ''),
559
560 'left_join' => 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
561 'where' => 'topics.topic_moved_id <> 0',
562 ),
563
564 array(
565 'target' => TOPICS_WATCH_TABLE,
566 'primary' => 'topics_watch.topic_id',
567 'query_first' => array('target', $convert->truncate_statement . TOPICS_WATCH_TABLE),
568
569 array('topic_id', 'topics_watch.topic_id', ''),
570 array('user_id', 'topics_watch.user_id', 'phpbb_user_id'),
571 array('notify_status', 'topics_watch.notify_status', ''),
572 ),
573
574 array(
575 'target' => SMILIES_TABLE,
576 'query_first' => array('target', $convert->truncate_statement . SMILIES_TABLE),
577 'autoincrement' => 'smiley_id',
578
579 array('smiley_id', 'smilies.smilies_id', ''),
580 array('code', 'smilies.code', array('function1' => 'phpbb_smilie_html_decode', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
581 array('emotion', 'smilies.emoticon', 'phpbb_set_encoding'),
582 array('smiley_url', 'smilies.smile_url', 'import_smiley'),
583 array('smiley_width', 'smilies.smile_url', 'get_smiley_width'),
584 array('smiley_height', 'smilies.smile_url', 'get_smiley_height'),
585 array('smiley_order', 'smilies.smilies_id', ''),
586 array('display_on_posting', 'smilies.smilies_id', 'get_smiley_display'),
587
588 'order_by' => 'smilies.smilies_id ASC',
589 ),
590
591 array(
592 'target' => POLL_OPTIONS_TABLE,
593 'primary' => 'vote_results.vote_option_id',
594 'query_first' => array('target', $convert->truncate_statement . POLL_OPTIONS_TABLE),
595
596 array('poll_option_id', 'vote_results.vote_option_id', ''),
597 array('topic_id', 'vote_desc.topic_id', ''),
598 array('', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
599 array('poll_option_text', 'vote_results.vote_option_text', array('function1' => 'phpbb_set_encoding', 'function2' => 'htmlspecialchars_decode', 'function3' => 'utf8_htmlspecialchars')),
600 array('poll_option_total', 'vote_results.vote_result', ''),
601
602 'where' => 'vote_results.vote_id = vote_desc.vote_id',
603 'left_join' => 'vote_desc LEFT JOIN topics ON topics.topic_id = vote_desc.topic_id',
604 ),
605
606 array(
607 'target' => POLL_VOTES_TABLE,
608 'primary' => 'vote_desc.topic_id',
609 'query_first' => array('target', $convert->truncate_statement . POLL_VOTES_TABLE),
610
611 array('poll_option_id', VOTE_CONVERTED, ''),
612 array('topic_id', 'vote_desc.topic_id', ''),
613 array('vote_user_id', 'vote_voters.vote_user_id', 'phpbb_user_id'),
614 array('vote_user_ip', 'vote_voters.vote_user_ip', 'decode_ip'),
615
616 'where' => 'vote_voters.vote_id = vote_desc.vote_id',
617 ),
618
619 array(
620 'target' => WORDS_TABLE,
621 'primary' => 'words.word_id',
622 'query_first' => array('target', $convert->truncate_statement . WORDS_TABLE),
623 'autoincrement' => 'word_id',
624
625 array('word_id', 'words.word_id', ''),
626 array('word', 'words.word', 'phpbb_set_encoding'),
627 array('replacement', 'words.replacement', 'phpbb_set_encoding'),
628 ),
629
630 array(
631 'target' => POSTS_TABLE,
632 'primary' => 'posts.post_id',
633 'autoincrement' => 'post_id',
634 'query_first' => array('target', $convert->truncate_statement . POSTS_TABLE),
635 'execute_first' => '
636 $config["max_post_chars"] = 0;
637 $config["min_post_chars"] = 0;
638 $config["max_quote_depth"] = 0;
639 ',
640
641 array('post_id', 'posts.post_id', ''),
642 array('topic_id', 'posts.topic_id', ''),
643 array('forum_id', 'posts.forum_id', ''),
644 array('poster_id', 'posts.poster_id', 'phpbb_user_id'),
645 array('icon_id', 0, ''),
646 array('poster_ip', 'posts.poster_ip', 'decode_ip'),
647 array('post_time', 'posts.post_time', ''),
648 array('enable_bbcode', 'posts.enable_bbcode', ''),
649 array('', 'posts.enable_html', ''),
650 array('enable_smilies', 'posts.enable_smilies', ''),
651 array('enable_sig', 'posts.enable_sig', ''),
652 array('enable_magic_url', 1, ''),
653 array('post_username', 'posts.post_username', 'phpbb_set_encoding'),
654 array('post_subject', 'posts_text.post_subject', 'phpbb_set_encoding'),
655 array('post_attachment', ((defined('MOD_ATTACHMENT')) ? 'posts.post_attachment' : 0), ''),
656 array('post_edit_time', 'posts.post_edit_time', array('typecast' => 'int')),
657 array('post_edit_count', 'posts.post_edit_count', ''),
658 array('post_edit_reason', '', ''),
659 array('post_edit_user', '', 'phpbb_post_edit_user'),
660 array('post_visibility', ITEM_APPROVED, ''),
661
662 array('bbcode_uid', 'posts.post_time', 'make_uid'),
663 array('post_text', 'posts_text.post_text', 'phpbb_prepare_message'),
664 array('', 'posts_text.bbcode_uid AS old_bbcode_uid', ''),
665 array('bbcode_bitfield', '', 'get_bbcode_bitfield'),
666 array('post_checksum', '', ''),
667
668 // Commented out inline search indexing, this takes up a LOT of time. :D
669 // @todo We either need to enable this or call the rebuild search functionality post convert
670 /* array('', '', 'search_indexing'),
671 array('', 'posts_text.post_text AS message', ''),
672 array('', 'posts_text.post_subject AS title', ''),*/
673
674 'where' => 'posts.post_id = posts_text.post_id'
675 ),
676
677 array(
678 'target' => PRIVMSGS_TABLE,
679 'primary' => 'privmsgs.privmsgs_id',
680 'autoincrement' => 'msg_id',
681 'query_first' => array(
682 array('target', $convert->truncate_statement . PRIVMSGS_TABLE),
683 array('target', $convert->truncate_statement . PRIVMSGS_RULES_TABLE),
684 ),
685
686 'execute_first' => '
687 $config["max_post_chars"] = 0;
688 $config["min_post_chars"] = 0;
689 $config["max_quote_depth"] = 0;
690 ',
691
692 array('msg_id', 'privmsgs.privmsgs_id', ''),
693 array('root_level', 0, ''),
694 array('author_id', 'privmsgs.privmsgs_from_userid AS poster_id', 'phpbb_user_id'),
695 array('icon_id', 0, ''),
696 array('author_ip', 'privmsgs.privmsgs_ip', 'decode_ip'),
697 array('message_time', 'privmsgs.privmsgs_date', ''),
698 array('enable_bbcode', 'privmsgs.privmsgs_enable_bbcode AS enable_bbcode', ''),
699 array('', 'privmsgs.privmsgs_enable_html AS enable_html', ''),
700 array('enable_smilies', 'privmsgs.privmsgs_enable_smilies AS enable_smilies', ''),
701 array('enable_magic_url', 1, ''),
702 array('enable_sig', 'privmsgs.privmsgs_attach_sig', ''),
703 array('message_subject', 'privmsgs.privmsgs_subject', 'phpbb_set_encoding'), // Already specialchared in 2.0.x
704 array('message_attachment', ((defined('MOD_ATTACHMENT')) ? 'privmsgs.privmsgs_attachment' : 0), ''),
705 array('message_edit_reason', '', ''),
706 array('message_edit_user', 0, ''),
707 array('message_edit_time', 0, ''),
708 array('message_edit_count', 0, ''),
709
710 array('bbcode_uid', 'privmsgs.privmsgs_date AS post_time', 'make_uid'),
711 array('message_text', 'privmsgs_text.privmsgs_text', 'phpbb_prepare_message'),
712 array('', 'privmsgs_text.privmsgs_bbcode_uid AS old_bbcode_uid', ''),
713 array('bbcode_bitfield', '', 'get_bbcode_bitfield'),
714 array('to_address', 'privmsgs.privmsgs_to_userid', 'phpbb_privmsgs_to_userid'),
715 array('bcc_address', '', ''),
716
717 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id'
718 ),
719
720 array(
721 'target' => PRIVMSGS_FOLDER_TABLE,
722 'primary' => 'users.user_id',
723 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_FOLDER_TABLE),
724
725 array('user_id', 'users.user_id', 'phpbb_user_id'),
726 array('folder_name', $user->lang['CONV_SAVED_MESSAGES'], ''),
727 array('pm_count', 0, ''),
728
729 'where' => 'users.user_id <> -1',
730 ),
731
732 // Inbox
733 array(
734 'target' => PRIVMSGS_TO_TABLE,
735 'primary' => 'privmsgs.privmsgs_id',
736 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_TO_TABLE),
737
738 array('msg_id', 'privmsgs.privmsgs_id', ''),
739 array('user_id', 'privmsgs.privmsgs_to_userid', 'phpbb_user_id'),
740 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
741 array('pm_deleted', 0, ''),
742 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
743 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
744 array('pm_replied', 0, ''),
745 array('pm_marked', 0, ''),
746 array('pm_forwarded', 0, ''),
747 array('folder_id', PRIVMSGS_INBOX, ''),
748
749 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
750 AND (privmsgs.privmsgs_type = 0 OR privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
751 ),
752
753 // Outbox
754 array(
755 'target' => PRIVMSGS_TO_TABLE,
756 'primary' => 'privmsgs.privmsgs_id',
757
758 array('msg_id', 'privmsgs.privmsgs_id', ''),
759 array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
760 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
761 array('pm_deleted', 0, ''),
762 array('pm_new', 0, ''),
763 array('pm_unread', 0, ''),
764 array('pm_replied', 0, ''),
765 array('pm_marked', 0, ''),
766 array('pm_forwarded', 0, ''),
767 array('folder_id', PRIVMSGS_OUTBOX, ''),
768
769 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
770 AND (privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
771 ),
772
773 // Sentbox
774 array(
775 'target' => PRIVMSGS_TO_TABLE,
776 'primary' => 'privmsgs.privmsgs_id',
777
778 array('msg_id', 'privmsgs.privmsgs_id', ''),
779 array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
780 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
781 array('pm_deleted', 0, ''),
782 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
783 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
784 array('pm_replied', 0, ''),
785 array('pm_marked', 0, ''),
786 array('pm_forwarded', 0, ''),
787 array('folder_id', PRIVMSGS_SENTBOX, ''),
788
789 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
790 AND privmsgs.privmsgs_type = 2',
791 ),
792
793 // Savebox (SAVED IN)
794 array(
795 'target' => PRIVMSGS_TO_TABLE,
796 'primary' => 'privmsgs.privmsgs_id',
797
798 array('msg_id', 'privmsgs.privmsgs_id', ''),
799 array('user_id', 'privmsgs.privmsgs_to_userid', 'phpbb_user_id'),
800 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
801 array('pm_deleted', 0, ''),
802 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
803 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
804 array('pm_replied', 0, ''),
805 array('pm_marked', 0, ''),
806 array('pm_forwarded', 0, ''),
807 array('folder_id', 'privmsgs.privmsgs_to_userid', 'phpbb_get_savebox_id'),
808
809 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
810 AND privmsgs.privmsgs_type = 3',
811 ),
812
813 // Savebox (SAVED OUT)
814 array(
815 'target' => PRIVMSGS_TO_TABLE,
816 'primary' => 'privmsgs.privmsgs_id',
817
818 array('msg_id', 'privmsgs.privmsgs_id', ''),
819 array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
820 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
821 array('pm_deleted', 0, ''),
822 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
823 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
824 array('pm_replied', 0, ''),
825 array('pm_marked', 0, ''),
826 array('pm_forwarded', 0, ''),
827 array('folder_id', 'privmsgs.privmsgs_from_userid', 'phpbb_get_savebox_id'),
828
829 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
830 AND privmsgs.privmsgs_type = 4',
831 ),
832
833 array(
834 'target' => GROUPS_TABLE,
835 'autoincrement' => 'group_id',
836 'query_first' => array(
837 array('target', $convert->truncate_statement . GROUPS_TABLE),
838 array('target', $convert->truncate_statement . TEAMPAGE_TABLE),
839 ),
840
841 array('group_id', 'groups.group_id', ''),
842 array('group_type', 'groups.group_type', 'phpbb_convert_group_type'),
843 array('group_display', 0, ''),
844 array('group_legend', 0, ''),
845 array('group_name', 'groups.group_name', 'phpbb_convert_group_name'), // phpbb_set_encoding called in phpbb_convert_group_name
846 array('group_desc', 'groups.group_description', 'phpbb_set_encoding'),
847
848 'where' => 'groups.group_single_user = 0',
849 ),
850
851 array(
852 'target' => USER_GROUP_TABLE,
853 'query_first' => array('target', $convert->truncate_statement . USER_GROUP_TABLE),
854 'execute_first' => '
855 add_default_groups();
856 add_groups_to_teampage();
857 ',
858
859 array('group_id', 'groups.group_id', ''),
860 array('user_id', 'groups.group_moderator', 'phpbb_user_id'),
861 array('group_leader', 1, ''),
862 array('user_pending', 0, ''),
863
864 'where' => 'groups.group_single_user = 0 AND groups.group_moderator <> 0',
865 ),
866
867 array(
868 'target' => USER_GROUP_TABLE,
869
870 array('group_id', 'user_group.group_id', ''),
871 array('user_id', 'user_group.user_id', 'phpbb_user_id'),
872 array('group_leader', 0, ''),
873 array('user_pending', 'user_group.user_pending', ''),
874
875 'where' => 'user_group.group_id = groups.group_id AND groups.group_single_user = 0 AND groups.group_moderator <> user_group.user_id',
876 ),
877
878 array(
879 'target' => USERS_TABLE,
880 'primary' => 'users.user_id',
881 'autoincrement' => 'user_id',
882 'query_first' => array(
883 array('target', 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS),
884 array('target', $convert->truncate_statement . BOTS_TABLE),
885 array('target', $convert->truncate_statement . USER_NOTIFICATIONS_TABLE),
886 ),
887
888 'execute_last' => '
889 remove_invalid_users();
890 ',
891
892 array('user_id', 'users.user_id', 'phpbb_user_id'),
893 array('', 'users.user_id AS poster_id', 'phpbb_user_id'),
894 array('user_type', 'users.user_active', 'set_user_type'),
895 array('group_id', 'users.user_level', 'phpbb_set_primary_group'),
896 array('user_regdate', 'users.user_regdate', ''),
897 array('username', 'users.username', 'phpbb_set_default_encoding'), // recode to utf8 with default lang
898 array('username_clean', 'users.username', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_clean_string')),
899 array('user_password', 'users.user_password', 'phpbb_convert_password_hash'),
900 array('user_posts', 'users.user_posts', 'intval'),
901 array('user_email', 'users.user_email', 'strtolower'),
902 array('user_birthday', ((defined('MOD_BIRTHDAY')) ? 'users.user_birthday' : ''), 'phpbb_get_birthday'),
903 array('user_lastvisit', 'users.user_lastvisit', 'intval'),
904 array('user_last_active', 'users.user_lastvisit', 'intval'),
905 array('user_lastmark', 'users.user_lastvisit', 'intval'),
906 array('user_lang', $config['default_lang'], ''),
907 array('', 'users.user_lang', ''),
908 array('user_timezone', 'users.user_timezone', 'phpbb_convert_timezone'),
909 array('user_dateformat', 'users.user_dateformat', array('function1' => 'phpbb_set_encoding', 'function2' => 'fill_dateformat')),
910 array('user_inactive_reason', '', 'phpbb_inactive_reason'),
911 array('user_inactive_time', '', 'phpbb_inactive_time'),
912
913 array('user_jabber', '', ''),
914 array('user_rank', 'users.user_rank', 'intval'),
915 array('user_permissions', '', ''),
916
917 array('user_avatar', 'users.user_avatar', 'phpbb_import_avatar'),
918 array('user_avatar_type', 'users.user_avatar_type', 'phpbb_avatar_type'),
919 array('user_avatar_width', 'users.user_avatar', 'phpbb_get_avatar_width'),
920 array('user_avatar_height', 'users.user_avatar', 'phpbb_get_avatar_height'),
921
922 array('user_new_privmsg', 'users.user_new_privmsg', ''),
923 array('user_unread_privmsg', 0, ''), //'users.user_unread_privmsg'
924 array('user_last_privmsg', 'users.user_last_privmsg', 'intval'),
925 array('user_emailtime', 'users.user_emailtime', 'null_to_zero'),
926 array('user_notify', 'users.user_notify', 'intval'),
927 array('user_notify_pm', 'users.user_notify_pm', 'intval'),
928 array('user_notify_type', NOTIFY_EMAIL, ''),
929 array('user_allow_pm', 'users.user_allow_pm', 'intval'),
930 array('user_allow_viewonline', 'users.user_allow_viewonline', 'intval'),
931 array('user_allow_viewemail', 'users.user_viewemail', 'intval'),
932 array('user_actkey', 'users.user_actkey', ''),
933 array('user_newpasswd', '', ''), // Users need to re-request their password...
934 array('user_style', $config['default_style'], ''),
935
936 array('user_options', '', 'set_user_options'),
937 array('', 'users.user_popup_pm AS popuppm', ''),
938 array('', 'users.user_allowhtml AS html', ''),
939 array('', 'users.user_allowbbcode AS bbcode', ''),
940 array('', 'users.user_allowsmile AS smile', ''),
941 array('', 'users.user_attachsig AS attachsig',''),
942
943 array('user_sig_bbcode_uid', 'users.user_regdate', 'make_uid'),
944 array('user_sig', 'users.user_sig', 'phpbb_prepare_message'),
945 array('', 'users.user_sig_bbcode_uid AS old_bbcode_uid', ''),
946 array('user_sig_bbcode_bitfield', '', 'get_bbcode_bitfield'),
947 array('', 'users.user_regdate AS post_time', ''),
948
949 array('', 'users.user_notify_pm', 'phpbb_add_notification_options'),
950
951 'where' => 'users.user_id <> -1',
952 ),
953
954 array(
955 'target' => PROFILE_FIELDS_DATA_TABLE,
956 'primary' => 'users.user_id',
957 'query_first' => array(
958 array('target', $convert->truncate_statement . PROFILE_FIELDS_DATA_TABLE),
959 ),
960
961 array('user_id', 'users.user_id', 'phpbb_user_id'),
962 array('pf_phpbb_occupation', 'users.user_occ', array('function1' => 'phpbb_set_encoding')),
963 array('pf_phpbb_interests', 'users.user_interests', array('function1' => 'phpbb_set_encoding')),
964 array('pf_phpbb_location', 'users.user_from', array('function1' => 'phpbb_set_encoding')),
965 array('pf_phpbb_icq', 'users.user_icq', array('function1' => 'phpbb_set_encoding')),
966 array('pf_phpbb_yahoo', 'users.user_yim', array('function1' => 'phpbb_set_encoding')),
967 array('pf_phpbb_website', 'users.user_website', 'validate_website'),
968
969 'where' => 'users.user_id <> -1',
970 ),
971 ),
972 );
973 }
974