aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-10-04 18:13:59 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-10-04 18:13:59 +0000
commitbf8ac19eaa8d74f9dfd6d597190f5664e7339382 (patch)
treec3ad876736748e36cb9176a0248cc43badfc1d9a /phpBB/install
parent3215bbf88864139dc8c7e9ac5773b1ea8a7e96c1 (diff)
downloadforums-bf8ac19eaa8d74f9dfd6d597190f5664e7339382.tar
forums-bf8ac19eaa8d74f9dfd6d597190f5664e7339382.tar.gz
forums-bf8ac19eaa8d74f9dfd6d597190f5664e7339382.tar.bz2
forums-bf8ac19eaa8d74f9dfd6d597190f5664e7339382.tar.xz
forums-bf8ac19eaa8d74f9dfd6d597190f5664e7339382.zip
Move trunk/phpBB to old_trunk/phpBB
git-svn-id: file:///svn/phpbb/trunk@10210 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/install')
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php934
-rw-r--r--phpBB/install/convertors/functions_phpbb20.php1845
-rw-r--r--phpBB/install/database_update.php410
-rw-r--r--phpBB/install/index.php498
-rw-r--r--phpBB/install/install_convert.php2103
-rw-r--r--phpBB/install/install_install.php1886
-rw-r--r--phpBB/install/install_main.php76
-rw-r--r--phpBB/install/install_update.php1386
-rw-r--r--phpBB/install/phpinfo.php5
-rw-r--r--phpBB/install/schemas/schema_data.php877
-rw-r--r--phpBB/install/schemas/schema_structure.php1081
11 files changed, 0 insertions, 11101 deletions
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
deleted file mode 100644
index f9cc9ed194..0000000000
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ /dev/null
@@ -1,934 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-* NOTE to potential convertor authors. Please use this file to get
-* familiar with the structure since we added some bare explanations here.
-*
-* Since this file gets included more than once on one page you are not able to add functions to it.
-* Instead use a functions_ file.
-*
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-include(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
-unset($dbpasswd);
-
-/**
-* $convertor_data provides some basic information about this convertor which is
-* used on the initial list of convertors and to populate the default settings
-*/
-$convertor_data = array(
- 'forum_name' => 'phpBB 2.0.x',
- 'version' => '1.0.2',
- 'phpbb_version' => '3.0.3',
- 'author' => '<a href="http://www.phpbb.com/">phpBB Group</a>',
- 'dbms' => $dbms,
- 'dbhost' => $dbhost,
- 'dbport' => $dbport,
- 'dbuser' => $dbuser,
- 'dbpasswd' => '',
- 'dbname' => $dbname,
- 'table_prefix' => 'phpbb_',
- 'forum_path' => '../forums',
- 'author_notes' => '',
-);
-
-/**
-* $tables is a list of the tables (minus prefix) which we expect to find in the
-* source forum. It is used to guess the prefix if the specified prefix is incorrect
-*/
-$tables = array(
- 'auth_access',
- 'banlist',
- 'categories',
- 'disallow',
- 'forum_prune',
- 'forums',
- 'groups',
- 'posts',
- 'posts_text',
- 'privmsgs',
- 'privmsgs_text',
- 'ranks',
- 'smilies',
- 'topics',
- 'topics_watch',
- 'user_group',
- 'users',
- 'vote_desc',
- 'vote_results',
- 'vote_voters',
- 'words'
-);
-
-/**
-* $config_schema details how the board configuration information is stored in the source forum.
-*
-* 'table_format' can take the value 'file' to indicate a config file. In this case array_name
-* is set to indicate the name of the array the config values are stored in
-* 'table_format' can be an array if the values are stored in a table which is an assosciative array
-* (as per phpBB 2.0.x)
-* If left empty, values are assumed to be stored in a table where each config setting is
-* a column (as per phpBB 1.x)
-*
-* In either of the latter cases 'table_name' indicates the name of the table in the database
-*
-* 'settings' is an array which maps the name of the config directive in the source forum
-* to the config directive in phpBB3. It can either be a direct mapping or use a function.
-* Please note that the contents of the old config value are passed to the function, therefore
-* an in-built function requiring the variable passed by reference is not able to be used. Since
-* empty() is such a function we created the function is_empty() to be used instead.
-*/
-$config_schema = array(
- 'table_name' => 'config',
- 'table_format' => array('config_name' => 'config_value'),
- 'settings' => array(
- 'allow_bbcode' => 'allow_bbcode',
- 'allow_smilies' => 'allow_smilies',
- 'allow_sig' => 'allow_sig',
- 'allow_namechange' => 'allow_namechange',
- 'allow_avatar_local' => 'allow_avatar_local',
- 'allow_avatar_remote' => 'allow_avatar_remote',
- 'allow_avatar_upload' => 'allow_avatar_upload',
- 'board_disable' => 'board_disable',
- 'sitename' => 'phpbb_set_encoding(sitename)',
- 'site_desc' => 'phpbb_set_encoding(site_desc)',
- 'session_length' => 'session_length',
- 'board_email_sig' => 'phpbb_set_encoding(board_email_sig)',
- 'posts_per_page' => 'posts_per_page',
- 'topics_per_page' => 'topics_per_page',
- 'enable_confirm' => 'enable_confirm',
- 'board_email_form' => 'board_email_form',
- 'override_user_style' => 'override_user_style',
- 'hot_threshold' => 'hot_threshold',
- 'max_poll_options' => 'max_poll_options',
- 'max_sig_chars' => 'max_sig_chars',
- 'pm_max_msgs' => 'max_inbox_privmsgs',
- 'smtp_delivery' => 'smtp_delivery',
- 'smtp_host' => 'smtp_host',
- 'smtp_username' => 'smtp_username',
- 'smtp_password' => 'smtp_password',
- 'require_activation' => 'require_activation',
- 'flood_interval' => 'flood_interval',
- 'avatar_filesize' => 'avatar_filesize',
- 'avatar_max_width' => 'avatar_max_width',
- 'avatar_max_height' => 'avatar_max_height',
- 'default_dateformat' => 'default_dateformat',
- 'board_timezone' => 'board_timezone',
- 'allow_privmsg' => 'not(privmsg_disable)',
- 'gzip_compress' => 'gzip_compress',
- 'coppa_enable' => 'is_empty(coppa_mail)',
- 'coppa_fax' => 'coppa_fax',
- 'coppa_mail' => 'coppa_mail',
- 'record_online_users' => 'record_online_users',
- 'record_online_date' => 'record_online_date',
- 'board_startdate' => 'board_startdate',
- )
-);
-
-/**
-* $test_file is the name of a file which is present on the source
-* forum which can be used to check that the path specified by the
-* user was correct
-*/
-$test_file = 'modcp.php';
-
-/**
-* If this is set then we are not generating the first page of information but getting the conversion information.
-*/
-if (!$get_info)
-{
- // Test to see if the birthday MOD is installed on the source forum
- // Niels' birthday mod
- if (get_config_value('birthday_required') !== false || get_config_value('bday_require') !== false)
- {
- define('MOD_BIRTHDAY', true);
- }
-
- // TerraFrost's validated birthday mod
- if (get_config_value('bday_require') !== false)
- {
- define('MOD_BIRTHDAY_TERRA', true);
- }
-
- // Test to see if the attachment MOD is installed on the source forum
- // If it is, we will convert this data as well
- $src_db->sql_return_on_error(true);
-
- $sql = "SELECT config_value
- FROM {$convert->src_table_prefix}attachments_config
- WHERE config_name = 'upload_dir'";
- $result = $src_db->sql_query($sql);
-
- if ($result && $row = $src_db->sql_fetchrow($result))
- {
- // Here the constant is defined
- define('MOD_ATTACHMENT', true);
-
- // Here i add more tables to be checked in the old forum
- $tables += array(
- 'attachments',
- 'attachments_desc',
- 'extensions',
- 'extension_groups'
- );
-
- $src_db->sql_freeresult($result);
- }
- else if ($result)
- {
- $src_db->sql_freeresult($result);
- }
-
-
- /**
- * Tests for further MODs can be included here.
- * Please use constants for this, prefixing them with MOD_
- */
-
- $src_db->sql_return_on_error(false);
-
- // Now let us set a temporary config variable for user id incrementing
- $sql = "SELECT user_id
- FROM {$convert->src_table_prefix}users
- WHERE user_id = 1";
- $result = $src_db->sql_query($sql);
- $user_id = (int) $src_db->sql_fetchfield('user_id');
- $src_db->sql_freeresult($result);
-
- // If there is a user id 1, we need to increment user ids. :/
- if ($user_id === 1)
- {
- // Try to get the maximum user id possible...
- $sql = "SELECT MAX(user_id) AS max_user_id
- FROM {$convert->src_table_prefix}users";
- $result = $src_db->sql_query($sql);
- $user_id = (int) $src_db->sql_fetchfield('max_user_id');
- $src_db->sql_freeresult($result);
-
- set_config('increment_user_id', ($user_id + 1), true);
- }
- else
- {
- set_config('increment_user_id', 0, true);
- }
-
- // Overwrite maximum avatar width/height
- @define('DEFAULT_AVATAR_X_CUSTOM', get_config_value('avatar_max_width'));
- @define('DEFAULT_AVATAR_Y_CUSTOM', get_config_value('avatar_max_height'));
-
- // additional table used only during conversion
- @define('USERCONV_TABLE', $table_prefix . 'userconv');
-
-/**
-* Description on how to use the convertor framework.
-*
-* 'schema' Syntax Description
-* -> 'target' => Target Table. If not specified the next table will be handled
-* -> 'primary' => Primary Key. If this is specified then this table is processed in batches
-* -> 'query_first' => array('target' or 'src', Query to execute before beginning the process
-* (if more than one then specified as array))
-* -> 'function_first' => Function to execute before beginning the process (if more than one then specified as array)
-* (This is mostly useful if variables need to be given to the converting process)
-* -> 'test_file' => This is not used at the moment but should be filled with a file from the old installation
-*
-* // DB Functions
-* 'distinct' => Add DISTINCT to the select query
-* 'where' => Add WHERE to the select query
-* 'group_by' => Add GROUP BY to the select query
-* 'left_join' => Add LEFT JOIN to the select query (if more than one joins specified as array)
-* 'having' => Add HAVING to the select query
-*
-* // DB INSERT array
-* This one consist of three parameters
-* First Parameter:
-* The key need to be filled within the target table
-* If this is empty, the target table gets not assigned the source value
-* Second Parameter:
-* Source value. If the first parameter is specified, it will be assigned this value.
-* If the first parameter is empty, this only gets added to the select query
-* Third Parameter:
-* Custom Function. Function to execute while storing source value into target table.
-* The functions return value get stored.
-* The function parameter consist of the value of the second parameter.
-*
-* types:
-* - empty string == execute nothing
-* - string == function to execute
-* - array == complex execution instructions
-*
-* Complex execution instructions:
-* @todo test complex execution instructions - in theory they will work fine
-*
-* By defining an array as the third parameter you are able to define some statements to be executed. The key
-* is defining what to execute, numbers can be appended...
-*
-* 'function' => execute function
-* 'execute' => run code, whereby all occurrences of {VALUE} get replaced by the last returned value.
-* The result *must* be assigned/stored to {RESULT}.
-* 'typecast' => typecast value
-*
-* The returned variables will be made always available to the next function to continue to work with.
-*
-* example (variable inputted is an integer of 1):
-*
-* array(
-* 'function1' => 'increment_by_one', // returned variable is 2
-* 'typecast' => 'string', // typecast variable to be a string
-* 'execute' => '{RESULT} = {VALUE} . ' is good';', // returned variable is '2 is good'
-* 'function2' => 'replace_good_with_bad', // returned variable is '2 is bad'
-* ),
-*
-*/
-
- $convertor = array(
- 'test_file' => 'viewtopic.php',
-
- 'avatar_path' => get_config_value('avatar_path') . '/',
- 'avatar_gallery_path' => get_config_value('avatar_gallery_path') . '/',
- 'smilies_path' => get_config_value('smilies_path') . '/',
- 'upload_path' => (defined('MOD_ATTACHMENT')) ? phpbb_get_files_dir() . '/' : '',
- 'thumbnails' => (defined('MOD_ATTACHMENT')) ? array('thumbs/', 't_') : '',
- 'ranks_path' => false, // phpBB 2.0.x had no config value for a ranks path
-
- // We empty some tables to have clean data available
- 'query_first' => array(
- array('target', $convert->truncate_statement . SEARCH_RESULTS_TABLE),
- array('target', $convert->truncate_statement . SEARCH_WORDLIST_TABLE),
- array('target', $convert->truncate_statement . SEARCH_WORDMATCH_TABLE),
- array('target', $convert->truncate_statement . LOG_TABLE),
- ),
-
-// 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.
-// Instead every file gets copied while processing the corresponding attachment entry.
-// if (defined("MOD_ATTACHMENT")) { import_attachment_files(); phpbb_copy_thumbnails(); }
-
- // phpBB2 allowed some similar usernames to coexist which would have the same
- // username_clean in phpBB3 which is not possible, so we'll give the admin a list
- // of user ids and usernames and let him deicde what he wants to do with them
- 'execute_first' => '
- phpbb_create_userconv_table();
- import_avatar_gallery();
- if (defined("MOD_ATTACHMENT")) phpbb_import_attach_config();
- phpbb_insert_forums();
- ',
-
- 'execute_last' => array('
- add_bots();
- ', '
- update_folder_pm_count();
- ', '
- update_unread_count();
- ', '
- phpbb_convert_authentication(\'start\');
- ', '
- phpbb_convert_authentication(\'first\');
- ', '
- phpbb_convert_authentication(\'second\');
- ', '
- phpbb_convert_authentication(\'third\');
- '),
-
- 'schema' => array(
- array(
- 'target' => USERCONV_TABLE,
- 'query_first' => array('target', $convert->truncate_statement . USERCONV_TABLE),
-
-
- array('user_id', 'users.user_id', ''),
- array('username_clean', 'users.username', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_clean_string')),
- ),
-
- array(
- 'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
- 'primary' => 'attachments.attach_id',
- 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . ATTACHMENTS_TABLE) : '',
- 'autoincrement' => 'attach_id',
-
- array('attach_id', 'attachments.attach_id', ''),
- array('post_msg_id', 'attachments.post_id', ''),
- array('topic_id', 'posts.topic_id', ''),
- array('in_message', 0, ''),
- array('is_orphan', 0, ''),
- array('poster_id', 'attachments.user_id_1 AS poster_id', 'phpbb_user_id'),
- array('physical_filename', 'attachments_desc.physical_filename', 'import_attachment'),
- array('real_filename', 'attachments_desc.real_filename', 'phpbb_set_encoding'),
- array('download_count', 'attachments_desc.download_count', ''),
- array('attach_comment', 'attachments_desc.comment', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
- array('extension', 'attachments_desc.extension', ''),
- array('mimetype', 'attachments_desc.mimetype', ''),
- array('filesize', 'attachments_desc.filesize', ''),
- array('filetime', 'attachments_desc.filetime', ''),
- array('thumbnail', 'attachments_desc.thumbnail', ''),
-
- 'where' => 'attachments_desc.attach_id = attachments.attach_id AND attachments.privmsgs_id = 0 AND posts.post_id = attachments.post_id',
- 'group_by' => 'attachments.attach_id'
- ),
-
- array(
- 'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
- 'primary' => 'attachments.attach_id',
- 'autoincrement' => 'attach_id',
-
- array('attach_id', 'attachments.attach_id', ''),
- array('post_msg_id', 'attachments.privmsgs_id', ''),
- array('topic_id', 0, ''),
- array('in_message', 1, ''),
- array('is_orphan', 0, ''),
- array('poster_id', 'attachments.user_id_1 AS poster_id', 'phpbb_user_id'),
- array('physical_filename', 'attachments_desc.physical_filename', 'import_attachment'),
- array('real_filename', 'attachments_desc.real_filename', ''),
- array('download_count', 'attachments_desc.download_count', ''),
- array('attach_comment', 'attachments_desc.comment', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
- array('extension', 'attachments_desc.extension', ''),
- array('mimetype', 'attachments_desc.mimetype', ''),
- array('filesize', 'attachments_desc.filesize', ''),
- array('filetime', 'attachments_desc.filetime', ''),
- array('thumbnail', 'attachments_desc.thumbnail', ''),
-
- 'where' => 'attachments_desc.attach_id = attachments.attach_id AND attachments.post_id = 0',
- 'group_by' => 'attachments.attach_id'
- ),
-
- array(
- 'target' => (defined('MOD_ATTACHMENT')) ? EXTENSIONS_TABLE : '',
- 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSIONS_TABLE) : '',
- 'autoincrement' => 'extension_id',
-
- array('extension_id', 'extensions.ext_id', ''),
- array('group_id', 'extensions.group_id', ''),
- array('extension', 'extensions.extension', ''),
- ),
-
- array(
- 'target' => (defined('MOD_ATTACHMENT')) ? EXTENSION_GROUPS_TABLE : '',
- 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSION_GROUPS_TABLE) : '',
- 'autoincrement' => 'group_id',
-
- array('group_id', 'extension_groups.group_id', ''),
- array('group_name', 'extension_groups.group_name', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
- array('cat_id', 'extension_groups.cat_id', 'phpbb_attachment_category'),
- array('allow_group', 'extension_groups.allow_group', ''),
- array('download_mode', 1, ''),
- array('upload_icon', '', ''),
- array('max_filesize', 'extension_groups.max_filesize', ''),
- array('allowed_forums', 'extension_groups.forum_permissions', 'phpbb_attachment_forum_perms'),
- array('allow_in_pm', 1, ''),
- ),
-
- array(
- 'target' => BANLIST_TABLE,
- 'execute_first' => 'phpbb_check_username_collisions();',
- 'query_first' => array('target', $convert->truncate_statement . BANLIST_TABLE),
-
- array('ban_ip', 'banlist.ban_ip', 'decode_ban_ip'),
- array('ban_userid', 'banlist.ban_userid', 'phpbb_user_id'),
- array('ban_email', 'banlist.ban_email', ''),
- array('ban_reason', '', ''),
- array('ban_give_reason', '', ''),
-
- 'where' => "banlist.ban_ip NOT LIKE '%.%'",
- ),
-
- array(
- 'target' => BANLIST_TABLE,
-
- array('ban_ip', 'banlist.ban_ip', ''),
- array('ban_userid', 0, ''),
- array('ban_email', '', ''),
- array('ban_reason', '', ''),
- array('ban_give_reason', '', ''),
-
- 'where' => "banlist.ban_ip LIKE '%.%'",
- ),
-
- array(
- 'target' => DISALLOW_TABLE,
- 'query_first' => array('target', $convert->truncate_statement . DISALLOW_TABLE),
-
- array('disallow_username', 'disallow.disallow_username', 'phpbb_disallowed_username'),
- ),
-
- array(
- 'target' => RANKS_TABLE,
- 'query_first' => array('target', $convert->truncate_statement . RANKS_TABLE),
- 'autoincrement' => 'rank_id',
-
- array('rank_id', 'ranks.rank_id', ''),
- array('rank_title', 'ranks.rank_title', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_htmlspecialchars')),
- array('rank_min', 'ranks.rank_min', array('typecast' => 'int', 'execute' => '{RESULT} = ({VALUE}[0] < 0) ? 0 : {VALUE}[0];')),
- array('rank_special', 'ranks.rank_special', ''),
- array('rank_image', 'ranks.rank_image', 'import_rank'),
- ),
-
- array(
- 'target' => TOPICS_TABLE,
- 'query_first' => array('target', $convert->truncate_statement . TOPICS_TABLE),
- 'primary' => 'topics.topic_id',
- 'autoincrement' => 'topic_id',
-
- array('topic_id', 'topics.topic_id', ''),
- array('forum_id', 'topics.forum_id', ''),
- array('icon_id', 0, ''),
- array('topic_poster', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
- array('topic_attachment', ((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
- array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
- array('topic_time', 'topics.topic_time', ''),
- array('topic_views', 'topics.topic_views', ''),
- array('topic_replies', 'topics.topic_replies', ''),
- array('topic_replies_real', 'topics.topic_replies', ''),
- array('topic_last_post_id', 'topics.topic_last_post_id', ''),
- array('topic_status', 'topics.topic_status', 'is_topic_locked'),
- array('topic_moved_id', 0, ''),
- array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'),
- array('topic_first_post_id', 'topics.topic_first_post_id', ''),
- array('topic_last_view_time', 'posts.post_time', 'intval'),
- array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
- array('poll_start', 'vote_desc.vote_start', 'null_to_zero'),
- array('poll_length', 'vote_desc.vote_length', 'null_to_zero'),
- array('poll_max_options', 1, ''),
- array('poll_vote_change', 0, ''),
-
- 'left_join' => array ( 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
- 'topics LEFT JOIN posts ON topics.topic_last_post_id = posts.post_id',
- ),
- 'where' => 'topics.topic_moved_id = 0',
- ),
-
- array(
- 'target' => TOPICS_TABLE,
- 'primary' => 'topics.topic_id',
- 'autoincrement' => 'topic_id',
-
- array('topic_id', 'topics.topic_id', ''),
- array('forum_id', 'topics.forum_id', ''),
- array('icon_id', 0, ''),
- array('topic_poster', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
- array('topic_attachment', ((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
- array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
- array('topic_time', 'topics.topic_time', ''),
- array('topic_views', 'topics.topic_views', ''),
- array('topic_replies', 'topics.topic_replies', ''),
- array('topic_replies_real', 'topics.topic_replies', ''),
- array('topic_last_post_id', 'topics.topic_last_post_id', ''),
- array('topic_status', ITEM_MOVED, ''),
- array('topic_moved_id', 'topics.topic_moved_id', ''),
- array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'),
- array('topic_first_post_id', 'topics.topic_first_post_id', ''),
-
- array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
- array('poll_start', 'vote_desc.vote_start', 'null_to_zero'),
- array('poll_length', 'vote_desc.vote_length', 'null_to_zero'),
- array('poll_max_options', 1, ''),
- array('poll_vote_change', 0, ''),
-
- 'left_join' => 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
- 'where' => 'topics.topic_moved_id <> 0',
- ),
-
- array(
- 'target' => TOPICS_WATCH_TABLE,
- 'primary' => 'topics_watch.topic_id',
- 'query_first' => array('target', $convert->truncate_statement . TOPICS_WATCH_TABLE),
-
- array('topic_id', 'topics_watch.topic_id', ''),
- array('user_id', 'topics_watch.user_id', 'phpbb_user_id'),
- array('notify_status', 'topics_watch.notify_status', ''),
- ),
-
- array(
- 'target' => SMILIES_TABLE,
- 'query_first' => array('target', $convert->truncate_statement . SMILIES_TABLE),
- 'autoincrement' => 'smiley_id',
-
- array('smiley_id', 'smilies.smilies_id', ''),
- array('code', 'smilies.code', array('function1' => 'phpbb_smilie_html_decode', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
- array('emotion', 'smilies.emoticon', 'phpbb_set_encoding'),
- array('smiley_url', 'smilies.smile_url', 'import_smiley'),
- array('smiley_width', 'smilies.smile_url', 'get_smiley_width'),
- array('smiley_height', 'smilies.smile_url', 'get_smiley_height'),
- array('smiley_order', 'smilies.smilies_id', ''),
- array('display_on_posting', 'smilies.smilies_id', 'get_smiley_display'),
-
- 'order_by' => 'smilies.smilies_id ASC',
- ),
-
- array(
- 'target' => POLL_OPTIONS_TABLE,
- 'primary' => 'vote_results.vote_option_id',
- 'query_first' => array('target', $convert->truncate_statement . POLL_OPTIONS_TABLE),
-
- array('poll_option_id', 'vote_results.vote_option_id', ''),
- array('topic_id', 'vote_desc.topic_id', ''),
- array('', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
- array('poll_option_text', 'vote_results.vote_option_text', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
- array('poll_option_total', 'vote_results.vote_result', ''),
-
- 'where' => 'vote_results.vote_id = vote_desc.vote_id',
- 'left_join' => 'vote_desc LEFT JOIN topics ON topics.topic_id = vote_desc.topic_id',
- ),
-
- array(
- 'target' => POLL_VOTES_TABLE,
- 'primary' => 'vote_desc.topic_id',
- 'query_first' => array('target', $convert->truncate_statement . POLL_VOTES_TABLE),
-
- array('poll_option_id', VOTE_CONVERTED, ''),
- array('topic_id', 'vote_desc.topic_id', ''),
- array('vote_user_id', 'vote_voters.vote_user_id', 'phpbb_user_id'),
- array('vote_user_ip', 'vote_voters.vote_user_ip', 'decode_ip'),
-
- 'where' => 'vote_voters.vote_id = vote_desc.vote_id',
- ),
-
- array(
- 'target' => WORDS_TABLE,
- 'primary' => 'words.word_id',
- 'query_first' => array('target', $convert->truncate_statement . WORDS_TABLE),
- 'autoincrement' => 'word_id',
-
- array('word_id', 'words.word_id', ''),
- array('word', 'words.word', 'phpbb_set_encoding'),
- array('replacement', 'words.replacement', 'phpbb_set_encoding'),
- ),
-
- array(
- 'target' => POSTS_TABLE,
- 'primary' => 'posts.post_id',
- 'autoincrement' => 'post_id',
- 'query_first' => array('target', $convert->truncate_statement . POSTS_TABLE),
- 'execute_first' => '
- $config["max_post_chars"] = 0;
- $config["max_quote_depth"] = 0;
- ',
-
- array('post_id', 'posts.post_id', ''),
- array('topic_id', 'posts.topic_id', ''),
- array('forum_id', 'posts.forum_id', ''),
- array('poster_id', 'posts.poster_id', 'phpbb_user_id'),
- array('icon_id', 0, ''),
- array('poster_ip', 'posts.poster_ip', 'decode_ip'),
- array('post_time', 'posts.post_time', ''),
- array('enable_bbcode', 'posts.enable_bbcode', ''),
- array('', 'posts.enable_html', ''),
- array('enable_smilies', 'posts.enable_smilies', ''),
- array('enable_sig', 'posts.enable_sig', ''),
- array('enable_magic_url', 1, ''),
- array('post_username', 'posts.post_username', 'phpbb_set_encoding'),
- array('post_subject', 'posts_text.post_subject', 'phpbb_set_encoding'),
- array('post_attachment', ((defined('MOD_ATTACHMENT')) ? 'posts.post_attachment' : 0), ''),
- array('post_edit_time', 'posts.post_edit_time', array('typecast' => 'int')),
- array('post_edit_count', 'posts.post_edit_count', ''),
- array('post_edit_reason', '', ''),
- array('post_edit_user', '', 'phpbb_post_edit_user'),
-
- array('bbcode_uid', 'posts.post_time', 'make_uid'),
- array('post_text', 'posts_text.post_text', 'phpbb_prepare_message'),
- array('', 'posts_text.bbcode_uid AS old_bbcode_uid', ''),
- array('bbcode_bitfield', '', 'get_bbcode_bitfield'),
- array('post_checksum', '', ''),
-
- // Commented out inline search indexing, this takes up a LOT of time. :D
- // @todo We either need to enable this or call the rebuild search functionality post convert
-/* array('', '', 'search_indexing'),
- array('', 'posts_text.post_text AS message', ''),
- array('', 'posts_text.post_subject AS title', ''),*/
-
- 'where' => 'posts.post_id = posts_text.post_id'
- ),
-
- array(
- 'target' => PRIVMSGS_TABLE,
- 'primary' => 'privmsgs.privmsgs_id',
- 'autoincrement' => 'msg_id',
- 'query_first' => array(
- array('target', $convert->truncate_statement . PRIVMSGS_TABLE),
- array('target', $convert->truncate_statement . PRIVMSGS_RULES_TABLE),
- ),
-
- 'execute_first' => '
- $config["max_post_chars"] = 0;
- $config["max_quote_depth"] = 0;
- ',
-
- array('msg_id', 'privmsgs.privmsgs_id', ''),
- array('root_level', 0, ''),
- array('author_id', 'privmsgs.privmsgs_from_userid AS poster_id', 'phpbb_user_id'),
- array('icon_id', 0, ''),
- array('author_ip', 'privmsgs.privmsgs_ip', 'decode_ip'),
- array('message_time', 'privmsgs.privmsgs_date', ''),
- array('enable_bbcode', 'privmsgs.privmsgs_enable_bbcode AS enable_bbcode', ''),
- array('', 'privmsgs.privmsgs_enable_html AS enable_html', ''),
- array('enable_smilies', 'privmsgs.privmsgs_enable_smilies AS enable_smilies', ''),
- array('enable_magic_url', 1, ''),
- array('enable_sig', 'privmsgs.privmsgs_attach_sig', ''),
- array('message_subject', 'privmsgs.privmsgs_subject', 'phpbb_set_encoding'), // Already specialchared in 2.0.x
- array('message_attachment', ((defined('MOD_ATTACHMENT')) ? 'privmsgs.privmsgs_attachment' : 0), ''),
- array('message_edit_reason', '', ''),
- array('message_edit_user', 0, ''),
- array('message_edit_time', 0, ''),
- array('message_edit_count', 0, ''),
-
- array('bbcode_uid', 'privmsgs.privmsgs_date AS post_time', 'make_uid'),
- array('message_text', 'privmsgs_text.privmsgs_text', 'phpbb_prepare_message'),
- array('', 'privmsgs_text.privmsgs_bbcode_uid AS old_bbcode_uid', ''),
- array('bbcode_bitfield', '', 'get_bbcode_bitfield'),
- array('to_address', 'privmsgs.privmsgs_to_userid', 'phpbb_privmsgs_to_userid'),
- array('bcc_address', '', ''),
-
- 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id'
- ),
-
- array(
- 'target' => PRIVMSGS_FOLDER_TABLE,
- 'primary' => 'users.user_id',
- 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_FOLDER_TABLE),
-
- array('user_id', 'users.user_id', 'phpbb_user_id'),
- array('folder_name', $user->lang['CONV_SAVED_MESSAGES'], ''),
- array('pm_count', 0, ''),
-
- 'where' => 'users.user_id <> -1',
- ),
-
- // Inbox
- array(
- 'target' => PRIVMSGS_TO_TABLE,
- 'primary' => 'privmsgs.privmsgs_id',
- 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_TO_TABLE),
-
- array('msg_id', 'privmsgs.privmsgs_id', ''),
- array('user_id', 'privmsgs.privmsgs_to_userid', 'phpbb_user_id'),
- array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('pm_deleted', 0, ''),
- array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
- array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
- array('pm_replied', 0, ''),
- array('pm_marked', 0, ''),
- array('pm_forwarded', 0, ''),
- array('folder_id', PRIVMSGS_INBOX, ''),
-
- 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
- AND (privmsgs.privmsgs_type = 0 OR privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
- ),
-
- // Outbox
- array(
- 'target' => PRIVMSGS_TO_TABLE,
- 'primary' => 'privmsgs.privmsgs_id',
-
- array('msg_id', 'privmsgs.privmsgs_id', ''),
- array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('pm_deleted', 0, ''),
- array('pm_new', 0, ''),
- array('pm_unread', 0, ''),
- array('pm_replied', 0, ''),
- array('pm_marked', 0, ''),
- array('pm_forwarded', 0, ''),
- array('folder_id', PRIVMSGS_OUTBOX, ''),
-
- 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
- AND (privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
- ),
-
- // Sentbox
- array(
- 'target' => PRIVMSGS_TO_TABLE,
- 'primary' => 'privmsgs.privmsgs_id',
-
- array('msg_id', 'privmsgs.privmsgs_id', ''),
- array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('pm_deleted', 0, ''),
- array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
- array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
- array('pm_replied', 0, ''),
- array('pm_marked', 0, ''),
- array('pm_forwarded', 0, ''),
- array('folder_id', PRIVMSGS_SENTBOX, ''),
-
- 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
- AND privmsgs.privmsgs_type = 2',
- ),
-
- // Savebox (SAVED IN)
- array(
- 'target' => PRIVMSGS_TO_TABLE,
- 'primary' => 'privmsgs.privmsgs_id',
-
- array('msg_id', 'privmsgs.privmsgs_id', ''),
- array('user_id', 'privmsgs.privmsgs_to_userid', 'phpbb_user_id'),
- array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('pm_deleted', 0, ''),
- array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
- array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
- array('pm_replied', 0, ''),
- array('pm_marked', 0, ''),
- array('pm_forwarded', 0, ''),
- array('folder_id', 'privmsgs.privmsgs_to_userid', 'phpbb_get_savebox_id'),
-
- 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
- AND privmsgs.privmsgs_type = 3',
- ),
-
- // Savebox (SAVED OUT)
- array(
- 'target' => PRIVMSGS_TO_TABLE,
- 'primary' => 'privmsgs.privmsgs_id',
-
- array('msg_id', 'privmsgs.privmsgs_id', ''),
- array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
- array('pm_deleted', 0, ''),
- array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
- array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
- array('pm_replied', 0, ''),
- array('pm_marked', 0, ''),
- array('pm_forwarded', 0, ''),
- array('folder_id', 'privmsgs.privmsgs_from_userid', 'phpbb_get_savebox_id'),
-
- 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
- AND privmsgs.privmsgs_type = 4',
- ),
-
- array(
- 'target' => GROUPS_TABLE,
- 'autoincrement' => 'group_id',
- 'query_first' => array('target', $convert->truncate_statement . GROUPS_TABLE),
-
- array('group_id', 'groups.group_id', ''),
- array('group_type', 'groups.group_type', 'phpbb_convert_group_type'),
- array('group_display', 0, ''),
- array('group_legend', 0, ''),
- array('group_name', 'groups.group_name', 'phpbb_convert_group_name'), // phpbb_set_encoding called in phpbb_convert_group_name
- array('group_name_clean', 'groups.group_name', 'phpbb_convert_group_name_clean'), // phpbb_set_encoding called in phpbb_convert_group_name
- array('group_desc', 'groups.group_description', 'phpbb_set_encoding'),
-
- 'where' => 'groups.group_single_user = 0',
- ),
-
- array(
- 'target' => USER_GROUP_TABLE,
- 'query_first' => array('target', $convert->truncate_statement . USER_GROUP_TABLE),
- 'execute_first' => '
- add_default_groups();
- ',
-
- array('group_id', 'groups.group_id', ''),
- array('user_id', 'groups.group_moderator', 'phpbb_user_id'),
- array('group_leader', 1, ''),
- array('user_pending', 0, ''),
-
- 'where' => 'groups.group_single_user = 0 AND groups.group_moderator <> 0',
- ),
-
- array(
- 'target' => USER_GROUP_TABLE,
-
- array('group_id', 'user_group.group_id', ''),
- array('user_id', 'user_group.user_id', 'phpbb_user_id'),
- array('group_leader', 0, ''),
- array('user_pending', 'user_group.user_pending', ''),
-
- 'where' => 'user_group.group_id = groups.group_id AND groups.group_single_user = 0 AND groups.group_moderator <> user_group.user_id',
- ),
-
- array(
- 'target' => USERS_TABLE,
- 'primary' => 'users.user_id',
- 'autoincrement' => 'user_id',
- 'query_first' => array(
- array('target', 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS),
- array('target', $convert->truncate_statement . BOTS_TABLE)
- ),
-
- 'execute_last' => '
- remove_invalid_users();
- ',
-
- array('user_id', 'users.user_id', 'phpbb_user_id'),
- array('', 'users.user_id AS poster_id', 'phpbb_user_id'),
- array('user_type', 'users.user_active', 'set_user_type'),
- array('group_id', 'users.user_level', 'phpbb_set_primary_group'),
- array('user_regdate', 'users.user_regdate', ''),
- array('username', 'users.username', 'phpbb_set_default_encoding'), // recode to utf8 with default lang
- array('username_clean', 'users.username', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_clean_string')),
- array('user_password', 'users.user_password', 'phpbb_hash'),
- array('user_pass_convert', 1, ''),
- array('user_posts', 'users.user_posts', 'intval'),
- array('user_email', 'users.user_email', 'strtolower'),
- array('user_email_hash', 'users.user_email', 'gen_email_hash'),
- array('user_birthday', ((defined('MOD_BIRTHDAY')) ? 'users.user_birthday' : ''), 'phpbb_get_birthday'),
- array('user_lastvisit', 'users.user_lastvisit', 'intval'),
- array('user_lastmark', 'users.user_lastvisit', 'intval'),
- array('user_lang', $config['default_lang'], ''),
- array('', 'users.user_lang', ''),
- array('user_timezone', 'users.user_timezone', 'floatval'),
- array('user_dateformat', 'users.user_dateformat', array('function1' => 'phpbb_set_encoding', 'function2' => 'fill_dateformat')),
- array('user_inactive_reason', '', 'phpbb_inactive_reason'),
- array('user_inactive_time', '', 'phpbb_inactive_time'),
-
- array('user_interests', 'users.user_interests', array('function1' => 'phpbb_set_encoding')),
- array('user_occ', 'users.user_occ', array('function1' => 'phpbb_set_encoding')),
- array('user_website', 'users.user_website', 'validate_website'),
- array('user_jabber', '', ''),
- array('user_msnm', 'users.user_msnm', array('function1' => 'phpbb_set_encoding')),
- array('user_yim', 'users.user_yim', array('function1' => 'phpbb_set_encoding')),
- array('user_aim', 'users.user_aim', array('function1' => 'phpbb_set_encoding')),
- array('user_icq', 'users.user_icq', array('function1' => 'phpbb_set_encoding')),
- array('user_from', 'users.user_from', array('function1' => 'phpbb_set_encoding')),
- array('user_rank', 'users.user_rank', 'intval'),
- array('user_permissions', '', ''),
-
- array('user_avatar', 'users.user_avatar', 'phpbb_import_avatar'),
- array('user_avatar_type', 'users.user_avatar_type', 'phpbb_avatar_type'),
- array('user_avatar_width', 'users.user_avatar', 'phpbb_get_avatar_width'),
- array('user_avatar_height', 'users.user_avatar', 'phpbb_get_avatar_height'),
-
- array('user_new_privmsg', 'users.user_new_privmsg', ''),
- array('user_unread_privmsg', 0, ''), //'users.user_unread_privmsg'
- array('user_last_privmsg', 'users.user_last_privmsg', 'intval'),
- array('user_emailtime', 'users.user_emailtime', 'null_to_zero'),
- array('user_notify', 'users.user_notify', 'intval'),
- array('user_notify_pm', 'users.user_notify_pm', 'intval'),
- array('user_notify_type', NOTIFY_EMAIL, ''),
- array('user_allow_pm', 'users.user_allow_pm', 'intval'),
- array('user_allow_viewonline', 'users.user_allow_viewonline', 'intval'),
- array('user_allow_viewemail', 'users.user_viewemail', 'intval'),
- array('user_actkey', 'users.user_actkey', ''),
- array('user_newpasswd', '', ''), // Users need to re-request their password...
- array('user_style', $config['default_style'], ''),
-
- array('user_options', '', 'set_user_options'),
- array('', 'users.user_popup_pm AS popuppm', ''),
- array('', 'users.user_allowhtml AS html', ''),
- array('', 'users.user_allowbbcode AS bbcode', ''),
- array('', 'users.user_allowsmile AS smile', ''),
- array('', 'users.user_attachsig AS attachsig',''),
-
- array('user_sig_bbcode_uid', 'users.user_regdate', 'make_uid'),
- array('user_sig', 'users.user_sig', 'phpbb_prepare_message'),
- array('', 'users.user_sig_bbcode_uid AS old_bbcode_uid', ''),
- array('user_sig_bbcode_bitfield', '', 'get_bbcode_bitfield'),
- array('', 'users.user_regdate AS post_time', ''),
-
- 'where' => 'users.user_id <> -1',
- ),
- ),
- );
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
deleted file mode 100644
index 4b04f85ba7..0000000000
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ /dev/null
@@ -1,1845 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Helper functions for phpBB 2.0.x to phpBB 3.0.x conversion
-*/
-
-/**
-* Set forum flags - only prune old polls by default
-*/
-function phpbb_forum_flags()
-{
- // Set forum flags
- $forum_flags = 0;
-
- // FORUM_FLAG_LINK_TRACK
- $forum_flags += 0;
-
- // FORUM_FLAG_PRUNE_POLL
- $forum_flags += FORUM_FLAG_PRUNE_POLL;
-
- // FORUM_FLAG_PRUNE_ANNOUNCE
- $forum_flags += 0;
-
- // FORUM_FLAG_PRUNE_STICKY
- $forum_flags += 0;
-
- // FORUM_FLAG_ACTIVE_TOPICS
- $forum_flags += 0;
-
- // FORUM_FLAG_POST_REVIEW
- $forum_flags += FORUM_FLAG_POST_REVIEW;
-
- return $forum_flags;
-}
-
-/**
-* Insert/Convert forums
-*/
-function phpbb_insert_forums()
-{
- global $db, $src_db, $same_db, $convert, $user, $config;
-
- $db->sql_query($convert->truncate_statement . FORUMS_TABLE);
-
- // Determine the highest id used within the old forums table (we add the categories after the forum ids)
- $sql = 'SELECT MAX(forum_id) AS max_forum_id
- FROM ' . $convert->src_table_prefix . 'forums';
- $result = $src_db->sql_query($sql);
- $max_forum_id = (int) $src_db->sql_fetchfield('max_forum_id');
- $src_db->sql_freeresult($result);
-
- $max_forum_id++;
-
- // pruning disabled globally?
- $sql = "SELECT config_value
- FROM {$convert->src_table_prefix}config
- WHERE config_name = 'prune_enable'";
- $result = $src_db->sql_query($sql);
- $prune_enabled = (int) $src_db->sql_fetchfield('config_value');
- $src_db->sql_freeresult($result);
-
-
- // Insert categories
- $sql = 'SELECT cat_id, cat_title
- FROM ' . $convert->src_table_prefix . 'categories
- ORDER BY cat_order';
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- $result = $src_db->sql_query($sql);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- if ($db->dbms_type == 'mssql')
- {
- $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' ON');
- }
-
- $cats_added = array();
- while ($row = $src_db->sql_fetchrow($result))
- {
- $sql_ary = array(
- 'forum_id' => (int) $max_forum_id,
- 'forum_name' => ($row['cat_title']) ? htmlspecialchars(phpbb_set_default_encoding($row['cat_title']), ENT_COMPAT, 'UTF-8') : $user->lang['CATEGORY'],
- 'parent_id' => 0,
- 'forum_parents' => '',
- 'forum_desc' => '',
- 'forum_type' => FORUM_CAT,
- 'forum_status' => ITEM_UNLOCKED,
- 'forum_rules' => '',
- );
-
- $sql = 'SELECT MAX(right_id) AS right_id
- FROM ' . FORUMS_TABLE;
- $_result = $db->sql_query($sql);
- $cat_row = $db->sql_fetchrow($_result);
- $db->sql_freeresult($_result);
-
- $sql_ary['left_id'] = (int) ($cat_row['right_id'] + 1);
- $sql_ary['right_id'] = (int) ($cat_row['right_id'] + 2);
-
- $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
- $db->sql_query($sql);
-
- $cats_added[$row['cat_id']] = $max_forum_id;
- $max_forum_id++;
- }
- $src_db->sql_freeresult($result);
-
- // There may be installations having forums with non-existant category ids.
- // We try to catch them and add them to an "unknown" category instead of leaving them out.
- $sql = 'SELECT cat_id
- FROM ' . $convert->src_table_prefix . 'forums
- GROUP BY cat_id';
- $result = $src_db->sql_query($sql);
-
- $unknown_cat_id = false;
- while ($row = $src_db->sql_fetchrow($result))
- {
- // Catch those categories not been added before
- if (!isset($cats_added[$row['cat_id']]))
- {
- $unknown_cat_id = true;
- }
- }
- $src_db->sql_freeresult($result);
-
- // Is there at least one category not known?
- if ($unknown_cat_id === true)
- {
- $unknown_cat_id = 'ghost';
-
- $sql_ary = array(
- 'forum_id' => (int) $max_forum_id,
- 'forum_name' => (string) $user->lang['CATEGORY'],
- 'parent_id' => 0,
- 'forum_parents' => '',
- 'forum_desc' => '',
- 'forum_type' => FORUM_CAT,
- 'forum_status' => ITEM_UNLOCKED,
- 'forum_rules' => '',
- );
-
- $sql = 'SELECT MAX(right_id) AS right_id
- FROM ' . FORUMS_TABLE;
- $_result = $db->sql_query($sql);
- $cat_row = $db->sql_fetchrow($_result);
- $db->sql_freeresult($_result);
-
- $sql_ary['left_id'] = (int) ($cat_row['right_id'] + 1);
- $sql_ary['right_id'] = (int) ($cat_row['right_id'] + 2);
-
- $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
- $db->sql_query($sql);
-
- $cats_added[$unknown_cat_id] = $max_forum_id;
- $max_forum_id++;
- }
-
- // Now insert the forums
- $sql = 'SELECT f.forum_id, f.forum_name, f.cat_id, f.forum_desc, f.forum_status, f.prune_enable, f.prune_next, fp.prune_days, fp.prune_freq FROM ' . $convert->src_table_prefix . 'forums f
- LEFT JOIN ' . $convert->src_table_prefix . 'forum_prune fp ON f.forum_id = fp.forum_id
- GROUP BY f.forum_id, f.forum_name, f.cat_id, f.forum_desc, f.forum_status, f.prune_enable, f.prune_next, f.forum_order, fp.prune_days, fp.prune_freq
- ORDER BY f.cat_id, f.forum_order';
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- $result = $src_db->sql_query($sql);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- while ($row = $src_db->sql_fetchrow($result))
- {
- // Some might have forums here with an id not being "possible"...
- // To be somewhat friendly we "change" the category id for those to a previously created ghost category
- if (!isset($cats_added[$row['cat_id']]) && $unknown_cat_id !== false)
- {
- $row['cat_id'] = $unknown_cat_id;
- }
-
- if (!isset($cats_added[$row['cat_id']]))
- {
- continue;
- }
-
- // Define the new forums sql ary
- $sql_ary = array(
- 'forum_id' => (int) $row['forum_id'],
- 'forum_name' => htmlspecialchars(phpbb_set_default_encoding($row['forum_name']), ENT_COMPAT, 'UTF-8'),
- 'parent_id' => (int) $cats_added[$row['cat_id']],
- 'forum_parents' => '',
- 'forum_desc' => htmlspecialchars(phpbb_set_default_encoding($row['forum_desc']), ENT_COMPAT, 'UTF-8'),
- 'forum_type' => FORUM_POST,
- 'forum_status' => is_item_locked($row['forum_status']),
- 'enable_prune' => ($prune_enabled) ? (int)$row['prune_enable'] : 0,
- 'prune_next' => (int) null_to_zero($row['prune_next']),
- 'prune_days' => (int) null_to_zero($row['prune_days']),
- 'prune_viewed' => 0,
- 'prune_freq' => (int) null_to_zero($row['prune_freq']),
-
- 'forum_flags' => phpbb_forum_flags(),
-
- // Default values
- 'forum_desc_bitfield' => '',
- 'forum_desc_options' => 7,
- 'forum_desc_uid' => '',
- 'forum_link' => '',
- 'forum_password' => '',
- 'forum_style' => 0,
- 'forum_image' => '',
- 'forum_rules' => '',
- 'forum_rules_link' => '',
- 'forum_rules_bitfield' => '',
- 'forum_rules_options' => 7,
- 'forum_rules_uid' => '',
- 'forum_topics_per_page' => 0,
- 'forum_posts' => 0,
- 'forum_topics' => 0,
- 'forum_topics_real' => 0,
- 'forum_last_post_id' => 0,
- 'forum_last_poster_id' => 0,
- 'forum_last_post_subject' => '',
- 'forum_last_post_time' => 0,
- 'forum_last_poster_name' => '',
- 'forum_last_poster_colour' => '',
- 'display_on_index' => 1,
- 'enable_indexing' => 1,
- 'enable_icons' => 0,
- );
-
- // Now add the forums with proper left/right ids
- $sql = 'SELECT left_id, right_id
- FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . $cats_added[$row['cat_id']];
- $_result = $db->sql_query($sql);
- $cat_row = $db->sql_fetchrow($_result);
- $db->sql_freeresult($_result);
-
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET left_id = left_id + 2, right_id = right_id + 2
- WHERE left_id > ' . $cat_row['right_id'];
- $db->sql_query($sql);
-
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET right_id = right_id + 2
- WHERE ' . $cat_row['left_id'] . ' BETWEEN left_id AND right_id';
- $db->sql_query($sql);
-
- $sql_ary['left_id'] = (int) $cat_row['right_id'];
- $sql_ary['right_id'] = (int) ($cat_row['right_id'] + 1);
-
- $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
- $db->sql_query($sql);
- }
- $src_db->sql_freeresult($result);
-
- switch ($db->dbms_type)
- {
- case 'postgres':
- $db->sql_query("SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));');
- break;
-
- case 'mssql':
- $db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' OFF');
- break;
-
- case 'oracle':
- $result = $db->sql_query('SELECT MAX(forum_id) as max_id FROM ' . FORUMS_TABLE);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $largest_id = (int) $row['max_id'];
-
- if ($largest_id)
- {
- $db->sql_query('DROP SEQUENCE ' . FORUMS_TABLE . '_seq');
- $db->sql_query('CREATE SEQUENCE ' . FORUMS_TABLE . '_seq START WITH ' . ($largest_id + 1));
- }
- break;
- }
-}
-
-/**
-* Function for recoding text with the default language
-*
-* @param string $text text to recode to utf8
-* @param bool $grab_user_lang if set to true the function tries to use $convert_row['user_lang'] (and falls back to $convert_row['poster_id']) instead of the boards default language
-*/
-function phpbb_set_encoding($text, $grab_user_lang = true)
-{
- global $lang_enc_array, $convert_row;
- global $convert;
-
- /*static $lang_enc_array = array(
- 'korean' => 'euc-kr',
- 'serbian' => 'windows-1250',
- 'polish' => 'iso-8859-2',
- 'kurdish' => 'windows-1254',
- 'slovak' => 'Windows-1250',
- 'russian' => 'windows-1251',
- 'estonian' => 'iso-8859-4',
- 'chinese_simplified' => 'gb2312',
- 'macedonian' => 'windows-1251',
- 'azerbaijani' => 'UTF-8',
- 'romanian' => 'iso-8859-2',
- 'romanian_diacritice' => 'iso-8859-2',
- 'lithuanian' => 'windows-1257',
- 'turkish' => 'iso-8859-9',
- 'ukrainian' => 'windows-1251',
- 'japanese' => 'shift_jis',
- 'hungarian' => 'ISO-8859-2',
- 'romanian_no_diacritics' => 'iso-8859-2',
- 'mongolian' => 'UTF-8',
- 'slovenian' => 'windows-1250',
- 'bosnian' => 'windows-1250',
- 'czech' => 'Windows-1250',
- 'farsi' => 'Windows-1256',
- 'croatian' => 'windows-1250',
- 'greek' => 'iso-8859-7',
- 'russian_tu' => 'windows-1251',
- 'sakha' => 'UTF-8',
- 'serbian_cyrillic' => 'windows-1251',
- 'bulgarian' => 'windows-1251',
- 'chinese_traditional_taiwan' => 'big5',
- 'chinese_traditional' => 'big5',
- 'arabic' => 'windows-1256',
- 'hebrew' => 'WINDOWS-1255',
- 'thai' => 'windows-874',
- //'chinese_traditional_taiwan' => 'utf-8' // custom modified, we may have to do an include :-(
- );*/
-
- if (empty($lang_enc_array))
- {
- $lang_enc_array = array();
- }
-
- $get_lang = trim(get_config_value('default_lang'));
-
- // Do we need the users language encoding?
- if ($grab_user_lang && !empty($convert_row))
- {
- if (!empty($convert_row['user_lang']))
- {
- $get_lang = trim($convert_row['user_lang']);
- }
- else if (!empty($convert_row['poster_id']))
- {
- global $src_db, $same_db;
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- $sql = 'SELECT user_lang
- FROM ' . $convert->src_table_prefix . 'users
- WHERE user_id = ' . (int) $convert_row['poster_id'];
- $result = $src_db->sql_query($sql);
- $get_lang = (string) $src_db->sql_fetchfield('user_lang');
- $src_db->sql_freeresult($result);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- $get_lang = (!trim($get_lang)) ? trim(get_config_value('default_lang')) : trim($get_lang);
- }
- }
-
- if (!isset($lang_enc_array[$get_lang]))
- {
- $filename = $convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . PHP_EXT;
-
- if (!file_exists($filename))
- {
- $get_lang = trim(get_config_value('default_lang'));
- }
-
- if (!isset($lang_enc_array[$get_lang]))
- {
- include($convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . PHP_EXT);
- $lang_enc_array[$get_lang] = $lang['ENCODING'];
- unset($lang);
- }
- }
-
- $encoding = $lang_enc_array[$get_lang];
-
- return utf8_recode($text, $lang_enc_array[$get_lang]);
-}
-
-/**
-* Same as phpbb_set_encoding, but forcing boards default language
-*/
-function phpbb_set_default_encoding($text)
-{
- return phpbb_set_encoding($text, false);
-}
-
-/**
-* Convert Birthday from Birthday MOD to phpBB Format
-*/
-function phpbb_get_birthday($birthday = '')
-{
- if (defined('MOD_BIRTHDAY_TERRA'))
- {
- $birthday = (string) $birthday;
-
- // stored as month, day, year
- if (!$birthday)
- {
- return ' 0- 0- 0';
- }
-
- // We use the original mod code to retrieve the birthday (not ideal)
- preg_match('/(..)(..)(....)/', sprintf('%08d', $birthday), $birthday_parts);
-
- $month = $birthday_parts[1];
- $day = $birthday_parts[2];
- $year = $birthday_parts[3];
-
- return sprintf('%2d-%2d-%4d', $day, $month, $year);
- }
- else
- {
- $birthday = (int) $birthday;
-
- if (!$birthday || $birthday == 999999 || $birthday < 0)
- {
- return ' 0- 0- 0';
- }
-
- // The birthday mod from niels is using this code to transform to day/month/year
- return sprintf('%2d-%2d-%4d', gmdate('j', $birthday * 86400 + 1), gmdate('n', $birthday * 86400 + 1), gmdate('Y', $birthday * 86400 + 1));
- }
-}
-
-/**
-* Return correct user id value
-* Everyone's id will be one higher to allow the guest/anonymous user to have a positive id as well
-*/
-function phpbb_user_id($user_id)
-{
- global $config;
-
- // Increment user id if the old forum is having a user with the id 1
- if (!isset($config['increment_user_id']))
- {
- global $src_db, $same_db, $convert;
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- // Now let us set a temporary config variable for user id incrementing
- $sql = "SELECT user_id
- FROM {$convert->src_table_prefix}users
- WHERE user_id = 1";
- $result = $src_db->sql_query($sql);
- $id = (int) $src_db->sql_fetchfield('user_id');
- $src_db->sql_freeresult($result);
-
- // Try to get the maximum user id possible...
- $sql = "SELECT MAX(user_id) AS max_user_id
- FROM {$convert->src_table_prefix}users";
- $result = $src_db->sql_query($sql);
- $max_id = (int) $src_db->sql_fetchfield('max_user_id');
- $src_db->sql_freeresult($result);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- // If there is a user id 1, we need to increment user ids. :/
- if ($id === 1)
- {
- set_config('increment_user_id', ($max_id + 1), true);
- $config['increment_user_id'] = $max_id + 1;
- }
- else
- {
- set_config('increment_user_id', 0, true);
- $config['increment_user_id'] = 0;
- }
- }
-
- // If the old user id is -1 in 2.0.x it is the anonymous user...
- if ($user_id == -1)
- {
- return ANONYMOUS;
- }
-
- if (!empty($config['increment_user_id']) && $user_id == 1)
- {
- return $config['increment_user_id'];
- }
-
- // A user id of 0 can happen, for example within the ban table if no user is banned...
- // Within the posts and topics table this can be "dangerous" but is the fault of the user
- // having mods installed (a poster id of 0 is not possible in 2.0.x).
- // Therefore, we return the user id "as is".
-
- return (int) $user_id;
-}
-
-/* Copy additional table fields from old forum to new forum if user wants this (for Mod compatibility for example)
-function phpbb_copy_table_fields()
-{
-}
-*/
-
-/**
-* Convert authentication
-* user, group and forum table has to be filled in order to work
-*/
-function phpbb_convert_authentication($mode)
-{
- global $db, $src_db, $same_db, $convert, $user, $config;
-
- if ($mode == 'start')
- {
- $db->sql_query($convert->truncate_statement . ACL_USERS_TABLE);
- $db->sql_query($convert->truncate_statement . ACL_GROUPS_TABLE);
-
- // What we will do is handling all 2.0.x admins as founder to replicate what is common in 2.0.x.
- // After conversion the main admin need to make sure he is removing permissions and the founder status if wanted.
-
-
- // Grab user ids of users with user_level of ADMIN
- $sql = "SELECT user_id
- FROM {$convert->src_table_prefix}users
- WHERE user_level = 1
- ORDER BY user_regdate ASC";
- $result = $src_db->sql_query($sql);
-
- while ($row = $src_db->sql_fetchrow($result))
- {
- $user_id = (int) phpbb_user_id($row['user_id']);
- // Set founder admin...
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_type = ' . USER_FOUNDER . "
- WHERE user_id = $user_id";
- $db->sql_query($sql);
- }
- $src_db->sql_freeresult($result);
-
- $sql = 'SELECT group_id
- FROM ' . GROUPS_TABLE . "
- WHERE group_name_clean = '" . $db->sql_escape('bots') . "'";
- $result = $db->sql_query($sql);
- $bot_group_id = (int) $db->sql_fetchfield('group_id');
- $db->sql_freeresult($result);
- }
-
- // Grab forum auth information
- $sql = "SELECT *
- FROM {$convert->src_table_prefix}forums";
- $result = $src_db->sql_query($sql);
-
- $forum_access = array();
- while ($row = $src_db->sql_fetchrow($result))
- {
- $forum_access[$row['forum_id']] = $row;
- }
- $src_db->sql_freeresult($result);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
- // Grab user auth information from 2.0.x board
- $sql = "SELECT ug.user_id, aa.*
- FROM {$convert->src_table_prefix}auth_access aa, {$convert->src_table_prefix}user_group ug, {$convert->src_table_prefix}groups g, {$convert->src_table_prefix}forums f
- WHERE g.group_id = aa.group_id
- AND g.group_single_user = 1
- AND ug.group_id = g.group_id
- AND f.forum_id = aa.forum_id";
- $result = $src_db->sql_query($sql);
-
- $user_access = array();
- while ($row = $src_db->sql_fetchrow($result))
- {
- $user_access[$row['forum_id']][] = $row;
- }
- $src_db->sql_freeresult($result);
-
- // Grab group auth information
- $sql = "SELECT g.group_id, aa.*
- FROM {$convert->src_table_prefix}auth_access aa, {$convert->src_table_prefix}groups g
- WHERE g.group_id = aa.group_id
- AND g.group_single_user <> 1";
- $result = $src_db->sql_query($sql);
-
- $group_access = array();
- while ($row = $src_db->sql_fetchrow($result))
- {
- $group_access[$row['forum_id']][] = $row;
- }
- $src_db->sql_freeresult($result);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- // Add Forum Access List
- $auth_map = array(
- 'auth_view' => array('f_', 'f_list'),
- 'auth_read' => array('f_read', 'f_search'),
- 'auth_post' => array('f_post', 'f_bbcode', 'f_smilies', 'f_img', 'f_sigs', 'f_postcount', 'f_report', 'f_subscribe', 'f_print', 'f_email'),
- 'auth_reply' => 'f_reply',
- 'auth_edit' => 'f_edit',
- 'auth_delete' => 'f_delete',
- 'auth_pollcreate' => 'f_poll',
- 'auth_vote' => 'f_vote',
- 'auth_announce' => 'f_announce',
- 'auth_sticky' => 'f_sticky',
- 'auth_attachments' => array('f_attach', 'f_download'),
- 'auth_download' => 'f_download',
- );
-
- // Define the ACL constants used in 2.0 to make the code slightly more readable
- define('AUTH_ALL', 0);
- define('AUTH_REG', 1);
- define('AUTH_ACL', 2);
- define('AUTH_MOD', 3);
- define('AUTH_ADMIN', 5);
-
- // A mapping of the simple permissions used by 2.0
- $simple_auth_ary = array(
- 'public' => array(
- 'auth_view' => AUTH_ALL,
- 'auth_read' => AUTH_ALL,
- 'auth_post' => AUTH_ALL,
- 'auth_reply' => AUTH_ALL,
- 'auth_edit' => AUTH_REG,
- 'auth_delete' => AUTH_REG,
- 'auth_sticky' => AUTH_MOD,
- 'auth_announce' => AUTH_MOD,
- 'auth_vote' => AUTH_REG,
- 'auth_pollcreate' => AUTH_REG,
- ),
- 'registered' => array(
- 'auth_view' => AUTH_ALL,
- 'auth_read' => AUTH_ALL,
- 'auth_post' => AUTH_REG,
- 'auth_reply' => AUTH_REG,
- 'auth_edit' => AUTH_REG,
- 'auth_delete' => AUTH_REG,
- 'auth_sticky' => AUTH_MOD,
- 'auth_announce' => AUTH_MOD,
- 'auth_vote' => AUTH_REG,
- 'auth_pollcreate' => AUTH_REG,
- ),
- 'registered_hidden' => array(
- 'auth_view' => AUTH_REG,
- 'auth_read' => AUTH_REG,
- 'auth_post' => AUTH_REG,
- 'auth_reply' => AUTH_REG,
- 'auth_edit' => AUTH_REG,
- 'auth_delete' => AUTH_REG,
- 'auth_sticky' => AUTH_MOD,
- 'auth_announce' => AUTH_MOD,
- 'auth_vote' => AUTH_REG,
- 'auth_pollcreate' => AUTH_REG,
- ),
- 'private' => array(
- 'auth_view' => AUTH_ALL,
- 'auth_read' => AUTH_ACL,
- 'auth_post' => AUTH_ACL,
- 'auth_reply' => AUTH_ACL,
- 'auth_edit' => AUTH_ACL,
- 'auth_delete' => AUTH_ACL,
- 'auth_sticky' => AUTH_ACL,
- 'auth_announce' => AUTH_MOD,
- 'auth_vote' => AUTH_ACL,
- 'auth_pollcreate' => AUTH_ACL,
- ),
- 'private_hidden' => array(
- 'auth_view' => AUTH_ACL,
- 'auth_read' => AUTH_ACL,
- 'auth_post' => AUTH_ACL,
- 'auth_reply' => AUTH_ACL,
- 'auth_edit' => AUTH_ACL,
- 'auth_delete' => AUTH_ACL,
- 'auth_sticky' => AUTH_ACL,
- 'auth_announce' => AUTH_MOD,
- 'auth_vote' => AUTH_ACL,
- 'auth_pollcreate' => AUTH_ACL,
- ),
- 'moderator' => array(
- 'auth_view' => AUTH_ALL,
- 'auth_read' => AUTH_MOD,
- 'auth_post' => AUTH_MOD,
- 'auth_reply' => AUTH_MOD,
- 'auth_edit' => AUTH_MOD,
- 'auth_delete' => AUTH_MOD,
- 'auth_sticky' => AUTH_MOD,
- 'auth_announce' => AUTH_MOD,
- 'auth_vote' => AUTH_MOD,
- 'auth_pollcreate' => AUTH_MOD,
- ),
- 'moderator_hidden' => array(
- 'auth_view' => AUTH_MOD,
- 'auth_read' => AUTH_MOD,
- 'auth_post' => AUTH_MOD,
- 'auth_reply' => AUTH_MOD,
- 'auth_edit' => AUTH_MOD,
- 'auth_delete' => AUTH_MOD,
- 'auth_sticky' => AUTH_MOD,
- 'auth_announce' => AUTH_MOD,
- 'auth_vote' => AUTH_MOD,
- 'auth_pollcreate' => AUTH_MOD,
- ),
- );
-
- if ($mode == 'start')
- {
- user_group_auth('guests', 'SELECT user_id, {GUESTS} FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS, false);
- user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS . " AND group_id <> $bot_group_id", false);
-
- // Selecting from old table
- if (!empty($config['increment_user_id']))
- {
- $auth_sql = 'SELECT user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id <> 1';
- user_group_auth('administrators', $auth_sql, true);
-
- $auth_sql = 'SELECT ' . $config['increment_user_id'] . ' as user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id = 1';
- user_group_auth('administrators', $auth_sql, true);
- }
- else
- {
- $auth_sql = 'SELECT user_id, {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
- user_group_auth('administrators', $auth_sql, true);
- }
-
- if (!empty($config['increment_user_id']))
- {
- $auth_sql = 'SELECT user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id <> 1';
- user_group_auth('global_moderators', $auth_sql, true);
-
- $auth_sql = 'SELECT ' . $config['increment_user_id'] . ' as user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1 AND user_id = 1';
- user_group_auth('global_moderators', $auth_sql, true);
- }
- else
- {
- $auth_sql = 'SELECT user_id, {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1';
- user_group_auth('global_moderators', $auth_sql, true);
- }
- }
- else if ($mode == 'first')
- {
- // Go through all 2.0.x forums
- foreach ($forum_access as $forum)
- {
- $new_forum_id = (int) $forum['forum_id'];
-
- // Administrators have full access to all forums whatever happens
- mass_auth('group_role', $new_forum_id, 'administrators', 'FORUM_FULL');
-
- $matched_type = '';
- foreach ($simple_auth_ary as $key => $auth_levels)
- {
- $matched = 1;
- foreach ($auth_levels as $k => $level)
- {
- if ($forum[$k] != $auth_levels[$k])
- {
- $matched = 0;
- }
- }
-
- if ($matched)
- {
- $matched_type = $key;
- break;
- }
- }
-
- switch ($matched_type)
- {
- case 'public':
- mass_auth('group_role', $new_forum_id, 'guests', 'FORUM_LIMITED');
- mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_LIMITED_POLLS');
- mass_auth('group_role', $new_forum_id, 'bots', 'FORUM_BOT');
- break;
-
- case 'registered':
- mass_auth('group_role', $new_forum_id, 'guests', 'FORUM_READONLY');
- mass_auth('group_role', $new_forum_id, 'bots', 'FORUM_BOT');
-
- // no break;
-
- case 'registered_hidden':
- mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_POLLS');
- break;
-
- case 'private':
- case 'private_hidden':
- case 'moderator':
- case 'moderator_hidden':
- default:
- // The permissions don't match a simple set, so we're going to have to map them directly
-
- // No post approval for all, in 2.0.x this feature does not exist
- mass_auth('group', $new_forum_id, 'guests', 'f_noapprove', ACL_YES);
- mass_auth('group', $new_forum_id, 'registered', 'f_noapprove', ACL_YES);
-
- // Go through authentication map
- foreach ($auth_map as $old_auth_key => $new_acl)
- {
- // If old authentication key does not exist we continue
- // This is helpful for mods adding additional authentication fields, we need to add them to the auth_map array
- if (!isset($forum[$old_auth_key]))
- {
- continue;
- }
-
- // Now set the new ACL correctly
- switch ($forum[$old_auth_key])
- {
- // AUTH_ALL
- case AUTH_ALL:
- mass_auth('group', $new_forum_id, 'guests', $new_acl, ACL_YES);
- mass_auth('group', $new_forum_id, 'bots', $new_acl, ACL_YES);
- mass_auth('group', $new_forum_id, 'registered', $new_acl, ACL_YES);
- break;
-
- // AUTH_REG
- case AUTH_REG:
- mass_auth('group', $new_forum_id, 'registered', $new_acl, ACL_YES);
- break;
-
- // AUTH_ACL
- case AUTH_ACL:
- // Go through the old group access list for this forum
- if (isset($group_access[$forum['forum_id']]))
- {
- foreach ($group_access[$forum['forum_id']] as $index => $access)
- {
- // We only check for ACL_YES equivalence entry
- if (isset($access[$old_auth_key]) && $access[$old_auth_key] == 1)
- {
- mass_auth('group', $new_forum_id, (int) $access['group_id'], $new_acl, ACL_YES);
- }
- }
- }
-
- if (isset($user_access[$forum['forum_id']]))
- {
- foreach ($user_access[$forum['forum_id']] as $index => $access)
- {
- // We only check for ACL_YES equivalence entry
- if (isset($access[$old_auth_key]) && $access[$old_auth_key] == 1)
- {
- mass_auth('user', $new_forum_id, (int) phpbb_user_id($access['user_id']), $new_acl, ACL_YES);
- }
- }
- }
- break;
-
- // AUTH_MOD
- case AUTH_MOD:
- if (isset($group_access[$forum['forum_id']]))
- {
- foreach ($group_access[$forum['forum_id']] as $index => $access)
- {
- // We only check for ACL_YES equivalence entry
- if (isset($access[$old_auth_key]) && $access[$old_auth_key] == 1)
- {
- mass_auth('group', $new_forum_id, (int) $access['group_id'], $new_acl, ACL_YES);
- }
- }
- }
-
- if (isset($user_access[$forum['forum_id']]))
- {
- foreach ($user_access[$forum['forum_id']] as $index => $access)
- {
- // We only check for ACL_YES equivalence entry
- if (isset($access[$old_auth_key]) && $access[$old_auth_key] == 1)
- {
- mass_auth('user', $new_forum_id, (int) phpbb_user_id($access['user_id']), $new_acl, ACL_YES);
- }
- }
- }
- break;
- }
- }
- break;
- }
- }
- }
- else if ($mode == 'second')
- {
- // Assign permission roles and other default permissions
-
- // guests having u_download and u_search ability
- $db->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT ' . get_group_id('guests') . ', 0, auth_option_id, 0, 1 FROM ' . ACL_OPTIONS_TABLE . " WHERE auth_option IN ('u_', 'u_download', 'u_search')");
-
- // administrators/global mods having full user features
- mass_auth('group_role', 0, 'administrators', 'USER_FULL');
- mass_auth('group_role', 0, 'global_moderators', 'USER_FULL');
-
- // By default all converted administrators are given full access
- mass_auth('group_role', 0, 'administrators', 'ADMIN_FULL');
-
- // All registered users are assigned the standard user role
- mass_auth('group_role', 0, 'registered', 'USER_STANDARD');
- mass_auth('group_role', 0, 'registered_coppa', 'USER_STANDARD');
-
- // Instead of administrators being global moderators we give the MOD_FULL role to global mods (admins already assigned to this group)
- mass_auth('group_role', 0, 'global_moderators', 'MOD_FULL');
-
- // And now those who have had their avatar rights removed get assigned a more restrictive role
- $sql = 'SELECT user_id FROM ' . $convert->src_table_prefix . 'users
- WHERE user_allowavatar = 0
- AND user_id > 0';
- $result = $src_db->sql_query($sql);
-
- while ($row = $src_db->sql_fetchrow($result))
- {
- mass_auth('user_role', 0, (int) phpbb_user_id($row['user_id']), 'USER_NOAVATAR');
- }
- $src_db->sql_freeresult($result);
-
- // And the same for those who have had their PM rights removed
- $sql = 'SELECT user_id FROM ' . $convert->src_table_prefix . 'users
- WHERE user_allow_pm = 0
- AND user_id > 0';
- $result = $src_db->sql_query($sql);
-
- while ($row = $src_db->sql_fetchrow($result))
- {
- mass_auth('user_role', 0, (int) phpbb_user_id($row['user_id']), 'USER_NOPM');
- }
- $src_db->sql_freeresult($result);
- }
- else if ($mode == 'third')
- {
- // And now the moderators
- // We make sure that they have at least standard access to the forums they moderate in addition to the moderating permissions
-
- $mod_post_map = array(
- 'auth_announce' => 'f_announce',
- 'auth_sticky' => 'f_sticky'
- );
-
- foreach ($user_access as $forum_id => $access_map)
- {
- $forum_id = (int) $forum_id;
-
- foreach ($access_map as $access)
- {
- if (isset($access['auth_mod']) && $access['auth_mod'] == 1)
- {
- mass_auth('user_role', $forum_id, (int) phpbb_user_id($access['user_id']), 'MOD_STANDARD');
- mass_auth('user_role', $forum_id, (int) phpbb_user_id($access['user_id']), 'FORUM_STANDARD');
- foreach ($mod_post_map as $old => $new)
- {
- if (isset($forum_access[$forum_id]) && isset($forum_access[$forum_id][$old]) && $forum_access[$forum_id][$old] == AUTH_MOD)
- {
- mass_auth('user', $forum_id, (int) phpbb_user_id($access['user_id']), $new, ACL_YES);
- }
- }
- }
- }
- }
-
- foreach ($group_access as $forum_id => $access_map)
- {
- $forum_id = (int) $forum_id;
-
- foreach ($access_map as $access)
- {
- if (isset($access['auth_mod']) && $access['auth_mod'] == 1)
- {
- mass_auth('group_role', $forum_id, (int) $access['group_id'], 'MOD_STANDARD');
- mass_auth('group_role', $forum_id, (int) $access['group_id'], 'FORUM_STANDARD');
- foreach ($mod_post_map as $old => $new)
- {
- if (isset($forum_access[$forum_id]) && isset($forum_access[$forum_id][$old]) && $forum_access[$forum_id][$old] == AUTH_MOD)
- {
- mass_auth('group', $forum_id, (int) $access['group_id'], $new, ACL_YES);
- }
- }
- }
- }
- }
-
- // We grant everyone readonly access to the categories to ensure that the forums are visible
- $sql = 'SELECT forum_id, forum_name, parent_id, left_id, right_id
- FROM ' . FORUMS_TABLE . '
- ORDER BY left_id ASC';
- $result = $db->sql_query($sql);
-
- $parent_forums = $forums = array();
- while ($row = $db->sql_fetchrow($result))
- {
- if ($row['parent_id'] == 0)
- {
- mass_auth('group_role', $row['forum_id'], 'administrators', 'FORUM_FULL');
- mass_auth('group_role', $row['forum_id'], 'global_moderators', 'FORUM_FULL');
- $parent_forums[] = $row;
- }
- else
- {
- $forums[] = $row;
- }
- }
- $db->sql_freeresult($result);
-
- global $auth;
-
- // Let us see which groups have access to these forums...
- foreach ($parent_forums as $row)
- {
- // Get the children
- $branch = $forum_ids = array();
-
- foreach ($forums as $key => $_row)
- {
- if ($_row['left_id'] > $row['left_id'] && $_row['left_id'] < $row['right_id'])
- {
- $branch[] = $_row;
- $forum_ids[] = $_row['forum_id'];
- continue;
- }
- }
-
- if (sizeof($forum_ids))
- {
- // Now make sure the user is able to read these forums
- $hold_ary = $auth->acl_group_raw_data(false, 'f_list', $forum_ids);
-
- if (empty($hold_ary))
- {
- continue;
- }
-
- foreach ($hold_ary as $g_id => $f_id_ary)
- {
- $set_group = false;
-
- foreach ($f_id_ary as $f_id => $auth_ary)
- {
- foreach ($auth_ary as $auth_option => $setting)
- {
- if ($setting == ACL_YES)
- {
- $set_group = true;
- break 2;
- }
- }
- }
-
- if ($set_group)
- {
- mass_auth('group', $row['forum_id'], $g_id, 'f_list', ACL_YES);
- }
- }
- }
- }
- }
-}
-
-/**
-* Set primary group.
-* Really simple and only based on user_level (remaining groups will be assigned later)
-*/
-function phpbb_set_primary_group($user_level)
-{
- global $convert_row;
-
- if ($user_level == 1)
- {
- return get_group_id('administrators');
- }
-/* else if ($user_level == 2)
- {
- return get_group_id('global_moderators');
- }
- else if ($user_level == 0 && $convert_row['user_active'])*/
- else if ($convert_row['user_active'])
- {
- return get_group_id('registered');
- }
-
- return 0;
-}
-
-/**
-* Convert the group name, making sure to avoid conflicts with 3.0 special groups
-*/
-function phpbb_convert_group_name($group_name)
-{
- $default_groups = array(
- 'GUESTS',
- 'REGISTERED',
- 'REGISTERED_COPPA',
- 'GLOBAL_MODERATORS',
- 'ADMINISTRATORS',
- 'BOTS',
- );
-
- if (in_array(strtoupper($group_name), $default_groups))
- {
- return 'phpBB2 - ' . $group_name;
- }
-
- return phpbb_set_default_encoding($group_name);
-}
-
-/**
-* Convert the group name, making sure to avoid conflicts with 3.0 special groups
-*/
-function phpbb_convert_group_name_clean($group_name)
-{
- $default_groups = array(
- 'GUESTS',
- 'REGISTERED',
- 'REGISTERED_COPPA',
- 'GLOBAL_MODERATORS',
- 'ADMINISTRATORS',
- 'BOTS',
- );
-
- if (in_array(strtoupper($group_name), $default_groups))
- {
- return utf8_clean_string('phpBB2 - ' . $group_name);
- }
-
- return utf8_clean_string(phpbb_set_default_encoding($group_name));
-}
-
-/**
-* Convert the group type constants
-*/
-function phpbb_convert_group_type($group_type)
-{
- switch ($group_type)
- {
- case 0:
- return GROUP_OPEN;
- break;
-
- case 1:
- return GROUP_CLOSED;
- break;
-
- case 2:
- return GROUP_HIDDEN;
- break;
- }
-
- // Never return GROUP_SPECIAL here, because only phpBB3's default groups are allowed to have this type set.
- return GROUP_HIDDEN;
-}
-
-/**
-* Convert the topic type constants
-*/
-function phpbb_convert_topic_type($topic_type)
-{
- switch ($topic_type)
- {
- case 0:
- return POST_NORMAL;
- break;
-
- case 1:
- return POST_STICKY;
- break;
-
- case 2:
- return POST_ANNOUNCE;
- break;
-
- case 3:
- return POST_GLOBAL;
- break;
- }
-
- return POST_NORMAL;
-}
-
-function phpbb_replace_size($matches)
-{
- return '[size=' . min(200, ceil(100.0 * (((double) $matches[1])/12.0))) . ':' . $matches[2] . ']';
-}
-
-/**
-* Reparse the message stripping out the bbcode_uid values and adding new ones and setting the bitfield
-* @todo What do we want to do about HTML in messages - currently it gets converted to the entities, but there may be some objections to this
-*/
-function phpbb_prepare_message($message)
-{
- global $db, $convert, $user, $config, $convert_row, $message_parser;
-
- if (!$message)
- {
- $convert->row['mp_bbcode_bitfield'] = $convert_row['mp_bbcode_bitfield'] = 0;
- return '';
- }
-
- // Decode phpBB 2.0.x Message
- if (isset($convert->row['old_bbcode_uid']) && $convert->row['old_bbcode_uid'] != '')
- {
- // Adjust size...
- if (strpos($message, '[size=') !== false)
- {
- $message = preg_replace_callback('/\[size=(\d*):(' . $convert->row['old_bbcode_uid'] . ')\]/', 'phpbb_replace_size', $message);
- }
-
- $message = preg_replace('/\:(([a-z0-9]:)?)' . $convert->row['old_bbcode_uid'] . '/s', '', $message);
- }
-
- if (strpos($message, '[quote=') !== false)
- {
- $message = preg_replace('/\[quote="(.*?)"\]/s', '[quote=&quot;\1&quot;]', $message);
- $message = preg_replace('/\[quote=\\\"(.*?)\\\"\]/s', '[quote=&quot;\1&quot;]', $message);
-
- // let's hope that this solves more problems than it causes. Deal with escaped quotes.
- $message = str_replace('\"', '&quot;', $message);
- $message = str_replace('\&quot;', '&quot;', $message);
- }
-
- // Already the new user id ;)
- $user_id = $convert->row['poster_id'];
-
- $message = str_replace('<', '&lt;', $message);
- $message = str_replace('>', '&gt;', $message);
- $message = str_replace('<br />', "\n", $message);
-
- // make the post UTF-8
- $message = phpbb_set_encoding($message);
-
- $message_parser->warn_msg = array(); // Reset the errors from the previous message
- $message_parser->bbcode_uid = make_uid($convert->row['post_time']);
- $message_parser->message = $message;
- unset($message);
-
- // Make sure options are set.
-// $enable_html = (!isset($row['enable_html'])) ? false : $row['enable_html'];
- $enable_bbcode = (!isset($convert->row['enable_bbcode'])) ? true : $convert->row['enable_bbcode'];
- $enable_smilies = (!isset($convert->row['enable_smilies'])) ? true : $convert->row['enable_smilies'];
- $enable_magic_url = (!isset($convert->row['enable_magic_url'])) ? true : $convert->row['enable_magic_url'];
-
- // parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post')
- $message_parser->parse($enable_bbcode, $enable_magic_url, $enable_smilies);
-
- if (sizeof($message_parser->warn_msg))
- {
- $msg_id = isset($convert->row['post_id']) ? $convert->row['post_id'] : $convert->row['privmsgs_id'];
- $convert->p_master->error('<span style="color:red">' . $user->lang['POST_ID'] . ': ' . $msg_id . ' ' . $user->lang['CONV_ERROR_MESSAGE_PARSER'] . ': <br /><br />' . implode('<br />', $message_parser->warn_msg), __LINE__, __FILE__, true);
- }
-
- $convert->row['mp_bbcode_bitfield'] = $convert_row['mp_bbcode_bitfield'] = $message_parser->bbcode_bitfield;
-
- $message = $message_parser->message;
- unset($message_parser->message);
-
- return $message;
-}
-
-/**
-* Return the bitfield calculated by the previous function
-*/
-function get_bbcode_bitfield()
-{
- global $convert_row;
-
- return $convert_row['mp_bbcode_bitfield'];
-}
-
-/**
-* Determine the last user to edit a post
-* In practice we only tracked edits by the original poster in 2.0.x so this will only be set if they had edited their own post
-*/
-function phpbb_post_edit_user()
-{
- global $convert_row, $config;
-
- if (isset($convert_row['post_edit_count']))
- {
- return phpbb_user_id($convert_row['poster_id']);
- }
-
- return 0;
-}
-
-/**
-* Obtain the path to uploaded files on the 2.0.x forum
-* This is only used if the Attachment MOD was installed
-*/
-function phpbb_get_files_dir()
-{
- if (!defined('MOD_ATTACHMENT'))
- {
- return;
- }
-
- global $src_db, $same_db, $convert, $user, $config;
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
- $sql = 'SELECT config_value AS upload_dir
- FROM ' . $convert->src_table_prefix . "attachments_config
- WHERE config_name = 'upload_dir'";
- $result = $src_db->sql_query($sql);
- $upload_path = $src_db->sql_fetchfield('upload_dir');
- $src_db->sql_freeresult($result);
-
- $sql = 'SELECT config_value AS ftp_upload
- FROM ' . $convert->src_table_prefix . "attachments_config
- WHERE config_name = 'allow_ftp_upload'";
- $result = $src_db->sql_query($sql);
- $ftp_upload = (int) $src_db->sql_fetchfield('ftp_upload');
- $src_db->sql_freeresult($result);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- if ($ftp_upload)
- {
- $convert->p_master->error($user->lang['CONV_ERROR_ATTACH_FTP_DIR'], __LINE__, __FILE__);
- }
-
- return $upload_path;
-}
-
-/**
-* Copy thumbnails of uploaded images from the 2.0.x forum
-* This is only used if the Attachment MOD was installed
-*/
-function phpbb_copy_thumbnails()
-{
- global $db, $convert, $user, $config;
-
- $src_path = $convert->options['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/';
-
- if ($handle = @opendir($src_path))
- {
- while ($entry = readdir($handle))
- {
- if ($entry[0] == '.')
- {
- continue;
- }
-
- if (is_dir($src_path . $entry))
- {
- continue;
- }
- else
- {
- copy_file($src_path . $entry, $config['upload_path'] . '/' . preg_replace('/^t_/', 'thumb_', $entry));
- @unlink(PHPBB_ROOT_PATH . $config['upload_path'] . '/thumbs/' . $entry);
- }
- }
- closedir($handle);
- }
-}
-
-/**
-* Convert the attachment category constants
-* This is only used if the Attachment MOD was installed
-*/
-function phpbb_attachment_category($cat_id)
-{
- switch ($cat_id)
- {
- case 1:
- return ATTACHMENT_CATEGORY_IMAGE;
- break;
-
- case 2:
- return ATTACHMENT_CATEGORY_WM;
- break;
-
- case 3:
- return ATTACHMENT_CATEGORY_FLASH;
- break;
- }
-
- return ATTACHMENT_CATEGORY_NONE;
-}
-
-/**
-* Obtain list of forums in which different attachment categories can be used
-*/
-function phpbb_attachment_forum_perms($forum_permissions)
-{
- if (empty($forum_permissions))
- {
- return '';
- }
-
- // Decode forum permissions
- $forum_ids = array();
-
- $one_char_encoding = '#';
- $two_char_encoding = '.';
-
- $auth_len = 1;
- for ($pos = 0; $pos < strlen($forum_permissions); $pos += $auth_len)
- {
- $forum_auth = substr($forum_permissions, $pos, 1);
- if ($forum_auth == $one_char_encoding)
- {
- $auth_len = 1;
- continue;
- }
- else if ($forum_auth == $two_char_encoding)
- {
- $auth_len = 2;
- $pos--;
- continue;
- }
-
- $forum_auth = substr($forum_permissions, $pos, $auth_len);
- $forum_id = base64_unpack($forum_auth);
-
- $forum_ids[] = (int) $forum_id;
- }
-
- if (sizeof($forum_ids))
- {
- return attachment_forum_perms($forum_ids);
- }
-
- return '';
-}
-
-/**
-* Convert the avatar type constants
-*/
-function phpbb_avatar_type($type)
-{
- switch ($type)
- {
- case 1:
- return AVATAR_UPLOAD;
- break;
-
- case 2:
- return AVATAR_REMOTE;
- break;
-
- case 3:
- return AVATAR_GALLERY;
- break;
- }
-
- return 0;
-}
-
-
-/**
-* Just undos the replacing of '<' and '>'
-*/
-function phpbb_smilie_html_decode($code)
-{
- $code = str_replace('&lt;', '<', $code);
- return str_replace('&gt;', '>', $code);
-}
-
-/**
-* Transfer avatars, copying the image if it was uploaded
-*/
-function phpbb_import_avatar($user_avatar)
-{
- global $convert_row;
-
- if (!$convert_row['user_avatar_type'])
- {
- return '';
- }
- else if ($convert_row['user_avatar_type'] == 1)
- {
- // Uploaded avatar
- return import_avatar($user_avatar, false, $convert_row['user_id']);
- }
- else if ($convert_row['user_avatar_type'] == 2)
- {
- // Remote avatar
- return $user_avatar;
- }
- else if ($convert_row['user_avatar_type'] == 3)
- {
- // Gallery avatar
- return $user_avatar;
- }
-
- return '';
-}
-
-
-/**
-* Find out about the avatar's dimensions
-*/
-function phpbb_get_avatar_height($user_avatar)
-{
- global $convert_row;
-
- if (empty($convert_row['user_avatar_type']))
- {
- return 0;
- }
- return get_avatar_height($user_avatar, 'phpbb_avatar_type', $convert_row['user_avatar_type']);
-}
-
-
-/**
-* Find out about the avatar's dimensions
-*/
-function phpbb_get_avatar_width($user_avatar)
-{
- global $convert_row;
-
- if (empty($convert_row['user_avatar_type']))
- {
- return 0;
- }
-
- return get_avatar_width($user_avatar, 'phpbb_avatar_type', $convert_row['user_avatar_type']);
-}
-
-
-/**
-* Calculate the correct to_address field for private messages
-*/
-function phpbb_privmsgs_to_userid($to_userid)
-{
- global $config;
-
- return 'u_' . phpbb_user_id($to_userid);
-}
-
-/**
-* Calculate whether a private message was unread using the bitfield
-*/
-function phpbb_unread_pm($pm_type)
-{
- return ($pm_type == 5) ? 1 : 0;
-}
-
-/**
-* Calculate whether a private message was new using the bitfield
-*/
-function phpbb_new_pm($pm_type)
-{
- return ($pm_type == 1) ? 1 : 0;
-}
-
-/**
-* Obtain the folder_id for the custom folder created to replace the savebox from 2.0.x (used to store saved private messages)
-*/
-function phpbb_get_savebox_id($user_id)
-{
- global $db;
-
- $user_id = phpbb_user_id($user_id);
-
- // Only one custom folder, check only one
- $sql = 'SELECT folder_id
- FROM ' . PRIVMSGS_FOLDER_TABLE . '
- WHERE user_id = ' . $user_id;
- $result = $db->sql_query_limit($sql, 1);
- $folder_id = (int) $db->sql_fetchfield('folder_id');
- $db->sql_freeresult($result);
-
- return $folder_id;
-}
-
-/**
-* Transfer attachment specific configuration options
-* These were not stored in the main config table on 2.0.x
-* This is only used if the Attachment MOD was installed
-*/
-function phpbb_import_attach_config()
-{
- global $db, $src_db, $same_db, $convert, $config;
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- $sql = 'SELECT *
- FROM ' . $convert->src_table_prefix . 'attachments_config';
- $result = $src_db->sql_query($sql);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- $attach_config = array();
- while ($row = $src_db->sql_fetchrow($result))
- {
- $attach_config[$row['config_name']] = $row['config_value'];
- }
- $src_db->sql_freeresult($result);
-
- set_config('allow_attachments', 1);
-
- // old attachment mod? Must be very old if this entry do not exist...
- if (!empty($attach_config['display_order']))
- {
- set_config('display_order', $attach_config['display_order']);
- }
- set_config('max_filesize', $attach_config['max_filesize']);
- set_config('max_filesize_pm', $attach_config['max_filesize_pm']);
- set_config('attachment_quota', $attach_config['attachment_quota']);
- set_config('max_attachments', $attach_config['max_attachments']);
- set_config('max_attachments_pm', $attach_config['max_attachments_pm']);
- set_config('allow_pm_attach', $attach_config['allow_pm_attach']);
-
- set_config('img_display_inlined', $attach_config['img_display_inlined']);
- set_config('img_max_width', $attach_config['img_max_width']);
- set_config('img_max_height', $attach_config['img_max_height']);
- set_config('img_link_width', $attach_config['img_link_width']);
- set_config('img_link_height', $attach_config['img_link_height']);
- set_config('img_create_thumbnail', $attach_config['img_create_thumbnail']);
- set_config('img_max_thumb_width', 400);
- set_config('img_min_thumb_filesize', $attach_config['img_min_thumb_filesize']);
- set_config('img_imagick', $attach_config['img_imagick']);
-}
-
-/**
-* Calculate the date a user became inactive
-*/
-function phpbb_inactive_time()
-{
- global $convert_row;
-
- if ($convert_row['user_active'])
- {
- return 0;
- }
-
- if ($convert_row['user_lastvisit'])
- {
- return $convert_row['user_lastvisit'];
- }
-
- return $convert_row['user_regdate'];
-}
-
-/**
-* Calculate the reason a user became inactive
-* We can't actually tell the difference between a manual deactivation and one for profile changes
-* from the data available to assume the latter
-*/
-function phpbb_inactive_reason()
-{
- global $convert_row;
-
- if ($convert_row['user_active'])
- {
- return 0;
- }
-
- if ($convert_row['user_lastvisit'])
- {
- return INACTIVE_PROFILE;
- }
-
- return INACTIVE_REGISTER;
-}
-
-/**
-* Adjust 2.0.x disallowed names to 3.0.x format
-*/
-function phpbb_disallowed_username($username)
-{
- // Replace * with %
- $username = phpbb_set_default_encoding(str_replace('*', '%', $username));
- return utf8_htmlspecialchars($username);
-}
-
-/**
-* Checks whether there are any usernames on the old board that would map to the same
-* username_clean on phpBB3. Prints out a list if any exist and exits.
-*/
-function phpbb_create_userconv_table()
-{
- global $db, $src_db, $convert, $table_prefix, $user, $lang;
-
- // create a temporary table in which we store the clean usernames
- $drop_sql = 'DROP TABLE ' . USERCONV_TABLE;
- switch ($db->dbms_type)
- {
- case 'firebird':
- $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
- user_id INTEGER NOT NULL,
- username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT \'\' NOT NULL COLLATE UNICODE
- )';
- break;
-
- case 'mssql':
- $create_sql = 'CREATE TABLE [' . USERCONV_TABLE . '] (
- [user_id] [int] NOT NULL ,
- [username_clean] [varchar] (255) DEFAULT (\'\') NOT NULL
- )';
- break;
-
- case 'mysql':
- $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
- user_id mediumint(8) NOT NULL,
- username_clean varchar(255) DEFAULT \'\' NOT NULL
- ) CHARACTER SET `utf8` COLLATE `utf8_bin`';
- break;
-
- case 'oracle':
- $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
- user_id number(8) NOT NULL,
- username_clean varchar2(255) DEFAULT \'\'
- )';
- break;
-
- case 'postgres':
- $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
- user_id INT4 DEFAULT \'0\',
- username_clean varchar_ci DEFAULT \'\' NOT NULL
- )';
- break;
-
- case 'sqlite':
- $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' (
- user_id INTEGER NOT NULL DEFAULT \'0\',
- username_clean varchar(255) NOT NULL DEFAULT \'\'
- )';
- break;
- }
-
- $db->sql_return_on_error(true);
- $db->sql_query($drop_sql);
- $db->sql_return_on_error(false);
- $db->sql_query($create_sql);
-}
-
-function phpbb_check_username_collisions()
-{
- global $db, $src_db, $convert, $table_prefix, $user, $lang;
-
- // now find the clean version of the usernames that collide
- $sql = 'SELECT username_clean
- FROM ' . USERCONV_TABLE .'
- GROUP BY username_clean
- HAVING COUNT(user_id) > 1';
- $result = $db->sql_query($sql);
-
- $colliding_names = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $colliding_names[] = $row['username_clean'];
- }
- $db->sql_freeresult($result);
-
- // there was at least one collision, the admin will have to solve it before conversion can continue
- if (sizeof($colliding_names))
- {
- $sql = 'SELECT user_id, username_clean
- FROM ' . USERCONV_TABLE . '
- WHERE ' . $db->sql_in_set('username_clean', $colliding_names);
- $result = $db->sql_query($sql);
- unset($colliding_names);
-
- $colliding_user_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $colliding_user_ids[(int) $row['user_id']] = $row['username_clean'];
- }
- $db->sql_freeresult($result);
-
- $sql = 'SELECT username, user_id, user_posts
- FROM ' . $convert->src_table_prefix . 'users
- WHERE ' . $src_db->sql_in_set('user_id', array_keys($colliding_user_ids));
- $result = $src_db->sql_query($sql);
-
- $colliding_users = array();
- while ($row = $src_db->sql_fetchrow($result))
- {
- $row['user_id'] = (int) $row['user_id'];
- if (isset($colliding_user_ids[$row['user_id']]))
- {
- $colliding_users[$colliding_user_ids[$row['user_id']]][] = $row;
- }
- }
- $src_db->sql_freeresult($result);
- unset($colliding_user_ids);
-
- $list = '';
- foreach ($colliding_users as $username_clean => $users)
- {
- $list .= sprintf($user->lang['COLLIDING_CLEAN_USERNAME'], $username_clean) . "<br />\n";
- foreach ($users as $i => $row)
- {
- $list .= sprintf($user->lang['COLLIDING_USER'], $row['user_id'], phpbb_set_default_encoding($row['username']), $row['user_posts']) . "<br />\n";
- }
- }
-
- $lang['INST_ERR_FATAL'] = $user->lang['CONV_ERR_FATAL'];
- $convert->p_master->error('<span style="color:red">' . $user->lang['COLLIDING_USERNAMES_FOUND'] . '</span></b><br /><br />' . $list . '<b>', __LINE__, __FILE__);
- }
-
- $drop_sql = 'DROP TABLE ' . USERCONV_TABLE;
- $db->sql_query($drop_sql);
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
deleted file mode 100644
index 0be2e0f5b8..0000000000
--- a/phpBB/install/database_update.php
+++ /dev/null
@@ -1,410 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-$updates_to_version = '3.1.0-dev1';
-
-// Enter any version to update from to test updates. The version within the db will not be updated.
-$debug_from_version = false;
-
-// Return if we "just include it" to find out for which version the database update is responsible for
-if (defined('IN_PHPBB') && defined('IN_INSTALL'))
-{
- return;
-}
-
-/**
-*/
-define('IN_PHPBB', true);
-define('IN_INSTALL', true);
-
-if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');
-if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
-include PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
-
-@set_time_limit(0);
-
-// Start session management
-phpbb::$user->session_begin();
-phpbb::$acl->init(phpbb::$user->data);
-phpbb::$user->setup('install');
-
-if (!phpbb::$user->is_registered)
-{
- login_box();
-}
-
-if (!phpbb::$acl->acl_get('a_board'))
-{
- trigger_error('NO_AUTH');
-}
-
-include PHPBB_ROOT_PATH . 'includes/db/db_tools.' . PHP_EXT;
-
-$db_tools = new phpbb_db_tools(phpbb::$db, true);
-
-// Define some variables for the database update
-$inline_update = (request_var('type', 0)) ? true : false;
-
-// Only an example, but also commented out
-$database_update_info = array(
-
- // Changes from 3.0.5 to 3.1.0-dev1
- '3.0.5' => array(),
-);
-
-$error_ary = array();
-$errored = false;
-
-header('Content-type: text/html; charset=UTF-8');
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo phpbb::$user->lang['DIRECTION']; ?>" lang="<?php echo phpbb::$user->lang['USER_LANG']; ?>" xml:lang="<?php echo phpbb::$user->lang['USER_LANG']; ?>">
-<head>
-
-<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-<meta http-equiv="content-language" content="<?php echo phpbb::$user->lang['USER_LANG']; ?>" />
-<meta http-equiv="content-style-type" content="text/css" />
-<meta http-equiv="imagetoolbar" content="no" />
-
-<title><?php echo phpbb::$user->lang['UPDATING_TO_LATEST_STABLE']; ?></title>
-
-<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
-
-</head>
-
-<body>
-<div id="wrap">
- <div id="page-header">&nbsp;</div>
-
- <div id="page-body">
- <div id="acp">
- <div class="panel">
- <span class="corners-top"><span></span></span>
- <div id="content">
- <div id="main" class="install-body">
-
- <h1><?php echo phpbb::$user->lang['UPDATING_TO_LATEST_STABLE']; ?></h1>
-
- <br />
-
- <p><?php echo phpbb::$user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo phpbb::$db->sql_layer; ?></strong><br />
-<?php
-
-// To let set_config() calls succeed, we need to make the config array available globally
-phpbb::$acm->destroy('#config');
-$config = phpbb_cache::obtain_config();
-
-echo phpbb::$user->lang['PREVIOUS_VERSION'] . ' :: <strong>' . phpbb::$config['version'] . '</strong><br />';
-echo phpbb::$user->lang['UPDATED_VERSION'] . ' :: <strong>' . $updates_to_version . '</strong></p>';
-
-$current_version = str_replace('rc', 'RC', strtolower(phpbb::$config['version']));
-$latest_version = str_replace('rc', 'RC', strtolower($updates_to_version));
-$orig_version = phpbb::$config['version'];
-
-// Fill DB version
-if (empty(phpbb::$config['dbms_version']))
-{
- set_config('dbms_version', phpbb::$db->sql_server_info(true));
-}
-
-// If the latest version and the current version are 'unequal', we will update the version_update_from, else we do not update anything.
-if ($inline_update)
-{
- if ($current_version !== $latest_version)
- {
- set_config('version_update_from', $orig_version);
- }
-}
-else
-{
- // If not called from the update script, we will actually remove the traces
- phpbb::$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
-}
-
-// Schema updates
-?>
- <br /><br />
-
- <h1><?php echo phpbb::$user->lang['UPDATE_DATABASE_SCHEMA']; ?></h1>
-
- <br />
- <p><?php echo phpbb::$user->lang['PROGRESS']; ?> :: <strong>
-
-<?php
-
-flush();
-
-// We go through the schema changes from the lowest to the highest version
-// We try to also include versions 'in-between'...
-// We go through the schema changes from the lowest to the highest version
-// We try to also include versions 'in-between'...
-$no_updates = true;
-$versions = array_keys($database_update_info);
-for ($i = 0; $i < sizeof($versions); $i++)
-{
- $version = $versions[$i];
- $schema_changes = $database_update_info[$version];
-
- $next_version = (isset($versions[$i + 1])) ? $versions[$i + 1] : $updates_to_version;
-
- // If the installed version to be updated to is < than the current version, and if the current version is >= as the version to be updated to next, we will skip the process
- if (version_compare($version, $current_version, '<') && version_compare($current_version, $next_version, '>='))
- {
- continue;
- }
-
- if (!sizeof($schema_changes))
- {
- continue;
- }
-
- // Get statements for schema updates
- $statements = $db_tools->sql_schema_changes($schema_changes);
-
- if (sizeof($statements))
- {
- $no_updates = false;
-
- foreach ($statements as $sql)
- {
- _sql($sql, $errored, $error_ary);
- }
- }
-}
-
-_write_result($no_updates, $errored, $error_ary);
-
-// Data updates
-$error_ary = array();
-$errored = $no_updates = false;
-
-?>
-
-<br /><br />
-<h1><?php echo phpbb::$user->lang['UPDATING_DATA']; ?></h1>
-<br />
-<p><?php echo phpbb::$user->lang['PROGRESS']; ?> :: <strong>
-
-<?php
-
-flush();
-
-$no_updates = true;
-
-$no_updates = true;
-$versions = array_keys($database_update_info);
-
-// some code magic
-for ($i = 0; $i < sizeof($versions); $i++)
-{
- $version = $versions[$i];
- $next_version = (isset($versions[$i + 1])) ? $versions[$i + 1] : $updates_to_version;
-
- // If the installed version to be updated to is < than the current version, and if the current version is >= as the version to be updated to next, we will skip the process
- if (version_compare($version, $current_version, '<') && version_compare($current_version, $next_version, '>='))
- {
- continue;
- }
-
- change_database_data($no_updates, $version);
-}
-
-_write_result($no_updates, $errored, $error_ary);
-
-$error_ary = array();
-$errored = $no_updates = false;
-
-?>
-
-<br /><br />
-<h1><?php echo phpbb::$user->lang['UPDATE_VERSION_OPTIMIZE']; ?></h1>
-<br />
-<p><?php echo phpbb::$user->lang['PROGRESS']; ?> :: <strong>
-
-<?php
-
-flush();
-
-if ($debug_from_version === false)
-{
- // update the version
- $sql = "UPDATE " . CONFIG_TABLE . "
- SET config_value = '$updates_to_version'
- WHERE config_name = 'version'";
- _sql($sql, $errored, $error_ary);
-}
-
-// Reset permissions
-$sql = 'UPDATE ' . USERS_TABLE . "
- SET user_permissions = '',
- user_perm_from = 0";
-_sql($sql, $errored, $error_ary);
-
-/* Optimize/vacuum analyze the tables where appropriate
-// this should be done for each version in future along with
-// the version number update
-switch (phpbb::$db->dbms_type)
-{
- case 'mysql':
- $sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'sessions_keys' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words';
- _sql($sql, $errored, $error_ary);
- break;
-
- case 'postgresql':
- _sql("VACUUM ANALYZE", $errored, $error_ary);
- break;
-}
-*/
-
-_write_result($no_updates, $errored, $error_ary);
-
-?>
-
-<br />
-<h1><?php echo phpbb::$user->lang['UPDATE_COMPLETED']; ?></h1>
-
-<br />
-
-<?php
-
-if (!$inline_update)
-{
- // Purge the cache...
- phpbb::$acm->purge();
-?>
-
- <p style="color:red"><?php echo phpbb::$user->lang['UPDATE_FILES_NOTICE']; ?></p>
-
- <p><?php echo phpbb::$user->lang['COMPLETE_LOGIN_TO_BOARD']; ?></p>
-
-<?php
-}
-else
-{
-?>
-
- <p><?php echo ((isset(phpbb::$user->lang['INLINE_UPDATE_SUCCESSFUL'])) ? phpbb::$user->lang['INLINE_UPDATE_SUCCESSFUL'] : 'The database update was successful. Now you need to continue the update process.'); ?></p>
-
- <p><a href="<?php echo append_sid('install/index', "mode=update&amp;sub=file_check&amp;lang=$language"); ?>" class="button1"><?php echo (isset(phpbb::$user->lang['CONTINUE_UPDATE_NOW'])) ? phpbb::$user->lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p>
-
-<?php
-}
-
-// Add database update to log
-add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version);
-
-// Now we purge the session table as well as all cache files
-phpbb::$acm->purge();
-
-?>
-
- </div>
- </div>
- <span class="corners-bottom"><span></span></span>
- </div>
- </div>
- </div>
-
- <div id="page-footer">
- Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>
- </div>
-</div>
-
-</body>
-</html>
-
-<?php
-
-garbage_collection();
-
-if (function_exists('exit_handler'))
-{
- exit_handler();
-}
-
-/**
-* Function where all data changes are executed
-*/
-function change_database_data($version)
-{
- global $errored, $error_ary;
-
- switch ($version)
- {
- default:
- // Changes from 3.0.5 to 3.1.0-dev1
- case '3.0.5':
- break;
- break;
- }
-}
-
-/**
-* Function for triggering an sql statement
-*/
-function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
-{
- if (phpbb::$base_config['debug_extra'])
- {
- echo "<br />\n{$sql}\n<br />";
- }
-
- phpbb::$db->sql_return_on_error(true);
-
- $result = phpbb::$db->sql_query($sql);
- if (phpbb::$db->sql_error_triggered)
- {
- $errored = true;
- $error_ary['sql'][] = phpbb::$db->sql_error_sql;
- $error_ary['error_code'][] = phpbb::$db->_sql_error();
- }
-
- phpbb::$db->sql_return_on_error(false);
-
- if ($echo_dot)
- {
- echo ". \n";
- flush();
- }
-
- return $result;
-}
-
-function _write_result($no_updates, $errored, $error_ary)
-{
- if ($no_updates)
- {
- echo ' ' . phpbb::$user->lang['NO_UPDATES_REQUIRED'] . '</strong></p>';
- }
- else
- {
- echo ' <span class="success">' . phpbb::$user->lang['DONE'] . '</span></strong><br />' . phpbb::$user->lang['RESULT'] . ' :: ';
-
- if ($errored)
- {
- echo ' <strong>' . phpbb::$user->lang['SOME_QUERIES_FAILED'] . '</strong> <ul>';
-
- for ($i = 0; $i < sizeof($error_ary['sql']); $i++)
- {
- echo '<li>' . phpbb::$user->lang['ERROR'] . ' :: <strong>' . htmlspecialchars($error_ary['error_code'][$i]['message']) . '</strong><br />';
- echo phpbb::$user->lang['SQL'] . ' :: <strong>' . htmlspecialchars($error_ary['sql'][$i]) . '</strong><br /><br /></li>';
- }
-
- echo '</ul> <br /><br />' . phpbb::$user->lang['SQL_FAILURE_EXPLAIN'] . '</p>';
- }
- else
- {
- echo '<strong>' . phpbb::$user->lang['NO_ERRORS'] . '</strong></p>';
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
deleted file mode 100644
index bb22ebaf36..0000000000
--- a/phpBB/install/index.php
+++ /dev/null
@@ -1,498 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**#@+
-* @ignore
-*/
-define('IN_PHPBB', true);
-define('IN_INSTALL', true);
-/**#@-*/
-
-if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');
-if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
-
-// Include bootstrap
-include PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT;
-
-// Includes functions for the installer
-require PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT;
-
-// Set time limit to 0
-@set_time_limit(0);
-
-/**
-* @todo get memory limit and display notice if it is too low for a conversion (only within conversion)
-$mem_limit = @ini_get('memory_limit');
-if (!empty($mem_limit))
-{
- $unit = strtolower(substr($mem_limit, -1, 1));
- $mem_limit = (int) $mem_limit;
-
- if ($unit == 'k')
- {
- $mem_limit = floor($mem_limit / 1024);
- }
- else if ($unit == 'g')
- {
- $mem_limit *= 1024;
- }
- else if (is_numeric($unit))
- {
- $mem_limit = floor((int) ($mem_limit . $unit) / 1048576);
- }
- $mem_limit = max(128, $mem_limit) . 'M';
-}
-else
-{
- $mem_limit = '128M';
-}
-@ini_set('memory_limit', $mem_limit);
-*/
-
-// Initialize some common config variables
-phpbb::$config += array(
- 'load_tplcompile' => true,
- 'cookie_name' => '',
-);
-
-// Register the template and the user object
-phpbb::register('template');
-phpbb::register('user', false, false, 'db', PHPBB_ROOT_PATH . 'language/');
-
-// Init "loose" user session
-phpbb::$user->session_begin();
-
-// Now set users language
-phpbb::$user->set_language(request_var('language', ''));
-
-// And also add the install language file
-phpbb::$user->add_lang('install');
-
-$mode = request_var('mode', 'overview');
-$sub = request_var('sub', '');
-
-// Set PHP error handler to ours
-set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
-
-phpbb::$template->set_custom_template('../adm/style', 'admin');
-phpbb::$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
-
-$install = new module();
-
-$install->create('install', 'index.' . PHP_EXT, $mode, $sub);
-$install->load();
-
-// Generate the page
-$install->page_header();
-$install->generate_navigation();
-
-phpbb::$template->set_filenames(array(
- 'body' => $install->get_tpl_name())
-);
-
-$install->page_footer();
-
-/**
-* @package install
-*/
-class module
-{
- var $id = 0;
- var $type = 'install';
- var $module_ary = array();
- var $filename;
- var $module_url = '';
- var $tpl_name = '';
- var $mode;
- var $sub;
-
- /**
- * Private methods, should not be overwritten
- */
- function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
- {
- $module = array();
-
- // Grab module information using Bart's "neat-o-module" system (tm)
- $dir = @opendir('.');
-
- if (!$dir)
- {
- $this->error('Unable to access the installation directory', __LINE__, __FILE__);
- }
-
- $setmodules = 1;
- while (($file = readdir($dir)) !== false)
- {
- if (preg_match('#^install_(.*?)\.' . PHP_EXT . '$#', $file))
- {
- include($file);
- }
- }
- closedir($dir);
-
- unset($setmodules);
-
- if (!sizeof($module))
- {
- $this->error('No installation modules found', __LINE__, __FILE__);
- }
-
- // Order to use and count further if modules get assigned to the same position or not having an order
- $max_module_order = 1000;
-
- foreach ($module as $row)
- {
- // Check any module pre-reqs
- if ($row['module_reqs'] != '')
- {
- }
-
- // Module order not specified or module already assigned at this position?
- if (!isset($row['module_order']) || isset($this->module_ary[$row['module_order']]))
- {
- $row['module_order'] = $max_module_order;
- $max_module_order++;
- }
-
- $this->module_ary[$row['module_order']]['name'] = $row['module_title'];
- $this->module_ary[$row['module_order']]['filename'] = $row['module_filename'];
- $this->module_ary[$row['module_order']]['subs'] = $row['module_subs'];
- $this->module_ary[$row['module_order']]['stages'] = $row['module_stages'];
-
- if (strtolower($selected_mod) == strtolower($row['module_title']))
- {
- $this->id = (int) $row['module_order'];
- $this->filename = (string) $row['module_filename'];
- $this->module_url = (string) $module_url;
- $this->mode = (string) $selected_mod;
- // Check that the sub-mode specified is valid or set a default if not
- if (is_array($row['module_subs']))
- {
- $this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_subs'])) ? $selected_submod : $row['module_subs'][0]);
- }
- else if (is_array($row['module_stages']))
- {
- $this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_stages'])) ? $selected_submod : $row['module_stages'][0]);
- }
- else
- {
- $this->sub = '';
- }
- }
- } // END foreach
- } // END create
-
- /**
- * Load and run the relevant module if applicable
- */
- function load($mode = false, $run = true)
- {
- if ($run)
- {
- if (!empty($mode))
- {
- $this->mode = $mode;
- }
-
- $module = $this->filename;
- if (!class_exists($module))
- {
- $this->error('Module "' . htmlspecialchars($module) . '" not accessible.', __LINE__, __FILE__);
- }
- $this->module = new $module($this);
-
- if (method_exists($this->module, 'main'))
- {
- $this->module->main($this->mode, $this->sub);
- }
- }
- }
-
- /**
- * Output the standard page header
- */
- function page_header()
- {
- if (defined('HEADER_INC'))
- {
- return;
- }
-
- define('HEADER_INC', true);
- global $stage;
-
- phpbb::$template->assign_vars(array(
- 'PAGE_TITLE' => $this->get_page_title(),
- 'T_IMAGE_PATH' => PHPBB_ROOT_PATH . 'adm/images/',
-
- 'S_CONTENT_DIRECTION' => phpbb::$user->lang['DIRECTION'],
- 'S_CONTENT_FLOW_BEGIN' => (phpbb::$user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
- 'S_CONTENT_FLOW_END' => (phpbb::$user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
- 'S_CONTENT_ENCODING' => 'UTF-8',
-
- 'S_USER_LANG' => phpbb::$user->lang['USER_LANG'],
- )
- );
-
- header('Content-type: text/html; charset=UTF-8');
- header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
- header('Pragma: no-cache');
-
- return;
- }
-
- /**
- * Output the standard page footer
- */
- function page_footer()
- {
- phpbb::$template->display('body');
-
- // Close our DB connection.
- if (phpbb::registered('db'))
- {
- phpbb::$db->sql_close();
- }
-
- if (function_exists('exit_handler'))
- {
- exit_handler();
- }
- }
-
- /**
- * Returns desired template name
- */
- function get_tpl_name()
- {
- return $this->module->tpl_name . '.html';
- }
-
- /**
- * Returns the desired page title
- */
- function get_page_title()
- {
- if (!isset($this->module->page_title))
- {
- return '';
- }
-
- return (isset(phpbb::$user->lang[$this->module->page_title])) ? phpbb::$user->lang[$this->module->page_title] : $this->module->page_title;
- }
-
- /**
- * Generate the navigation tabs
- */
- function generate_navigation()
- {
- if (is_array($this->module_ary))
- {
- @ksort($this->module_ary);
- foreach ($this->module_ary as $cat_ary)
- {
- $cat = $cat_ary['name'];
- $l_cat = (!empty($lang['CAT_' . $cat])) ? $lang['CAT_' . $cat] : preg_replace('#_#', ' ', $cat);
- $cat = strtolower($cat);
- $url = $this->module_url . "?mode=$cat&amp;language=" . phpbb::$user->lang_name;
-
- if ($this->mode == $cat)
- {
- phpbb::$template->assign_block_vars('t_block1', array(
- 'L_TITLE' => $l_cat,
- 'S_SELECTED' => true,
- 'U_TITLE' => $url,
- ));
-
- if (is_array($this->module_ary[$this->id]['subs']))
- {
- $subs = $this->module_ary[$this->id]['subs'];
- foreach ($subs as $option)
- {
- $l_option = (!empty(phpbb::$user->lang['SUB_' . $option])) ? phpbb::$user->lang['SUB_' . $option] : preg_replace('#_#', ' ', $option);
- $option = strtolower($option);
- $url = $this->module_url . '?mode=' . $this->mode . "&amp;sub=$option&amp;language=" . phpbb::$user->lang_name;
-
- phpbb::$template->assign_block_vars('l_block1', array(
- 'L_TITLE' => $l_option,
- 'S_SELECTED' => ($this->sub == $option),
- 'U_TITLE' => $url,
- ));
- }
- }
-
- if (is_array($this->module_ary[$this->id]['stages']))
- {
- $subs = $this->module_ary[$this->id]['stages'];
- $matched = false;
- foreach ($subs as $option)
- {
- $l_option = (!empty(phpbb::$user->lang['STAGE_' . $option])) ? phpbb::$user->lang['STAGE_' . $option] : preg_replace('#_#', ' ', $option);
- $option = strtolower($option);
- $matched = ($this->sub == $option) ? true : $matched;
-
- phpbb::$template->assign_block_vars('l_block2', array(
- 'L_TITLE' => $l_option,
- 'S_SELECTED' => ($this->sub == $option),
- 'S_COMPLETE' => !$matched,
- ));
- }
- }
- }
- else
- {
- phpbb::$template->assign_block_vars('t_block1', array(
- 'L_TITLE' => $l_cat,
- 'S_SELECTED' => false,
- 'U_TITLE' => $url,
- ));
- }
- }
- }
- }
-
- /**
- * Output an error message
- * If skip is true, return and continue execution, else exit
- */
- function error($error, $line, $file)
- {
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['INST_ERR'],
- ));
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => basename($file) . ' [ ' . $line . ' ]',
- 'RESULT' => '<b style="color:red">' . $error . '</b>',
- ));
-
- return;
- }
-
- /**
- * Output an error message for a database related problem
- * If skip is true, return and continue execution, else exit
- */
- function db_error($error, $sql, $line, $file)
- {
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['INST_ERR_FATAL'],
- ));
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => basename($file) . ' [ ' . $line . ' ]',
- 'RESULT' => '<b style="color:red">' . $error . '</b><br />&#187; SQL:' . $sql,
- ));
-
- return;
- }
-
- /**
- * Generate the relevant HTML for an input field and the associated label and explanatory text
- */
- function input_field($name, $type, $value='', $options='')
- {
- $tpl_type = explode(':', $type);
- $tpl = '';
-
- switch ($tpl_type[0])
- {
- case 'text':
- case 'password':
- $size = (int) $tpl_type[1];
- $maxlength = (int) $tpl_type[2];
-
- $tpl = '<input id="' . $name . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $value . '" />';
- break;
-
- case 'textarea':
- $rows = (int) $tpl_type[1];
- $cols = (int) $tpl_type[2];
-
- $tpl = '<textarea id="' . $name . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $value . '</textarea>';
- break;
-
- case 'radio':
- $key_yes = ($value) ? ' checked="checked" id="' . $name . '"' : '';
- $key_no = (!$value) ? ' checked="checked" id="' . $name . '"' : '';
-
- $tpl_type_cond = explode('_', $tpl_type[1]);
- $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
-
- $tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? phpbb::$user->lang['NO'] : phpbb::$user->lang['DISABLED']) . '</label>';
- $tpl_yes = '<label><input type="radio" name="' . $name . '" value="1"' . $key_yes . ' class="radio" /> ' . (($type_no) ? phpbb::$user->lang['YES'] : phpbb::$user->lang['ENABLED']) . '</label>';
-
- $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . '&nbsp;&nbsp;' . $tpl_no : $tpl_no . '&nbsp;&nbsp;' . $tpl_yes;
- break;
-
- case 'select':
- eval('$s_options = ' . str_replace('{VALUE}', $value, $options) . ';');
- $tpl = '<select id="' . $name . '" name="' . $name . '">' . $s_options . '</select>';
- break;
-
- case 'custom':
- eval('$tpl = ' . str_replace('{VALUE}', $value, $options) . ';');
- break;
-
- default:
- break;
- }
-
- return $tpl;
- }
-
- /**
- * Generate the drop down of available language packs
- */
- function inst_language_select($default = '')
- {
- $dir = @opendir(PHPBB_ROOT_PATH . 'language');
-
- if (!$dir)
- {
- $this->error('Unable to access the language directory', __LINE__, __FILE__);
- }
-
- while ($file = readdir($dir))
- {
- $path = PHPBB_ROOT_PATH . 'language/' . $file;
-
- if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS')
- {
- continue;
- }
-
- if (file_exists($path . '/iso.txt'))
- {
- list($displayname, $localname) = @file($path . '/iso.txt');
- $lang[$localname] = $file;
- }
- }
- closedir($dir);
-
- @asort($lang);
- @reset($lang);
-
- $user_select = '';
- foreach ($lang as $displayname => $filename)
- {
- $selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : '';
- $user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
- }
-
- return $user_select;
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
deleted file mode 100644
index 110472a499..0000000000
--- a/phpBB/install/install_convert.php
+++ /dev/null
@@ -1,2103 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-*/
-
-if (!defined('IN_INSTALL'))
-{
- // Someone has tried to access the file direct. This is not a good idea, so exit
- exit;
-}
-
-if (!empty($setmodules))
-{
- $module[] = array(
- 'module_type' => 'install',
- 'module_title' => 'CONVERT',
- 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1),
- 'module_order' => 20,
- 'module_subs' => '',
- 'module_stages' => array('INTRO', 'SETTINGS', 'IN_PROGRESS', 'FINAL'),
- 'module_reqs' => ''
- );
-}
-
-/**
-* Class holding all convertor-specific details.
-* @package install
-*/
-class convert
-{
- var $options = array();
-
- var $convertor_tag = '';
- var $src_dbms = '';
- var $src_dbhost = '';
- var $src_dbport = '';
- var $src_dbuser = '';
- var $src_dbpasswd = '';
- var $src_dbname = '';
- var $src_table_prefix = '';
-
- var $convertor_data = array();
- var $tables = array();
- var $config_schema = array();
- var $convertor = array();
- var $src_truncate_statement = 'DELETE FROM ';
- var $truncate_statement = 'DELETE FROM ';
-
- var $fulltext_search;
-
- // Batch size, can be adjusted by the conversion file
- // For big boards a value of 6000 seems to be optimal
- var $batch_size = 2000;
- // Number of rows to be inserted at once (extended insert) if supported
- // For installations having enough memory a value of 60 may be good.
- var $num_wait_rows = 20;
-
- // Mysqls internal recoding engine messing up with our (better) functions? We at least support more encodings than mysql so should use it in favor.
- var $mysql_convert = false;
-
- var $p_master;
-
- function __construct(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-}
-
-/**
-* Convert class for conversions
-* @package install
-*/
-class install_convert extends module
-{
- /**
- * Variables used while converting, they are accessible from the global variable $convert
- */
- function install_convert(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($mode, $sub)
- {
- global $lang, $template, $config, $language, $table_prefix;
- global $convert;
-
- $this->tpl_name = 'install_convert';
- $this->mode = $mode;
-
- $convert = new convert($this->p_master);
-
- switch ($sub)
- {
- case 'intro':
- // Try opening config file
- // @todo If phpBB is not installed, we need to do a cut-down installation here
- // For now, we redirect to the installation script instead
- if (@file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT))
- {
- include(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
- }
-
- if (!defined('PHPBB_INSTALLED'))
- {
- $template->assign_vars(array(
- 'S_NOT_INSTALLED' => true,
- 'TITLE' => $lang['BOARD_NOT_INSTALLED'],
- 'BODY' => sprintf($lang['BOARD_NOT_INSTALLED_EXPLAIN'], append_sid('install/index', 'mode=install&amp;language=' . $language)),
- ));
-
- return;
- }
-
- require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT);
-
- $db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
- unset($dbpasswd);
-
- // We need to fill the config to let internal functions correctly work
- $sql = 'SELECT *
- FROM ' . CONFIG_TABLE;
- $result = $db->sql_query($sql);
-
- $config = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $config[$row['config_name']] = $row['config_value'];
- }
- $db->sql_freeresult($result);
-
- // Detect if there is already a conversion in progress at this point and offer to resume
- // It's quite possible that the user will get disconnected during a large conversion so they need to be able to resume it
- $new_conversion = request_var('new_conv', 0);
-
- if ($new_conversion)
- {
- $config['convert_progress'] = '';
- $config['convert_db_server'] = '';
- $config['convert_db_user'] = '';
- $db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
- WHERE config_name = 'convert_progress'
- OR config_name = 'convert_db_server'
- OR config_name = 'convert_db_user'"
- );
- }
-
- // Let's see if there is a conversion in the works...
- $options = array();
- if (!empty($config['convert_progress']) && !empty($config['convert_db_server']) && !empty($config['convert_db_user']) && !empty($config['convert_options']))
- {
- $options = unserialize($config['convert_progress']);
- $options = array_merge($options, unserialize($config['convert_db_server']), unserialize($config['convert_db_user']), unserialize($config['convert_options']));
- }
-
- // This information should have already been checked once, but do it again for safety
- if (!empty($options) && !empty($options['tag']) &&
- isset($options['dbms']) &&
- isset($options['dbhost']) &&
- isset($options['dbport']) &&
- isset($options['dbuser']) &&
- isset($options['dbpasswd']) &&
- isset($options['dbname']) &&
- isset($options['table_prefix']))
- {
- $this->page_title = $lang['CONTINUE_CONVERT'];
-
- $template->assign_vars(array(
- 'TITLE' => $lang['CONTINUE_CONVERT'],
- 'BODY' => $lang['CONTINUE_CONVERT_BODY'],
- 'L_NEW' => $lang['CONVERT_NEW_CONVERSION'],
- 'L_CONTINUE' => $lang['CONTINUE_OLD_CONVERSION'],
- 'S_CONTINUE' => true,
-
- 'U_NEW_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&amp;sub=intro&amp;new_conv=1&amp;language=$language",
- 'U_CONTINUE_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&amp;sub=in_progress&amp;tag={$options['tag']}{$options['step']}&amp;language=$language",
- ));
-
- return;
- }
-
- $this->list_convertors($sub);
-
- break;
-
- case 'settings':
- $this->get_convert_settings($sub);
- break;
-
- case 'in_progress':
- $this->convert_data($sub);
- break;
-
- case 'final':
- $this->page_title = $lang['CONVERT_COMPLETE'];
-
- $template->assign_vars(array(
- 'TITLE' => $lang['CONVERT_COMPLETE'],
- 'BODY' => $lang['CONVERT_COMPLETE_EXPLAIN'],
- ));
-
- // If we reached this step (conversion completed) we want to purge the cache and log the user out.
- // This is for making sure the session get not screwed due to the 3.0.x users table being completely new.
- phpbb::$acm->purge();
-
- require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT);
-
- $db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
- unset($dbpasswd);
-
- $sql = 'SELECT config_value
- FROM ' . CONFIG_TABLE . '
- WHERE config_name = \'search_type\'';
- $result = $db->sql_query($sql);
-
- if ($db->sql_fetchfield('config_value') != 'fulltext_mysql')
- {
- $template->assign_vars(array(
- 'S_ERROR_BOX' => true,
- 'ERROR_TITLE' => $lang['SEARCH_INDEX_UNCONVERTED'],
- 'ERROR_MSG' => $lang['SEARCH_INDEX_UNCONVERTED_EXPLAIN'],
- ));
- }
-
- if ($db->truncate)
- {
- $db->sql_query('TRUNCATE TABLE ' . SESSIONS_KEYS_TABLE);
- $db->sql_query('TRUNCATE TABLE ' . SESSIONS_TABLE);
- }
- else
- {
- $db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE);
- $db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
- }
-
- break;
- }
- }
-
- /**
- * Generate a list of all available conversion modules
- */
- function list_convertors($sub)
- {
- global $lang, $language, $template;
-
- $this->page_title = $lang['SUB_INTRO'];
-
- $template->assign_vars(array(
- 'TITLE' => $lang['CONVERT_INTRO'],
- 'BODY' => $lang['CONVERT_INTRO_BODY'],
-
- 'L_AUTHOR' => $lang['AUTHOR'],
- 'L_AVAILABLE_CONVERTORS' => $lang['AVAILABLE_CONVERTORS'],
- 'L_CONVERT' => $lang['CONVERT'],
- 'L_NO_CONVERTORS' => $lang['NO_CONVERTORS'],
- 'L_OPTIONS' => $lang['CONVERT_OPTIONS'],
- 'L_SOFTWARE' => $lang['SOFTWARE'],
- 'L_VERSION' => $lang['VERSION'],
-
- 'S_LIST' => true,
- ));
-
- $convertors = $sort = array();
- $get_info = true;
-
- $handle = @opendir('./convertors/');
-
- if (!$handle)
- {
- $this->error('Unable to access the convertors directory', __LINE__, __FILE__);
- }
-
- while ($entry = readdir($handle))
- {
- if (preg_match('/^convert_([a-z0-9_]+).' . PHP_EXT . '$/i', $entry, $m))
- {
- include('./convertors/' . $entry);
- if (isset($convertor_data))
- {
- $sort[strtolower($convertor_data['forum_name'])] = sizeof($convertors);
-
- $convertors[] = array(
- 'tag' => $m[1],
- 'forum_name' => $convertor_data['forum_name'],
- 'version' => $convertor_data['version'],
- 'dbms' => $convertor_data['dbms'],
- 'dbhost' => $convertor_data['dbhost'],
- 'dbport' => $convertor_data['dbport'],
- 'dbuser' => $convertor_data['dbuser'],
- 'dbpasswd' => $convertor_data['dbpasswd'],
- 'dbname' => $convertor_data['dbname'],
- 'table_prefix' => $convertor_data['table_prefix'],
- 'author' => $convertor_data['author']
- );
- }
- unset($convertor_data);
- }
- }
- closedir($handle);
-
- @ksort($sort);
-
- foreach ($sort as $void => $index)
- {
- $template->assign_block_vars('convertors', array(
- 'AUTHOR' => $convertors[$index]['author'],
- 'SOFTWARE' => $convertors[$index]['forum_name'],
- 'VERSION' => $convertors[$index]['version'],
-
- 'U_CONVERT' => $this->p_master->module_url . "?mode={$this->mode}&amp;language=$language&amp;sub=settings&amp;tag=" . $convertors[$index]['tag'],
- ));
- }
- }
-
- /**
- */
- function get_convert_settings($sub)
- {
- global $lang, $language, $template, $db, $config;
-
- require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT);
-
- $db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
- unset($dbpasswd);
-
- $this->page_title = $lang['STAGE_SETTINGS'];
-
- // We need to fill the config to let internal functions correctly work
- $sql = 'SELECT *
- FROM ' . CONFIG_TABLE;
- $result = $db->sql_query($sql);
-
- $config = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $config[$row['config_name']] = $row['config_value'];
- }
- $db->sql_freeresult($result);
-
- $convertor_tag = request_var('tag', '');
-
- if (empty($convertor_tag))
- {
- $this->p_master->error($lang['NO_CONVERT_SPECIFIED'], __LINE__, __FILE__);
- }
- $get_info = true;
-
- // check security implications of direct inclusion
- $convertor_tag = basename($convertor_tag);
- if (!file_exists('./convertors/convert_' . $convertor_tag . '.' . PHP_EXT))
- {
- $this->p_master->error($lang['CONVERT_NOT_EXIST'], __LINE__, __FILE__);
- }
-
- include('./convertors/convert_' . $convertor_tag . '.' . PHP_EXT);
-
- // The test_file is a file that should be present in the location of the old board.
- if (!isset($test_file))
- {
- $this->p_master->error($lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__);
- }
-
- $submit = phpbb_request::is_set_post('submit');
-
- $src_dbms = request_var('src_dbms', $convertor_data['dbms']);
- $src_dbhost = request_var('src_dbhost', $convertor_data['dbhost']);
- $src_dbport = request_var('src_dbport', $convertor_data['dbport']);
- $src_dbuser = request_var('src_dbuser', $convertor_data['dbuser']);
- $src_dbpasswd = request_var('src_dbpasswd', $convertor_data['dbpasswd']);
- $src_dbname = request_var('src_dbname', $convertor_data['dbname']);
- $src_table_prefix = request_var('src_table_prefix', $convertor_data['table_prefix']);
- $forum_path = request_var('forum_path', $convertor_data['forum_path']);
- $refresh = request_var('refresh', 1);
-
- // Default URL of the old board
- // @todo Are we going to use this for attempting to convert URL references in posts, or should we remove it?
- // -> We should convert old urls to the new relative urls format
- // $src_url = request_var('src_url', 'Not in use at the moment');
-
- // strip trailing slash from old forum path
- $forum_path = (strlen($forum_path) && $forum_path[strlen($forum_path) - 1] == '/') ? substr($forum_path, 0, -1) : $forum_path;
-
- $error = array();
- if ($submit)
- {
- if (!@file_exists('./../' . $forum_path . '/' . $test_file))
- {
- $error[] = sprintf($lang['COULD_NOT_FIND_PATH'], $forum_path);
- }
-
- $connect_test = false;
- $available_dbms = get_available_dbms(false, true, true);
-
- if (!isset($available_dbms[$src_dbms]) || !$available_dbms[$src_dbms]['AVAILABLE'])
- {
- $error['db'][] = $lang['INST_ERR_NO_DB'];
- $connect_test = false;
- }
- else
- {
- $connect_test = connect_check_db($available_dbms[$src_dbms], $src_table_prefix, $src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, $error, ($src_dbms == $dbms) ? false : true);
- }
-
- // The forum prefix of the old and the new forum can only be the same if two different databases are used.
- if ($src_table_prefix == $table_prefix && $src_dbms == $dbms && $src_dbhost == $dbhost && $src_dbport == $dbport && $src_dbname == $dbname)
- {
- $error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix);
- }
-
- // Check table prefix
- if (!sizeof($error))
- {
- // initiate database connection to old db if old and new db differ
- global $src_db, $same_db;
- $src_db = $same_db = false;
-
- if ($src_dbms != $dbms || $src_dbhost != $dbhost || $src_dbport != $dbport || $src_dbname != $dbname || $src_dbuser != $dbuser)
- {
- $sql_db = 'dbal_' . $src_dbms;
- $src_db = new $sql_db();
- $src_db->sql_connect($src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, false, true);
- $same_db = false;
- }
- else
- {
- $src_db = $db;
- $same_db = true;
- }
-
- $src_db->sql_return_on_error(true);
- $db->sql_return_on_error(true);
-
- // Try to select one row from the first table to see if the prefix is OK
- $result = $src_db->sql_query_limit('SELECT * FROM ' . $src_table_prefix . $tables[0], 1);
-
- if (!$result)
- {
- $prefixes = array();
-
- $tables_existing = get_tables($src_db);
- $tables_existing = array_map('strtolower', $tables_existing);
- foreach ($tables_existing as $table_name)
- {
- compare_table($tables, $table_name, $prefixes);
- }
- unset($tables_existing);
-
- foreach ($prefixes as $prefix => $count)
- {
- if ($count >= sizeof($tables))
- {
- $possible_prefix = $prefix;
- break;
- }
- }
-
- $msg = '';
- if (!empty($convertor_data['table_prefix']))
- {
- $msg .= sprintf($lang['DEFAULT_PREFIX_IS'], $convertor_data['forum_name'], $convertor_data['table_prefix']);
- }
-
- if (!empty($possible_prefix))
- {
- $msg .= '<br />';
- $msg .= ($possible_prefix == '*') ? $lang['BLANK_PREFIX_FOUND'] : sprintf($lang['PREFIX_FOUND'], $possible_prefix);
- $src_table_prefix = ($possible_prefix == '*') ? '' : $possible_prefix;
- }
-
- $error[] = $msg;
- }
- $src_db->sql_freeresult($result);
- $src_db->sql_return_on_error(false);
- }
-
- if (!sizeof($error))
- {
- // Save convertor Status
- set_config('convert_progress', serialize(array(
- 'step' => '',
- 'table_prefix' => $src_table_prefix,
- 'tag' => $convertor_tag,
- )), true);
- set_config('convert_db_server', serialize(array(
- 'dbms' => $src_dbms,
- 'dbhost' => $src_dbhost,
- 'dbport' => $src_dbport,
- 'dbname' => $src_dbname,
- )), true);
- set_config('convert_db_user', serialize(array(
- 'dbuser' => $src_dbuser,
- 'dbpasswd' => $src_dbpasswd,
- )), true);
-
- // Save options
- set_config('convert_options', serialize(array('forum_path' => './../' . $forum_path, 'refresh' => $refresh)), true);
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => $lang['VERIFY_OPTIONS'],
- 'RESULT' => $lang['CONVERT_SETTINGS_VERIFIED'],
- ));
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $lang['BEGIN_CONVERT'],
-// 'S_HIDDEN' => $s_hidden_fields,
- 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&amp;sub=in_progress&amp;tag=$convertor_tag&amp;language=$language",
- ));
-
- return;
- }
- else
- {
- $template->assign_block_vars('checks', array(
- 'TITLE' => $lang['VERIFY_OPTIONS'],
- 'RESULT' => '<b style="color:red">' . implode('<br />', $error) . '</b>',
- ));
- }
- } // end submit
-
- foreach ($this->convert_options as $config_key => $vars)
- {
- if (!is_array($vars) && strpos($config_key, 'legend') === false)
- {
- continue;
- }
-
- if (strpos($config_key, 'legend') !== false)
- {
- $template->assign_block_vars('options', array(
- 'S_LEGEND' => true,
- 'LEGEND' => $lang[$vars])
- );
-
- continue;
- }
-
- $options = isset($vars['options']) ? $vars['options'] : '';
-
- $template->assign_block_vars('options', array(
- 'KEY' => $config_key,
- 'TITLE' => $lang[$vars['lang']],
- 'S_EXPLAIN' => $vars['explain'],
- 'S_LEGEND' => false,
- 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '',
- 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $$config_key, $options),
- )
- );
- }
-
- $template->assign_vars(array(
- 'TITLE' => $lang['STAGE_SETTINGS'],
- 'BODY' => $lang['CONV_OPTIONS_BODY'],
- 'L_SUBMIT' => $lang['BEGIN_CONVERT'],
- 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&amp;sub=settings&amp;tag=$convertor_tag&amp;language=$language",
- ));
- }
-
- /**
- * The function which does the actual work (or dispatches it to the relevant places)
- */
- function convert_data($sub)
- {
- global $template, $user, $db, $lang, $config;
- global $convert, $convert_row, $message_parser, $skip_rows, $language;
-
- require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT);
- require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT);
-
- $db = new $sql_db();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
- unset($dbpasswd);
-
- $sql = 'SELECT *
- FROM ' . CONFIG_TABLE;
- $result = $db->sql_query($sql);
-
- $config = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $config[$row['config_name']] = $row['config_value'];
- }
- $db->sql_freeresult($result);
-
- // Override a couple of config variables for the duration
- $config['max_quote_depth'] = 0;
-
- // @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues
- $config['max_post_chars'] = 0;
-
- // Set up a user as well. We _should_ have enough of a database here at this point to do this
- // and it helps for any core code we call
- $user->session_begin();
- $user->page = session::extract_current_page(PHPBB_ROOT_PATH);
-
- // This is a little bit of a fudge, but it allows the language entries to be available to the
- // core code without us loading them again
- $user->lang = &$lang;
-
- $this->page_title = $user->lang['STAGE_IN_PROGRESS'];
-
- $convert->options = array();
- if (isset($config['convert_progress']))
- {
- $convert->options = unserialize($config['convert_progress']);
- $convert->options = array_merge($convert->options, unserialize($config['convert_db_server']), unserialize($config['convert_db_user']), unserialize($config['convert_options']));
- }
-
- // This information should have already been checked once, but do it again for safety
- if (empty($convert->options) || empty($convert->options['tag']) ||
- !isset($convert->options['dbms']) ||
- !isset($convert->options['dbhost']) ||
- !isset($convert->options['dbport']) ||
- !isset($convert->options['dbuser']) ||
- !isset($convert->options['dbpasswd']) ||
- !isset($convert->options['dbname']) ||
- !isset($convert->options['table_prefix']))
- {
- $this->p_master->error($user->lang['NO_CONVERT_SPECIFIED'], __LINE__, __FILE__);
- }
-
- // Make some short variables accessible, for easier referencing
- $convert->convertor_tag = basename($convert->options['tag']);
- $convert->src_dbms = $convert->options['dbms'];
- $convert->src_dbhost = $convert->options['dbhost'];
- $convert->src_dbport = $convert->options['dbport'];
- $convert->src_dbuser = $convert->options['dbuser'];
- $convert->src_dbpasswd = $convert->options['dbpasswd'];
- $convert->src_dbname = $convert->options['dbname'];
- $convert->src_table_prefix = $convert->options['table_prefix'];
-
- // initiate database connection to old db if old and new db differ
- global $src_db, $same_db;
- $src_db = $same_db = null;
- if ($convert->src_dbms != $dbms || $convert->src_dbhost != $dbhost || $convert->src_dbport != $dbport || $convert->src_dbname != $dbname || $convert->src_dbuser != $dbuser)
- {
- if ($convert->src_dbms != $dbms)
- {
- require(PHPBB_ROOT_PATH . 'includes/db/' . $convert->src_dbms . '.' . PHP_EXT);
- }
- $sql_db = 'dbal_' . $convert->src_dbms;
- $src_db = new $sql_db();
- $src_db->sql_connect($convert->src_dbhost, $convert->src_dbuser, htmlspecialchars_decode($convert->src_dbpasswd), $convert->src_dbname, $convert->src_dbport, false, true);
- $same_db = false;
- }
- else
- {
- $src_db = $db;
- $same_db = true;
- }
-
- $convert->mysql_convert = false;
- switch ($src_db->sql_layer)
- {
- case 'sqlite':
- case 'firebird':
- $convert->src_truncate_statement = 'DELETE FROM ';
- break;
-
- // Thanks MySQL, for silently converting...
- case 'mysql':
- if (version_compare($src_db->sql_server_info(true), '4.1.3', '>='))
- {
- $convert->mysql_convert = true;
- }
- $convert->src_truncate_statement = 'TRUNCATE TABLE ';
- break;
-
- case 'mysqli':
- $convert->mysql_convert = true;
- $convert->src_truncate_statement = 'TRUNCATE TABLE ';
- break;
-
- default:
- $convert->src_truncate_statement = 'TRUNCATE TABLE ';
- break;
- }
-
- if ($convert->mysql_convert && !$same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- if ($db->truncate)
- {
- $convert->truncate_statement = 'TRUNCATE TABLE ';
- }
- else
- {
- $convert->truncate_statement = 'DELETE FROM ';
- }
-
- $get_info = false;
-
- // check security implications of direct inclusion
- if (!file_exists('./convertors/convert_' . $convert->convertor_tag . '.' . PHP_EXT))
- {
- $this->p_master->error($user->lang['CONVERT_NOT_EXIST'], __LINE__, __FILE__);
- }
-
- if (file_exists('./convertors/functions_' . $convert->convertor_tag . '.' . PHP_EXT))
- {
- include('./convertors/functions_' . $convert->convertor_tag . '.' . PHP_EXT);
- }
-
- $get_info = true;
- include('./convertors/convert_' . $convert->convertor_tag . '.' . PHP_EXT);
-
- // Map some variables...
- $convert->convertor_data = $convertor_data;
- $convert->tables = $tables;
- $convert->config_schema = $config_schema;
-
- // Now include the real data
- $get_info = false;
- include('./convertors/convert_' . $convert->convertor_tag . '.' . PHP_EXT);
-
- $convert->convertor_data = $convertor_data;
- $convert->tables = $tables;
- $convert->config_schema = $config_schema;
- $convert->convertor = $convertor;
-
- // The test_file is a file that should be present in the location of the old board.
- if (!file_exists($convert->options['forum_path'] . '/' . $test_file))
- {
- $this->p_master->error(sprintf($user->lang['COULD_NOT_FIND_PATH'], $convert->options['forum_path']), __LINE__, __FILE__);
- }
-
- $search_type = basename(trim($config['search_type']));
-
- // For conversions we are a bit less strict and set to a search backend we know exist...
- if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT))
- {
- $search_type = 'fulltext_native';
- set_config('search_type', $search_type);
- }
-
- if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT))
- {
- trigger_error('NO_SUCH_SEARCH_MODULE');
- }
-
- require(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT);
-
- $error = false;
- $convert->fulltext_search = new $search_type($error);
-
- if ($error)
- {
- trigger_error($error);
- }
-
- include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT);
- $message_parser = new parse_message();
-
- $jump = request_var('jump', 0);
- $final_jump = request_var('final_jump', 0);
- $sync_batch = request_var('sync_batch', -1);
- $last_statement = request_var('last', 0);
-
- // We are running sync...
- if ($sync_batch >= 0)
- {
- $this->sync_forums($sync_batch);
- return;
- }
-
- if ($jump)
- {
- $this->jump($jump, $last_statement);
- return;
- }
-
- if ($final_jump)
- {
- $this->final_jump($final_jump);
- return;
- }
-
- $current_table = request_var('current_table', 0);
- $old_current_table = min(-1, $current_table - 1);
- $skip_rows = request_var('skip_rows', 0);
-
- if (!$current_table && !$skip_rows)
- {
- if (!phpbb_request::variable('confirm', false))
- {
- // If avatars / ranks / smilies folders are specified make sure they are writable
- $bad_folders = array();
-
- $local_paths = array(
- 'avatar_path' => path($config['avatar_path']),
- 'avatar_gallery_path' => path($config['avatar_gallery_path']),
- 'icons_path' => path($config['icons_path']),
- 'ranks_path' => path($config['ranks_path']),
- 'smilies_path' => path($config['smilies_path'])
- );
-
- foreach ($local_paths as $folder => $local_path)
- {
- if (isset($convert->convertor[$folder]))
- {
- if (empty($convert->convertor['test_file']))
- {
- // test_file is mandantory at the moment so this should never be reached, but just in case...
- $this->p_master->error($user->lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__);
- }
-
- if (!$local_path || !@is_writable(PHPBB_ROOT_PATH . $local_path))
- {
- if (!$local_path)
- {
- $bad_folders[] = sprintf($user->lang['CONFIG_PHPBB_EMPTY'], $folder);
- }
- else
- {
- $bad_folders[] = $local_path;
- }
- }
- }
- }
-
- if (sizeof($bad_folders))
- {
- $msg = (sizeof($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE'];
- sort($bad_folders);
- $this->p_master->error(sprintf($msg, implode('<br />', $bad_folders)), __LINE__, __FILE__, true);
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['INSTALL_TEST'],
- 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&amp;sub=in_progress&amp;tag={$convert->convertor_tag}&amp;language=$language",
- ));
- return;
- }
-
- // Grab all the tables used in convertor
- $missing_tables = $tables_list = $aliases = array();
-
- foreach ($convert->convertor['schema'] as $schema)
- {
- // Skip those not used (because of addons/plugins not detected)
- if (!$schema['target'])
- {
- continue;
- }
-
- foreach ($schema as $key => $val)
- {
- // we're dealing with an array like:
- // array('forum_status', 'forums.forum_status', 'is_item_locked')
- if (is_int($key) && !empty($val[1]))
- {
- $temp_data = $val[1];
- if (!is_array($temp_data))
- {
- $temp_data = array($temp_data);
- }
-
- foreach ($temp_data as $val)
- {
- if (preg_match('/([a-z0-9_]+)\.([a-z0-9_]+)\)* ?A?S? ?([a-z0-9_]*?)\.?([a-z0-9_]*)$/i', $val, $m))
- {
- $table = $convert->src_table_prefix . $m[1];
- $tables_list[$table] = $table;
-
- if (!empty($m[3]))
- {
- $aliases[] = $convert->src_table_prefix . $m[3];
- }
- }
- }
- }
- // 'left_join' => 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1'
- else if ($key == 'left_join')
- {
- // Convert the value if it wasn't an array already.
- if (!is_array($val))
- {
- $val = array($val);
- }
-
- for ($j = 0; $j < sizeof($val); ++$j)
- {
- if (preg_match('/LEFT JOIN ([a-z0-9_]+) AS ([a-z0-9_]+)/i', $val[$j], $m))
- {
- $table = $convert->src_table_prefix . $m[1];
- $tables_list[$table] = $table;
-
- if (!empty($m[2]))
- {
- $aliases[] = $convert->src_table_prefix . $m[2];
- }
- }
- }
- }
- }
- }
-
- // Remove aliased tables from $tables_list
- foreach ($aliases as $alias)
- {
- unset($tables_list[$alias]);
- }
-
- // Check if the tables that we need exist
- $src_db->sql_return_on_error(true);
- foreach ($tables_list as $table => $null)
- {
- $sql = 'SELECT 1 FROM ' . $table;
- $_result = $src_db->sql_query_limit($sql, 1);
-
- if (!$_result)
- {
- $missing_tables[] = $table;
- }
- $src_db->sql_freeresult($_result);
- }
- $src_db->sql_return_on_error(false);
-
- // Throw an error if some tables are missing
- // We used to do some guessing here, but since we have a suggestion of possible values earlier, I don't see it adding anything here to do it again
-
- if (sizeof($missing_tables) == sizeof($tables_list))
- {
- $this->p_master->error($user->lang['NO_TABLES_FOUND'] . ' ' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__);
- }
- else if (sizeof($missing_tables))
- {
- $this->p_master->error(sprintf($user->lang['TABLES_MISSING'], implode(', ', $missing_tables)) . '<br /><br />' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__);
- }
-
- $url = $this->save_convert_progress('&amp;confirm=1');
- $msg = $user->lang['PRE_CONVERT_COMPLETE'];
-
- if ($convert->convertor_data['author_notes'])
- {
- $msg .= '</p><p>' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']);
- }
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
- 'L_MESSAGE' => $msg,
- 'U_ACTION' => $url,
- ));
-
- return;
- } // if (!phpbb_request::variable('confirm', false))
-
- $template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => $user->lang['STARTING_CONVERT'],
- ));
-
- // Convert the config table and load the settings of the old board
- if (!empty($convert->config_schema))
- {
- restore_config($convert->config_schema);
-
- // Override a couple of config variables for the duration
- $config['max_quote_depth'] = 0;
-
- // @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues
- $config['max_post_chars'] = 0;
- }
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => $user->lang['CONFIG_CONVERT'],
- 'RESULT' => $user->lang['DONE'],
- ));
-
- // Now process queries and execute functions that have to be executed prior to the conversion
- if (!empty($convert->convertor['execute_first']))
- {
- eval($convert->convertor['execute_first']);
- }
-
- if (!empty($convert->convertor['query_first']))
- {
- if (!is_array($convert->convertor['query_first']))
- {
- $convert->convertor['query_first'] = array('target', array($convert->convertor['query_first']));
- }
- else if (!is_array($convert->convertor['query_first'][0]))
- {
- $convert->convertor['query_first'] = array(array($convert->convertor['query_first'][0], $convert->convertor['query_first'][1]));
- }
-
- foreach ($convert->convertor['query_first'] as $query_first)
- {
- if ($query_first[0] == 'src')
- {
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- $src_db->sql_query($query_first[1]);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
- }
- else
- {
- $db->sql_query($query_first[1]);
- }
- }
- }
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => $user->lang['PREPROCESS_STEP'],
- 'RESULT' => $user->lang['DONE'],
- ));
- } // if (!$current_table && !$skip_rows)
-
- $template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => $user->lang['FILLING_TABLES'],
- ));
-
- // This loop takes one target table and processes it
- while ($current_table < sizeof($convert->convertor['schema']))
- {
- $schema = $convert->convertor['schema'][$current_table];
-
- // The target table isn't set, this can be because a module (for example the attachement mod) is taking care of this.
- if (empty($schema['target']))
- {
- $current_table++;
- continue;
- }
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => sprintf($user->lang['FILLING_TABLE'], $schema['target']),
- ));
-
- // This is only the case when we first start working on the tables.
- if (!$skip_rows)
- {
- // process execute_first and query_first for this table...
- if (!empty($schema['execute_first']))
- {
- eval($schema['execute_first']);
- }
-
- if (!empty($schema['query_first']))
- {
- if (!is_array($schema['query_first']))
- {
- $schema['query_first'] = array('target', array($schema['query_first']));
- }
- else if (!is_array($schema['query_first'][0]))
- {
- $schema['query_first'] = array(array($schema['query_first'][0], $schema['query_first'][1]));
- }
-
- foreach ($schema['query_first'] as $query_first)
- {
- if ($query_first[0] == 'src')
- {
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
- $src_db->sql_query($query_first[1]);
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
- }
- else
- {
- $db->sql_query($query_first[1]);
- }
- }
- }
-
- if (!empty($schema['autoincrement']))
- {
- switch ($db->dbms_type)
- {
- case 'postgres':
- $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));');
- break;
-
- case 'oracle':
- $result = $db->sql_query('SELECT MAX(' . $schema['autoincrement'] . ') as max_id FROM ' . $schema['target']);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $largest_id = (int) $row['max_id'];
-
- if ($largest_id)
- {
- $db->sql_query('DROP SEQUENCE ' . $schema['target'] . '_seq');
- $db->sql_query('CREATE SEQUENCE ' . $schema['target'] . '_seq START WITH ' . ($largest_id + 1));
- }
- break;
- }
- }
- }
-
- // Process execute_always for this table
- // This is for code which needs to be executed on every pass of this table if
- // it gets split because of time restrictions
- if (!empty($schema['execute_always']))
- {
- eval($schema['execute_always']);
- }
-
- //
- // Set up some variables
- //
- // $waiting_rows holds rows for multirows insertion (MySQL only)
- // $src_tables holds unique tables with aliases to select from
- // $src_fields will quickly refer source fields (or aliases) corresponding to the current index
- // $select_fields holds the names of the fields to retrieve
- //
-
- $sql_data = array(
- 'source_fields' => array(),
- 'target_fields' => array(),
- 'source_tables' => array(),
- 'select_fields' => array(),
- );
-
- // This statement is building the keys for later insertion.
- $insert_query = $this->build_insert_query($schema, $sql_data, $current_table);
-
- // If no source table is affected, we skip the table
- if (empty($sql_data['source_tables']))
- {
- $skip_rows = 0;
- $current_table++;
- continue;
- }
-
- $distinct = (!empty($schema['distinct'])) ? 'DISTINCT ' : '';
-
- $sql = 'SELECT ' . $distinct . implode(', ', $sql_data['select_fields']) . " \nFROM " . implode(', ', $sql_data['source_tables']);
-
- // Where
- $sql .= (!empty($schema['where'])) ? "\nWHERE (" . $schema['where'] . ')' : '';
-
- // Group By
- if (!empty($schema['group_by']))
- {
- $schema['group_by'] = array($schema['group_by']);
- foreach ($sql_data['select_fields'] as $select)
- {
- $alias = strpos(strtolower($select), ' as ');
- $select = ($alias) ? substr($select, 0, $alias) : $select;
- if (!in_array($select, $schema['group_by']))
- {
- $schema['group_by'][] = $select;
- }
- }
- }
- $sql .= (!empty($schema['group_by'])) ? "\nGROUP BY " . implode(', ', $schema['group_by']) : '';
-
- // Having
- $sql .= (!empty($schema['having'])) ? "\nHAVING " . $schema['having'] : '';
-
- // Order By
- if (empty($schema['order_by']) && !empty($schema['primary']))
- {
- $schema['order_by'] = $schema['primary'];
- }
- $sql .= (!empty($schema['order_by'])) ? "\nORDER BY " . $schema['order_by'] : '';
-
- // Counting basically holds the amount of rows processed.
- $counting = -1;
- $batch_time = 0;
-
- while ($counting === -1 || ($counting >= $convert->batch_size && still_on_time()))
- {
- $old_current_table = $current_table;
-
- $rows = '';
- $waiting_rows = array();
-
- if (!empty($batch_time))
- {
- $mtime = explode(' ', microtime());
- $mtime = $mtime[0] + $mtime[1];
- $rows = ceil($counting/($mtime - $batch_time)) . " rows/s ($counting rows) | ";
- }
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => "skip_rows = $skip_rows",
- 'RESULT' => $rows . ((defined('DEBUG_EXTRA') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''),
- ));
-
- $mtime = explode(' ', microtime());
- $batch_time = $mtime[0] + $mtime[1];
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- // Take skip rows into account and only fetch batch_size amount of rows
- $___result = $src_db->sql_query_limit($sql, $convert->batch_size, $skip_rows);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
-
- // This loop processes each row
- $counting = 0;
-
- $convert->row = $convert_row = array();
-
- if (!empty($schema['autoincrement']))
- {
- switch ($db->dbms_type)
- {
- case 'mssql':
- $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' ON');
- break;
- }
- }
-
- // Now handle the rows until time is over or no more rows to process...
- while ($counting === 0 || still_on_time())
- {
- $convert_row = $src_db->sql_fetchrow($___result);
-
- if (!$convert_row)
- {
- // move to the next batch or table
- break;
- }
-
- // With this we are able to always save the last state
- $convert->row = $convert_row;
-
- // Increment the counting variable, it stores the number of rows we have processed
- $counting++;
-
- $insert_values = array();
-
- $sql_flag = $this->process_row($schema, $sql_data, $insert_values);
-
- if ($sql_flag === true)
- {
- switch ($db->dbms_type)
- {
- // If MySQL, we'll wait to have num_wait_rows rows to submit at once
- case 'mysql':
- $waiting_rows[] = '(' . implode(', ', $insert_values) . ')';
-
- if (sizeof($waiting_rows) >= $convert->num_wait_rows)
- {
- $errored = false;
-
- $db->sql_return_on_error(true);
-
- if (!$db->sql_query($insert_query . implode(', ', $waiting_rows)))
- {
- $errored = true;
- }
- $db->sql_return_on_error(false);
-
- if ($errored)
- {
- $db->sql_return_on_error(true);
-
- // Because it errored out we will try to insert the rows one by one... most of the time this
- // is caused by duplicate entries - but we also do not want to miss one...
- foreach ($waiting_rows as $waiting_sql)
- {
- if (!$db->sql_query($insert_query . $waiting_sql))
- {
- $this->p_master->db_error($user->lang['DB_ERR_INSERT'], htmlspecialchars($insert_query . $waiting_sql) . '<br /><br />' . htmlspecialchars(print_r($db->_sql_error(), true)), __LINE__, __FILE__, true);
- }
- }
-
- $db->sql_return_on_error(false);
- }
-
- $waiting_rows = array();
- }
-
- break;
-
- default:
- $insert_sql = $insert_query . '(' . implode(', ', $insert_values) . ')';
-
- $db->sql_return_on_error(true);
-
- if (!$db->sql_query($insert_sql))
- {
- $this->p_master->db_error($user->lang['DB_ERR_INSERT'], htmlspecialchars($insert_sql) . '<br /><br />' . htmlspecialchars(print_r($db->_sql_error(), true)), __LINE__, __FILE__, true);
- }
- $db->sql_return_on_error(false);
-
- $waiting_rows = array();
-
- break;
- }
- }
-
- $skip_rows++;
- }
- $src_db->sql_freeresult($___result);
-
- // We might still have some rows waiting
- if (sizeof($waiting_rows))
- {
- $errored = false;
- $db->sql_return_on_error(true);
-
- if (!$db->sql_query($insert_query . implode(', ', $waiting_rows)))
- {
- $errored = true;
- }
- $db->sql_return_on_error(false);
-
- if ($errored)
- {
- $db->sql_return_on_error(true);
-
- // Because it errored out we will try to insert the rows one by one... most of the time this
- // is caused by duplicate entries - but we also do not want to miss one...
- foreach ($waiting_rows as $waiting_sql)
- {
- $db->sql_query($insert_query . $waiting_sql);
- $this->p_master->db_error($user->lang['DB_ERR_INSERT'], htmlspecialchars($insert_query . $waiting_sql) . '<br /><br />' . htmlspecialchars(print_r($db->_sql_error(), true)), __LINE__, __FILE__, true);
- }
-
- $db->sql_return_on_error(false);
- }
-
- $waiting_rows = array();
- }
-
- if (!empty($schema['autoincrement']))
- {
- switch ($db->dbms_type)
- {
- case 'mssql':
- $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' OFF');
- break;
-
- case 'postgres':
- $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));');
- break;
-
- case 'oracle':
- $result = $db->sql_query('SELECT MAX(' . $schema['autoincrement'] . ') as max_id FROM ' . $schema['target']);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $largest_id = (int) $row['max_id'];
-
- if ($largest_id)
- {
- $db->sql_query('DROP SEQUENCE ' . $schema['target'] . '_seq');
- $db->sql_query('CREATE SEQUENCE ' . $schema['target'] . '_seq START WITH ' . ($largest_id + 1));
- }
- break;
- }
- }
- }
-
- // When we reach this point, either the current table has been processed or we're running out of time.
- if (still_on_time() && $counting < $convert->batch_size/* && !defined('DEBUG_EXTRA')*/)
- {
- $skip_rows = 0;
- $current_table++;
- }
- else
- {/*
- if (still_on_time() && $counting < $convert->batch_size)
- {
- $skip_rows = 0;
- $current_table++;
- }*/
-
- // Looks like we ran out of time.
- $url = $this->save_convert_progress('&amp;current_table=' . $current_table . '&amp;skip_rows=' . $skip_rows);
-
- $current_table++;
-// $percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows));
-
- $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, sizeof($convert->convertor['schema']));
-
- $template->assign_vars(array(
- 'L_MESSAGE' => $msg,
- 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
- }
-
- // Process execute_last then we'll be done
- $url = $this->save_convert_progress('&amp;jump=1');
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['FINAL_STEP'],
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
-
- /**
- * Sync function being executed at the middle, some functions need to be executed after a successful sync.
- */
- function sync_forums($sync_batch)
- {
- global $template, $user, $db, $config;
- global $convert;
-
- $template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => $user->lang['SYNC_TOPICS'],
- ));
-
- $batch_size = $convert->batch_size;
-
- $sql = 'SELECT MIN(topic_id) as min_value, MAX(topic_id) AS max_value
- FROM ' . TOPICS_TABLE;
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // Set values of minimum/maximum primary value for this table.
- $primary_min = $row['min_value'];
- $primary_max = $row['max_value'];
-
- if ($sync_batch == 0)
- {
- $sync_batch = (int) $primary_min;
- }
-
- if ($sync_batch == 0)
- {
- $sync_batch = 1;
- }
-
- // Fetch a batch of rows, process and insert them.
- while ($sync_batch <= $primary_max && still_on_time())
- {
- $end = ($sync_batch + $batch_size - 1);
-
- // Sync all topics in batch mode...
- sync('topic_approved', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, false);
- sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true);
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . ((defined('DEBUG_EXTRA') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''),
- 'RESULT' => $user->lang['DONE'],
- ));
-
- $sync_batch += $batch_size;
- }
-
- if ($sync_batch >= $primary_max)
- {
- $url = $this->save_convert_progress('&amp;final_jump=1');
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
- else
- {
- $sync_batch--;
- }
-
- $url = $this->save_convert_progress('&amp;sync_batch=' . $sync_batch);
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
-
- /**
- * Save the convertor status
- */
- function save_convert_progress($step)
- {
- global $convert, $language;
-
- // Save convertor Status
- set_config('convert_progress', serialize(array(
- 'step' => $step,
- 'table_prefix' => $convert->src_table_prefix,
- 'tag' => $convert->convertor_tag,
- )), true);
-
- set_config('convert_db_server', serialize(array(
- 'dbms' => $convert->src_dbms,
- 'dbhost' => $convert->src_dbhost,
- 'dbport' => $convert->src_dbport,
- 'dbname' => $convert->src_dbname,
- )), true);
-
- set_config('convert_db_user', serialize(array(
- 'dbuser' => $convert->src_dbuser,
- 'dbpasswd' => $convert->src_dbpasswd,
- )), true);
-
- return $this->p_master->module_url . "?mode={$this->mode}&amp;sub=in_progress&amp;tag={$convert->convertor_tag}$step&amp;language=$language";
- }
-
- /**
- * Finish conversion, the last function to be called.
- */
- function finish_conversion()
- {
- global $db, $convert, $config, $language, $user, $template;
-
- $db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
- WHERE config_name = 'convert_progress'
- OR config_name = 'convert_options'
- OR config_name = 'convert_db_server'
- OR config_name = 'convert_db_user'");
- $db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
-
- @unlink(PHPBB_ROOT_PATH . 'cache/data_global.php');
- cache_moderators();
-
- // And finally, add a note to the log
- add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']);
-
- $url = $this->p_master->module_url . "?mode={$this->mode}&amp;sub=final&amp;language=$language";
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['FINAL_STEP'],
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
-
- /**
- * This function marks the steps after syncing
- */
- function final_jump($final_jump)
- {
- global $template, $user, $src_db, $same_db, $db, $config;
- global $convert;
-
- $template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => $user->lang['PROCESS_LAST'],
- ));
-
- if ($final_jump == 1)
- {
- $db->sql_return_on_error(true);
-
- update_topics_posted();
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => $user->lang['UPDATE_TOPICS_POSTED'],
- 'RESULT' => $user->lang['DONE'],
- ));
-
- if ($db->sql_error_triggered)
- {
- $template->assign_vars(array(
- 'S_ERROR_BOX' => true,
- 'ERROR_TITLE' => $user->lang['UPDATE_TOPICS_POSTED'],
- 'ERROR_MSG' => $user->lang['UPDATE_TOPICS_POSTED_ERR'],
- ));
- }
- $db->sql_return_on_error(false);
-
- $this->finish_conversion();
- return;
- }
- }
-
- /**
- * This function marks the steps before syncing (jump=1)
- */
- function jump($jump, $last_statement)
- {
- global $template, $user, $src_db, $same_db, $db, $config;
- global $convert;
-
- $template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => $user->lang['PROCESS_LAST'],
- ));
-
- if ($jump == 1)
- {
- // Execute 'last' statements/queries
- if (!empty($convert->convertor['execute_last']))
- {
- if (!is_array($convert->convertor['execute_last']))
- {
- eval($convert->convertor['execute_last']);
- }
- else
- {
- while ($last_statement < sizeof($convert->convertor['execute_last']))
- {
- eval($convert->convertor['execute_last'][$last_statement]);
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => $convert->convertor['execute_last'][$last_statement],
- 'RESULT' => $user->lang['DONE'],
- ));
-
- $last_statement++;
- $url = $this->save_convert_progress('&amp;jump=1&amp;last=' . $last_statement);
-
- $percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement));
- $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, sizeof($convert->convertor['execute_last']), $percentage);
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['CONTINUE_LAST'],
- 'L_MESSAGE' => $msg,
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
- }
- }
-
- if (!empty($convert->convertor['query_last']))
- {
- if (!is_array($convert->convertor['query_last']))
- {
- $convert->convertor['query_last'] = array('target', array($convert->convertor['query_last']));
- }
- else if (!is_array($convert->convertor['query_last'][0]))
- {
- $convert->convertor['query_last'] = array(array($convert->convertor['query_last'][0], $convert->convertor['query_last'][1]));
- }
-
- foreach ($convert->convertor['query_last'] as $query_last)
- {
- if ($query_last[0] == 'src')
- {
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'binary'");
- }
-
- $src_db->sql_query($query_last[1]);
-
- if ($convert->mysql_convert && $same_db)
- {
- $src_db->sql_query("SET NAMES 'utf8'");
- }
- }
- else
- {
- $db->sql_query($query_last[1]);
- }
- }
- }
-
- // Sanity check
- $db->sql_return_on_error(false);
- $src_db->sql_return_on_error(false);
-
- fix_empty_primary_groups();
-
- if (!isset($config['board_startdate']))
- {
- $sql = 'SELECT MIN(user_regdate) AS board_startdate
- FROM ' . USERS_TABLE;
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (($row['board_startdate'] < $config['board_startdate'] && $row['board_startdate'] > 0) || !isset($config['board_startdate']))
- {
- set_config('board_startdate', $row['board_startdate']);
- $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_regdate = ' . $row['board_startdate'] . ' WHERE user_id = ' . ANONYMOUS);
- }
- }
-
- update_dynamic_config();
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => $user->lang['CLEAN_VERIFY'],
- 'RESULT' => $user->lang['DONE'],
- ));
-
- $url = $this->save_convert_progress('&amp;jump=2');
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
-
- if ($jump == 2)
- {
- $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_permissions = ''");
-
- // TODO: sync() is likely going to bomb out on forums with a considerable amount of topics.
- // TODO: the sync function is able to handle FROM-TO values, we should use them here (batch processing)
- sync('forum', '', '', false, true);
- phpbb::$acm->destroy_sql(FORUMS_TABLE);
-
- $template->assign_block_vars('checks', array(
- 'TITLE' => $user->lang['SYNC_FORUMS'],
- 'RESULT' => $user->lang['DONE'],
- ));
-
- // Continue with synchronizing the forums...
- $url = $this->save_convert_progress('&amp;sync_batch=0');
-
- $template->assign_vars(array(
- 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'],
- 'U_ACTION' => $url,
- ));
-
- $this->meta_refresh($url);
- return;
- }
- }
-
- function build_insert_query(&$schema, &$sql_data, $current_table)
- {
- global $db, $user;
- global $convert;
-
- // Can we use IGNORE with this DBMS?
- $sql_ignore = ($db->dbms_type === 'mysql' && !defined('DEBUG_EXTRA')) ? 'IGNORE ' : '';
- $insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' (';
-
- $aliases = array();
-
- $sql_data = array(
- 'source_fields' => array(),
- 'target_fields' => array(),
- 'source_tables' => array(),
- 'select_fields' => array(),
- );
-
- foreach ($schema as $key => $val)
- {
- // Example: array('group_name', 'extension_groups.group_name', 'htmlspecialchars'),
- if (is_int($key))
- {
- if (!empty($val[0]))
- {
- // Target fields
- $sql_data['target_fields'][$val[0]] = $key;
- $insert_query .= $val[0] . ', ';
- }
-
- if (!is_array($val[1]))
- {
- $val[1] = array($val[1]);
- }
-
- foreach ($val[1] as $valkey => $value_1)
- {
- // This should cover about any case:
- //
- // table.field => SELECT table.field FROM table
- // table.field AS alias => SELECT table.field AS alias FROM table
- // table.field AS table2.alias => SELECT table2.field AS alias FROM table table2
- // table.field AS table2.field => SELECT table2.field FROM table table2
- //
- if (preg_match('/^([a-z0-9_]+)\.([a-z0-9_]+)( +AS +(([a-z0-9_]+?)\.)?([a-z0-9_]+))?$/i', $value_1, $m))
- {
- // There is 'AS ...' in the field names
- if (!empty($m[3]))
- {
- $value_1 = ($m[2] == $m[6]) ? $m[1] . '.' . $m[2] : $m[1] . '.' . $m[2] . ' AS ' . $m[6];
-
- // Table alias: store it then replace the source table with it
- if (!empty($m[5]) && $m[5] != $m[1])
- {
- $aliases[$m[5]] = $m[1];
- $value_1 = str_replace($m[1] . '.' . $m[2], $m[5] . '.' . $m[2], $value_1);
- }
- }
- else
- {
- // No table alias
- $sql_data['source_tables'][$m[1]] = (empty($convert->src_table_prefix)) ? $m[1] : $convert->src_table_prefix . $m[1] . ' ' . $m[1];
- }
-
- $sql_data['select_fields'][$value_1] = $value_1;
- $sql_data['source_fields'][$key][$valkey] = (!empty($m[6])) ? $m[6] : $m[2];
- }
- }
- }
- else if ($key == 'where' || $key == 'group_by' || $key == 'order_by' || $key == 'having')
- {
- if (@preg_match_all('/([a-z0-9_]+)\.([a-z0-9_]+)/i', $val, $m))
- {
- foreach ($m[1] as $value)
- {
- $sql_data['source_tables'][$value] = (empty($convert->src_table_prefix)) ? $value : $convert->src_table_prefix . $value . ' ' . $value;
- }
- }
- }
- }
-
- // Add the aliases to the list of tables
- foreach ($aliases as $alias => $table)
- {
- $sql_data['source_tables'][$alias] = $convert->src_table_prefix . $table . ' ' . $alias;
- }
-
- // 'left_join' => 'forums LEFT JOIN forum_prune ON forums.forum_id = forum_prune.forum_id',
- if (!empty($schema['left_join']))
- {
- if (!is_array($schema['left_join']))
- {
- $schema['left_join'] = array($schema['left_join']);
- }
-
- foreach ($schema['left_join'] as $left_join)
- {
- // This won't handle concatened LEFT JOINs
- if (!preg_match('/([a-z0-9_]+) LEFT JOIN ([a-z0-9_]+) A?S? ?([a-z0-9_]*?) ?(ON|USING)(.*)/i', $left_join, $m))
- {
- $this->p_master->error(sprintf($user->lang['NOT_UNDERSTAND'], 'LEFT JOIN', $left_join, $current_table, $schema['target']), __LINE__, __FILE__);
- }
-
- if (!empty($aliases[$m[2]]))
- {
- if (!empty($m[3]))
- {
- $this->p_master->error(sprintf($user->lang['NAMING_CONFLICT'], $m[2], $m[3], $schema['left_join']), __LINE__, __FILE__);
- }
-
- $m[2] = $aliases[$m[2]];
- $m[3] = $m[2];
- }
-
- $right_table = $convert->src_table_prefix . $m[2];
- if (!empty($m[3]))
- {
- unset($sql_data['source_tables'][$m[3]]);
- }
- else if ($m[2] != $m[1])
- {
- unset($sql_data['source_tables'][$m[2]]);
- }
-
- if (strpos($sql_data['source_tables'][$m[1]], "\nLEFT JOIN") !== false)
- {
- $sql_data['source_tables'][$m[1]] = '(' . $sql_data['source_tables'][$m[1]] . ")\nLEFT JOIN $right_table";
- }
- else
- {
- $sql_data['source_tables'][$m[1]] .= "\nLEFT JOIN $right_table";
- }
-
- if (!empty($m[3]))
- {
- unset($sql_data['source_tables'][$m[3]]);
- $sql_data['source_tables'][$m[1]] .= ' AS ' . $m[3];
- }
- else if (!empty($convert->src_table_prefix))
- {
- $sql_data['source_tables'][$m[1]] .= ' AS ' . $m[2];
- }
- $sql_data['source_tables'][$m[1]] .= ' ' . $m[4] . $m[5];
- }
- }
-
- // Remove ", " from the end of the insert query
- $insert_query = substr($insert_query, 0, -2) . ') VALUES ';
-
- return $insert_query;
- }
-
- /**
- * Function for processing the currently handled row
- */
- function process_row(&$schema, &$sql_data, &$insert_values)
- {
- global $template, $user, $db, $lang, $config;
- global $convert, $convert_row;
-
- $sql_flag = false;
-
- foreach ($schema as $key => $fields)
- {
- // We are only interested in the lines with:
- // array('comment', 'attachments_desc.comment', 'htmlspecialchars'),
- if (is_int($key))
- {
- if (!is_array($fields[1]))
- {
- $fields[1] = array($fields[1]);
- }
-
- $firstkey_set = false;
- $firstkey = 0;
-
- foreach ($fields[1] as $inner_key => $inner_value)
- {
- if (!$firstkey_set)
- {
- $firstkey = $inner_key;
- $firstkey_set = true;
- }
-
- $src_field = isset($sql_data['source_fields'][$key][$inner_key]) ? $sql_data['source_fields'][$key][$inner_key] : '';
-
- if (!empty($src_field))
- {
- $fields[1][$inner_key] = $convert->row[$src_field];
- }
- }
-
- if (!empty($fields[0]))
- {
- // We have a target field, if we haven't set $sql_flag yet it will be set to TRUE.
- // If a function has already set it to FALSE it won't change it.
- if ($sql_flag === false)
- {
- $sql_flag = true;
- }
-
- // No function assigned?
- if (empty($fields[2]))
- {
- $value = $fields[1][$firstkey];
- }
- else if (is_array($fields[2]))
- {
- // Execute complex function/eval/typecast
- $value = $fields[1];
-
- foreach ($fields[2] as $type => $execution)
- {
- if (strpos($type, 'typecast') === 0)
- {
- if (!is_array($value))
- {
- $value = array($value);
- }
- $value = $value[0];
- settype($value, $execution);
- }
- else if (strpos($type, 'function') === 0)
- {
- if (!is_array($value))
- {
- $value = array($value);
- }
-
- $value = call_user_func_array($execution, $value);
- }
- else if (strpos($type, 'execute') === 0)
- {
- if (!is_array($value))
- {
- $value = array($value);
- }
-
- $execution = str_replace('{RESULT}', '$value', $execution);
- $execution = str_replace('{VALUE}', '$value', $execution);
- eval($execution);
- }
- }
- }
- else
- {
- $value = call_user_func_array($fields[2], $fields[1]);
- }
-
- if (is_null($value))
- {
- $value = '';
- }
-
- $insert_values[] = $db->_sql_validate_value($value);
- }
- else if (!empty($fields[2]))
- {
- if (is_array($fields[2]))
- {
- // Execute complex function/eval/typecast
- $value = '';
-
- foreach ($fields[2] as $type => $execution)
- {
- if (strpos($type, 'typecast') === 0)
- {
- $value = settype($value, $execution);
- }
- else if (strpos($type, 'function') === 0)
- {
- if (!is_array($value))
- {
- $value = array($value);
- }
-
- $value = call_user_func_array($execution, $value);
- }
- else if (strpos($type, 'execute') === 0)
- {
- if (!is_array($value))
- {
- $value = array($value);
- }
-
- $execution = str_replace('{RESULT}', '$value', $execution);
- $execution = str_replace('{VALUE}', '$value', $execution);
- eval($execution);
- }
- }
- }
- else
- {
- call_user_func_array($fields[2], $fields[1]);
- }
- }
- }
- }
-
- return $sql_flag;
- }
-
- /**
- * Own meta refresh function to be able to change the global time used
- */
- function meta_refresh($url)
- {
- global $convert, $template;
-
- if ($convert->options['refresh'])
- {
- // Because we should not rely on correct settings, we simply use the relative path here directly.
- $template->assign_vars(array(
- 'S_REFRESH' => true,
- 'META' => '<meta http-equiv="refresh" content="5;url=' . $url . '" />')
- );
- }
- }
-
- /**
- * The information below will be used to build the input fields presented to the user
- */
- var $convert_options = array(
- 'legend1' => 'SPECIFY_OPTIONS',
- 'src_dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\', true)', 'explain' => false),
- 'src_dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true),
- 'src_dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true),
- 'src_dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false),
- 'src_dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false),
- 'src_dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false),
- 'src_table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => false),
- //'src_url' => array('lang' => 'FORUM_ADDRESS', 'type' => 'text:50:100', 'explain' => true),
- 'forum_path' => array('lang' => 'FORUM_PATH', 'type' => 'text:25:100', 'explain' => true),
- 'refresh' => array('lang' => 'REFRESH_PAGE', 'type' => 'radio:yes_no', 'explain' => true),
- );
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
deleted file mode 100644
index 6f05a222cf..0000000000
--- a/phpBB/install/install_install.php
+++ /dev/null
@@ -1,1886 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-*/
-if (!defined('IN_INSTALL'))
-{
- // Someone has tried to access the file direct. This is not a good idea, so exit
- exit;
-}
-
-if (!empty($setmodules))
-{
- // If phpBB is already installed we do not include this module
- if (@file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && !file_exists(PHPBB_ROOT_PATH . 'cache/install_lock'))
- {
- include PHPBB_ROOT_PATH . 'config.' . PHP_EXT;
-
- if (phpbb::$base_config['installed'])
- {
- return;
- }
- }
-
- $module[] = array(
- 'module_type' => 'install',
- 'module_title' => 'INSTALL',
- 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1),
- 'module_order' => 10,
- 'module_subs' => '',
- 'module_stages' => array('INTRO', 'REQUIREMENTS', 'DATABASE', 'ADMINISTRATOR', 'CONFIG_FILE', 'ADVANCED', 'CREATE_TABLE', 'FINAL'),
- 'module_reqs' => ''
- );
-}
-
-/**
-* Installation
-* @package install
-*/
-class install_install extends module
-{
- function install_install(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($mode, $sub)
- {
- phpbb::$template->assign_vars(array(
- 'S_SUB' => $sub,
- 'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select(phpbb::$user->lang_name) . '</select>',
- ));
-
- switch ($sub)
- {
- case 'intro':
- $this->page_title = 'SUB_INTRO';
-
- phpbb::$template->assign_vars(array(
- 'U_ACTION' => phpbb::$url->append_sid($this->p_master->module_url, "mode=$mode&amp;sub=requirements&amp;language=" . phpbb::$user->lang_name),
- ));
-
- break;
-
- case 'requirements':
- $this->page_title = 'STAGE_REQUIREMENTS';
- $this->check_server_requirements($mode, $sub);
- break;
-
- case 'database':
- $this->page_title = 'STAGE_DATABASE';
-
- // Obtain any submitted data
- $data = $this->get_submitted_data();
-
- $this->obtain_database_settings($mode, $sub, $data);
- break;
-
- case 'administrator':
- $this->page_title = 'STAGE_ADMINISTRATOR';
-
- phpbb::$user->add_lang('acp/board');
-
- // Obtain any submitted data
- $data = $this->get_submitted_data();
-
- $this->obtain_admin_settings($mode, $sub, $data);
-
- break;
-
- case 'config_file':
- $this->page_title = 'STAGE_CONFIG_FILE';
-
- // Obtain any submitted data
- $data = $this->get_submitted_data();
-
- $this->create_config_file($mode, $sub, $data);
- break;
-
- case 'advanced':
- $this->page_title = 'STAGE_ADVANCED';
-
- phpbb::$user->add_lang('acp/common');
- phpbb::$user->add_lang('acp/board');
-
- // Obtain any submitted data
- $data = $this->get_submitted_data();
-
- $this->obtain_advanced_settings($mode, $sub, $data);
- break;
-
- case 'create_table':
- $this->page_title = 'STAGE_CREATE_TABLE';
-
- // Obtain any submitted data
- $data = $this->get_submitted_data();
-
- $this->load_schema($mode, $sub, $data);
- break;
-
- case 'final':
- $this->page_title = 'STAGE_FINAL';
-
- include PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
-
- phpbb::$acm->purge();
-
- $this->build_search_index($mode, $sub);
- $this->add_modules($mode, $sub);
- $this->add_language($mode, $sub);
- $this->add_bots($mode, $sub);
- $this->email_admin($mode, $sub);
-
- // Remove the lock file
- @unlink(PHPBB_ROOT_PATH . 'cache/install_lock');
-
- break;
- }
-
- $this->tpl_name = 'install/install';
- }
-
- function build_form($data, $form_array)
- {
- foreach ($form_array as $config_key => $vars)
- {
- if (!is_array($vars) && strpos($config_key, 'legend') === false)
- {
- continue;
- }
-
- if (strpos($config_key, 'legend') !== false)
- {
- phpbb::$template->assign_block_vars('options', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang[$vars],
- ));
-
- continue;
- }
-
- $options = isset($vars['options']) ? $vars['options'] : '';
-
- phpbb::$template->assign_block_vars('options', array(
- 'KEY' => $config_key,
- 'TITLE' => phpbb::$user->lang[$vars['lang']],
- 'S_EXPLAIN' => $vars['explain'],
- 'TITLE_EXPLAIN' => ($vars['explain']) ? phpbb::$user->lang[$vars['lang'] . '_EXPLAIN'] : '',
- 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options),
- ));
- }
- }
-
- function return_hidden_fields()
- {
- $args = func_get_args();
- $data = array_shift($args);
-
- $s_hidden_fields = '';
-
- foreach ($args as $argument)
- {
- if (!is_array($argument))
- {
- continue;
- }
-
- foreach ($argument as $config_key => $vars)
- {
- if (!is_array($vars))
- {
- continue;
- }
-
- $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
- }
- }
-
- return $s_hidden_fields;
- }
-
- /**
- * Checks that the server we are installing on meets the requirements for running phpBB
- */
- function check_server_requirements($mode, $sub)
- {
- $passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false,);
-
- // Test for basic PHP settings
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['PHP_SETTINGS'],
- 'LEGEND_EXPLAIN' => phpbb::$user->lang['PHP_SETTINGS_EXPLAIN'],
- ));
-
- // Test the minimum PHP version
- if (version_compare(PHP_VERSION, '5.2.0') < 0)
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- }
- else
- {
- $passed['php'] = true;
-
- // We also give feedback on whether we're running in safe mode
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'];
- if (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on')
- {
- $result .= ', ' . phpbb::$user->lang['PHP_SAFE_MODE'];
- }
- $result .= '</strong>';
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['PHP_VERSION_REQD'],
- 'RESULT' => $result,
- ));
-
- // Check for register_globals being enabled
- if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- }
- else
- {
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'] . '</strong>';
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['PHP_REGISTER_GLOBALS'],
- 'TITLE_EXPLAIN' => phpbb::$user->lang['PHP_REGISTER_GLOBALS_EXPLAIN'],
- 'RESULT' => $result,
-
- 'S_EXPLAIN' => true,
- ));
-
- // Check for url_fopen
- if (@ini_get('allow_url_fopen') == '1' || strtolower(@ini_get('allow_url_fopen')) == 'on')
- {
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'] . '</strong>';
- }
- else
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['PHP_URL_FOPEN_SUPPORT'],
- 'TITLE_EXPLAIN' => phpbb::$user->lang['PHP_URL_FOPEN_SUPPORT_EXPLAIN'],
- 'RESULT' => $result,
-
- 'S_EXPLAIN' => true,
- ));
-
- // Check for getimagesize
- if (@function_exists('getimagesize'))
- {
- $passed['imagesize'] = true;
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'] . '</strong>';
- }
- else
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['PHP_GETIMAGESIZE_SUPPORT'],
- 'TITLE_EXPLAIN' => phpbb::$user->lang['PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'],
- 'RESULT' => $result,
-
- 'S_EXPLAIN' => true,
- ));
-
- // Check for PCRE UTF-8 support
- if (@preg_match('//u', ''))
- {
- $passed['pcre'] = true;
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'] . '</strong>';
- }
- else
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['PCRE_UTF_SUPPORT'],
- 'TITLE_EXPLAIN' => phpbb::$user->lang['PCRE_UTF_SUPPORT_EXPLAIN'],
- 'RESULT' => $result,
-
- 'S_EXPLAIN' => true,
- ));
-
- // Check for PCRE unicode property support
- if (@preg_match('/\p{Ll}/u', 'a'))
- {
- $passed['pcre'] = true;
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'] . '</strong>';
- }
- else
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['PCRE_UNI_PROP_SUPPORT'],
- 'TITLE_EXPLAIN' => phpbb::$user->lang['PCRE_UNI_PROP_SUPPORT_EXPLAIN'],
- 'RESULT' => $result,
-
- 'S_EXPLAIN' => true,
- ));
-
- // MBString passes always. If the extension is loaded it only can interfere with our functions, set to false then
- $passed['mbstring'] = true;
- if (@extension_loaded('mbstring'))
- {
- // Test for available database modules
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['MBSTRING_CHECK'],
- 'LEGEND_EXPLAIN' => phpbb::$user->lang['MBSTRING_CHECK_EXPLAIN'],
- ));
-
- $checks = array(
- array('func_overload', '&', MB_OVERLOAD_MAIL|MB_OVERLOAD_STRING),
- array('encoding_translation', '!=', 0),
- array('http_input', '!=', 'pass'),
- array('http_output', '!=', 'pass')
- );
-
- foreach ($checks as $mb_checks)
- {
- $ini_val = @ini_get('mbstring.' . $mb_checks[0]);
- switch ($mb_checks[1])
- {
- case '&':
- if (intval($ini_val) & $mb_checks[2])
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- $passed['mbstring'] = false;
- }
- else
- {
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'] . '</strong>';
- }
- break;
-
- case '!=':
- if ($ini_val != $mb_checks[2])
- {
- $result = '<strong style="color:red">' . phpbb::$user->lang['NO'] . '</strong>';
- $passed['mbstring'] = false;
- }
- else
- {
- $result = '<strong style="color:green">' . phpbb::$user->lang['YES'] . '</strong>';
- }
- break;
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['MBSTRING_' . strtoupper($mb_checks[0])],
- 'TITLE_EXPLAIN' => phpbb::$user->lang['MBSTRING_' . strtoupper($mb_checks[0]) . '_EXPLAIN'],
- 'RESULT' => $result,
-
- 'S_EXPLAIN' => true,
- ));
- }
- }
-
- // Test for available database modules
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['PHP_SUPPORTED_DB'],
- 'LEGEND_EXPLAIN' => phpbb::$user->lang['PHP_SUPPORTED_DB_EXPLAIN'],
- ));
-
- $available_dbms = get_available_dbms(false, true);
- $passed['db'] = $available_dbms['ANY_DB_SUPPORT'];
- unset($available_dbms['ANY_DB_SUPPORT']);
-
- foreach ($available_dbms as $db_name => $db_ary)
- {
- if (!$db_ary['AVAILABLE'])
- {
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['DLL_' . strtoupper($db_name)],
- 'RESULT' => '<span style="color:red">' . phpbb::$user->lang['UNAVAILABLE'] . '</span>',
- ));
- }
- else
- {
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['DLL_' . strtoupper($db_name)],
- 'RESULT' => '<strong style="color:green">' . phpbb::$user->lang['AVAILABLE'] . '</strong>',
- ));
- }
- }
-
- // Test for other modules
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['PHP_OPTIONAL_MODULE'],
- 'LEGEND_EXPLAIN' => phpbb::$user->lang['PHP_OPTIONAL_MODULE_EXPLAIN'],
- ));
-
- foreach ($this->php_dlls_other as $dll)
- {
- if (!@extension_loaded($dll))
- {
- if (!can_load_dll($dll))
- {
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['DLL_' . strtoupper($dll)],
- 'RESULT' => '<strong style="color:red">' . phpbb::$user->lang['UNAVAILABLE'] . '</strong>',
- ));
- continue;
- }
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['DLL_' . strtoupper($dll)],
- 'RESULT' => '<strong style="color:green">' . phpbb::$user->lang['AVAILABLE'] . '</strong>',
- ));
- }
-
- // Can we find Imagemagick anywhere on the system?
- $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : '';
-
- $magic_home = getenv('MAGICK_HOME');
- $img_imagick = '';
- if (empty($magic_home))
- {
- $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/');
- $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH'))));
-
- $locations = array_merge($path_locations, $locations);
- foreach ($locations as $location)
- {
- // The path might not end properly, fudge it
- if (substr($location, -1, 1) !== '/')
- {
- $location .= '/';
- }
-
- if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000)
- {
- $img_imagick = str_replace('\\', '/', $location);
- continue;
- }
- }
- }
- else
- {
- $img_imagick = str_replace('\\', '/', $magic_home);
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['APP_MAGICK'],
- 'RESULT' => ($img_imagick) ? '<strong style="color:green">' . phpbb::$user->lang['AVAILABLE'] . ', ' . htmlspecialchars($img_imagick) . '</strong>' : '<strong style="color:blue">' . phpbb::$user->lang['NO_LOCATION'] . '</strong>',
- ));
-
- // Check permissions on files/directories we need access to
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['FILES_REQUIRED'],
- 'LEGEND_EXPLAIN' => phpbb::$user->lang['FILES_REQUIRED_EXPLAIN'],
- ));
-
- $directories = array('cache/', 'files/', 'store/');
-
- umask(0);
-
- $passed['files'] = true;
- foreach ($directories as $dir)
- {
- $exists = $write = false;
-
- // Try to create the directory if it does not exist
- if (!file_exists(PHPBB_ROOT_PATH . $dir))
- {
- @mkdir(PHPBB_ROOT_PATH . $dir, 0777);
- phpbb::$system->chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
- }
-
- // Now really check
- if (file_exists(PHPBB_ROOT_PATH . $dir) && is_dir(PHPBB_ROOT_PATH . $dir))
- {
- phpbb::$system->chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
- $exists = true;
- }
-
- // Now check if it is writable by storing a simple file
- $fp = @fopen(PHPBB_ROOT_PATH . $dir . 'test_lock', 'wb');
- if ($fp !== false)
- {
- $write = true;
- }
- @fclose($fp);
-
- @unlink(PHPBB_ROOT_PATH . $dir . 'test_lock');
-
- $passed['files'] = ($exists && $write && $passed['files']) ? true : false;
-
- $exists = ($exists) ? '<strong style="color:green">' . phpbb::$user->lang['FOUND'] . '</strong>' : '<strong style="color:red">' . phpbb::$user->lang['NOT_FOUND'] . '</strong>';
- $write = ($write) ? ', <strong style="color:green">' . phpbb::$user->lang['WRITABLE'] . '</strong>' : (($exists) ? ', <strong style="color:red">' . phpbb::$user->lang['UNWRITABLE'] . '</strong>' : '');
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => $dir,
- 'RESULT' => $exists . $write,
- ));
- }
-
- // Check permissions on files/directories it would be useful access to
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['FILES_OPTIONAL'],
- 'LEGEND_EXPLAIN' => phpbb::$user->lang['FILES_OPTIONAL_EXPLAIN'],
- ));
-
- $directories = array('config.' . PHP_EXT, 'images/avatars/upload/');
-
- foreach ($directories as $dir)
- {
- $write = $exists = true;
- if (file_exists(PHPBB_ROOT_PATH . $dir))
- {
- if (!@is_writable(PHPBB_ROOT_PATH . $dir))
- {
- $write = false;
- }
- }
- else
- {
- $write = $exists = false;
- }
-
- $exists_str = ($exists) ? '<strong style="color:green">' . phpbb::$user->lang['FOUND'] . '</strong>' : '<strong style="color:red">' . phpbb::$user->lang['NOT_FOUND'] . '</strong>';
- $write_str = ($write) ? ', <strong style="color:green">' . phpbb::$user->lang['WRITABLE'] . '</strong>' : (($exists) ? ', <strong style="color:red">' . phpbb::$user->lang['UNWRITABLE'] . '</strong>' : '');
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => $dir,
- 'RESULT' => $exists_str . $write_str,
- ));
- }
-
- // And finally where do we want to go next (well today is taken isn't it :P)
- $s_hidden_fields = ($img_imagick) ? '<input type="hidden" name="img_imagick" value="' . htmlspecialchars($img_imagick) . '" />' : '';
-
- $url = (!in_array(false, $passed)) ? phpbb::$url->append_sid($this->p_master->module_url, "mode=$mode&amp;sub=database&amp;language=" . phpbb::$user->lang_name) : phpbb::$url->build_url();
-
- phpbb::$template->assign_vars(array(
- 'S_FAILED' => in_array(false, $passed),
- 'S_HIDDEN' => $s_hidden_fields,
- 'U_ACTION_TEST' => phpbb::$url->build_url(),
- 'U_ACTION' => $url,
- ));
- }
-
- /**
- * Obtain the information required to connect to the database
- */
- function obtain_database_settings($mode, $sub, &$data)
- {
- $connect_test = false;
- $error = array();
-
- $available_dbms = get_available_dbms();
-
- // Has the user opted to test the connection?
- if (phpbb_request::is_set_post('testdb'))
- {
- if (!isset($available_dbms[$data['dbms']]))
- {
- $error[] = phpbb::$user->lang['INST_ERR_NO_DB'];
- $connect_test = false;
- }
- else
- {
- $connect_test = connect_check_db($available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], $error);
- }
-
- if ($connect_test)
- {
- phpbb::$template->assign_vars(array(
- 'S_CONNECT_TEST' => true,
- 'S_SUCCESS' => true,
- ));
- }
- else
- {
- phpbb::$template->assign_vars(array(
- 'S_CONNECT_TEST' => true,
- 'ERROR' => implode('<br />', $error),
- ));
- }
- }
-
- if (!$connect_test)
- {
- // And now for the main part of this page
- $data['table_prefix'] = (!empty($data['table_prefix']) ? $data['table_prefix'] : 'phpbb_');
- $this->build_form($data, $this->db_config_options);
- }
-
- // And finally where do we want to go next (well today is taken isn't it :P)
- $s_hidden_fields = $this->return_hidden_fields($data, $this->common_config_options);
-
- if ($connect_test)
- {
- $s_hidden_fields .= $this->return_hidden_fields($data, $this->db_config_options);
- }
-
- $url = ($connect_test) ? phpbb::$url->append_sid($this->p_master->module_url, "mode=$mode&amp;sub=administrator") : phpbb::$url->build_url();
- $s_hidden_fields .= ($connect_test) ? '' : '<input type="hidden" name="testdb" value="true" />';
-
- phpbb::$template->assign_vars(array(
- 'S_HIDDEN' => $s_hidden_fields,
- 'U_ACTION' => $url,
- ));
- }
-
- /**
- * Obtain the administrator's name, password and email address
- */
- function obtain_admin_settings($mode, $sub, &$data)
- {
- if ($data['dbms'] == '')
- {
- // Someone's been silly and tried calling this page direct
- // So we send them back to the start to do it again properly
- $this->p_master->redirect('index.' . PHP_EXT . '?mode=install');
- }
-
- $passed = false;
- $data['default_lang'] = ($data['default_lang'] !== '') ? $data['default_lang'] : $data['language'];
-
- if (phpbb_request::is_set_post('check'))
- {
- $error = array();
-
- // Check the entered email address and password
- if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email'] == '' || $data['board_contact'] == '')
- {
- $error[] = phpbb::$user->lang['INST_ERR_MISSING_DATA'];
- }
-
- if ($data['admin_pass1'] != $data['admin_pass2'] && $data['admin_pass1'] != '')
- {
- $error[] = phpbb::$user->lang['INST_ERR_PASSWORD_MISMATCH'];
- }
-
- // Test against the default username rules
- if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) < 3)
- {
- $error[] = phpbb::$user->lang['INST_ERR_USER_TOO_SHORT'];
- }
-
- if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) > 20)
- {
- $error[] = phpbb::$user->lang['INST_ERR_USER_TOO_LONG'];
- }
-
- // Test against the default password rules
- if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) < 6)
- {
- $error[] = phpbb::$user->lang['INST_ERR_PASSWORD_TOO_SHORT'];
- }
-
- if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) > 30)
- {
- $error[] = phpbb::$user->lang['INST_ERR_PASSWORD_TOO_LONG'];
- }
-
- if ($data['board_email'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email']))
- {
- $error[] = phpbb::$user->lang['INST_ERR_EMAIL_INVALID'];
- }
-
- if ($data['board_contact'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_contact']))
- {
- $error[] = phpbb::$user->lang['INST_ERR_EMAIL_INVALID'];
- }
-
- phpbb::$template->assign_block_vars('checks', array(
- 'S_LEGEND' => true,
- 'LEGEND' => phpbb::$user->lang['STAGE_ADMINISTRATOR'],
- ));
-
- if (!sizeof($error))
- {
- $passed = true;
-
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['ADMIN_TEST'],
- 'RESULT' => '<strong style="color:green">' . phpbb::$user->lang['TESTS_PASSED'] . '</strong>',
- ));
- }
- else
- {
- phpbb::$template->assign_block_vars('checks', array(
- 'TITLE' => phpbb::$user->lang['ADMIN_TEST'],
- 'RESULT' => '<strong style="color:red">' . implode('<br />', $error) . '</strong>',
- ));
- }
- }
-
- $s_hidden_fields = '';
-
- if (!$passed)
- {
- $this->build_form($data, $this->admin_config_options);
- }
- else
- {
- $s_hidden_fields .= $this->return_hidden_fields($data, $this->admin_config_options);
- }
-
- $s_hidden_fields .= $this->return_hidden_fields($data, $this->common_config_options, $this->db_config_options);
-
- $url = ($passed) ? phpbb::$url->append_sid($this->p_master->module_url, "mode=$mode&amp;sub=config_file") : phpbb::$url->build_url();
- $s_hidden_fields .= ($passed) ? '' : '<input type="hidden" name="check" value="true" />';
-
- phpbb::$template->assign_vars(array(
- 'S_HIDDEN' => $s_hidden_fields,
- 'U_ACTION' => $url,
- ));
- }
-
- /**
- * Writes the config file to disk, or if unable to do so offers alternative methods
- */
- function create_config_file($mode, $sub, &$data)
- {
- if ($data['dbms'] == '')
- {
- // Someone's been silly and tried calling this page direct
- // So we send them back to the start to do it again properly
- $this->p_master->redirect('index.' . PHP_EXT . '?mode=install');
- }
-
- $s_hidden_fields = $this->return_hidden_fields($data, $this->common_config_options);
- $written = false;
-
- // Create a list of any PHP modules we wish to have loaded
- $load_extensions = array();
- $available_dbms = get_available_dbms($data['dbms']);
-
- $check_exts = array_merge($this->php_dlls_other);
-
- foreach ($check_exts as $dll)
- {
- if (!@extension_loaded($dll))
- {
- if (!can_load_dll($dll))
- {
- continue;
- }
-
- $load_extensions[] = $dll . '.' . PHP_SHLIB_SUFFIX;
- }
- }
-
- $db_module = $available_dbms[$data['dbms']]['MODULE'];
-
- if (!is_array($db_module))
- {
- $db_module = array($db_module);
- }
-
- $load_dll = true;
- foreach ($db_module as $dll)
- {
- if (@extension_loaded($dll))
- {
- $load_dll = false;
- break;
- }
-
- if (!can_load_dll($dll))
- {
- $load_dll = false;
- break;
- }
-
- $load_dll = true;
- }
-
- if ($load_dll)
- {
- $dll = current($db_module);
- $load_extensions[] = $dll . '.' . PHP_SHLIB_SUFFIX;
- }
-
- // Create a lock file to indicate that there is an install in progress
- $fp = @fopen(PHPBB_ROOT_PATH . 'cache/install_lock', 'wb');
- if ($fp === false)
- {
- // We were unable to create the lock file - abort
- trigger_error(phpbb::$user->lang['UNABLE_WRITE_LOCK'], E_USER_ERROR);
- }
- @fclose($fp);
-
- phpbb::$system->chmod(PHPBB_ROOT_PATH . 'cache/install_lock', phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
-
- $load_extensions = implode(',', $load_extensions);
-
- // Time to convert the data provided into a config file
- $config_data = "<?php\n";
- $config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";
- $config_data .= "if (class_exists('phpbb') && defined('IN_PHPBB'))\n{\n\tphpbb::set_config(array(\n";
-
- $config_data_array = array(
- 'dbms' => $available_dbms[$data['dbms']]['DRIVER'],
- 'dbhost' => $data['dbhost'],
- 'dbport' => $data['dbport'],
- 'dbname' => $data['dbname'],
- 'dbuser' => $data['dbuser'],
- 'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
- 'table_prefix' => $data['table_prefix'],
- 'admin_folder' => 'adm',
- 'acm_type' => 'file',
- 'extensions' => $load_extensions,
- );
-
- foreach ($config_data_array as $key => $value)
- {
- $config_data .= "\t\t'{$key}' => '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "',\n";
- }
- unset($config_data_array);
-
- $config_data .= "\n\t\t'debug' => true,\n\t\t'debug_extra' => true,\n\n\t\t// DO NOT CHANGE\n\t\t'installed' => true,\n\t));\n}\n\n";
-
- // Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
- if ((file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && is_writable(PHPBB_ROOT_PATH . 'config.' . PHP_EXT)) || is_writable(PHPBB_ROOT_PATH))
- {
- // Assume it will work ... if nothing goes wrong below
- $written = true;
-
- if (!($fp = @fopen(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, 'w')))
- {
- // Something went wrong ... so let's try another method
- $written = false;
- }
-
- if (!(@fwrite($fp, $config_data)))
- {
- // Something went wrong ... so let's try another method
- $written = false;
- }
-
- @fclose($fp);
-
- if ($written)
- {
- @chmod(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, 0644);
- }
- }
-
- if (phpbb_request::is_set_post('dldone'))
- {
- // Do a basic check to make sure that the file has been uploaded
- // Note that all we check is that the file has _something_ in it
- // We don't compare the contents exactly - if they can't upload
- // a single file correctly, it's likely they will have other problems....
- if (filesize(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) > 10)
- {
- $written = true;
- }
- }
-
- $s_hidden_fields .= $this->return_hidden_fields($data, $this->db_config_options, $this->admin_config_options);
-
- if (!$written)
- {
- // OK, so it didn't work let's try the alternatives
- if (phpbb_request::is_set_post('dlconfig'))
- {
- // They want a copy of the file to download, so send the relevant headers and dump out the data
- header('Content-Type: text/x-delimtext; name="config.' . PHP_EXT . '"');
- header('Content-disposition: attachment; filename=config.' . PHP_EXT);
- echo $config_data;
- exit;
- }
-
- // The option to download the config file is always available, so output it here
- phpbb::$template->assign_vars(array(
- 'S_HIDDEN' => $s_hidden_fields,
- 'U_ACTION' => phpbb::$url->build_url(),
- ));
- }
- else
- {
- phpbb::$template->assign_vars(array(
- 'S_WRITTEN' => true,
- 'S_HIDDEN' => $s_hidden_fields,
- 'U_ACTION' => phpbb::$url->append_sid($this->p_master->module_url, "mode=$mode&amp;sub=advanced"),
- ));
- }
- }
-
- /**
- * Provide an opportunity to customise some advanced settings during the install
- * in case it is necessary for them to be set to access later
- */
- function obtain_advanced_settings($mode, $sub, &$data)
- {
- if ($data['dbms'] == '')
- {
- // Someone's been silly and tried calling this page direct
- // So we send them back to the start to do it again properly
- $this->p_master->redirect('index.' . PHP_EXT . '?mode=install');
- }
-
- $s_hidden_fields = $this->return_hidden_fields($data, $this->common_config_options);
-
- $data['email_enable'] = ($data['email_enable'] !== '') ? $data['email_enable'] : true;
- $data['server_name'] = ($data['server_name'] !== '') ? $data['server_name'] : phpbb::$user->system['host'];
- $data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : phpbb::$user->system['port'];
- $data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
- $data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true : false);
-
- if ($data['script_path'] === '')
- {
- // Replace backslashes and doubled slashes (could happen on some proxy setups)
- $data['script_path'] = trim(str_replace(array('/install/', '\\install\\'), '', phpbb::$user->page['script_path']));
- }
-
- $this->build_form($data, $this->advanced_config_options);
- $s_hidden_fields .= $this->return_hidden_fields($data, $this->db_config_options, $this->admin_config_options);
-
- phpbb::$template->assign_vars(array(
- 'S_HIDDEN' => $s_hidden_fields,
- 'U_ACTION' => phpbb::$url->append_sid($this->p_master->module_url, "mode=$mode&amp;sub=create_table"),
- ));
- }
-
- /**
- * Load the contents of the schema into the database and then alter it based on what has been input during the installation
- */
- function load_schema($mode, $sub, &$data)
- {
- $s_hidden_fields = '';
-
- if ($data['dbms'] == '')
- {
- // Someone's been silly and tried calling this page direct
- // So we send them back to the start to do it again properly
- $this->p_master->redirect('index.' . PHP_EXT . '?mode=install');
- }
-
- // If we get here and the extension isn't loaded it should be safe to just go ahead and load it
- $available_dbms = get_available_dbms($data['dbms']);
-
- if (!isset($available_dbms[$data['dbms']]))
- {
- // Someone's been silly and tried providing a non-existant dbms
- $this->p_master->redirect('index.' . PHP_EXT . '?mode=install');
- }
-
- phpbb::assign('db', phpbb_db_dbal::connect($data['dbms'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false));
-
- // Include the db tools - we work with them to create the tables
- include PHPBB_ROOT_PATH . 'includes/db/db_tools.' . PHP_EXT;
-
- // Load the Schema data (Fill $schema_data)
- include PHPBB_ROOT_PATH . 'install/schemas/schema_structure.' . PHP_EXT;
-
- // we do not return statements, we simply let them execute
- $db_tools = new phpbb_db_tools(phpbb::$db);
-
- foreach ($schema_data as $table_name => $table_data)
- {
- // Change prefix, we always have phpbb_, therefore we can do a substr() here
- $table_name = $data['table_prefix'] . substr($table_name, 6);
-
- // Now create the table
- $db_tools->sql_create_table($table_name, $table_data);
- }
-
- // Now get the schema data
- include PHPBB_ROOT_PATH . 'install/schemas/schema_data.' . PHP_EXT;
-
- // Build data array for substituted content ;)
-
- $cookie_domain = ($data['server_name'] != '') ? $data['server_name'] : phpbb::$user->system['host'];
-
- // Try to come up with the best solution for cookie domain...
- if (strpos($cookie_domain, 'www.') === 0)
- {
- $cookie_domain = str_replace('www.', '.', $cookie_domain);
- }
-
- if ($data['script_path'] !== '/')
- {
- // Adjust destination path (no trailing slash)
- if (substr($data['script_path'], -1) == '/')
- {
- $data['script_path'] = substr($data['script_path'], 0, -1);
- }
-
- $data['script_path'] = str_replace(array('../', './'), '', $data['script_path']);
-
- if ($data['script_path'][0] != '/')
- {
- $data['script_path'] = '/' . $data['script_path'];
- }
- }
-
- $ref = substr(phpbb::$user->system['referer'], strpos(phpbb::$user->system['referer'], '://') + 3);
-
- $template_data = array(
- 'BOARD_STARTDATE' => time(),
- 'CURRENT_TIME' => time(),
- 'DEFAULT_LANG' => $data['default_lang'],
- 'DBMS_VERSION' => phpbb::$db->sql_server_info(true),
- 'IMG_IMAGICK' => $data['img_imagick'],
- 'SERVER_NAME' => $data['server_name'],
- 'SERVER_PORT' => $data['server_port'],
- 'BOARD_EMAIL' => $data['board_email'],
- 'BOARD_CONTACT' => $data['board_contact'],
- 'COOKIE_DOMAIN' => $cookie_domain,
- 'DEFAULT_DATEFORMAT'=> phpbb::$user->lang['default_dateformat'],
- 'EMAIL_ENABLE' => $data['email_enable'],
- 'SMTP_DELIVERY' => $data['smtp_delivery'],
- 'SMTP_HOST' => $data['smtp_host'],
- 'SMTP_AUTH_METHOD' => $data['smtp_auth'],
- 'SMTP_USERNAME' => $data['smtp_user'],
- 'SMTP_PASSWORD' => $data['smtp_pass'],
- 'COOKIE_SECURE' => $data['cookie_secure'],
- 'COOKIE_NAME' => 'phpbb3_' . phpbb::$security->gen_rand_string(4),
- 'FORCE_SERVER_VARS' => $data['force_server_vars'],
- 'SCRIPT_PATH' => $data['script_path'],
- 'SERVER_PROTOCOL' => $data['server_protocol'],
- 'NEWEST_USERNAME' => $data['admin_name'],
- 'AVATAR_SALT' => md5(phpbb::$security->gen_rand_string()),
- 'CAPTCHA_PLUGIN' => (@extension_loaded('gd') || can_load_dll('gd')) ? 'phpbb_captcha_gd' : 'phpbb_captcha_nogd',
- 'REFERER_VALIDATION'=> (!(stripos($ref, phpbb::$user->system['host']) === 0)) ? '0' : '1',
- 'ADMIN_NAME' => $data['admin_name'],
- 'ADMIN_NAME_CLEAN' => utf8_clean_string($data['admin_name']),
- 'ADMIN_PASSWORD' => phpbb::$security->hash_password($data['admin_pass1']),
- 'ADMIN_EMAIL' => $data['board_contact'],
- 'ADMIN_EMAIL_HASH' => hexdec(crc32($data['board_contact']) . strlen($data['board_contact'])),
- 'USER_IP' => phpbb::$user->ip,
- );
-
- // Apply Schema changes
- $db_tools->db->sql_transaction('begin');
-
- foreach ($schema_data as $schema_array)
- {
- $schema_array['table'] = $data['table_prefix'] . substr($schema_array['table'], 6);
- $db_tools->sql_insert_data($schema_array, $template_data);
- }
-
- $db_tools->db->sql_transaction('commit');
-
- // Update data
- $db_tools->db->sql_transaction('begin');
-
- foreach ($schema_updates as $schema_array)
- {
- $schema_array['table'] = $data['table_prefix'] . substr($schema_array['table'], 6);
- $db_tools->sql_update_data($schema_array, $template_data);
- }
-
- $db_tools->db->sql_transaction('commit');
-
- // We need to insert the role data manually... else the schema array is quite large...
- $sql = 'SELECT role_id, role_name
- FROM ' . $data['table_prefix'] . 'acl_roles';
- $result = phpbb::$db->sql_query($sql);
-
- $role_ids = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $role_ids[$row['role_name']] = $row['role_id'];
- }
- phpbb::$db->sql_freeresult($result);
-
- foreach ($this->role_definitions as $role_ary)
- {
- $role_name = $role_ary[0];
- $auth_setting = $role_ary[1];
- $permission = $role_ary[2];
- $condition = $role_ary[3];
- $options = $role_ary[4];
-
- $sql = '';
- $sql .= 'INSERT INTO ' . $data['table_prefix'] . 'acl_roles_data (role_id, auth_option_id, auth_setting) ';
- $sql .= 'SELECT ' . $role_ids[$role_name] . ', auth_option_id, ' . $auth_setting . ' ';
- $sql .= 'FROM ' . $data['table_prefix'] . 'acl_options ';
- $sql .= "WHERE auth_option LIKE '{$permission}%'";
-
- if ($options !== false)
- {
- $sql .= ' AND auth_option ' . $condition . ' (\'' . implode("', '", $options) . "')";
- }
-
- phpbb::$db->sql_query($sql);
- }
-
- phpbb::$template->assign_vars(array(
- 'S_HIDDEN' => build_hidden_fields($data),
- 'U_ACTION' => phpbb::$url->append_sid($this->p_master->module_url, "mode=$mode&amp;sub=final"),
- ));
- }
-
- /**
- * Build the search index...
- */
- function build_search_index($mode, $sub)
- {
- include_once PHPBB_ROOT_PATH . 'includes/search/fulltext_native.' . PHP_EXT;
-
- $error = false;
- $search = new fulltext_native($error);
-
- $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
- FROM ' . POSTS_TABLE;
- $result = phpbb::$db->sql_query($sql);
-
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
- }
- phpbb::$db->sql_freeresult($result);
- }
-
- /**
- * Populate the module tables
- */
- function add_modules($mode, $sub)
- {
- include_once PHPBB_ROOT_PATH . 'modules/acp/acp_modules.' . PHP_EXT;
-
- $_module = new acp_modules();
- $module_classes = array('acp', 'mcp', 'ucp');
-
- // Add categories
- foreach ($module_classes as $module_class)
- {
- $categories = array();
-
- // Set the module class
- $_module->module_class = $module_class;
-
- foreach ($this->module_categories[$module_class] as $cat_name => $subs)
- {
- $module_data = array(
- 'module_basename' => '',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => 0,
- 'module_class' => $module_class,
- 'module_langname' => $cat_name,
- 'module_mode' => '',
- 'module_auth' => '',
- );
-
- // Add category
- $_module->update_module_data($module_data, true);
-
- $categories[$cat_name]['id'] = (int) $module_data['module_id'];
- $categories[$cat_name]['parent_id'] = 0;
-
- // Create sub-categories...
- if (is_array($subs))
- {
- foreach ($subs as $level2_name)
- {
- $module_data = array(
- 'module_basename' => '',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'parent_id' => (int) $categories[$cat_name]['id'],
- 'module_class' => $module_class,
- 'module_langname' => $level2_name,
- 'module_mode' => '',
- 'module_auth' => '',
- );
-
- $_module->update_module_data($module_data, true);
-
- $categories[$level2_name]['id'] = (int) $module_data['module_id'];
- $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id'];
- }
- }
- }
-
- // Get the modules we want to add... returned sorted by name
- $module_info = $_module->get_module_infos('', $module_class);
-
- foreach ($module_info as $module_basename => $fileinfo)
- {
- foreach ($fileinfo['modes'] as $module_mode => $row)
- {
- foreach ($row['cat'] as $cat_name)
- {
- if (!isset($categories[$cat_name]))
- {
- continue;
- }
-
- $module_data = array(
- 'module_basename' => $module_basename,
- 'module_enabled' => 1,
- 'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1,
- 'parent_id' => (int) $categories[$cat_name]['id'],
- 'module_class' => $module_class,
- 'module_langname' => $row['title'],
- 'module_mode' => $module_mode,
- 'module_auth' => $row['auth'],
- );
-
- $_module->update_module_data($module_data, true);
- }
- }
- }
-
- // Move some of the modules around since the code above will put them in the wrong place
- if ($module_class == 'acp')
- {
- // Move main module 4 up...
- $sql = 'SELECT *
- FROM ' . MODULES_TABLE . "
- WHERE module_basename = 'main'
- AND module_class = 'acp'
- AND module_mode = 'main'";
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $_module->move_module_by($row, 'move_up', 4);
-
- // Move permissions intro screen module 4 up...
- $sql = 'SELECT *
- FROM ' . MODULES_TABLE . "
- WHERE module_basename = 'permissions'
- AND module_class = 'acp'
- AND module_mode = 'intro'";
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $_module->move_module_by($row, 'move_up', 4);
-
- // Move manage users screen module 5 up...
- $sql = 'SELECT *
- FROM ' . MODULES_TABLE . "
- WHERE module_basename = 'users'
- AND module_class = 'acp'
- AND module_mode = 'overview'";
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $_module->move_module_by($row, 'move_up', 5);
- }
-
- if ($module_class == 'ucp')
- {
- // Move attachment module 4 down...
- $sql = 'SELECT *
- FROM ' . MODULES_TABLE . "
- WHERE module_basename = 'attachments'
- AND module_class = 'ucp'
- AND module_mode = 'attachments'";
- $result = phpbb::$db->sql_query($sql);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $_module->move_module_by($row, 'move_down', 4);
- }
-
- // And now for the special ones
- // (these are modules which appear in multiple categories and thus get added manually to some for more control)
- if (isset($this->module_extras[$module_class]))
- {
- foreach ($this->module_extras[$module_class] as $cat_name => $mods)
- {
- $sql = 'SELECT module_id, left_id, right_id
- FROM ' . MODULES_TABLE . "
- WHERE module_langname = '" . phpbb::$db->sql_escape($cat_name) . "'
- AND module_class = '" . phpbb::$db->sql_escape($module_class) . "'";
- $result = phpbb::$db->sql_query_limit($sql, 1);
- $row2 = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- foreach ($mods as $mod_name)
- {
- $sql = 'SELECT *
- FROM ' . MODULES_TABLE . "
- WHERE module_langname = '" . phpbb::$db->sql_escape($mod_name) . "'
- AND module_class = '" . phpbb::$db->sql_escape($module_class) . "'
- AND module_basename <> ''";
- $result = phpbb::$db->sql_query_limit($sql, 1);
- $row = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- $module_data = array(
- 'module_basename' => $row['module_basename'],
- 'module_enabled' => (int) $row['module_enabled'],
- 'module_display' => (int) $row['module_display'],
- 'parent_id' => (int) $row2['module_id'],
- 'module_class' => $row['module_class'],
- 'module_langname' => $row['module_langname'],
- 'module_mode' => $row['module_mode'],
- 'module_auth' => $row['module_auth'],
- );
-
- $_module->update_module_data($module_data, true);
- }
- }
- }
-
- $_module->remove_cache_file();
- }
- }
-
- /**
- * Populate the language tables
- */
- function add_language($mode, $sub)
- {
- $dir = @opendir(PHPBB_ROOT_PATH . 'language');
-
- if (!$dir)
- {
- trigger_error('Unable to access the language directory', E_USER_ERROR);
- }
-
- while (($file = readdir($dir)) !== false)
- {
- $path = PHPBB_ROOT_PATH . 'language/' . $file;
-
- if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS')
- {
- continue;
- }
-
- if (is_dir($path) && file_exists($path . '/iso.txt'))
- {
- $lang_file = file("$path/iso.txt");
-
- $lang_pack = array(
- 'lang_iso' => basename($path),
- 'lang_dir' => basename($path),
- 'lang_english_name' => trim(htmlspecialchars($lang_file[0])),
- 'lang_local_name' => trim(htmlspecialchars($lang_file[1], ENT_COMPAT, 'UTF-8')),
- 'lang_author' => trim(htmlspecialchars($lang_file[2], ENT_COMPAT, 'UTF-8')),
- );
-
- phpbb::$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $lang_pack));
-
- $valid_localized = array(
- 'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply',
- );
-
- $sql_ary = array();
-
- $sql = 'SELECT *
- FROM ' . STYLES_IMAGESET_TABLE;
- $result = phpbb::$db->sql_query($sql);
-
- while ($imageset_row = phpbb::$db->sql_fetchrow($result))
- {
- if (@file_exists(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg"))
- {
- $cfg_data_imageset_data = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg");
- foreach ($cfg_data_imageset_data as $image_name => $value)
- {
- if (strpos($value, '*') !== false)
- {
- if (substr($value, -1, 1) === '*')
- {
- list($image_filename, $image_height) = explode('*', $value);
- $image_width = 0;
- }
- else
- {
- list($image_filename, $image_height, $image_width) = explode('*', $value);
- }
- }
- else
- {
- $image_filename = $value;
- $image_height = $image_width = 0;
- }
-
- if (strpos($image_name, 'img_') === 0 && $image_filename)
- {
- $image_name = substr($image_name, 4);
- if (in_array($image_name, $valid_localized))
- {
- $sql_ary[] = array(
- 'image_name' => (string) $image_name,
- 'image_filename' => (string) $image_filename,
- 'image_height' => (int) $image_height,
- 'image_width' => (int) $image_width,
- 'imageset_id' => (int) $imageset_row['imageset_id'],
- 'image_lang' => (string) $lang_pack['lang_iso'],
- );
- }
- }
- }
- }
- }
- phpbb::$db->sql_freeresult($result);
-
- if (sizeof($sql_ary))
- {
- phpbb::$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
- }
- }
- }
- closedir($dir);
- }
-
- /**
- * Add search robots to the database
- */
- function add_bots($mode, $sub)
- {
- $sql = 'SELECT group_id
- FROM ' . GROUPS_TABLE . "
- WHERE group_name_clean = 'bots'";
- $result = phpbb::$db->sql_query($sql);
- $group_id = (int) phpbb::$db->sql_fetchfield('group_id');
- phpbb::$db->sql_freeresult($result);
-
- if (!$group_id)
- {
- // If we reach this point then something has gone very wrong
- trigger_error('NO_GROUP', E_USER_ERROR);
- }
-
- if (!function_exists('user_add'))
- {
- include PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
- }
-
- foreach ($this->bot_list as $bot_name => $bot_ary)
- {
- $user_row = array(
- 'user_type' => phpbb::USER_IGNORE,
- 'group_id' => $group_id,
- 'username' => $bot_name,
- 'user_regdate' => time(),
- 'user_password' => '',
- 'user_colour' => '9E8DA7',
- 'user_email' => '',
- 'user_lang' => phpbb::$config['default_lang'],
- 'user_style' => 1,
- 'user_timezone' => 0,
- 'user_dateformat' => phpbb::$user->lang['default_dateformat'],
- 'user_allow_massemail' => 0,
- );
-
- $user_id = user_add($user_row);
-
- if (!$user_id)
- {
- // If we can't insert this user then continue to the next one to avoid inconsistant data
- $this->p_master->db_error('Unable to insert bot into users table', phpbb::$db->sql_error_sql, __LINE__, __FILE__);
- continue;
- }
-
- $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array(
- 'bot_active' => 1,
- 'bot_name' => (string) $bot_name,
- 'user_id' => (int) $user_id,
- 'bot_agent' => (string) $bot_ary[0],
- 'bot_ip' => (string) $bot_ary[1],
- ));
-
- $result = phpbb::$db->sql_query($sql);
- }
- }
-
- /**
- * Sends an email to the board administrator with their password and some useful links
- */
- function email_admin($mode, $sub)
- {
- // Obtain any submitted data
- $data = $this->get_submitted_data();
-
- // Normal Login
- phpbb::$user->login($data['admin_name'], $data['admin_pass1'], false, true, false);
-
- // Admin Login
- phpbb::$user->login($data['admin_name'], $data['admin_pass1'], false, true, true);
-
- phpbb::$acl->init(phpbb::$user->data);
-
- // OK, Now that we've reached this point we can be confident that everything is installed and working......I hope :)
- /* So it's time to send an email to the administrator confirming the details they entered
- if (phpbb::$config['email_enable'])
- {
- include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT);
-
- $messenger = new messenger(false);
-
- $messenger->template('installed', $data['language']);
-
- $messenger->to($data['board_contact'], $data['admin_name']);
-
- $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']);
- $messenger->headers('X-AntiAbuse: User_id - ' . phpbb::$user->data['user_id']);
- $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']);
- $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip);
-
- $messenger->assign_vars(array(
- 'USERNAME' => htmlspecialchars_decode($data['admin_name']),
- 'PASSWORD' => htmlspecialchars_decode($data['admin_pass1']))
- );
-
- $messenger->send(NOTIFY_EMAIL);
- }
-*/
- // And finally, add a note to the log
- add_log('admin', 'LOG_INSTALL_INSTALLED', phpbb::$config['version']);
-
- phpbb::$template->assign_vars(array(
- 'L_BODY' => phpbb::$user->lang('INSTALL_CONGRATS_EXPLAIN', phpbb::$config['version'], phpbb::$url->append_sid('install/index', 'mode=convert&amp;language=' . $data['language']), '../docs/README.html'),
- 'U_ACTION' => phpbb::$url->append_sid('adm/index'),
- ));
- }
-
- /**
- * Generate a list of available mail server authentication methods
- */
- function mail_auth_select($selected_method)
- {
- $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
- $s_smtp_auth_options = '';
-
- foreach ($auth_methods as $method)
- {
- $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
- }
-
- return $s_smtp_auth_options;
- }
-
- /**
- * Get submitted data
- */
- function get_submitted_data()
- {
- return array(
- 'language' => basename(request_var('language', '')),
- 'dbms' => request_var('dbms', ''),
- 'dbhost' => request_var('dbhost', ''),
- 'dbport' => request_var('dbport', ''),
- 'dbuser' => request_var('dbuser', ''),
- 'dbpasswd' => request_var('dbpasswd', '', true),
- 'dbname' => request_var('dbname', ''),
- 'table_prefix' => request_var('table_prefix', ''),
- 'default_lang' => basename(request_var('default_lang', '')),
- 'admin_name' => utf8_normalize_nfc(request_var('admin_name', '', true)),
- 'admin_pass1' => request_var('admin_pass1', '', true),
- 'admin_pass2' => request_var('admin_pass2', '', true),
- 'board_email' => strtolower(request_var('board_email', '')),
- 'board_contact' => strtolower(request_var('board_contact', '')),
- 'img_imagick' => request_var('img_imagick', ''),
- 'ftp_path' => request_var('ftp_path', ''),
- 'ftp_user' => request_var('ftp_user', ''),
- 'ftp_pass' => request_var('ftp_pass', ''),
- 'email_enable' => request_var('email_enable', ''),
- 'smtp_delivery' => request_var('smtp_delivery', ''),
- 'smtp_host' => request_var('smtp_host', ''),
- 'smtp_auth' => request_var('smtp_auth', ''),
- 'smtp_user' => request_var('smtp_user', ''),
- 'smtp_pass' => request_var('smtp_pass', ''),
- 'cookie_secure' => request_var('cookie_secure', ''),
- 'force_server_vars' => request_var('force_server_vars', ''),
- 'server_protocol' => request_var('server_protocol', ''),
- 'server_name' => request_var('server_name', ''),
- 'server_port' => request_var('server_port', ''),
- 'script_path' => request_var('script_path', ''),
- );
- }
-
- var $common_config_options = array('language' => array(), 'img_imagick' => array());
-
- /**
- * The information below will be used to build the input fields presented to the user
- */
- var $db_config_options = array(
- 'legend1' => 'DB_CONFIG',
- 'dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false),
- 'dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true),
- 'dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true),
- 'dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false),
- 'dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false),
- 'dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false),
- 'table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => false),
- );
- var $admin_config_options = array(
- 'legend1' => 'ADMIN_CONFIG',
- 'default_lang' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false),
- 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true),
- 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true),
- 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false),
- 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => true),
- 'board_email' => array('lang' => 'ADMIN_EMAIL', 'type' => 'text:25:100', 'explain' => true),
- );
- var $advanced_config_options = array(
- 'legend1' => 'ACP_EMAIL_SETTINGS',
- 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true),
- 'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true),
- 'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false),
- 'smtp_auth' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => '$this->module->mail_auth_select(\'{VALUE}\')', 'explain' => true),
- 'smtp_user' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true),
- 'smtp_pass' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true),
-
- 'legend2' => 'SERVER_URL_SETTINGS',
- 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:enabled_disabled', 'explain' => true),
- 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'type' => 'radio:yes_no', 'explain' => true),
- 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'type' => 'text:10:10', 'explain' => true),
- 'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true),
- 'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true),
- 'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true),
- );
-
- /**
- * Specific PHP modules we may require for certain optional or extended features
- */
- var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml');
-
- /**
- * A list of the web-crawlers/bots we recognise by default
- *
- * Candidates but not included:
- * 'Accoona [Bot]' 'Accoona-AI-Agent/'
- * 'ASPseek [Crawler]' 'ASPseek/'
- * 'Boitho [Crawler]' 'boitho.com-dc/'
- * 'Bunnybot [Bot]' 'powered by www.buncat.de'
- * 'Cosmix [Bot]' 'cfetch/'
- * 'Crawler Search [Crawler]' '.Crawler-Search.de'
- * 'Findexa [Crawler]' 'Findexa Crawler ('
- * 'GBSpider [Spider]' 'GBSpider v'
- * 'genie [Bot]' 'genieBot ('
- * 'Hogsearch [Bot]' 'oegp v. 1.3.0'
- * 'Insuranco [Bot]' 'InsurancoBot'
- * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler'
- * 'ISC Systems [Bot]' 'ISC Systems iRc Search'
- * 'Jyxobot [Bot]' 'Jyxobot/'
- * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/'
- * 'LinkWalker' 'LinkWalker'
- * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html'
- * 'Naver [Bot]' 'nhnbot@naver.com)'
- * 'NetResearchServer' 'NetResearchServer/'
- * 'Nimble [Crawler]' 'NimbleCrawler'
- * 'Ocelli [Bot]' 'Ocelli/'
- * 'Onsearch [Bot]' 'onCHECK-Robot'
- * 'Orange [Spider]' 'OrangeSpider'
- * 'Sproose [Bot]' 'http://www.sproose.com/bot'
- * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)'
- * 'Tbot [Bot]' 'Tbot/'
- * 'Thumbshots [Capture]' 'thumbshots-de-Bot'
- * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/'
- * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)'
- * 'WissenOnline [Bot]' 'WissenOnline-Bot'
- * 'WWWeasel [Bot]' 'WWWeasel Robot v'
- * 'Xaldon [Spider]' 'Xaldon WebSpider'
- */
- var $bot_list = array(
- 'AdsBot [Google]' => array('AdsBot-Google', ''),
- 'Alexa [Bot]' => array('ia_archiver', ''),
- 'Alta Vista [Bot]' => array('Scooter/', ''),
- 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''),
- 'Baidu [Spider]' => array('Baiduspider+(', ''),
- 'Exabot [Bot]' => array('Exabot/', ''),
- 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''),
- 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''),
- 'Francis [Bot]' => array('http://www.neomo.de/', ''),
- 'Gigabot [Bot]' => array('Gigabot/', ''),
- 'Google Adsense [Bot]' => array('Mediapartners-Google', ''),
- 'Google Desktop' => array('Google Desktop', ''),
- 'Google Feedfetcher' => array('Feedfetcher-Google', ''),
- 'Google [Bot]' => array('Googlebot', ''),
- 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''),
- 'Heritrix [Crawler]' => array('heritrix/1.', ''),
- 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''),
- 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''),
- 'ichiro [Crawler]' => array('ichiro/', ''),
- 'Majestic-12 [Bot]' => array('MJ12bot/', ''),
- 'Metager [Bot]' => array('MetagerBot/', ''),
- 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''),
- 'MSN [Bot]' => array('msnbot/', ''),
- 'MSNbot Media' => array('msnbot-media/', ''),
- 'NG-Search [Bot]' => array('NG-Search/', ''),
- 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''),
- 'Nutch/CVS [Bot]' => array('NutchCVS/', ''),
- 'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''),
- 'Online link [Validator]' => array('online link validator', ''),
- 'psbot [Picsearch]' => array('psbot/0', ''),
- 'Seekport [Bot]' => array('Seekbot/', ''),
- 'Sensis [Crawler]' => array('Sensis Web Crawler', ''),
- 'SEO Crawler' => array('SEO search Crawler/', ''),
- 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''),
- 'SEOSearch [Crawler]' => array('SEOsearch/', ''),
- 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
- 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
- 'Synoo [Bot]' => array('SynooBot/', ''),
- 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''),
- 'TurnitinBot [Bot]' => array('TurnitinBot/', ''),
- 'Voyager [Bot]' => array('voyager/1.0', ''),
- 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''),
- 'W3C [Linkcheck]' => array('W3C-checklink/', ''),
- 'W3C [Validator]' => array('W3C_*Validator', ''),
- 'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''),
- 'YaCy [Bot]' => array('yacybot', ''),
- 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
- 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
- 'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
- 'YahooSeeker [Bot]' => array('YahooSeeker/', ''),
- );
-
- /**
- * Define the module structure so that we can populate the database without
- * needing to hard-code module_id values
- */
- var $module_categories = array(
- 'acp' => array(
- 'ACP_CAT_GENERAL' => array(
- 'ACP_QUICK_ACCESS',
- 'ACP_BOARD_CONFIGURATION',
- 'ACP_CLIENT_COMMUNICATION',
- 'ACP_SERVER_CONFIGURATION',
- ),
- 'ACP_CAT_FORUMS' => array(
- 'ACP_MANAGE_FORUMS',
- 'ACP_FORUM_BASED_PERMISSIONS',
- ),
- 'ACP_CAT_POSTING' => array(
- 'ACP_MESSAGES',
- 'ACP_ATTACHMENTS',
- ),
- 'ACP_CAT_USERGROUP' => array(
- 'ACP_CAT_USERS',
- 'ACP_GROUPS',
- 'ACP_USER_SECURITY',
- ),
- 'ACP_CAT_PERMISSIONS' => array(
- 'ACP_GLOBAL_PERMISSIONS',
- 'ACP_FORUM_BASED_PERMISSIONS',
- 'ACP_PERMISSION_ROLES',
- 'ACP_PERMISSION_MASKS',
- ),
- 'ACP_CAT_STYLES' => array(
- 'ACP_STYLE_MANAGEMENT',
- 'ACP_STYLE_COMPONENTS',
- ),
- 'ACP_CAT_MAINTENANCE' => array(
- 'ACP_FORUM_LOGS',
- 'ACP_CAT_DATABASE',
- ),
- 'ACP_CAT_SYSTEM' => array(
- 'ACP_AUTOMATION',
- 'ACP_GENERAL_TASKS',
- 'ACP_MODULE_MANAGEMENT',
- ),
- 'ACP_CAT_DOT_MODS' => null,
- ),
- 'mcp' => array(
- 'MCP_MAIN' => null,
- 'MCP_QUEUE' => null,
- 'MCP_REPORTS' => null,
- 'MCP_NOTES' => null,
- 'MCP_WARN' => null,
- 'MCP_LOGS' => null,
- 'MCP_BAN' => null,
- ),
- 'ucp' => array(
- 'UCP_MAIN' => null,
- 'UCP_PROFILE' => null,
- 'UCP_PREFS' => null,
- 'UCP_PM' => null,
- 'UCP_USERGROUPS' => null,
- 'UCP_ZEBRA' => null,
- ),
- );
-
- var $module_extras = array(
- 'acp' => array(
- 'ACP_QUICK_ACCESS' => array(
- 'ACP_MANAGE_USERS',
- 'ACP_GROUPS_MANAGE',
- 'ACP_MANAGE_FORUMS',
- 'ACP_MOD_LOGS',
- 'ACP_BOTS',
- 'ACP_PHP_INFO',
- ),
- 'ACP_FORUM_BASED_PERMISSIONS' => array(
- 'ACP_FORUM_PERMISSIONS',
- 'ACP_FORUM_MODERATORS',
- 'ACP_USERS_FORUM_PERMISSIONS',
- 'ACP_GROUPS_FORUM_PERMISSIONS',
- ),
- ),
- );
-
- var $role_definitions = array(
- // Standard Admin (a_)
- array('ROLE_ADMIN_STANDARD', 1, 'a_', 'NOT IN', array('a_switchperm', 'a_jabber', 'a_phpinfo', 'a_server', 'a_backup', 'a_styles', 'a_clearlogs', 'a_modules', 'a_language', 'a_email', 'a_bots', 'a_search', 'a_aauth', 'a_roles')),
- // Forum Admin (a_)
- array('ROLE_ADMIN_FORUM', 1, 'a_', 'IN', array('a_', 'a_authgroups', 'a_authusers', 'a_fauth', 'a_forum', 'a_forumadd', 'a_forumdel', 'a_mauth', 'a_prune', 'a_uauth', 'a_viewauth', 'a_viewlogs')),
- // User and Groups Admin (a_)
- array('ROLE_ADMIN_USERGROUP', 1, 'a_', 'IN', array('a_', 'a_authgroups', 'a_authusers', 'a_ban', 'a_group', 'a_groupadd', 'a_groupdel', 'a_ranks', 'a_uauth', 'a_user', 'a_viewauth', 'a_viewlogs')),
- // Full Admin (a_)
- array('ROLE_ADMIN_FULL', 1, 'a_', false, false),
- // All Features (u_)
- array('ROLE_USER_FULL', 1, 'u_', false, false),
- // Standard Features (u_)
- array('ROLE_USER_STANDARD', 1, 'u_', 'NOT IN', array('u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_flash', 'u_pm_forward')),
- // Limited Features (u_)
- array('ROLE_USER_LIMITED', 1, 'u_', 'NOT IN', array('u_attach', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group')),
- // No Private Messages (u_)
- array('ROLE_USER_NOPM', 1, 'u_', 'IN', array('u_', 'u_chgavatar', 'u_chgcensors', 'u_chgemail', 'u_chgpasswd', 'u_download', 'u_hideonline', 'u_sig', 'u_viewprofile')),
- array('ROLE_USER_NOPM', 0, 'u_', 'IN', array('u_readpm', 'u_sendpm', 'u_masspm', 'u_masspm_group')),
- // No Avatar (u_)
- array('ROLE_USER_NOAVATAR', 1, 'u_', 'NOT IN', array('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group')),
- array('ROLE_USER_NOAVATAR', 0, 'u_', 'IN', array('u_chgavatar', 'u_masspm', 'u_masspm_group')),
- // Download and search for guests (u_)
- array('ROLE_USER_GUESTS', 1, 'u_', 'IN', array('u_', 'u_download', 'u_search')),
- // Full Moderator (m_)
- array('ROLE_MOD_FULL', 1, 'm_', false, false),
- // Standard Moderator (m_)
- array('ROLE_MOD_STANDARD', 1, 'm_', 'NOT IN', array('m_ban', 'm_chgposter')),
- // Simple Moderator (m_)
- array('ROLE_MOD_SIMPLE', 1, 'm_', 'IN', array('m_', 'm_delete', 'm_edit', 'm_info', 'm_report')),
- // Queue Moderator (m_)
- array('ROLE_MOD_QUEUE', 1, 'm_', 'IN', array('m_', 'm_approve', 'm_edit')),
- // Full Access (f_)
- array('ROLE_FORUM_FULL', 1, 'f_', false, false),
- // Standard Access (f_)
- array('ROLE_FORUM_STANDARD', 1, 'f_', 'NOT IN', array('f_announce', 'f_flash', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock')),
- // No Access (f_)
- array('ROLE_FORUM_NOACCESS', 0, 'f_', 'IN', array('f_')),
- // Read Only Access (f_)
- array('ROLE_FORUM_READONLY', 1, 'f_', 'IN', array('f_', 'f_download', 'f_list', 'f_read', 'f_search', 'f_subscribe', 'f_print')),
- // Limited Access (f_)
- array('ROLE_FORUM_LIMITED', 1, 'f_', 'NOT IN', array('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg')),
- // Bot Access (f_)
- array('ROLE_FORUM_BOT', 1, 'f_', 'IN', array('f_', 'f_download', 'f_list', 'f_read', 'f_print')),
- // On Moderation Queue (f_)
- array('ROLE_FORUM_ONQUEUE', 1, 'f_', 'NOT IN', array('f_announce', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove')),
- array('ROLE_FORUM_ONQUEUE', 0, 'f_', 'IN', array('f_noapprove')),
- // Standard Access + Polls (f_)
- array('ROLE_FORUM_POLLS', 1, 'f_', 'NOT IN', array('f_announce', 'f_flash', 'f_ignoreflood', 'f_sticky', 'f_user_lock')),
- // Limited Access + Polls (f_)
- array('ROLE_FORUM_LIMITED_POLLS', 1, 'f_', 'NOT IN', array('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg')),
- );
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/install_main.php b/phpBB/install/install_main.php
deleted file mode 100644
index 48cd600249..0000000000
--- a/phpBB/install/install_main.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-*/
-
-/**
-*/
-
-if ( !defined('IN_INSTALL') )
-{
- // Someone has tried to access the file direct. This is not a good idea, so exit
- exit;
-}
-
-if (!empty($setmodules))
-{
- $module[] = array(
- 'module_type' => 'install',
- 'module_title' => 'OVERVIEW',
- 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1),
- 'module_order' => 0,
- 'module_subs' => array('INTRO', 'LICENSE', 'SUPPORT'),
- 'module_stages' => '',
- 'module_reqs' => ''
- );
-}
-
-/**
-* Main Tab - Installation
-* @package install
-*/
-class install_main extends module
-{
- function install_main(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($mode, $sub)
- {
- switch ($sub)
- {
- case 'intro' :
- $title = phpbb::$user->lang['SUB_INTRO'];
- $body = phpbb::$user->lang['OVERVIEW_BODY'];
- break;
-
- case 'license' :
- $title = phpbb::$user->lang['GPL'];
- $body = implode("<br />\n", file('../docs/COPYING'));
- break;
-
- case 'support' :
- $title = phpbb::$user->lang['SUB_SUPPORT'];
- $body = phpbb::$user->lang['SUPPORT_BODY'];
- break;
- }
-
- $this->tpl_name = 'install/main';
- $this->page_title = $title;
-
- phpbb::$template->assign_vars(array(
- 'TITLE' => $title,
- 'BODY' => $body,
-
- 'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select(phpbb::$user->lang_name) . '</select>',
- ));
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
deleted file mode 100644
index 1cc38c5a94..0000000000
--- a/phpBB/install/install_update.php
+++ /dev/null
@@ -1,1386 +0,0 @@
-<?php
-/**
-*
-* @package install
-* @version $Id$
-* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
-*
-* @todo check for writable cache/store/files directory
-*/
-
-/**
-*/
-if (!defined('IN_INSTALL'))
-{
- // Someone has tried to access the file directly. This is not a good idea, so exit
- exit;
-}
-
-if (!empty($setmodules))
-{
- // If phpBB is not installed we do not include this module
- if (@file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && !@file_exists(PHPBB_ROOT_PATH . 'cache/install_lock'))
- {
- include_once(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
-
- if (!phpbb::$base_config['installed'])
- {
- return;
- }
- }
- else
- {
- return;
- }
-
- $module[] = array(
- 'module_type' => 'update',
- 'module_title' => 'UPDATE',
- 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1),
- 'module_order' => 30,
- 'module_subs' => '',
- 'module_stages' => array('INTRO', 'VERSION_CHECK', 'UPDATE_DB', 'FILE_CHECK', 'UPDATE_FILES'),
- 'module_reqs' => ''
- );
-}
-
-/**
-* Update Installation
-* @package install
-*/
-class install_update extends module
-{
- var $p_master;
- var $update_info;
-
- var $old_location;
- var $new_location;
- var $latest_version;
- var $current_version;
- var $unequal_version;
-
- // Set to false
- var $test_update = false;
-
- function install_update(&$p_master)
- {
- $this->p_master = &$p_master;
- }
-
- function main($mode, $sub)
- {
- require PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
-
- $this->tpl_name = 'install_update';
- $this->page_title = 'UPDATE_INSTALLATION';
- $this->unequal_version = false;
-
- $this->old_location = PHPBB_ROOT_PATH . 'install/update/old/';
- $this->new_location = PHPBB_ROOT_PATH . 'install/update/new/';
-
- // Force template recompile
- phpbb::$config['load_tplcompile'] = 1;
-
- // Start session management
- phpbb::$user->session_begin();
- phpbb::$acl->init(phpbb::$user->data);
- phpbb::$user->setup('viewforum');
-
- // If we are within the intro page we need to make sure we get up-to-date version info
- if ($sub == 'intro')
- {
- phpbb::$acm->destroy('version_info');
- }
-
- // Set custom template again. ;)
- phpbb::$template->set_custom_template('../adm/style', 'admin');
-
- // Get current and latest version
- if (($latest_version = phpbb::$acm->get('version_info')) === false)
- {
- $this->latest_version = $this->get_file('version_info');
- phpbb::$acm->put('version_info', $this->latest_version);
- }
- else
- {
- $this->latest_version = $latest_version;
- }
-
- // For the current version we trick a bit. ;)
- $this->current_version = (!empty(phpbb::$config['version_update_from'])) ? phpbb::$config['version_update_from'] : phpbb::$config['version'];
-
- $up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->latest_version)), '<')) ? false : true;
-
- // Check for a valid update directory, else point the user to the phpbb.com website
- if (!file_exists(PHPBB_ROOT_PATH . 'install/update') || !file_exists(PHPBB_ROOT_PATH . 'install/update/index.php') || !file_exists($this->old_location) || !file_exists($this->new_location))
- {
- phpbb::$template->assign_vars(array(
- 'S_ERROR' => true,
- 'ERROR_MSG' => ($up_to_date) ? phpbb::$user->lang['NO_UPDATE_FILES_UP_TO_DATE'] : sprintf(phpbb::$user->lang['NO_UPDATE_FILES_OUTDATED'], phpbb::$config['version'], $this->current_version, $this->latest_version),
- ));
-
- return;
- }
-
- $this->update_info = $this->get_file('update_info');
-
- // Make sure the update directory holds the correct information
- // Since admins are able to run the update/checks more than once we only check if the current version is lower or equal than the version to which we update to.
- if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '>'))
- {
- phpbb::$template->assign_vars(array(
- 'S_ERROR' => true,
- 'ERROR_MSG' => sprintf(phpbb::$user->lang['INCOMPATIBLE_UPDATE_FILES'], phpbb::$config['version'], $this->update_info['version']['from'], $this->update_info['version']['to']),
- ));
-
- return;
- }
-
- // Check if the update files stored are for the latest version...
- if ($this->latest_version != $this->update_info['version']['to'])
- {
- $this->unequal_version = true;
-
- phpbb::$template->assign_vars(array(
- 'S_WARNING' => true,
- 'WARNING_MSG' => sprintf(phpbb::$user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version),
- ));
- }
-
- // Fill DB version
- if (empty(phpbb::$config['dbms_version']))
- {
- set_config('dbms_version', phpbb::$db->sql_server_info(true));
- }
-
- if ($this->test_update === false)
- {
- // Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present
- if (in_array('adm/style/install_update.html', $this->update_info['files']))
- {
- $this->tpl_name = '../../install/update/new/adm/style/install_update';
- }
-
- // What about the language file? Got it updated?
- if (in_array('language/en/install.php', $this->update_info['files']))
- {
- $lang = array();
- include($this->new_location . 'language/en/install.php');
- // only add new keys to user's language in english
- $new_keys = array_diff(array_keys($lang), array_keys(phpbb::$user->lang));
- foreach ($new_keys as $i => $new_key)
- {
- phpbb::$user->lang[$new_key] = $lang[$new_key];
- }
- }
- }
-
- // Include renderer and engine
- $this->include_file('includes/diff/diff.' . PHP_EXT);
- $this->include_file('includes/diff/engine.' . PHP_EXT);
- $this->include_file('includes/diff/renderer.' . PHP_EXT);
-
- // Make sure we stay at the file check if checking the files again
- if (phpbb_request::variable('clean_up', false, false, phpbb_request::POST))
- {
- $sub = $this->p_master->sub = 'file_check';
- }
-
- switch ($sub)
- {
- case 'intro':
- $this->page_title = 'UPDATE_INSTALLATION';
-
- phpbb::$template->assign_vars(array(
- 'S_INTRO' => true,
- 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=version_check"),
- ));
-
- // Make sure the update list is destroyed.
- phpbb::$acm->destroy('update_list');
- phpbb::$acm->destroy('diff_files');
- break;
-
- case 'version_check':
- $this->page_title = 'STAGE_VERSION_CHECK';
-
- phpbb::$template->assign_vars(array(
- 'S_UP_TO_DATE' => $up_to_date,
- 'S_VERSION_CHECK' => true,
-
- 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=file_check"),
- 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_db"),
-
- 'LATEST_VERSION' => $this->latest_version,
- 'CURRENT_VERSION' => $this->current_version,
- ));
-
- // Print out version the update package updates to
- if ($this->unequal_version)
- {
- phpbb::$template->assign_var('PACKAGE_VERSION', $this->update_info['version']['to']);
- }
-
- break;
-
- case 'update_db':
-
- // Make sure the database update is valid for the latest version
- $valid = false;
- $updates_to_version = '';
-
- if (file_exists(PHPBB_ROOT_PATH . 'install/database_update.' . PHP_EXT))
- {
- include_once(PHPBB_ROOT_PATH . 'install/database_update.' . PHP_EXT);
-
- if ($updates_to_version === $this->update_info['version']['to'])
- {
- $valid = true;
- }
- }
-
- // Should not happen at all
- if (!$valid)
- {
- trigger_error(phpbb::$user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR);
- }
-
- // Just a precaution
- phpbb::$acm->purge();
-
- // Redirect the user to the database update script with some explanations...
- phpbb::$template->assign_vars(array(
- 'S_DB_UPDATE' => true,
- 'S_DB_UPDATE_FINISHED' => (phpbb::$config['version'] == $this->update_info['version']['to']) ? true : false,
- 'U_DB_UPDATE' => append_sid('install/database_update', 'type=1&amp;language=' . phpbb::$user->data['user_lang']),
- 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_db"),
- 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=file_check"),
- ));
-
- break;
-
- case 'file_check':
-
- // Make sure the previous file collection is no longer valid...
- phpbb::$acm->destroy('diff_files');
-
- $this->page_title = 'STAGE_FILE_CHECK';
-
- // Now make sure our update list is correct if the admin refreshes
- $action = request_var('action', '');
-
- // We are directly within an update. To make sure our update list is correct we check its status.
- $update_list = (phpbb_request::variable('clean_up', false, false, phpbb_request::POST)) ? false : phpbb::$acm->get('update_list');
- $modified = ($update_list !== false) ? phpbb::$acm->get_modified_date('data', 'update_list') : 0;
-
- // Make sure the list is up-to-date
- if ($update_list !== false)
- {
- $get_new_list = false;
- foreach ($this->update_info['files'] as $file)
- {
- if (file_exists(PHPBB_ROOT_PATH . $file) && filemtime(PHPBB_ROOT_PATH . $file) > $modified)
- {
- $get_new_list = true;
- break;
- }
- }
- }
- else
- {
- $get_new_list = true;
- }
-
- if (!$get_new_list && $update_list['status'] != -1)
- {
- $get_new_list = true;
- }
-
- if ($get_new_list)
- {
- $this->get_update_structure($update_list);
- phpbb::$acm->put('update_list', $update_list);
-
- // Refresh the page if we are still not finished...
- if ($update_list['status'] != -1)
- {
- $refresh_url = append_sid($this->p_master->module_url, "mode=$mode&amp;sub=file_check");
- meta_refresh(2, $refresh_url);
-
- phpbb::$template->assign_vars(array(
- 'S_IN_PROGRESS' => true,
- 'S_COLLECTED' => (int) $update_list['status'],
- 'S_TO_COLLECT' => sizeof($this->update_info['files']),
- 'L_IN_PROGRESS' => phpbb::$user->lang['COLLECTING_FILE_DIFFS'],
- 'L_IN_PROGRESS_EXPLAIN' => sprintf(phpbb::$user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files'])),
- ));
-
- return;
- }
- }
-
- if ($action == 'diff')
- {
- $this->show_diff($update_list);
- return;
- }
-
- if (sizeof($update_list['no_update']))
- {
- phpbb::$template->assign_vars(array(
- 'S_NO_UPDATE_FILES' => true,
- 'NO_UPDATE_FILES' => implode(', ', array_map('htmlspecialchars', $update_list['no_update'])),
- ));
- }
-
- // Now assign the list to the template
- foreach ($update_list as $status => $filelist)
- {
- if ($status == 'no_update' || !sizeof($filelist) || $status == 'status')
- {
- continue;
- }
-
-/* phpbb::$template->assign_block_vars('files', array(
- 'S_STATUS' => true,
- 'STATUS' => $status,
- 'L_STATUS' => phpbb::$user->lang['STATUS_' . strtoupper($status)],
- 'TITLE' => phpbb::$user->lang['FILES_' . strtoupper($status)],
- 'EXPLAIN' => phpbb::$user->lang['FILES_' . strtoupper($status) . '_EXPLAIN'],
- )
- );*/
-
- foreach ($filelist as $file_struct)
- {
- $s_binary = (!empty($this->update_info['binary']) && in_array($file_struct['filename'], $this->update_info['binary'])) ? true : false;
-
- $filename = htmlspecialchars($file_struct['filename']);
- if (strrpos($filename, '/') !== false)
- {
- $dir_part = substr($filename, 0, strrpos($filename, '/') + 1);
- $file_part = substr($filename, strrpos($filename, '/') + 1);
- }
- else
- {
- $dir_part = '';
- $file_part = $filename;
- }
-
- $diff_url = append_sid($this->p_master->module_url, "mode=$mode&amp;sub=file_check&amp;action=diff&amp;status=$status&amp;file=" . urlencode($file_struct['filename']));
-
- phpbb::$template->assign_block_vars($status, array(
- 'STATUS' => $status,
-
- 'FILENAME' => $filename,
- 'DIR_PART' => $dir_part,
- 'FILE_PART' => $file_part,
- 'NUM_CONFLICTS' => (isset($file_struct['conflicts'])) ? $file_struct['conflicts'] : 0,
-
- 'S_CUSTOM' => ($file_struct['custom']) ? true : false,
- 'S_BINARY' => $s_binary,
- 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '',
-
- 'U_SHOW_DIFF' => $diff_url,
- 'L_SHOW_DIFF' => ($status != 'up_to_date') ? phpbb::$user->lang['SHOW_DIFF_' . strtoupper($status)] : '',
-
- 'U_VIEW_MOD_FILE' => $diff_url . '&amp;op=' . MERGE_MOD_FILE,
- 'U_VIEW_NEW_FILE' => $diff_url . '&amp;op=' . MERGE_NEW_FILE,
- 'U_VIEW_NO_MERGE_MOD' => $diff_url . '&amp;op=' . MERGE_NO_MERGE_MOD,
- 'U_VIEW_NO_MERGE_NEW' => $diff_url . '&amp;op=' . MERGE_NO_MERGE_NEW,
- ));
- }
- }
-
- $all_up_to_date = true;
- foreach ($update_list as $status => $filelist)
- {
- if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && sizeof($filelist))
- {
- $all_up_to_date = false;
- break;
- }
- }
-
- phpbb::$template->assign_vars(array(
- 'S_FILE_CHECK' => true,
- 'S_ALL_UP_TO_DATE' => $all_up_to_date,
- 'S_VERSION_UP_TO_DATE' => $up_to_date,
- 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=file_check"),
- 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_files"),
- 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_db"),
- ));
-
- if ($all_up_to_date)
- {
- // Add database update to log
- add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->latest_version);
-
- // Refresh prosilver css data - this may cause some unhappy users, but
- $sql = 'SELECT *
- FROM ' . STYLES_THEME_TABLE . "
- WHERE theme_name = 'prosilver'";
- $result = phpbb::$db->sql_query($sql);
- $theme = phpbb::$db->sql_fetchrow($result);
- phpbb::$db->sql_freeresult($result);
-
- if ($theme)
- {
- $recache = (empty($theme['theme_data'])) ? true : false;
- $update_time = time();
-
- // We test for stylesheet.css because it is faster and most likely the only file changed on common themes
- if (!$recache && $theme['theme_mtime'] < @filemtime(PHPBB_ROOT_PATH . 'styles/' . $theme['theme_path'] . '/theme/stylesheet.css'))
- {
- $recache = true;
- $update_time = @filemtime(PHPBB_ROOT_PATH . 'styles/' . $theme['theme_path'] . '/theme/stylesheet.css');
- }
- else if (!$recache)
- {
- $last_change = $theme['theme_mtime'];
- $dir = @opendir(PHPBB_ROOT_PATH . "styles/{$theme['theme_path']}/theme");
-
- if ($dir)
- {
- while (($entry = readdir($dir)) !== false)
- {
- if (substr(strrchr($entry, '.'), 1) == 'css' && $last_change < @filemtime(PHPBB_ROOT_PATH . "styles/{$theme['theme_path']}/theme/{$entry}"))
- {
- $recache = true;
- break;
- }
- }
- closedir($dir);
- }
- }
-
- if ($recache)
- {
- include_once(PHPBB_ROOT_PATH . 'includes/acp/acp_styles.' . PHP_EXT);
-
- $theme['theme_data'] = acp_styles::db_theme_data($theme);
- $theme['theme_mtime'] = $update_time;
-
- // Save CSS contents
- $sql_ary = array(
- 'theme_mtime' => $theme['theme_mtime'],
- 'theme_data' => $theme['theme_data']
- );
-
- $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . '
- WHERE theme_id = ' . $theme['theme_id'];
- phpbb::$db->sql_query($sql);
-
- phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
- }
- }
-
- phpbb::$db->sql_return_on_error(true);
- phpbb::$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
- phpbb::$db->sql_return_on_error(false);
-
- phpbb::$acm->purge();
- }
-
- break;
-
- case 'update_files':
-
- $this->page_title = 'STAGE_UPDATE_FILES';
-
- $s_hidden_fields = '';
- $params = array();
- $conflicts = request_var('conflict', array('' => 0));
- $modified = request_var('modified', array('' => 0));
-
- foreach ($conflicts as $filename => $merge_option)
- {
- $s_hidden_fields .= '<input type="hidden" name="conflict[' . htmlspecialchars($filename) . ']" value="' . $merge_option . '" />';
- $params[] = 'conflict[' . urlencode($filename) . ']=' . urlencode($merge_option);
- }
-
- foreach ($modified as $filename => $merge_option)
- {
- if (!$merge_option)
- {
- continue;
- }
- $s_hidden_fields .= '<input type="hidden" name="modified[' . htmlspecialchars($filename) . ']" value="' . $merge_option . '" />';
- $params[] = 'modified[' . urlencode($filename) . ']=' . urlencode($merge_option);
- }
-
- $no_update = request_var('no_update', array(0 => ''));
-
- foreach ($no_update as $index => $filename)
- {
- $s_hidden_fields .= '<input type="hidden" name="no_update[]" value="' . htmlspecialchars($filename) . '" />';
- $params[] = 'no_update[]=' . urlencode($filename);
- }
-
- // Before the user is choosing his preferred method, let's create the content list...
- $update_list = phpbb::$acm->get('update_list');
-
- if ($update_list === false)
- {
- trigger_error(phpbb::$user->lang['NO_UPDATE_INFO'], E_USER_ERROR);
- }
-
- // Check if the conflicts data is valid
- if (sizeof($conflicts))
- {
- $conflict_filenames = array();
- foreach ($update_list['conflict'] as $files)
- {
- $conflict_filenames[] = $files['filename'];
- }
-
- $new_conflicts = array();
- foreach ($conflicts as $filename => $diff_method)
- {
- if (in_array($filename, $conflict_filenames))
- {
- $new_conflicts[$filename] = $diff_method;
- }
- }
-
- $conflicts = $new_conflicts;
- }
-
- // Build list for modifications
- if (sizeof($modified))
- {
- $modified_filenames = array();
- foreach ($update_list['modified'] as $files)
- {
- $modified_filenames[] = $files['filename'];
- }
-
- $new_modified = array();
- foreach ($modified as $filename => $diff_method)
- {
- if (in_array($filename, $modified_filenames))
- {
- $new_modified[$filename] = $diff_method;
- }
- }
-
- $modified = $new_modified;
- }
-
- // Check number of conflicting files, they need to be equal. For modified files the number can differ
- if (sizeof($update_list['conflict']) != sizeof($conflicts))
- {
- trigger_error(phpbb::$user->lang['MERGE_SELECT_ERROR'], E_USER_ERROR);
- }
-
- // Before we do anything, let us diff the files and store the raw file information "somewhere"
- $get_files = false;
- $file_list = phpbb::$acm->get('diff_files');
-
- if ($file_list === false || $file_list['status'] != -1)
- {
- $get_files = true;
- }
-
- if ($get_files)
- {
- if ($file_list === false)
- {
- $file_list = array(
- 'status' => 0,
- );
- }
-
- $processed = 0;
- foreach ($update_list as $status => $files)
- {
- if (!is_array($files))
- {
- continue;
- }
-
- foreach ($files as $file_struct)
- {
- // Skip this file if the user selected to not update it
- if (in_array($file_struct['filename'], $no_update))
- {
- continue;
- }
-
- // Already handled... then skip of course...
- if (isset($file_list[$file_struct['filename']]))
- {
- continue;
- }
-
- // Refresh if we reach 5 diffs...
- if ($processed >= 5)
- {
- phpbb::$acm->put('diff_files', $file_list);
-
- if (request_var('download', false))
- {
- $params[] = 'download=1';
- }
-
- $redirect_url = append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_files&amp;" . implode('&amp;', $params));
- meta_refresh(3, $redirect_url);
-
- phpbb::$template->assign_vars(array(
- 'S_IN_PROGRESS' => true,
- 'L_IN_PROGRESS' => phpbb::$user->lang['MERGING_FILES'],
- 'L_IN_PROGRESS_EXPLAIN' => phpbb::$user->lang['MERGING_FILES_EXPLAIN'],
- ));
-
- return;
- }
-
- $original_filename = ($file_struct['custom']) ? $file_struct['original'] : $file_struct['filename'];
-
- switch ($status)
- {
- case 'modified':
-
- $option = (isset($modified[$file_struct['filename']])) ? $modified[$file_struct['filename']] : 0;
-
- switch ($option)
- {
- case MERGE_NO_MERGE_NEW:
- $contents = file_get_contents($this->new_location . $original_filename);
- break;
-
- case MERGE_NO_MERGE_MOD:
- $contents = file_get_contents(PHPBB_ROOT_PATH . $file_struct['filename']);
- break;
-
- default:
- $diff = $this->return_diff($this->old_location . $original_filename, PHPBB_ROOT_PATH . $file_struct['filename'], $this->new_location . $original_filename);
-
- $contents = implode("\n", $diff->merged_new_output());
- unset($diff);
- break;
- }
-
- $file_list[$file_struct['filename']] = 'file_' . md5($file_struct['filename']);
- phpbb::$acm->put($file_list[$file_struct['filename']], base64_encode($contents));
-
- $file_list['status']++;
- $processed++;
-
- break;
-
- case 'conflict':
-
- $option = $conflicts[$file_struct['filename']];
- $contents = '';
-
- switch ($option)
- {
- case MERGE_NO_MERGE_NEW:
- $contents = file_get_contents($this->new_location . $original_filename);
- break;
-
- case MERGE_NO_MERGE_MOD:
- $contents = file_get_contents(PHPBB_ROOT_PATH . $file_struct['filename']);
- break;
-
- default:
-
- $diff = $this->return_diff($this->old_location . $original_filename, PHPBB_ROOT_PATH . $file_struct['filename'], $this->new_location . $original_filename);
-
- if ($option == MERGE_NEW_FILE)
- {
- $contents = implode("\n", $diff->merged_new_output());
- }
- else if ($option == MERGE_MOD_FILE)
- {
- $contents = implode("\n", $diff->merged_orig_output());
- }
- else
- {
- unset($diff);
- break 2;
- }
-
- unset($diff);
- break;
- }
-
- $file_list[$file_struct['filename']] = 'file_' . md5($file_struct['filename']);
- phpbb::$acm->put($file_list[$file_struct['filename']], base64_encode($contents));
-
- $file_list['status']++;
- $processed++;
-
- break;
- }
- }
- }
- }
-
- $file_list['status'] = -1;
- phpbb::$acm->put('diff_files', $file_list);
-
- $this->include_file('includes/functions_compress.' . $phpEx);
- $this->include_file('includes/functions_transfer.' . $phpEx);
-
- $module_url = append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_files");
- foreach ($update_list as &$files)
- {
- if (!is_array($files))
- {
- continue;
- }
- for ($i = 0, $size = sizeof($files); $i < $size; $i++)
- {
- // Skip this file if the user selected to not update it
- if (in_array($files[$i]['filename'], $no_update))
- {
- unset($files[$i]['filename']);
- }
- }
- $files = array_values($files);
- }
- unset($files);
- $new_location = $this->new_location;
- $download_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to'];
- $check_params = "mode=$mode&amp;sub=file_check";
-
- $temp = process_transfer($module_url, $update_list, $new_location, $download_filename);
- if (is_string($temp))
- {
- $this->page_title = $temp;
- }
-
- phpbb::$template->assign_vars(array(
- 'S_UPDATE_OPTIONS' => true,
- 'S_CHECK_AGAIN' => true,
- // 'U_INITIAL_ACTION' isn't set because it's taken care of in the S_FILE_CHECK block of install_update.html
- 'U_FINAL_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_files"))
- );
-
- break;
-
- }
- }
-
- /**
- * Show file diff
- */
- function show_diff(&$update_list)
- {
- $this->tpl_name = 'install_update_diff';
-
- // Got the diff template itself updated? If so, we are able to directly use it
- if (in_array('adm/style/install_update_diff.html', $this->update_info['files']))
- {
- $this->tpl_name = '../../install/update/new/adm/style/install_update_diff';
- }
-
- $this->page_title = 'VIEWING_FILE_DIFF';
-
- $status = request_var('status', '');
- $file = request_var('file', '');
- $diff_mode = request_var('diff_mode', 'inline');
-
- // First of all make sure the file is within our file update list with the correct status
- $found_entry = array();
- foreach ($update_list[$status] as $index => $file_struct)
- {
- if ($file_struct['filename'] === $file)
- {
- $found_entry = $update_list[$status][$index];
- }
- }
-
- if (empty($found_entry))
- {
- trigger_error(phpbb::$user->lang['FILE_DIFF_NOT_ALLOWED'], E_USER_ERROR);
- }
-
- // If the status is 'up_to_date' then we do not need to show a diff
- if ($status == 'up_to_date')
- {
- trigger_error(phpbb::$user->lang['FILE_ALREADY_UP_TO_DATE'], E_USER_ERROR);
- }
-
- $original_file = ($found_entry['custom']) ? $found_entry['original'] : $file;
-
- // Get the correct diff
- switch ($status)
- {
- case 'conflict':
- $option = request_var('op', 0);
-
- switch ($option)
- {
- case MERGE_NO_MERGE_NEW:
- case MERGE_NO_MERGE_MOD:
-
- $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : PHPBB_ROOT_PATH . $file);
-
- phpbb::$template->assign_var('S_DIFF_NEW_FILE', true);
- $diff_mode = 'inline';
- $this->page_title = 'VIEWING_FILE_CONTENTS';
-
- break;
-
-/*
- $diff = $this->return_diff($this->old_location . $original_file, PHPBB_ROOT_PATH . $file, $this->new_location . $original_file);
-
- $tmp = array(
- 'file1' => array(),
- 'file2' => ($option == MERGE_NEW_FILE) ? implode("\n", $diff->merged_new_output()) : implode("\n", $diff->merged_orig_output()),
- );
-
- $diff = new diff($tmp['file1'], $tmp['file2']);
-
- unset($tmp);
-
- phpbb::$template->assign_var('S_DIFF_NEW_FILE', true);
- $diff_mode = 'inline';
- $this->page_title = 'VIEWING_FILE_CONTENTS';
-
- break;
-*/
- // Merge differences and use new phpBB code for conflicted blocks
- case MERGE_NEW_FILE:
- case MERGE_MOD_FILE:
-
- $diff = $this->return_diff($this->old_location . $original_file, PHPBB_ROOT_PATH . $file, $this->new_location . $original_file);
-
- phpbb::$template->assign_vars(array(
- 'S_DIFF_CONFLICT_FILE' => true,
- 'NUM_CONFLICTS' => $diff->get_num_conflicts(),
- ));
-
- $diff = $this->return_diff(PHPBB_ROOT_PATH . $file, ($option == MERGE_NEW_FILE) ? $diff->merged_new_output() : $diff->merged_orig_output());
- break;
-
- // Download conflict file
- default:
-
- $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file);
-
- header('Pragma: no-cache');
- header("Content-Type: application/octetstream; name=\"$file\"");
- header("Content-disposition: attachment; filename=$file");
-
- @set_time_limit(0);
-
- echo implode("\n", $diff->get_conflicts_content());
-
- flush();
- exit;
-
- break;
- }
-
- break;
-
- case 'modified':
- $option = request_var('op', 0);
-
- switch ($option)
- {
- case MERGE_NO_MERGE_NEW:
- case MERGE_NO_MERGE_MOD:
-
- $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : PHPBB_ROOT_PATH . $file);
-
- phpbb::$template->assign_var('S_DIFF_NEW_FILE', true);
- $diff_mode = 'inline';
- $this->page_title = 'VIEWING_FILE_CONTENTS';
-
- break;
-
- default:
- $diff = $this->return_diff($this->old_location . $original_file, PHPBB_ROOT_PATH . $original_file, $this->new_location . $file);
- break;
- }
- break;
-
- case 'not_modified':
- case 'new_conflict':
- $diff = $this->return_diff(PHPBB_ROOT_PATH . $file, $this->new_location . $original_file);
- break;
-
- case 'new':
-
- $diff = $this->return_diff(array(), $this->new_location . $original_file);
-
- phpbb::$template->assign_var('S_DIFF_NEW_FILE', true);
- $diff_mode = 'inline';
- $this->page_title = 'VIEWING_FILE_CONTENTS';
-
- break;
- }
-
- $diff_mode_options = '';
- foreach (array('side_by_side', 'inline', 'unified', 'raw') as $option)
- {
- $diff_mode_options .= '<option value="' . $option . '"' . (($diff_mode == $option) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['DIFF_' . strtoupper($option)] . '</option>';
- }
-
- // Now the correct renderer
- $render_class = 'diff_renderer_' . $diff_mode;
-
- if (!class_exists($render_class))
- {
- trigger_error('Chosen diff mode is not supported', E_USER_ERROR);
- }
-
- $renderer = new $render_class();
-
- phpbb::$template->assign_vars(array(
- 'DIFF_CONTENT' => $renderer->get_diff_content($diff),
- 'DIFF_MODE' => $diff_mode,
- 'S_DIFF_MODE_OPTIONS' => $diff_mode_options,
- 'S_SHOW_DIFF' => true,
- ));
-
- unset($diff, $renderer);
- }
-
- /**
- * Collect all file status infos we need for the update by diffing all files
- */
- function get_update_structure(&$update_list)
- {
- if ($update_list === false)
- {
- $update_list = array(
- 'up_to_date' => array(),
- 'new' => array(),
- 'not_modified' => array(),
- 'modified' => array(),
- 'new_conflict' => array(),
- 'conflict' => array(),
- 'no_update' => array(),
- 'status' => 0,
- );
- }
-
- /* if (!empty($this->update_info['custom']))
- {
- foreach ($this->update_info['custom'] as $original_file => $file_ary)
- {
- foreach ($file_ary as $index => $file)
- {
- $this->make_update_diff($update_list, $original_file, $file, true);
- }
- }
- } */
-
- // Get a list of those files which are completely new by checking with file_exists...
- $num_bytes_processed = 0;
-
- foreach ($this->update_info['files'] as $index => $file)
- {
- if (is_int($update_list['status']) && $index < $update_list['status'])
- {
- continue;
- }
-
- if ($num_bytes_processed >= 500 * 1024)
- {
- return;
- }
-
- if (!file_exists(PHPBB_ROOT_PATH . $file))
- {
- // Make sure the update files are consistent by checking if the file is in new_files...
- if (!file_exists($this->new_location . $file))
- {
- trigger_error(phpbb::$user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR);
- }
-
- // If the file exists within the old directory the file got removed and we will write it back
- // not a biggie, but we might want to state this circumstance separately later.
- // if (file_exists($this->old_location . $file))
- // {
- // $update_list['removed'][] = $file;
- // }
-
- /* Only include a new file as new if the underlying path exist
- // The path normally do not exist if the original style or language has been removed
- if (file_exists(PHPBB_ROOT_PATH . dirname($file)))
- {
- $this->get_custom_info($update_list['new'], $file);
- $update_list['new'][] = array('filename' => $file, 'custom' => false);
- }
- else
- {
- // Do not include style-related or language-related content
- if (strpos($file, 'styles/') !== 0 && strpos($file, 'language/') !== 0)
- {
- $update_list['no_update'][] = $file;
- }
- }*/
-
- if (file_exists(PHPBB_ROOT_PATH . dirname($file)) || (strpos($file, 'styles/') !== 0 && strpos($file, 'language/') !== 0))
- {
- $this->get_custom_info($update_list['new'], $file);
- $update_list['new'][] = array('filename' => $file, 'custom' => false);
- }
-
- // unset($this->update_info['files'][$index]);
- }
- else
- {
- // not modified?
- $this->make_update_diff($update_list, $file, $file);
- }
-
- $num_bytes_processed += (file_exists($this->new_location . $file)) ? filesize($this->new_location . $file) : 100 * 1024;
- $update_list['status']++;
- }
-
- $update_list['status'] = -1;
-/* if (!sizeof($this->update_info['files']))
- {
- return $update_list;
- }
-
- // Now diff the remaining files to get information about their status (not modified/modified/up-to-date)
-
- // not modified?
- foreach ($this->update_info['files'] as $index => $file)
- {
- $this->make_update_diff($update_list, $file, $file);
- }
-
- // Now to the styles...
- if (empty($this->update_info['custom']))
- {
- return $update_list;
- }
-
- foreach ($this->update_info['custom'] as $original_file => $file_ary)
- {
- foreach ($file_ary as $index => $file)
- {
- $this->make_update_diff($update_list, $original_file, $file, true);
- }
- }
-
- return $update_list;*/
- }
-
- /**
- * Compare files for storage in update_list
- */
- function make_update_diff(&$update_list, $original_file, $file, $custom = false)
- {
- $update_ary = array('filename' => $file, 'custom' => $custom);
-
- if ($custom)
- {
- $update_ary['original'] = $original_file;
- }
-
- // On a successfull update the new location file exists but the old one does not exist.
- // Check for this circumstance, the new file need to be up-to-date with the current file then...
- if (!file_exists($this->old_location . $original_file) && file_exists($this->new_location . $original_file) && file_exists(PHPBB_ROOT_PATH . $file))
- {
- $tmp = array(
- 'file1' => file_get_contents($this->new_location . $original_file),
- 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file),
- );
-
- // We need to diff the contents here to make sure the file is really the one we expect
- $diff = new diff($tmp['file1'], $tmp['file2'], false);
- $empty = $diff->is_empty();
-
- unset($tmp, $diff);
-
- // if there are no differences we have an up-to-date file...
- if ($empty)
- {
- $update_list['up_to_date'][] = $update_ary;
- return;
- }
-
- // If no other status matches we have another file in the way...
- $update_list['new_conflict'][] = $update_ary;
- return;
- }
-
- // Old file removed?
- if (file_exists($this->old_location . $original_file) && !file_exists($this->new_location . $original_file))
- {
- return;
- }
-
- // Check for existance, else abort immediately
- if (!file_exists($this->old_location . $original_file) || !file_exists($this->new_location . $original_file))
- {
- trigger_error(phpbb::$user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR);
- }
-
- $tmp = array(
- 'file1' => file_get_contents($this->old_location . $original_file),
- 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file),
- );
-
- // We need to diff the contents here to make sure the file is really the one we expect
- $diff = new diff($tmp['file1'], $tmp['file2'], false);
- $empty_1 = $diff->is_empty();
-
- unset($tmp, $diff);
-
- $tmp = array(
- 'file1' => file_get_contents($this->new_location . $original_file),
- 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file),
- );
-
- // We need to diff the contents here to make sure the file is really the one we expect
- $diff = new diff($tmp['file1'], $tmp['file2'], false);
- $empty_2 = $diff->is_empty();
-
- unset($tmp, $diff);
-
- // If the file is not modified we are finished here...
- if ($empty_1)
- {
- // Further check if it is already up to date - it could happen that non-modified files
- // slip through
- if ($empty_2)
- {
- $update_list['up_to_date'][] = $update_ary;
- return;
- }
-
- $update_list['not_modified'][] = $update_ary;
- return;
- }
-
- // If the file had been modified then we need to check if it is already up to date
-
- // if there are no differences we have an up-to-date file...
- if ($empty_2)
- {
- $update_list['up_to_date'][] = $update_ary;
- return;
- }
-
- // if the file is modified we try to make sure a merge succeed
- $tmp = array(
- 'file1' => file_get_contents($this->old_location . $original_file),
- 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file),
- 'file3' => file_get_contents($this->new_location . $original_file),
- );
-
- $diff = new diff3($tmp['file1'], $tmp['file2'], $tmp['file3'], false);
-
- unset($tmp);
-
- if ($diff->get_num_conflicts())
- {
- $update_ary['conflicts'] = $diff->get_num_conflicts();
-
- // There is one special case... users having merged with a conflicting file... we need to check this
- $tmp = array(
- 'file1' => file_get_contents(PHPBB_ROOT_PATH . $file),
- 'file2' => implode("\n", $diff->merged_orig_output()),
- );
-
- $diff = new diff($tmp['file1'], $tmp['file2'], false);
- $empty = $diff->is_empty();
-
- if ($empty)
- {
- unset($update_ary['conflicts']);
- unset($diff);
- $update_list['up_to_date'][] = $update_ary;
- return;
- }
-
- $update_list['conflict'][] = $update_ary;
- unset($diff);
-
- return;
- }
-
- $tmp = array(
- 'file1' => file_get_contents(PHPBB_ROOT_PATH . $file),
- 'file2' => implode("\n", $diff->merged_new_output()),
- );
-
- // now compare the merged output with the original file to see if the modified file is up to date
- $diff = new diff($tmp['file1'], $tmp['file2'], false);
- $empty = $diff->is_empty();
-
- if ($empty)
- {
- unset($diff);
-
- $update_list['up_to_date'][] = $update_ary;
- return;
- }
-
- // If no other status matches we have a modified file...
- $update_list['modified'][] = $update_ary;
- }
-
- /**
- * Update update_list with custom new files
- */
- function get_custom_info(&$update_list, $file)
- {
- if (empty($this->update_info['custom']))
- {
- return;
- }
-
- if (isset($this->update_info['custom'][$file]))
- {
- foreach ($this->update_info['custom'][$file] as $_file)
- {
- $update_list[] = array('filename' => $_file, 'custom' => true, 'original' => $file);
- }
- }
- }
-
- /**
- * Get remote file
- */
- function get_file($mode)
- {
- $errstr = '';
- $errno = 0;
-
- switch ($mode)
- {
- case 'version_info':
- $info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno);
-
- if ($info !== false)
- {
- $info = explode("\n", $info);
- $info = trim($info[0]);
- }
-
- if ($this->test_update !== false)
- {
- $info = $this->test_update;
- }
-
- // If info is false the fsockopen function may not be working. Instead get the latest version from our update file (and pray it is up-to-date)
- if ($info === false)
- {
- $update_info = array();
- include(PHPBB_ROOT_PATH . 'install/update/index.php');
- $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info;
-
- if ($info !== false)
- {
- $info = (!empty($info['version']['to'])) ? trim($info['version']['to']) : false;
- }
- }
- break;
-
- case 'update_info':
- $update_info = array();
- include(PHPBB_ROOT_PATH . 'install/update/index.php');
-
- $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info;
- $errstr = ($info === false) ? phpbb::$user->lang['WRONG_INFO_FILE_FORMAT'] : '';
-
- if ($info !== false)
- {
- // Adjust the update info file to hold some specific style-related information
- $info['custom'] = array();
-/*
- // Get custom installed styles...
- $sql = 'SELECT template_name, template_path
- FROM ' . STYLES_TEMPLATE_TABLE . "
- WHERE LOWER(template_name) NOT IN ('subsilver2', 'prosilver')";
- $result = phpbb::$db->sql_query($sql);
-
- $templates = array();
- while ($row = phpbb::$db->sql_fetchrow($result))
- {
- $templates[] = $row;
- }
- phpbb::$db->sql_freeresult($result);
-
- if (sizeof($templates))
- {
- foreach ($info['files'] as $filename)
- {
- // Template update?
- if (strpos(strtolower($filename), 'styles/prosilver/template/') === 0)
- {
- foreach ($templates as $row)
- {
- $info['custom'][$filename][] = str_replace('/prosilver/', '/' . $row['template_path'] . '/', $filename);
- }
- }
- }
- }
-*/
- }
- break;
-
- default:
- trigger_error('Mode for getting remote file not specified', E_USER_ERROR);
- break;
- }
-
- if ($info === false)
- {
- trigger_error($errstr, E_USER_ERROR);
- }
-
- return $info;
- }
-
- /**
- * Function for including files...
- */
- function include_file($filename)
- {
- if (!empty($this->update_info['files']) && in_array($filename, $this->update_info['files']))
- {
- include_once($this->new_location . $filename);
- }
- else
- {
- include_once(PHPBB_ROOT_PATH . $filename);
- }
- }
-
- /**
- * Wrapper for returning a diff object
- */
- function &return_diff()
- {
- $args = func_get_args();
- $three_way_diff = (func_num_args() > 2) ? true : false;
-
- $file1 = array_shift($args);
- $file2 = array_shift($args);
-
- $tmp['file1'] = (!empty($file1) && is_string($file1)) ? file_get_contents($file1) : $file1;
- $tmp['file2'] = (!empty($file2) && is_string($file2)) ? file_get_contents($file2) : $file2;
-
- if ($three_way_diff)
- {
- $file3 = array_shift($args);
- $tmp['file3'] = (!empty($file3) && is_string($file3)) ? file_get_contents($file3) : $file3;
-
- $diff = new diff3($tmp['file1'], $tmp['file2'], $tmp['file3']);
- }
- else
- {
- $diff = new diff($tmp['file1'], $tmp['file2']);
- }
-
- unset($tmp);
-
- return $diff;
- }
-}
-
-?> \ No newline at end of file
diff --git a/phpBB/install/phpinfo.php b/phpBB/install/phpinfo.php
deleted file mode 100644
index 6480abf34a..0000000000
--- a/phpBB/install/phpinfo.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-phpinfo();
-
-?> \ No newline at end of file
diff --git a/phpBB/install/schemas/schema_data.php b/phpBB/install/schemas/schema_data.php
deleted file mode 100644
index 766a918340..0000000000
--- a/phpBB/install/schemas/schema_data.php
+++ /dev/null
@@ -1,877 +0,0 @@
-<?php
-
-$schema_data = $schema_updates = array();
-
-// We need some default increments first, so add them first
-
-// phpbb_styles_imageset
-$schema_data[] = array(
- 'table' => 'phpbb_styles_imageset',
- 'columns' => array('imageset_name', 'imageset_copyright', 'imageset_path'),
- 'data' => array(
- array('prosilver', '&copy; phpBB Group', 'prosilver'),
- ),
- 'store_auto_increment' => 'IMAGESET_ID',
-);
-
-// phpbb_styles_template
-$schema_data[] = array(
- 'table' => 'phpbb_styles_template',
- 'columns' => array('template_name', 'template_copyright', 'template_path', 'bbcode_bitfield'),
- 'data' => array(
- array('prosilver', '&copy; phpBB Group', 'prosilver', 'lNg='),
- ),
- 'store_auto_increment' => 'TEMPLATE_ID',
-);
-
-// phpbb_styles_theme
-$schema_data[] = array(
- 'table' => 'phpbb_styles_theme',
- 'columns' => array('theme_name', 'theme_copyright', 'theme_path', 'theme_storedb', 'theme_data'),
- 'data' => array(
- array('prosilver', '&copy; phpBB Group', 'prosilver', 1, ''),
- ),
- 'store_auto_increment' => 'THEME_ID',
-);
-
-// phpbb_styles
-$schema_data[] = array(
- 'table' => 'phpbb_styles',
- 'columns' => array('style_name', 'style_copyright', 'style_active', 'template_id', 'theme_id', 'imageset_id'),
- 'data' => array(
- array('prosilver', '&copy; phpBB Group', 1, array('auto_increment' => 'TEMPLATE_ID:0'), array('auto_increment' => 'THEME_ID:0'), array('auto_increment' => 'IMAGESET_ID:0')),
- ),
- 'store_auto_increment' => 'STYLE_ID',
-);
-
-// phpbb_config
-$schema_data[] = array(
- 'table' => 'phpbb_config',
- 'columns' => array('string:config_name', 'string:config_value'),
- 'data' => array(
- array('active_sessions', '0'),
- array('allow_attachments', '1'),
- array('allow_autologin', '1'),
- array('allow_avatar_local', '0'),
- array('allow_avatar_remote', '0'),
- array('allow_avatar_upload', '0'),
- array('allow_bbcode', '1'),
- array('allow_birthdays', '1'),
- array('allow_bookmarks', '1'),
- array('allow_emailreuse', '0'),
- array('allow_forum_notify', '1'),
- array('allow_mass_pm', '1'),
- array('allow_name_chars', 'USERNAME_CHARS_ANY'),
- array('allow_namechange', '0'),
- array('allow_nocensors', '0'),
- array('allow_pm_attach', '0'),
- array('allow_post_flash', '1'),
- array('allow_post_links', '1'),
- array('allow_privmsg', '1'),
- array('allow_sig', '1'),
- array('allow_sig_bbcode', '1'),
- array('allow_sig_flash', '0'),
- array('allow_sig_img', '1'),
- array('allow_sig_links', '1'),
- array('allow_sig_pm', '1'),
- array('allow_sig_smilies', '1'),
- array('allow_smilies', '1'),
- array('allow_topic_notify', '1'),
- array('attachment_quota', '52428800'),
- array('auth_bbcode_pm', '1'),
- array('auth_flash_pm', '0'),
- array('auth_img_pm', '1'),
- array('auth_method', 'db'),
- array('auth_smilies_pm', '1'),
- array('avatar_filesize', '6144'),
- array('avatar_gallery_path', 'images/avatars/gallery'),
- array('avatar_max_height', '90'),
- array('avatar_max_width', '90'),
- array('avatar_min_height', '20'),
- array('avatar_min_width', '20'),
- array('avatar_path', 'images/avatars/upload'),
- array('avatar_salt', '{AVATAR_SALT}'),
- array('board_contact', '{BOARD_CONTACT}'),
- array('board_disable', '0'),
- array('board_disable_msg', ''),
- array('board_dst', '0'),
- array('board_email', '{BOARD_EMAIL}'),
- array('board_email_from', '0'),
- array('board_email_sig', '{L_CONFIG_BOARD_EMAIL_SIG}'),
- array('board_hide_emails', '1'),
- array('board_startdate', '{BOARD_STARTDATE}'),
- array('board_timezone', '0'),
- array('browser_check', '1'),
- array('bump_interval', '10'),
- array('bump_type', 'd'),
- array('cache_gc', '7200'),
- array('captcha_plugin', '{CAPTCHA_PLUGIN}'),
- array('captcha_gd_foreground_noise', '0'),
- array('captcha_gd_x_grid', '25'),
- array('captcha_gd_y_grid', '25'),
- array('captcha_gd_wave', '0'),
- array('captcha_gd_3d_noise', '1'),
- array('captcha_gd_fonts', '1'),
- array('confirm_refresh', '1'),
- array('check_attachment_content', '1'),
- array('check_dnsbl', '0'),
- array('chg_passforce', '0'),
- array('cookie_domain', '{COOKIE_DOMAIN}'),
- array('cookie_name', '{COOKIE_NAME}'),
- array('cookie_path', '/'),
- array('cookie_secure', '{COOKIE_SECURE}'),
- array('coppa_enable', '0'),
- array('coppa_fax', ''),
- array('coppa_mail', ''),
- array('database_gc', '604800'),
- array('dbms_version', '{DBMS_VERSION}'),
- array('default_dateformat', '{DEFAULT_DATEFORMAT}'),
- array('default_lang', '{DEFAULT_LANG}'),
- array('default_style', array('auto_increment' => 'STYLE_ID:0')),
- array('display_last_edited', '1'),
- array('display_order', '0'),
- array('edit_time', '0'),
- array('email_check_mx', '0'),
- array('email_enable', '{EMAIL_ENABLE}'),
- array('email_function_name', 'mail'),
- array('email_package_size', '50'),
- array('enable_confirm', '1'),
- array('enable_pm_icons', '1'),
- array('enable_post_confirm', '1'),
- array('enable_queue_trigger', '0'),
- array('flood_interval', '15'),
- array('force_server_vars', '{FORCE_SERVER_VARS}'),
- array('form_token_lifetime', '7200'),
- array('form_token_mintime', '0'),
- array('form_token_sid_guests', '1'),
- array('forward_pm', '1'),
- array('forwarded_for_check', '0'),
- array('full_folder_action', '2'),
- array('fulltext_mysql_max_word_len', '254'),
- array('fulltext_mysql_min_word_len', '4'),
- array('fulltext_native_common_thres', '5'),
- array('fulltext_native_load_upd', '1'),
- array('fulltext_native_max_chars', '14'),
- array('fulltext_native_min_chars', '3'),
- array('gzip_compress', '0'),
- array('hot_threshold', '25'),
- array('icons_path', 'images/icons'),
- array('img_create_thumbnail', '0'),
- array('img_display_inlined', '1'),
- array('img_imagick', '{IMG_IMAGICK}'),
- array('img_link_height', '0'),
- array('img_link_width', '0'),
- array('img_max_height', '0'),
- array('img_max_thumb_width', '400'),
- array('img_max_width', '0'),
- array('img_min_thumb_filesize', '12000'),
- array('ip_check', '3'),
- array('jab_enable', '0'),
- array('jab_host', ''),
- array('jab_password', ''),
- array('jab_package_size', '20'),
- array('jab_port', '5222'),
- array('jab_use_ssl', '0'),
- array('jab_username', ''),
- array('ldap_base_dn', ''),
- array('ldap_email', ''),
- array('ldap_password', ''),
- array('ldap_port', ''),
- array('ldap_server', ''),
- array('ldap_uid', ''),
- array('ldap_user', ''),
- array('ldap_user_filter', ''),
- array('limit_load', '0'),
- array('limit_search_load', '0'),
- array('load_anon_lastread', '0'),
- array('load_birthdays', '1'),
- array('load_cpf_memberlist', '0'),
- array('load_cpf_viewprofile', '1'),
- array('load_cpf_viewtopic', '0'),
- array('load_db_lastread', '1'),
- array('load_db_track', '1'),
- array('load_jumpbox', '1'),
- array('load_moderators', '1'),
- array('load_online', '1'),
- array('load_online_guests', '1'),
- array('load_online_time', '5'),
- array('load_online_track', '1'),
- array('load_search', '1'),
- array('load_tplcompile', '0'),
- array('load_user_activity', '1'),
- array('max_attachments', '3'),
- array('max_attachments_pm', '1'),
- array('max_autologin_time', '0'),
- array('max_filesize', '262144'),
- array('max_filesize_pm', '262144'),
- array('max_login_attempts', '3'),
- array('max_name_chars', '20'),
- array('max_num_search_keywords', '10'),
- array('max_pass_chars', '30'),
- array('max_poll_options', '10'),
- array('max_poll_chars', '60000'),
- array('max_post_font_size', '200'),
- array('max_post_img_height', '0'),
- array('max_post_img_width', '0'),
- array('max_post_smilies', '0'),
- array('max_post_urls', '0'),
- array('max_quote_depth', '3'),
- array('max_reg_attempts', '5'),
- array('max_sig_chars', '255'),
- array('max_sig_font_size', '200'),
- array('max_sig_img_height', '0'),
- array('max_sig_img_width', '0'),
- array('max_sig_smilies', '0'),
- array('max_sig_urls', '5'),
- array('min_name_chars', '3'),
- array('min_pass_chars', '6'),
- array('min_search_author_chars', '3'),
- array('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title'),
- array('override_user_style', '0'),
- array('pass_complex', 'PASS_TYPE_ANY'),
- array('pm_edit_time', '0'),
- array('pm_max_boxes', '4'),
- array('pm_max_msgs', '50'),
- array('pm_max_recipients', '0'),
- array('posts_per_page', '10'),
- array('print_pm', '1'),
- array('queue_interval', '600'),
- array('queue_trigger_posts', '3'),
- array('ranks_path', 'images/ranks'),
- array('require_activation', '0'),
- array('referer_validation', '{REFERER_VALIDATION}'),
- array('script_path', '{SCRIPT_PATH}'),
- array('search_block_size', '250'),
- array('search_gc', '7200'),
- array('search_indexing_state', ''),
- array('search_interval', '0'),
- array('search_anonymous_interval', '0'),
- array('search_type', 'fulltext_native'),
- array('search_store_results', '1800'),
- array('secure_allow_deny', '1'),
- array('secure_allow_empty_referer', '1'),
- array('secure_downloads', '0'),
- array('server_name', '{SERVER_NAME}'),
- array('server_port', '{SERVER_PORT}'),
- array('server_protocol', '{SERVER_PROTOCOL}'),
- array('session_gc', '3600'),
- array('session_length', '3600'),
- array('site_desc', '{L_CONFIG_SITE_DESC}'),
- array('sitename', '{L_CONFIG_SITENAME}'),
- array('smilies_path', 'images/smilies'),
- array('smtp_auth_method', '{SMTP_AUTH_METHOD}'),
- array('smtp_delivery', '{SMTP_DELIVERY}'),
- array('smtp_host', '{SMTP_HOST}'),
- array('smtp_password', '{SMTP_PASSWORD}'),
- array('smtp_port', '25'),
- array('smtp_username', '{SMTP_USERNAME}'),
- array('topics_per_page', '25'),
- array('tpl_allow_php', '0'),
- array('upload_icons_path', 'images/upload_icons'),
- array('upload_path', 'files'),
- array('version', '3.1.0-dev1'),
- array('warnings_expire_days', '90'),
- array('warnings_gc', '14400'),
- ),
-);
-
-// Ranks
-$schema_data[] = array(
- 'table' => 'phpbb_ranks',
- 'columns' => array('rank_title', 'rank_min', 'rank_special', 'rank_image'),
- 'data' => array(
- array('{L_RANKS_SITE_ADMIN_TITLE}', 0, 1, ''),
- ),
- 'store_auto_increment' => 'RANK_ID',
-);
-
-// Groups
-$schema_data[] = array(
- 'table' => 'phpbb_groups',
- 'columns' => array('group_name', 'group_name_clean', 'group_type', 'group_founder_manage', 'group_colour', 'group_legend', 'group_avatar', 'group_desc', 'group_desc_uid', 'group_max_recipients'),
- 'data' => array(
- array('GUESTS', 'guests', 3, 0, '', 0, '', '', '', 0),
- array('REGISTERED', 'registered', 3, 0, '', 0, '', '', '', 5),
- array('REGISTERED_COPPA', 'registered_coppa', 3, 0, '', 0, '', '', '', 5),
- array('GLOBAL_MODERATORS', 'global_moderators', 3, 0, '00AA00', 1, '', '', '', 50),
- array('ADMINISTRATORS', 'administrators', 3, 1, 'AA0000', 1, '', '', '', 50),
- array('BOTS', 'bots', 3, 0, '9E8DA7', 0, '', '', '', 5),
- ),
- 'store_auto_increment' => 'GROUP_ID',
-);
-
-// Users
-$schema_data[] = array(
- 'table' => 'phpbb_users',
- 'columns' => array('user_type', 'group_id', 'username', 'username_clean', 'user_regdate', 'user_password', 'user_email', 'user_lang', 'user_style', 'user_rank', 'user_colour', 'user_posts', 'user_permissions', 'user_ip', 'user_birthday', 'user_lastpage', 'user_last_confirm_key', 'user_post_sortby_type', 'user_post_sortby_dir', 'user_topic_sortby_type', 'user_topic_sortby_dir', 'user_avatar', 'user_sig', 'user_sig_bbcode_uid', 'user_from', 'user_icq', 'user_aim', 'user_yim', 'user_msnm', 'user_jabber', 'user_website', 'user_occ', 'user_interests', 'user_actkey', 'user_newpasswd', 'user_allow_massemail', 'user_email_hash', 'user_dateformat'),
- 'data' => array(
- // Anonymous
- array(2, array('auto_increment' => 'GROUP_ID:0'), 'Anonymous', 'anonymous', '{CURRENT_TIME}', '', '', '{DEFAULT_LANG}', array('auto_increment' => 'STYLE_ID:0'), 0, '', 0, '', '{USER_IP}', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, '{DEFAULT_DATEFORMAT}'),
- // Admin
- array(3, array('auto_increment' => 'GROUP_ID:4'), '{ADMIN_NAME}', '{ADMIN_NAME_CLEAN}', '{CURRENT_TIME}', '{ADMIN_PASSWORD}', '{ADMIN_EMAIL}', '{DEFAULT_LANG}', array('auto_increment' => 'STYLE_ID:0'), array('auto_increment' => 'RANK_ID:0'), 'AA0000', 1, '', '{USER_IP}', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 1, '{ADMIN_EMAIL_HASH}', '{DEFAULT_DATEFORMAT}'),
- ),
- 'store_auto_increment' => 'USER_ID',
-);
-
-// Dynamic config values
-$schema_data[] = array(
- 'table' => 'phpbb_config',
- 'columns' => array('string:config_name', 'string:config_value', 'is_dynamic'),
- 'data' => array(
- array('cache_last_gc', '0', 1),
- array('cron_lock', '0', 1),
- array('database_last_gc', '0', 1),
- array('last_queue_run', '0', 1),
- array('newest_user_colour', 'AA0000', 1),
- array('newest_user_id', array('auto_increment' => 'USER_ID:1'), 1),
- array('newest_username', '{NEWEST_USERNAME}', 1),
- array('num_files', '0', 1),
- array('num_posts', '1', 1),
- array('num_topics', '1', 1),
- array('num_users', '1', 1),
- array('rand_seed', '0', 1),
- array('rand_seed_last_update', '0', 1),
- array('record_online_date', '0', 1),
- array('record_online_users', '0', 1),
- array('search_last_gc', '0', 1),
- array('session_last_gc', '0', 1),
- array('upload_dir_size', '0', 1),
- array('warnings_last_gc', '0', 1),
- ),
-);
-
-// Forums
-$schema_data[] = array(
- 'table' => 'phpbb_forums',
- 'columns' => array('forum_name', 'forum_desc', 'left_id', 'right_id', 'parent_id', 'forum_type', 'forum_posts', 'forum_topics', 'forum_topics_real', 'forum_last_post_id', 'forum_last_poster_id', 'forum_last_poster_name', 'forum_last_poster_colour', 'forum_last_post_subject', 'forum_last_post_time', 'forum_link', 'forum_password', 'forum_image', 'forum_rules', 'forum_rules_link', 'forum_rules_uid', 'forum_desc_uid', 'prune_days', 'prune_viewed', 'forum_parents'),
- 'data' => array(
- array('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 1, 1, 1, 0, array('auto_increment' => 'USER_ID:1'), '{ADMIN_NAME}', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', '{CURRENT_TIME}', '', '', '', '', '', '', '', 0, 0, ''),
- array('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, array('auto_increment' => 'FORUM_ID:0'), 1, 1, 1, 1, 0, array('auto_increment' => 'USER_ID:1'), '{ADMIN_NAME}', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', '{CURRENT_TIME}', '', '', '', '', '', '', '', 0, 0, ''),
- ),
- 'store_auto_increment' => 'FORUM_ID',
-);
-
-// Demo Topic
-$schema_data[] = array(
- 'table' => 'phpbb_topics',
- 'columns' => array('topic_title', 'topic_poster', 'topic_time', 'topic_views', 'topic_replies', 'topic_replies_real', 'forum_id', 'topic_status', 'topic_type', 'topic_first_post_id', 'topic_first_poster_name', 'topic_first_poster_colour', 'topic_last_post_id', 'topic_last_poster_id', 'topic_last_poster_name', 'topic_last_poster_colour', 'topic_last_post_subject', 'topic_last_post_time', 'topic_last_view_time', 'poll_title'),
- 'data' => array(
- array('{L_TOPICS_TOPIC_TITLE}', array('auto_increment' => 'USER_ID:1'), '{CURRENT_TIME}', 0, 0, 0, array('auto_increment' => 'FORUM_ID:1'), 0, 0, 0, '{ADMIN_NAME}', 'AA0000', 0, array('auto_increment' => 'USER_ID:1'), '{ADMIN_NAME}', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', '{CURRENT_TIME}', 0, ''),
- ),
- 'store_auto_increment' => 'TOPIC_ID',
-);
-
-// Demo Post
-$schema_data[] = array(
- 'table' => 'phpbb_posts',
- 'columns' => array('topic_id', 'forum_id', 'poster_id', 'icon_id', 'post_time', 'post_username', 'poster_ip', 'post_subject', 'post_text', 'post_checksum', 'bbcode_uid'),
- 'data' => array(
- array(array('auto_increment' => 'TOPIC_ID:0'), array('auto_increment' => 'FORUM_ID:1'), array('auto_increment' => 'USER_ID:1'), 0, '{CURRENT_TIME}', '', '{USER_IP}', '{L_TOPICS_TOPIC_TITLE}', '{L_DEFAULT_INSTALL_POST}', '', ''),
- ),
- 'store_auto_increment' => 'POST_ID',
-);
-
-// Admin posted to the demo topic
-$schema_data[] = array(
- 'table' => 'phpbb_topics_posted',
- 'columns' => array('user_id', 'topic_id', 'topic_posted'),
- 'data' => array(
- array(array('auto_increment' => 'USER_ID:1'), array('auto_increment' => 'TOPIC_ID:0'), 1),
- ),
-);
-
-// Update forums table
-$schema_updates[] = array(
- 'table' => 'phpbb_forums',
- 'columns' => array('forum_last_post_id'),
- 'data' => array(array('auto_increment' => 'POST_ID:0')),
-);
-
-// Update topics table
-$schema_updates[] = array(
- 'table' => 'phpbb_topics',
- 'columns' => array('topic_first_post_id', 'topic_last_post_id'),
- 'data' => array(array('auto_increment' => 'POST_ID:0'), array('auto_increment' => 'POST_ID:0')),
- 'where' => array(
- array('topic_id' => array('auto_increment' => 'TOPIC_ID:0')),
- ),
-);
-
-// User -> Group
-$schema_data[] = array(
- 'table' => 'phpbb_user_group',
- 'columns' => array('group_id', 'user_id', 'user_pending', 'group_leader'),
- 'data' => array(
- array(array('auto_increment' => 'GROUP_ID:0'), array('auto_increment' => 'USER_ID:0'), 0, 0),
- array(array('auto_increment' => 'GROUP_ID:1'), array('auto_increment' => 'USER_ID:1'), 0, 0),
- array(array('auto_increment' => 'GROUP_ID:3'), array('auto_increment' => 'USER_ID:1'), 0, 0),
- array(array('auto_increment' => 'GROUP_ID:4'), array('auto_increment' => 'USER_ID:1'), 0, 1),
- ),
-);
-
-// Forum related auth options
-$schema_data[] = array(
- 'table' => 'phpbb_acl_options',
- 'columns' => array('auth_option', 'is_local', 'is_global'),
- 'data' => array(
- array('f_', 1, 0),
- array('f_announce', 1, 0),
- array('f_attach', 1, 0),
- array('f_bbcode', 1, 0),
- array('f_bump', 1, 0),
- array('f_delete', 1, 0),
- array('f_download', 1, 0),
- array('f_edit', 1, 0),
- array('f_email', 1, 0),
- array('f_flash', 1, 0),
- array('f_icons', 1, 0),
- array('f_ignoreflood', 1, 0),
- array('f_img', 1, 0),
- array('f_list', 1, 0),
- array('f_noapprove', 1, 0),
- array('f_poll', 1, 0),
- array('f_post', 1, 0),
- array('f_postcount', 1, 0),
- array('f_print', 1, 0),
- array('f_read', 1, 0),
- array('f_reply', 1, 0),
- array('f_report', 1, 0),
- array('f_search', 1, 0),
- array('f_sigs', 1, 0),
- array('f_smilies', 1, 0),
- array('f_sticky', 1, 0),
- array('f_subscribe', 1, 0),
- array('f_user_lock', 1, 0),
- array('f_vote', 1, 0),
- array('f_votechg', 1, 0),
-
- // Moderator related auth options
- array('m_', 1, 1),
- array('m_approve', 1, 1),
- array('m_chgposter', 1, 1),
- array('m_delete', 1, 1),
- array('m_edit', 1, 1),
- array('m_info', 1, 1),
- array('m_lock', 1, 1),
- array('m_merge', 1, 1),
- array('m_move', 1, 1),
- array('m_report', 1, 1),
- array('m_split', 1, 1),
-
- // Global moderator auth option (not a local option)
- array('m_ban', 0, 1),
- array('m_warn', 0, 1),
-
- // Admin related auth options
- array('a_', 0, 1),
- array('a_aauth', 0, 1),
- array('a_attach', 0, 1),
- array('a_authgroups', 0, 1),
- array('a_authusers', 0, 1),
- array('a_backup', 0, 1),
- array('a_ban', 0, 1),
- array('a_bbcode', 0, 1),
- array('a_board', 0, 1),
- array('a_bots', 0, 1),
- array('a_clearlogs', 0, 1),
- array('a_email', 0, 1),
- array('a_fauth', 0, 1),
- array('a_forum', 0, 1),
- array('a_forumadd', 0, 1),
- array('a_forumdel', 0, 1),
- array('a_group', 0, 1),
- array('a_groupadd', 0, 1),
- array('a_groupdel', 0, 1),
- array('a_icons', 0, 1),
- array('a_jabber', 0, 1),
- array('a_language', 0, 1),
- array('a_mauth', 0, 1),
- array('a_modules', 0, 1),
- array('a_names', 0, 1),
- array('a_phpinfo', 0, 1),
- array('a_profile', 0, 1),
- array('a_prune', 0, 1),
- array('a_ranks', 0, 1),
- array('a_reasons', 0, 1),
- array('a_roles', 0, 1),
- array('a_search', 0, 1),
- array('a_server', 0, 1),
- array('a_styles', 0, 1),
- array('a_switchperm', 0, 1),
- array('a_uauth', 0, 1),
- array('a_user', 0, 1),
- array('a_userdel', 0, 1),
- array('a_viewauth', 0, 1),
- array('a_viewlogs', 0, 1),
- array('a_words', 0, 1),
-
- // User related auth options
- array('u_', 0, 1),
- array('u_attach', 0, 1),
- array('u_chgavatar', 0, 1),
- array('u_chgcensors', 0, 1),
- array('u_chgemail', 0, 1),
- array('u_chggrp', 0, 1),
- array('u_chgname', 0, 1),
- array('u_chgpasswd', 0, 1),
- array('u_download', 0, 1),
- array('u_hideonline', 0, 1),
- array('u_ignoreflood', 0, 1),
- array('u_masspm', 0, 1),
- array('u_masspm_group', 0, 1),
- array('u_pm_attach', 0, 1),
- array('u_pm_bbcode', 0, 1),
- array('u_pm_delete', 0, 1),
- array('u_pm_download', 0, 1),
- array('u_pm_edit', 0, 1),
- array('u_pm_emailpm', 0, 1),
- array('u_pm_flash', 0, 1),
- array('u_pm_forward', 0, 1),
- array('u_pm_img', 0, 1),
- array('u_pm_printpm', 0, 1),
- array('u_pm_smilies', 0, 1),
- array('u_readpm', 0, 1),
- array('u_savedrafts', 0, 1),
- array('u_search', 0, 1),
- array('u_sendemail', 0, 1),
- array('u_sendim', 0, 1),
- array('u_sendpm', 0, 1),
- array('u_sig', 0, 1),
- array('u_viewonline', 0, 1),
- array('u_viewprofile', 0, 1),
- ),
- 'store_auto_increment' => 'AUTH_OPTION_ID',
-);
-
-// standard auth roles
-$schema_data[] = array(
- 'table' => 'phpbb_acl_roles',
- 'columns' => array('role_name', 'role_description', 'role_type', 'role_order'),
- 'data' => array(
- array('ROLE_ADMIN_STANDARD', 'ROLE_DESCRIPTION_ADMIN_STANDARD', 'a_', 1),
- array('ROLE_ADMIN_FORUM', 'ROLE_DESCRIPTION_ADMIN_FORUM', 'a_', 3),
- array('ROLE_ADMIN_USERGROUP', 'ROLE_DESCRIPTION_ADMIN_USERGROUP', 'a_', 4),
- array('ROLE_ADMIN_FULL', 'ROLE_DESCRIPTION_ADMIN_FULL', 'a_', 2),
- array('ROLE_USER_FULL', 'ROLE_DESCRIPTION_USER_FULL', 'u_', 3),
- array('ROLE_USER_STANDARD', 'ROLE_DESCRIPTION_USER_STANDARD', 'u_', 1),
- array('ROLE_USER_LIMITED', 'ROLE_DESCRIPTION_USER_LIMITED', 'u_', 2),
- array('ROLE_USER_NOPM', 'ROLE_DESCRIPTION_USER_NOPM', 'u_', 4),
- array('ROLE_USER_NOAVATAR', 'ROLE_DESCRIPTION_USER_NOAVATAR', 'u_', 5),
- array('ROLE_MOD_FULL', 'ROLE_DESCRIPTION_MOD_FULL', 'm_', 3),
- array('ROLE_MOD_STANDARD', 'ROLE_DESCRIPTION_MOD_STANDARD', 'm_', 1),
- array('ROLE_MOD_SIMPLE', 'ROLE_DESCRIPTION_MOD_SIMPLE', 'm_', 2),
- array('ROLE_MOD_QUEUE', 'ROLE_DESCRIPTION_MOD_QUEUE', 'm_', 4),
- array('ROLE_FORUM_FULL', 'ROLE_DESCRIPTION_FORUM_FULL', 'f_', 7),
- array('ROLE_FORUM_STANDARD', 'ROLE_DESCRIPTION_FORUM_STANDARD', 'f_', 5),
- array('ROLE_FORUM_NOACCESS', 'ROLE_DESCRIPTION_FORUM_NOACCESS', 'f_', 1),
- array('ROLE_FORUM_READONLY', 'ROLE_DESCRIPTION_FORUM_READONLY', 'f_', 2),
- array('ROLE_FORUM_LIMITED', 'ROLE_DESCRIPTION_FORUM_LIMITED', 'f_', 3),
- array('ROLE_FORUM_BOT', 'ROLE_DESCRIPTION_FORUM_BOT', 'f_', 9),
- array('ROLE_FORUM_ONQUEUE', 'ROLE_DESCRIPTION_FORUM_ONQUEUE', 'f_', 8),
- array('ROLE_FORUM_POLLS', 'ROLE_DESCRIPTION_FORUM_POLLS', 'f_', 6),
- array('ROLE_FORUM_LIMITED_POLLS', 'ROLE_DESCRIPTION_FORUM_LIMITED_POLLS', 'f_', 4),
- array('ROLE_USER_GUESTS', 'ROLE_DESCRIPTION_USER_GUESTS', 'u_', 6),
- ),
- 'store_auto_increment' => 'ROLE_ID',
-);
-
-// Permissions
-
-$schema_data[] = array(
- 'table' => 'phpbb_acl_groups',
- 'columns' => array('group_id', 'forum_id', 'auth_option_id', 'auth_role_id', 'auth_setting'),
- 'data' => array(
- // GUESTS - u_download and u_search ability
- array(array('auto_increment' => 'GROUP_ID:0'), 0, 0, array('auto_increment' => 'ROLE_ID:22'), 0),
- // ADMINISTRATOR Group - full user features
- array(array('auto_increment' => 'GROUP_ID:4'), 0, 0, array('auto_increment' => 'ROLE_ID:4'), 0),
- // ADMINISTRATOR Group - standard admin
- array(array('auto_increment' => 'GROUP_ID:4'), 0, 0, array('auto_increment' => 'ROLE_ID:0'), 0),
- // REGISTERED and REGISTERED_COPPA having standard user features
- array(array('auto_increment' => 'GROUP_ID:1'), 0, 0, array('auto_increment' => 'ROLE_ID:5'), 0),
- array(array('auto_increment' => 'GROUP_ID:2'), 0, 0, array('auto_increment' => 'ROLE_ID:5'), 0),
- // GLOBAL_MODERATORS having full user features
- array(array('auto_increment' => 'GROUP_ID:3'), 0, 0, array('auto_increment' => 'ROLE_ID:4'), 0),
- // GLOBAL_MODERATORS having full global moderator access
- array(array('auto_increment' => 'GROUP_ID:3'), 0, 0, array('auto_increment' => 'ROLE_ID:9'), 0),
-
- // Giving all groups read only access to the first category
- // since administrators and moderators are already within the registered users group we do not need to set them here
- array(array('auto_increment' => 'GROUP_ID:0'), array('auto_increment' => 'FORUM_ID:0'), 0, array('auto_increment' => 'ROLE_ID:16'), 0),
- array(array('auto_increment' => 'GROUP_ID:1'), array('auto_increment' => 'FORUM_ID:0'), 0, array('auto_increment' => 'ROLE_ID:16'), 0),
- array(array('auto_increment' => 'GROUP_ID:2'), array('auto_increment' => 'FORUM_ID:0'), 0, array('auto_increment' => 'ROLE_ID:16'), 0),
- array(array('auto_increment' => 'GROUP_ID:5'), array('auto_increment' => 'FORUM_ID:0'), 0, array('auto_increment' => 'ROLE_ID:16'), 0),
-
- // Giving access to the first forum
- // guests having read only access
- array(array('auto_increment' => 'GROUP_ID:0'), array('auto_increment' => 'FORUM_ID:1'), 0, array('auto_increment' => 'ROLE_ID:16'), 0),
- // registered and registered_coppa having standard access
- array(array('auto_increment' => 'GROUP_ID:1'), array('auto_increment' => 'FORUM_ID:1'), 0, array('auto_increment' => 'ROLE_ID:14'), 0),
- array(array('auto_increment' => 'GROUP_ID:2'), array('auto_increment' => 'FORUM_ID:1'), 0, array('auto_increment' => 'ROLE_ID:14'), 0),
- // global moderators having standard access + polls
- array(array('auto_increment' => 'GROUP_ID:3'), array('auto_increment' => 'FORUM_ID:1'), 0, array('auto_increment' => 'ROLE_ID:20'), 0),
- // administrators having full forum and full moderator access
- array(array('auto_increment' => 'GROUP_ID:4'), array('auto_increment' => 'FORUM_ID:1'), 0, array('auto_increment' => 'ROLE_ID:13'), 0),
- array(array('auto_increment' => 'GROUP_ID:4'), array('auto_increment' => 'FORUM_ID:1'), 0, array('auto_increment' => 'ROLE_ID:9'), 0),
- // Bots having bot access
- array(array('auto_increment' => 'GROUP_ID:5'), array('auto_increment' => 'FORUM_ID:1'), 0, array('auto_increment' => 'ROLE_ID:18'), 0),
- ),
-);
-
-// phpbb_styles_imageset_data
-$schema_data[] = array(
- 'table' => 'phpbb_styles_imageset_data',
- 'columns' => array('image_name', 'image_filename', 'image_lang', 'image_height', 'image_width', 'imageset_id'),
- 'data' => array(
- array('site_logo', 'site_logo.gif', '', 52, 139, array('auto_increment' => 'IMAGESET_ID:0')),
- array('forum_link', 'forum_link.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('forum_read', 'forum_read.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('forum_read_locked', 'forum_read_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('forum_read_subforum', 'forum_read_subforum.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('forum_unread', 'forum_unread.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('forum_unread_locked', 'forum_unread_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('forum_unread_subforum', 'forum_unread_subforum.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_moved', 'topic_moved.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_read', 'topic_read.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_read_mine', 'topic_read_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_read_hot', 'topic_read_hot.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_read_hot_mine', 'topic_read_hot_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_read_locked', 'topic_read_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_read_locked_mine', 'topic_read_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_unread', 'topic_unread.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_unread_mine', 'topic_unread_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_unread_hot', 'topic_unread_hot.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_unread_hot_mine', 'topic_unread_hot_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_unread_locked', 'topic_unread_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('topic_unread_locked_mine', 'topic_unread_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_read', 'sticky_read.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_read_mine', 'sticky_read_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_read_locked', 'sticky_read_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_read_locked_mine', 'sticky_read_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_unread', 'sticky_unread.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_unread_mine', 'sticky_unread_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_unread_locked', 'sticky_unread_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('sticky_unread_locked_mine', 'sticky_unread_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_read', 'announce_read.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_read_mine', 'announce_read_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_read_locked', 'announce_read_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_read_locked_mine', 'announce_read_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_unread', 'announce_unread.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_unread_mine', 'announce_unread_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_unread_locked', 'announce_unread_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('announce_unread_locked_mine', 'announce_unread_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_read', 'announce_read.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_read_mine', 'announce_read_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_read_locked', 'announce_read_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_read_locked_mine', 'announce_read_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_unread', 'announce_unread.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_unread_mine', 'announce_unread_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_unread_locked', 'announce_unread_locked.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('global_unread_locked_mine', 'announce_unread_locked_mine.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('pm_read', 'topic_read.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('pm_unread', 'topic_unread.gif', '', 27, 27, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_back_top', 'icon_back_top.gif', '', 11, 11, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_contact_aim', 'icon_contact_aim.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_contact_email', 'icon_contact_email.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_contact_icq', 'icon_contact_icq.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_contact_jabber', 'icon_contact_jabber.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_contact_msnm', 'icon_contact_msnm.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_contact_www', 'icon_contact_www.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_contact_yahoo', 'icon_contact_yahoo.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_post_delete', 'icon_post_delete.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_post_info', 'icon_post_info.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_post_report', 'icon_post_report.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_post_target', 'icon_post_target.gif', '', 9, 11, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_post_target_unread', 'icon_post_target_unread.gif', '', 9, 11, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_topic_attach', 'icon_topic_attach.gif', '', 10, 7, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_topic_latest', 'icon_topic_latest.gif', '', 9, 11, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_topic_newest', 'icon_topic_newest.gif', '', 9, 11, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_topic_reported', 'icon_topic_reported.gif', '', 14, 16, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_topic_unapproved', 'icon_topic_unapproved.gif', '', 14, 16, array('auto_increment' => 'IMAGESET_ID:0')),
- array('icon_user_warn', 'icon_user_warn.gif', '', 20, 20, array('auto_increment' => 'IMAGESET_ID:0')),
- array('subforum_read', 'subforum_read.gif', '', 9, 11, array('auto_increment' => 'IMAGESET_ID:0')),
- array('subforum_unread', 'subforum_unread.gif', '', 9, 11, array('auto_increment' => 'IMAGESET_ID:0')),
- ),
-);
-
-// Smilies
-$schema_data[] = array(
- 'table' => 'phpbb_smilies',
- 'columns' => array('code', 'smiley_url', 'emotion', 'smiley_width', 'smiley_height', 'smiley_order'),
- 'data' => array(
- array(':D', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 1),
- array(':-D', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 2),
- array(':grin:', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 3),
- array(':)', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 4),
- array(':-)', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 5),
- array(':smile:', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 6),
- array(';)', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 7),
- array(';-)', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 8),
- array(':wink:', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 9),
- array(':(', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 10),
- array(':-(', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 11),
- array(':sad:', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 12),
- array(':o', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 13),
- array(':-o', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 14),
- array(':eek:', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 15),
- array(':shock:', 'icon_eek.gif', '{L_SMILIES_SHOCKED}', 15, 17, 16),
- array(':?', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 17),
- array(':-?', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 18),
- array(':???:', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 19),
- array('8-)', 'icon_cool.gif', '{L_SMILIES_COOL}', 15, 17, 20),
- array(':cool:', 'icon_cool.gif', '{L_SMILIES_COOL}', 15, 17, 21),
- array(':lol:', 'icon_lol.gif', '{L_SMILIES_LAUGHING}', 15, 17, 22),
- array(':x', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 23),
- array(':-x', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 24),
- array(':mad:', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 25),
- array(':P', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 26),
- array(':-P', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 27),
- array(':razz:', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 28),
- array(':oops:', 'icon_redface.gif', '{L_SMILIES_EMARRASSED}', 15, 17, 29),
- array(':cry:', 'icon_cry.gif', '{L_SMILIES_CRYING}', 15, 17, 30),
- array(':evil:', 'icon_evil.gif', '{L_SMILIES_EVIL}', 15, 17, 31),
- array(':twisted:', 'icon_twisted.gif', '{L_SMILIES_TWISTED_EVIL}', 15, 17, 32),
- array(':roll:', 'icon_rolleyes.gif', '{L_SMILIES_ROLLING_EYES}', 15, 17, 33),
- array(':!:', 'icon_exclaim.gif', '{L_SMILIES_EXCLAMATION}', 15, 17, 34),
- array(':?:', 'icon_question.gif', '{L_SMILIES_QUESTION}', 15, 17, 35),
- array(':idea:', 'icon_idea.gif', '{L_SMILIES_IDEA}', 15, 17, 36),
- array(':arrow:', 'icon_arrow.gif', '{L_SMILIES_ARROW}', 15, 17, 37),
- array(':|', 'icon_neutral.gif', '{L_SMILIES_NEUTRAL}', 15, 17, 38),
- array(':-|', 'icon_neutral.gif', '{L_SMILIES_NEUTRAL}', 15, 17, 39),
- array(':mrgreen:', 'icon_mrgreen.gif', '{L_SMILIES_MR_GREEN}', 15, 17, 40),
- array(':geek:', 'icon_e_geek.gif', '{L_SMILIES_GEEK}', 17, 17, 41),
- array(':ugeek:', 'icon_e_ugeek.gif', '{L_SMILIES_UBER_GEEK}', 17, 18, 42),
- ),
-);
-
-// icons
-$schema_data[] = array(
- 'table' => 'phpbb_icons',
- 'columns' => array('icons_url', 'icons_width', 'icons_height', 'icons_order', 'display_on_posting'),
- 'data' => array(
- array('misc/fire.gif', 16, 16, 1, 1),
- array('smile/redface.gif', 16, 16, 9, 1),
- array('smile/mrgreen.gif', 16, 16, 10, 1),
- array('misc/heart.gif', 16, 16, 4, 1),
- array('misc/star.gif', 16, 16, 2, 1),
- array('misc/radioactive.gif', 16, 16, 3, 1),
- array('misc/thinking.gif', 16, 16, 5, 1),
- array('smile/info.gif', 16, 16, 8, 1),
- array('smile/question.gif', 16, 16, 6, 1),
- array('smile/alert.gif', 16, 16, 7, 1),
- ),
-);
-
-// reasons
-$schema_data[] = array(
- 'table' => 'phpbb_reports_reasons',
- 'columns' => array('reason_title', 'reason_description', 'reason_order'),
- 'data' => array(
- array('warez', '{L_REPORT_WAREZ}', 1),
- array('spam', '{L_REPORT_SPAM}', 2),
- array('off_topic', '{L_REPORT_OFF_TOPIC}', 3),
- array('other', '{L_REPORT_OTHER}', 4),
- ),
-);
-
-// extension_groups
-$schema_data[] = array(
- 'table' => 'phpbb_extension_groups',
- 'columns' => array('group_name', 'cat_id', 'allow_group', 'download_mode', 'upload_icon', 'max_filesize', 'allowed_forums'),
- 'data' => array(
- array('{L_EXT_GROUP_IMAGES}', 1, 1, 1, '', 0, ''),
- array('{L_EXT_GROUP_ARCHIVES}', 0, 1, 1, '', 0, ''),
- array('{L_EXT_GROUP_PLAIN_TEXT}', 0, 0, 1, '', 0, ''),
- array('{L_EXT_GROUP_DOCUMENTS}', 0, 0, 1, '', 0, ''),
- array('{L_EXT_GROUP_REAL_MEDIA}', 3, 0, 1, '', 0, ''),
- array('{L_EXT_GROUP_WINDOWS_MEDIA}', 2, 0, 1, '', 0, ''),
- array('{L_EXT_GROUP_FLASH_FILES}', 5, 0, 1, '', 0, ''),
- array('{L_EXT_GROUP_QUICKTIME_MEDIA}', 6, 0, 1, '', 0, ''),
- array('{L_EXT_GROUP_DOWNLOADABLE_FILES}', 0, 0, 1, '', 0, ''),
- ),
- 'store_auto_increment' => 'EXT_GROUP_ID',
-);
-
-// extensions
-$schema_data[] = array(
- 'table' => 'phpbb_extensions',
- 'columns' => array('group_id', 'extension'),
- 'data' => array(
- array(array('auto_increment' => 'EXT_GROUP_ID:0'), 'gif'),
- array(array('auto_increment' => 'EXT_GROUP_ID:0'), 'png'),
- array(array('auto_increment' => 'EXT_GROUP_ID:0'), 'jpeg'),
- array(array('auto_increment' => 'EXT_GROUP_ID:0'), 'jpg'),
- array(array('auto_increment' => 'EXT_GROUP_ID:0'), 'tif'),
- array(array('auto_increment' => 'EXT_GROUP_ID:0'), 'tiff'),
- array(array('auto_increment' => 'EXT_GROUP_ID:0'), 'tga'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'gtar'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'gz'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'tar'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'zip'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'rar'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'ace'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'torrent'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'tgz'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), 'bz2'),
- array(array('auto_increment' => 'EXT_GROUP_ID:1'), '7z'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'txt'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'c'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'h'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'cpp'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'hpp'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'diz'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'csv'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'ini'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'log'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'js'),
- array(array('auto_increment' => 'EXT_GROUP_ID:2'), 'xml'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'xls'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'xlsx'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'xlsm'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'xlsb'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'doc'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'docx'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'docm'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'dot'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'dotx'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'dotm'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'pdf'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'ai'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'ps'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'ppt'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'pptx'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'pptm'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'odg'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'odp'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'ods'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'odt'),
- array(array('auto_increment' => 'EXT_GROUP_ID:3'), 'rtf'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:4'), 'rm'),
- array(array('auto_increment' => 'EXT_GROUP_ID:4'), 'ram'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:5'), 'wma'),
- array(array('auto_increment' => 'EXT_GROUP_ID:5'), 'wmv'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:6'), 'swf'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:7'), 'mov'),
- array(array('auto_increment' => 'EXT_GROUP_ID:7'), 'm4v'),
- array(array('auto_increment' => 'EXT_GROUP_ID:7'), 'm4a'),
- array(array('auto_increment' => 'EXT_GROUP_ID:7'), 'mp4'),
- array(array('auto_increment' => 'EXT_GROUP_ID:7'), '3gp'),
- array(array('auto_increment' => 'EXT_GROUP_ID:7'), '3g2'),
- array(array('auto_increment' => 'EXT_GROUP_ID:7'), 'qt'),
-
- array(array('auto_increment' => 'EXT_GROUP_ID:8'), 'mpeg'),
- array(array('auto_increment' => 'EXT_GROUP_ID:8'), 'mpg'),
- array(array('auto_increment' => 'EXT_GROUP_ID:8'), 'mp3'),
- array(array('auto_increment' => 'EXT_GROUP_ID:8'), 'ogg'),
- array(array('auto_increment' => 'EXT_GROUP_ID:8'), 'ogm'),
- ),
-);
-
-?> \ No newline at end of file
diff --git a/phpBB/install/schemas/schema_structure.php b/phpBB/install/schemas/schema_structure.php
deleted file mode 100644
index 641fafc4ac..0000000000
--- a/phpBB/install/schemas/schema_structure.php
+++ /dev/null
@@ -1,1081 +0,0 @@
-<?php
-
-$schema_data = array();
-
-$schema_data['phpbb_attachments'] = array(
- 'COLUMNS' => array(
- 'attach_id' => array('UINT', NULL, 'auto_increment'),
- 'post_msg_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'in_message' => array('BOOL', 0),
- 'poster_id' => array('UINT', 0),
- 'is_orphan' => array('BOOL', 1),
- 'physical_filename' => array('VCHAR', ''),
- 'real_filename' => array('VCHAR', ''),
- 'download_count' => array('UINT', 0),
- 'attach_comment' => array('TEXT_UNI', ''),
- 'extension' => array('VCHAR:100', ''),
- 'mimetype' => array('VCHAR:100', ''),
- 'filesize' => array('UINT:20', 0),
- 'filetime' => array('TIMESTAMP', 0),
- 'thumbnail' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'attach_id',
- 'KEYS' => array(
- 'filetime' => array('INDEX', 'filetime'),
- 'post_msg_id' => array('INDEX', 'post_msg_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'poster_id' => array('INDEX', 'poster_id'),
- 'is_orphan' => array('INDEX', 'is_orphan'),
- ),
-);
-
-$schema_data['phpbb_acl_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_role_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'KEYS' => array(
- 'group_id' => array('INDEX', 'group_id'),
- 'auth_opt_id' => array('INDEX', 'auth_option_id'),
- 'auth_role_id' => array('INDEX', 'auth_role_id'),
- ),
-);
-
-$schema_data['phpbb_acl_options'] = array(
- 'COLUMNS' => array(
- 'auth_option_id' => array('UINT', NULL, 'auto_increment'),
- 'auth_option' => array('VCHAR:50', ''),
- 'is_global' => array('BOOL', 0),
- 'is_local' => array('BOOL', 0),
- 'founder_only' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'auth_option_id',
- 'KEYS' => array(
- 'auth_option' => array('UNIQUE', 'auth_option'),
- ),
-);
-
-$schema_data['phpbb_acl_roles'] = array(
- 'COLUMNS' => array(
- 'role_id' => array('UINT', NULL, 'auto_increment'),
- 'role_name' => array('VCHAR_UNI', ''),
- 'role_description' => array('TEXT_UNI', ''),
- 'role_type' => array('VCHAR:10', ''),
- 'role_order' => array('USINT', 0),
- ),
- 'PRIMARY_KEY' => 'role_id',
- 'KEYS' => array(
- 'role_type' => array('INDEX', 'role_type'),
- 'role_order' => array('INDEX', 'role_order'),
- ),
-);
-
-$schema_data['phpbb_acl_roles_data'] = array(
- 'COLUMNS' => array(
- 'role_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'PRIMARY_KEY' => array('role_id', 'auth_option_id'),
- 'KEYS' => array(
- 'ath_op_id' => array('INDEX', 'auth_option_id'),
- ),
-);
-
-$schema_data['phpbb_acl_users'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_role_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- 'auth_option_id' => array('INDEX', 'auth_option_id'),
- 'auth_role_id' => array('INDEX', 'auth_role_id'),
- ),
-);
-
-$schema_data['phpbb_banlist'] = array(
- 'COLUMNS' => array(
- 'ban_id' => array('UINT', NULL, 'auto_increment'),
- 'ban_userid' => array('UINT', 0),
- 'ban_ip' => array('VCHAR:40', ''),
- 'ban_email' => array('VCHAR_UNI:100', ''),
- 'ban_start' => array('TIMESTAMP', 0),
- 'ban_end' => array('TIMESTAMP', 0),
- 'ban_exclude' => array('BOOL', 0),
- 'ban_reason' => array('VCHAR_UNI', ''),
- 'ban_give_reason' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'ban_id',
- 'KEYS' => array(
- 'ban_end' => array('INDEX', 'ban_end'),
- 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')),
- 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')),
- 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')),
- ),
-);
-
-$schema_data['phpbb_bbcodes'] = array(
- 'COLUMNS' => array(
- 'bbcode_id' => array('TINT:3', 0),
- 'bbcode_tag' => array('VCHAR:16', ''),
- 'bbcode_helpline' => array('VCHAR_UNI', ''),
- 'display_on_posting' => array('BOOL', 0),
- 'bbcode_match' => array('TEXT_UNI', ''),
- 'bbcode_tpl' => array('MTEXT_UNI', ''),
- 'first_pass_match' => array('MTEXT_UNI', ''),
- 'first_pass_replace' => array('MTEXT_UNI', ''),
- 'second_pass_match' => array('MTEXT_UNI', ''),
- 'second_pass_replace' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'bbcode_id',
- 'KEYS' => array(
- 'display_on_post' => array('INDEX', 'display_on_posting'),
- ),
-);
-
-$schema_data['phpbb_bookmarks'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => array('topic_id', 'user_id'),
-);
-
-$schema_data['phpbb_bots'] = array(
- 'COLUMNS' => array(
- 'bot_id' => array('UINT', NULL, 'auto_increment'),
- 'bot_active' => array('BOOL', 1),
- 'bot_name' => array('STEXT_UNI', ''),
- 'user_id' => array('UINT', 0),
- 'bot_agent' => array('VCHAR', ''),
- 'bot_ip' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'bot_id',
- 'KEYS' => array(
- 'bot_active' => array('INDEX', 'bot_active'),
- ),
-);
-
-$schema_data['phpbb_config'] = array(
- 'COLUMNS' => array(
- 'config_name' => array('VCHAR', ''),
- 'config_value' => array('VCHAR_UNI', ''),
- 'is_dynamic' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'config_name',
- 'KEYS' => array(
- 'is_dynamic' => array('INDEX', 'is_dynamic'),
- ),
-);
-
-$schema_data['phpbb_confirm'] = array(
- 'COLUMNS' => array(
- 'confirm_id' => array('CHAR:32', ''),
- 'session_id' => array('CHAR:32', ''),
- 'confirm_type' => array('TINT:3', 0),
- 'code' => array('VCHAR:8', ''),
- 'seed' => array('UINT:10', 0),
- ),
- 'PRIMARY_KEY' => array('session_id', 'confirm_id'),
- 'KEYS' => array(
- 'confirm_type' => array('INDEX', 'confirm_type'),
- ),
-);
-
-$schema_data['phpbb_disallow'] = array(
- 'COLUMNS' => array(
- 'disallow_id' => array('UINT', NULL, 'auto_increment'),
- 'disallow_username' => array('VCHAR_UNI:255', ''),
- ),
- 'PRIMARY_KEY' => 'disallow_id',
-);
-
-$schema_data['phpbb_drafts'] = array(
- 'COLUMNS' => array(
- 'draft_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'save_time' => array('TIMESTAMP', 0),
- 'draft_subject' => array('STEXT_UNI', ''),
- 'draft_message' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'draft_id',
- 'KEYS' => array(
- 'save_time' => array('INDEX', 'save_time'),
- ),
-);
-
-$schema_data['phpbb_extensions'] = array(
- 'COLUMNS' => array(
- 'extension_id' => array('UINT', NULL, 'auto_increment'),
- 'group_id' => array('UINT', 0),
- 'extension' => array('VCHAR:100', ''),
- ),
- 'PRIMARY_KEY' => 'extension_id',
-);
-
-$schema_data['phpbb_extension_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', NULL, 'auto_increment'),
- 'group_name' => array('VCHAR_UNI', ''),
- 'cat_id' => array('TINT:2', 0),
- 'allow_group' => array('BOOL', 0),
- 'download_mode' => array('BOOL', 1),
- 'upload_icon' => array('VCHAR', ''),
- 'max_filesize' => array('UINT:20', 0),
- 'allowed_forums' => array('TEXT', ''),
- 'allow_in_pm' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'group_id',
-);
-
-$schema_data['phpbb_forums'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', NULL, 'auto_increment'),
- 'parent_id' => array('UINT', 0),
- 'left_id' => array('UINT', 0),
- 'right_id' => array('UINT', 0),
- 'forum_parents' => array('MTEXT', ''),
- 'forum_name' => array('STEXT_UNI', ''),
- 'forum_desc' => array('TEXT_UNI', ''),
- 'forum_desc_bitfield' => array('VCHAR:255', ''),
- 'forum_desc_options' => array('UINT:11', 7),
- 'forum_desc_uid' => array('VCHAR:8', ''),
- 'forum_link' => array('VCHAR_UNI', ''),
- 'forum_password' => array('VCHAR_UNI:40', ''),
- 'forum_style' => array('UINT', 0),
- 'forum_image' => array('VCHAR', ''),
- 'forum_rules' => array('TEXT_UNI', ''),
- 'forum_rules_link' => array('VCHAR_UNI', ''),
- 'forum_rules_bitfield' => array('VCHAR:255', ''),
- 'forum_rules_options' => array('UINT:11', 7),
- 'forum_rules_uid' => array('VCHAR:8', ''),
- 'forum_topics_per_page' => array('TINT:4', 0),
- 'forum_type' => array('TINT:4', 0),
- 'forum_status' => array('TINT:4', 0),
- 'forum_posts' => array('UINT', 0),
- 'forum_topics' => array('UINT', 0),
- 'forum_topics_real' => array('UINT', 0),
- 'forum_last_post_id' => array('UINT', 0),
- 'forum_last_poster_id' => array('UINT', 0),
- 'forum_last_post_subject' => array('STEXT_UNI', ''),
- 'forum_last_post_time' => array('TIMESTAMP', 0),
- 'forum_last_poster_name'=> array('VCHAR_UNI', ''),
- 'forum_last_poster_colour'=> array('VCHAR:6', ''),
- 'forum_flags' => array('TINT:4', 32),
- 'display_subforum_list' => array('BOOL', 1),
- 'display_on_index' => array('BOOL', 1),
- 'enable_indexing' => array('BOOL', 1),
- 'enable_icons' => array('BOOL', 1),
- 'enable_prune' => array('BOOL', 0),
- 'prune_next' => array('TIMESTAMP', 0),
- 'prune_days' => array('UINT', 0),
- 'prune_viewed' => array('UINT', 0),
- 'prune_freq' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'forum_id',
- 'KEYS' => array(
- 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
- 'forum_lastpost_id' => array('INDEX', 'forum_last_post_id'),
- ),
-);
-
-$schema_data['phpbb_forums_access'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'session_id' => array('CHAR:32', ''),
- ),
- 'PRIMARY_KEY' => array('forum_id', 'user_id', 'session_id'),
-);
-
-$schema_data['phpbb_forums_track'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'mark_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'forum_id'),
-);
-
-$schema_data['phpbb_forums_watch'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'notify_status' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'notify_stat' => array('INDEX', 'notify_status'),
- ),
-);
-
-$schema_data['phpbb_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', NULL, 'auto_increment'),
- 'group_type' => array('TINT:4', 1),
- 'group_founder_manage' => array('BOOL', 0),
- 'group_name' => array('VCHAR_UNI', ''),
- 'group_name_clean' => array('VCHAR_UNI', ''),
- 'group_desc' => array('TEXT_UNI', ''),
- 'group_desc_bitfield' => array('VCHAR:255', ''),
- 'group_desc_options' => array('UINT:11', 7),
- 'group_desc_uid' => array('VCHAR:8', ''),
- 'group_display' => array('BOOL', 0),
- 'group_avatar' => array('VCHAR', ''),
- 'group_avatar_type' => array('TINT:2', 0),
- 'group_avatar_width' => array('USINT', 0),
- 'group_avatar_height' => array('USINT', 0),
- 'group_rank' => array('UINT', 0),
- 'group_colour' => array('VCHAR:6', ''),
- 'group_sig_chars' => array('UINT', 0),
- 'group_receive_pm' => array('BOOL', 0),
- 'group_message_limit' => array('UINT', 0),
- 'group_max_recipients' => array('UINT', 0),
- 'group_legend' => array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'group_id',
- 'KEYS' => array(
- 'group_legend_name' => array('INDEX', array('group_legend', 'group_name')),
- ),
-);
-
-$schema_data['phpbb_icons'] = array(
- 'COLUMNS' => array(
- 'icons_id' => array('UINT', NULL, 'auto_increment'),
- 'icons_url' => array('VCHAR', ''),
- 'icons_width' => array('TINT:4', 0),
- 'icons_height' => array('TINT:4', 0),
- 'icons_order' => array('UINT', 0),
- 'display_on_posting' => array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'icons_id',
- 'KEYS' => array(
- 'display_on_posting' => array('INDEX', 'display_on_posting'),
- ),
-);
-
-$schema_data['phpbb_lang'] = array(
- 'COLUMNS' => array(
- 'lang_id' => array('TINT:4', NULL, 'auto_increment'),
- 'lang_iso' => array('VCHAR:30', ''),
- 'lang_dir' => array('VCHAR:30', ''),
- 'lang_english_name' => array('VCHAR_UNI:100', ''),
- 'lang_local_name' => array('VCHAR_UNI:255', ''),
- 'lang_author' => array('VCHAR_UNI:255', ''),
- ),
- 'PRIMARY_KEY' => 'lang_id',
- 'KEYS' => array(
- 'lang_iso' => array('INDEX', 'lang_iso'),
- ),
-);
-
-$schema_data['phpbb_log'] = array(
- 'COLUMNS' => array(
- 'log_id' => array('UINT', NULL, 'auto_increment'),
- 'log_type' => array('TINT:4', 0),
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'reportee_id' => array('UINT', 0),
- 'log_ip' => array('VCHAR:40', ''),
- 'log_time' => array('TIMESTAMP', 0),
- 'log_operation' => array('TEXT_UNI', ''),
- 'log_data' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'log_id',
- 'KEYS' => array(
- 'log_type' => array('INDEX', 'log_type'),
- 'forum_id' => array('INDEX', 'forum_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'reportee_id' => array('INDEX', 'reportee_id'),
- 'user_id' => array('INDEX', 'user_id'),
- ),
-);
-
-$schema_data['phpbb_moderator_cache'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'username' => array('VCHAR_UNI:255', ''),
- 'group_id' => array('UINT', 0),
- 'group_name' => array('VCHAR_UNI', ''),
- 'display_on_index' => array('BOOL', 1),
- ),
- 'KEYS' => array(
- 'disp_idx' => array('INDEX', 'display_on_index'),
- 'forum_id' => array('INDEX', 'forum_id'),
- ),
-);
-
-$schema_data['phpbb_modules'] = array(
- 'COLUMNS' => array(
- 'module_id' => array('UINT', NULL, 'auto_increment'),
- 'module_enabled' => array('BOOL', 1),
- 'module_display' => array('BOOL', 1),
- 'module_basename' => array('VCHAR', ''),
- 'module_class' => array('VCHAR:10', ''),
- 'parent_id' => array('UINT', 0),
- 'left_id' => array('UINT', 0),
- 'right_id' => array('UINT', 0),
- 'module_langname' => array('VCHAR', ''),
- 'module_mode' => array('VCHAR', ''),
- 'module_auth' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'module_id',
- 'KEYS' => array(
- 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
- 'module_enabled' => array('INDEX', 'module_enabled'),
- 'class_left_id' => array('INDEX', array('module_class', 'left_id')),
- ),
-);
-
-$schema_data['phpbb_poll_options'] = array(
- 'COLUMNS' => array(
- 'poll_option_id' => array('TINT:4', 0),
- 'topic_id' => array('UINT', 0),
- 'poll_option_text' => array('TEXT_UNI', ''),
- 'poll_option_total' => array('UINT', 0),
- ),
- 'KEYS' => array(
- 'poll_opt_id' => array('INDEX', 'poll_option_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- ),
-);
-
-$schema_data['phpbb_poll_votes'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'poll_option_id' => array('TINT:4', 0),
- 'vote_user_id' => array('UINT', 0),
- 'vote_user_ip' => array('VCHAR:40', ''),
- ),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'vote_user_id' => array('INDEX', 'vote_user_id'),
- 'vote_user_ip' => array('INDEX', 'vote_user_ip'),
- ),
-);
-
-$schema_data['phpbb_posts'] = array(
- 'COLUMNS' => array(
- 'post_id' => array('UINT', NULL, 'auto_increment'),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'poster_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'poster_ip' => array('VCHAR:40', ''),
- 'post_time' => array('TIMESTAMP', 0),
- 'post_approved' => array('BOOL', 1),
- 'post_reported' => array('BOOL', 0),
- 'enable_bbcode' => array('BOOL', 1),
- 'enable_smilies' => array('BOOL', 1),
- 'enable_magic_url' => array('BOOL', 1),
- 'enable_sig' => array('BOOL', 1),
- 'post_username' => array('VCHAR_UNI:255', ''),
- 'post_subject' => array('STEXT_UNI', '', 'true_sort'),
- 'post_text' => array('MTEXT_UNI', ''),
- 'post_checksum' => array('VCHAR:32', ''),
- 'post_attachment' => array('BOOL', 0),
- 'bbcode_bitfield' => array('VCHAR:255', ''),
- 'bbcode_uid' => array('VCHAR:8', ''),
- 'post_postcount' => array('BOOL', 1),
- 'post_edit_time' => array('TIMESTAMP', 0),
- 'post_edit_reason' => array('STEXT_UNI', ''),
- 'post_edit_user' => array('UINT', 0),
- 'post_edit_count' => array('USINT', 0),
- 'post_edit_locked' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'post_id',
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'poster_ip' => array('INDEX', 'poster_ip'),
- 'poster_id' => array('INDEX', 'poster_id'),
- 'post_approved' => array('INDEX', 'post_approved'),
- 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')),
- ),
-);
-
-$schema_data['phpbb_privmsgs'] = array(
- 'COLUMNS' => array(
- 'msg_id' => array('UINT', NULL, 'auto_increment'),
- 'root_level' => array('UINT', 0),
- 'author_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'author_ip' => array('VCHAR:40', ''),
- 'message_time' => array('TIMESTAMP', 0),
- 'enable_bbcode' => array('BOOL', 1),
- 'enable_smilies' => array('BOOL', 1),
- 'enable_magic_url' => array('BOOL', 1),
- 'enable_sig' => array('BOOL', 1),
- 'message_subject' => array('STEXT_UNI', ''),
- 'message_text' => array('MTEXT_UNI', ''),
- 'message_edit_reason' => array('STEXT_UNI', ''),
- 'message_edit_user' => array('UINT', 0),
- 'message_attachment' => array('BOOL', 0),
- 'bbcode_bitfield' => array('VCHAR:255', ''),
- 'bbcode_uid' => array('VCHAR:8', ''),
- 'message_edit_time' => array('TIMESTAMP', 0),
- 'message_edit_count' => array('USINT', 0),
- 'to_address' => array('TEXT_UNI', ''),
- 'bcc_address' => array('TEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'msg_id',
- 'KEYS' => array(
- 'author_ip' => array('INDEX', 'author_ip'),
- 'message_time' => array('INDEX', 'message_time'),
- 'author_id' => array('INDEX', 'author_id'),
- 'root_level' => array('INDEX', 'root_level'),
- ),
-);
-
-$schema_data['phpbb_privmsgs_folder'] = array(
- 'COLUMNS' => array(
- 'folder_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'folder_name' => array('VCHAR_UNI', ''),
- 'pm_count' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'folder_id',
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- ),
-);
-
-$schema_data['phpbb_privmsgs_rules'] = array(
- 'COLUMNS' => array(
- 'rule_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'rule_check' => array('UINT', 0),
- 'rule_connection' => array('UINT', 0),
- 'rule_string' => array('VCHAR_UNI', ''),
- 'rule_user_id' => array('UINT', 0),
- 'rule_group_id' => array('UINT', 0),
- 'rule_action' => array('UINT', 0),
- 'rule_folder_id' => array('INT:11', 0),
- ),
- 'PRIMARY_KEY' => 'rule_id',
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- ),
-);
-
-$schema_data['phpbb_privmsgs_to'] = array(
- 'COLUMNS' => array(
- 'msg_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'author_id' => array('UINT', 0),
- 'pm_deleted' => array('BOOL', 0),
- 'pm_new' => array('BOOL', 1),
- 'pm_unread' => array('BOOL', 1),
- 'pm_replied' => array('BOOL', 0),
- 'pm_marked' => array('BOOL', 0),
- 'pm_forwarded' => array('BOOL', 0),
- 'folder_id' => array('INT:11', 0),
- ),
- 'KEYS' => array(
- 'msg_id' => array('INDEX', 'msg_id'),
- 'author_id' => array('INDEX', 'author_id'),
- 'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')),
- ),
-);
-
-$schema_data['phpbb_profile_fields'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', NULL, 'auto_increment'),
- 'field_name' => array('VCHAR_UNI', ''),
- 'field_type' => array('TINT:4', 0),
- 'field_ident' => array('VCHAR:20', ''),
- 'field_length' => array('VCHAR:20', ''),
- 'field_minlen' => array('VCHAR', ''),
- 'field_maxlen' => array('VCHAR', ''),
- 'field_novalue' => array('VCHAR_UNI', ''),
- 'field_default_value' => array('VCHAR_UNI', ''),
- 'field_validation' => array('VCHAR_UNI:20', ''),
- 'field_required' => array('BOOL', 0),
- 'field_show_on_reg' => array('BOOL', 0),
- 'field_show_profile' => array('BOOL', 0),
- 'field_hide' => array('BOOL', 0),
- 'field_no_view' => array('BOOL', 0),
- 'field_active' => array('BOOL', 0),
- 'field_order' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'field_id',
- 'KEYS' => array(
- 'fld_type' => array('INDEX', 'field_type'),
- 'fld_ordr' => array('INDEX', 'field_order'),
- ),
-);
-
-$schema_data['phpbb_profile_fields_data'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'user_id',
-);
-
-$schema_data['phpbb_profile_fields_lang'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', 0),
- 'lang_id' => array('UINT', 0),
- 'option_id' => array('UINT', 0),
- 'field_type' => array('TINT:4', 0),
- 'lang_value' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => array('field_id', 'lang_id', 'option_id'),
-);
-
-$schema_data['phpbb_profile_lang'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', 0),
- 'lang_id' => array('UINT', 0),
- 'lang_name' => array('VCHAR_UNI', ''),
- 'lang_explain' => array('TEXT_UNI', ''),
- 'lang_default_value' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => array('field_id', 'lang_id'),
-);
-
-$schema_data['phpbb_ranks'] = array(
- 'COLUMNS' => array(
- 'rank_id' => array('UINT', NULL, 'auto_increment'),
- 'rank_title' => array('VCHAR_UNI', ''),
- 'rank_min' => array('UINT', 0),
- 'rank_special' => array('BOOL', 0),
- 'rank_image' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'rank_id',
-);
-
-$schema_data['phpbb_reports'] = array(
- 'COLUMNS' => array(
- 'report_id' => array('UINT', NULL, 'auto_increment'),
- 'reason_id' => array('USINT', 0),
- 'post_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'user_notify' => array('BOOL', 0),
- 'report_closed' => array('BOOL', 0),
- 'report_time' => array('TIMESTAMP', 0),
- 'report_text' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'report_id',
-);
-
-$schema_data['phpbb_reports_reasons'] = array(
- 'COLUMNS' => array(
- 'reason_id' => array('USINT', NULL, 'auto_increment'),
- 'reason_title' => array('VCHAR_UNI', ''),
- 'reason_description' => array('MTEXT_UNI', ''),
- 'reason_order' => array('USINT', 0),
- ),
- 'PRIMARY_KEY' => 'reason_id',
-);
-
-$schema_data['phpbb_search_results'] = array(
- 'COLUMNS' => array(
- 'search_key' => array('VCHAR:32', ''),
- 'search_time' => array('TIMESTAMP', 0),
- 'search_keywords' => array('MTEXT_UNI', ''),
- 'search_authors' => array('MTEXT', ''),
- ),
- 'PRIMARY_KEY' => 'search_key',
-);
-
-$schema_data['phpbb_search_wordlist'] = array(
- 'COLUMNS' => array(
- 'word_id' => array('UINT', NULL, 'auto_increment'),
- 'word_text' => array('VCHAR_UNI', ''),
- 'word_common' => array('BOOL', 0),
- 'word_count' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'word_id',
- 'KEYS' => array(
- 'wrd_txt' => array('UNIQUE', 'word_text'),
- 'wrd_cnt' => array('INDEX', 'word_count'),
- ),
-);
-
-$schema_data['phpbb_search_wordmatch'] = array(
- 'COLUMNS' => array(
- 'post_id' => array('UINT', 0),
- 'word_id' => array('UINT', 0),
- 'title_match' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'unq_mtch' => array('UNIQUE', array('word_id', 'post_id', 'title_match')),
- 'word_id' => array('INDEX', 'word_id'),
- 'post_id' => array('INDEX', 'post_id'),
- ),
-);
-
-$schema_data['phpbb_sessions'] = array(
- 'COLUMNS' => array(
- 'session_id' => array('CHAR:32', ''),
- 'session_user_id' => array('UINT', 0),
- 'session_forum_id' => array('UINT', 0),
- 'session_last_visit' => array('TIMESTAMP', 0),
- 'session_start' => array('TIMESTAMP', 0),
- 'session_time' => array('TIMESTAMP', 0),
- 'session_ip' => array('VCHAR:40', ''),
- 'session_browser' => array('VCHAR:150', ''),
- 'session_forwarded_for' => array('VCHAR:255', ''),
- 'session_page' => array('VCHAR_UNI', ''),
- 'session_viewonline' => array('BOOL', 1),
- 'session_autologin' => array('BOOL', 0),
- 'session_admin' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'session_id',
- 'KEYS' => array(
- 'session_time' => array('INDEX', 'session_time'),
- 'session_user_id' => array('INDEX', 'session_user_id'),
- 'session_fid' => array('INDEX', 'session_forum_id'),
- ),
-);
-
-$schema_data['phpbb_sessions_keys'] = array(
- 'COLUMNS' => array(
- 'key_id' => array('CHAR:32', ''),
- 'user_id' => array('UINT', 0),
- 'last_ip' => array('VCHAR:40', ''),
- 'last_login' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('key_id', 'user_id'),
- 'KEYS' => array(
- 'last_login' => array('INDEX', 'last_login'),
- ),
-);
-
-$schema_data['phpbb_sitelist'] = array(
- 'COLUMNS' => array(
- 'site_id' => array('UINT', NULL, 'auto_increment'),
- 'site_ip' => array('VCHAR:40', ''),
- 'site_hostname' => array('VCHAR', ''),
- 'ip_exclude' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'site_id',
-);
-
-$schema_data['phpbb_smilies'] = array(
- 'COLUMNS' => array(
- 'smiley_id' => array('UINT', NULL, 'auto_increment'),
- // We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed.
- 'code' => array('VCHAR_UNI:50', ''),
- 'emotion' => array('VCHAR_UNI:50', ''),
- 'smiley_url' => array('VCHAR:50', ''),
- 'smiley_width' => array('USINT', 0),
- 'smiley_height' => array('USINT', 0),
- 'smiley_order' => array('UINT', 0),
- 'display_on_posting'=> array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'smiley_id',
- 'KEYS' => array(
- 'display_on_post' => array('INDEX', 'display_on_posting'),
- ),
-);
-
-$schema_data['phpbb_styles'] = array(
- 'COLUMNS' => array(
- 'style_id' => array('UINT', NULL, 'auto_increment'),
- 'style_name' => array('VCHAR_UNI:255', ''),
- 'style_copyright' => array('VCHAR_UNI', ''),
- 'style_active' => array('BOOL', 1),
- 'template_id' => array('UINT', 0),
- 'theme_id' => array('UINT', 0),
- 'imageset_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'style_id',
- 'KEYS' => array(
- 'style_name' => array('UNIQUE', 'style_name'),
- 'template_id' => array('INDEX', 'template_id'),
- 'theme_id' => array('INDEX', 'theme_id'),
- 'imageset_id' => array('INDEX', 'imageset_id'),
- ),
-);
-
-$schema_data['phpbb_styles_template'] = array(
- 'COLUMNS' => array(
- 'template_id' => array('UINT', NULL, 'auto_increment'),
- 'template_name' => array('VCHAR_UNI:255', ''),
- 'template_copyright' => array('VCHAR_UNI', ''),
- 'template_path' => array('VCHAR:100', ''),
- 'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
- 'template_storedb' => array('BOOL', 0),
- 'template_inherits_id' => array('UINT:4', 0),
- 'template_inherit_path' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'template_id',
- 'KEYS' => array(
- 'tmplte_nm' => array('UNIQUE', 'template_name'),
- ),
-);
-
-$schema_data['phpbb_styles_theme'] = array(
- 'COLUMNS' => array(
- 'theme_id' => array('UINT', NULL, 'auto_increment'),
- 'theme_name' => array('VCHAR_UNI:255', ''),
- 'theme_copyright' => array('VCHAR_UNI', ''),
- 'theme_path' => array('VCHAR:100', ''),
- 'theme_storedb' => array('BOOL', 0),
- 'theme_mtime' => array('TIMESTAMP', 0),
- 'theme_data' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'theme_id',
- 'KEYS' => array(
- 'theme_name' => array('UNIQUE', 'theme_name'),
- ),
-);
-
-$schema_data['phpbb_styles_imageset'] = array(
- 'COLUMNS' => array(
- 'imageset_id' => array('UINT', NULL, 'auto_increment'),
- 'imageset_name' => array('VCHAR_UNI:255', ''),
- 'imageset_copyright' => array('VCHAR_UNI', ''),
- 'imageset_path' => array('VCHAR:100', ''),
- ),
- 'PRIMARY_KEY' => 'imageset_id',
- 'KEYS' => array(
- 'imgset_nm' => array('UNIQUE', 'imageset_name'),
- ),
-);
-
-$schema_data['phpbb_styles_imageset_data'] = array(
- 'COLUMNS' => array(
- 'image_id' => array('UINT', NULL, 'auto_increment'),
- 'image_name' => array('VCHAR:200', ''),
- 'image_filename' => array('VCHAR:200', ''),
- 'image_lang' => array('VCHAR:30', ''),
- 'image_height' => array('USINT', 0),
- 'image_width' => array('USINT', 0),
- 'imageset_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'image_id',
- 'KEYS' => array(
- 'i_d' => array('INDEX', 'imageset_id'),
- ),
-);
-
-$schema_data['phpbb_topics'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', NULL, 'auto_increment'),
- 'forum_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'topic_attachment' => array('BOOL', 0),
- 'topic_approved' => array('BOOL', 1),
- 'topic_reported' => array('BOOL', 0),
- 'topic_title' => array('STEXT_UNI', '', 'true_sort'),
- 'topic_poster' => array('UINT', 0),
- 'topic_time' => array('TIMESTAMP', 0),
- 'topic_time_limit' => array('TIMESTAMP', 0),
- 'topic_views' => array('UINT', 0),
- 'topic_replies' => array('UINT', 0),
- 'topic_replies_real' => array('UINT', 0),
- 'topic_status' => array('TINT:3', 0),
- 'topic_type' => array('TINT:3', 0),
- 'topic_first_post_id' => array('UINT', 0),
- 'topic_first_poster_name' => array('VCHAR_UNI', ''),
- 'topic_first_poster_colour' => array('VCHAR:6', ''),
- 'topic_last_post_id' => array('UINT', 0),
- 'topic_last_poster_id' => array('UINT', 0),
- 'topic_last_poster_name' => array('VCHAR_UNI', ''),
- 'topic_last_poster_colour' => array('VCHAR:6', ''),
- 'topic_last_post_subject' => array('STEXT_UNI', ''),
- 'topic_last_post_time' => array('TIMESTAMP', 0),
- 'topic_last_view_time' => array('TIMESTAMP', 0),
- 'topic_moved_id' => array('UINT', 0),
- 'topic_bumped' => array('BOOL', 0),
- 'topic_bumper' => array('UINT', 0),
- 'poll_title' => array('STEXT_UNI', ''),
- 'poll_start' => array('TIMESTAMP', 0),
- 'poll_length' => array('TIMESTAMP', 0),
- 'poll_max_options' => array('TINT:4', 1),
- 'poll_last_vote' => array('TIMESTAMP', 0),
- 'poll_vote_change' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'topic_id',
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')),
- 'last_post_time' => array('INDEX', 'topic_last_post_time'),
- 'topic_approved' => array('INDEX', 'topic_approved'),
- 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')),
- 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')),
- ),
-);
-
-$schema_data['phpbb_topics_track'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'mark_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'topic_id'),
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- ),
-);
-
-$schema_data['phpbb_topics_posted'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'topic_posted' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'topic_id'),
-);
-
-$schema_data['phpbb_topics_watch'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'notify_status' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'notify_stat' => array('INDEX', 'notify_status'),
- ),
-);
-
-$schema_data['phpbb_user_group'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'group_leader' => array('BOOL', 0),
- 'user_pending' => array('BOOL', 1),
- ),
- 'KEYS' => array(
- 'group_id' => array('INDEX', 'group_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'group_leader' => array('INDEX', 'group_leader'),
- ),
-);
-
-$schema_data['phpbb_users'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', NULL, 'auto_increment'),
- 'user_type' => array('TINT:2', 0),
- 'group_id' => array('UINT', 3),
- 'user_permissions' => array('MTEXT', ''),
- 'user_perm_from' => array('UINT', 0),
- 'user_ip' => array('VCHAR:40', ''),
- 'user_regdate' => array('TIMESTAMP', 0),
- 'username' => array('VCHAR_UNI', ''),
- 'username_clean' => array('VCHAR_UNI', ''),
- 'user_password' => array('VCHAR_UNI:40', ''),
- 'user_passchg' => array('TIMESTAMP', 0),
- 'user_pass_convert' => array('BOOL', 0),
- 'user_email' => array('VCHAR_UNI:100', ''),
- 'user_email_hash' => array('BINT', 0),
- 'user_birthday' => array('VCHAR:10', ''),
- 'user_lastvisit' => array('TIMESTAMP', 0),
- 'user_lastmark' => array('TIMESTAMP', 0),
- 'user_lastpost_time' => array('TIMESTAMP', 0),
- 'user_lastpage' => array('VCHAR_UNI:200', ''),
- 'user_last_confirm_key' => array('VCHAR:10', ''),
- 'user_last_search' => array('TIMESTAMP', 0),
- 'user_warnings' => array('TINT:4', 0),
- 'user_last_warning' => array('TIMESTAMP', 0),
- 'user_login_attempts' => array('TINT:4', 0),
- 'user_inactive_reason' => array('TINT:2', 0),
- 'user_inactive_time' => array('TIMESTAMP', 0),
- 'user_posts' => array('UINT', 0),
- 'user_lang' => array('VCHAR:30', ''),
- 'user_timezone' => array('DECIMAL', 0),
- 'user_dst' => array('BOOL', 0),
- 'user_dateformat' => array('VCHAR_UNI:30', 'd M Y H:i'),
- 'user_style' => array('UINT', 0),
- 'user_rank' => array('UINT', 0),
- 'user_colour' => array('VCHAR:6', ''),
- 'user_new_privmsg' => array('INT:4', 0),
- 'user_unread_privmsg' => array('INT:4', 0),
- 'user_last_privmsg' => array('TIMESTAMP', 0),
- 'user_message_rules' => array('BOOL', 0),
- 'user_full_folder' => array('INT:11', -3),
- 'user_emailtime' => array('TIMESTAMP', 0),
- 'user_topic_show_days' => array('USINT', 0),
- 'user_topic_sortby_type' => array('VCHAR:1', 't'),
- 'user_topic_sortby_dir' => array('VCHAR:1', 'd'),
- 'user_post_show_days' => array('USINT', 0),
- 'user_post_sortby_type' => array('VCHAR:1', 't'),
- 'user_post_sortby_dir' => array('VCHAR:1', 'a'),
- 'user_notify' => array('BOOL', 0),
- 'user_notify_pm' => array('BOOL', 1),
- 'user_notify_type' => array('TINT:4', 0),
- 'user_allow_pm' => array('BOOL', 1),
- 'user_allow_viewonline' => array('BOOL', 1),
- 'user_allow_viewemail' => array('BOOL', 1),
- 'user_allow_massemail' => array('BOOL', 1),
- 'user_options' => array('UINT:11', 895),
- 'user_avatar' => array('VCHAR', ''),
- 'user_avatar_type' => array('TINT:2', 0),
- 'user_avatar_width' => array('USINT', 0),
- 'user_avatar_height' => array('USINT', 0),
- 'user_sig' => array('MTEXT_UNI', ''),
- 'user_sig_bbcode_uid' => array('VCHAR:8', ''),
- 'user_sig_bbcode_bitfield' => array('VCHAR:255', ''),
- 'user_from' => array('VCHAR_UNI:100', ''),
- 'user_icq' => array('VCHAR:15', ''),
- 'user_aim' => array('VCHAR_UNI', ''),
- 'user_yim' => array('VCHAR_UNI', ''),
- 'user_msnm' => array('VCHAR_UNI', ''),
- 'user_jabber' => array('VCHAR_UNI', ''),
- 'user_website' => array('VCHAR_UNI:200', ''),
- 'user_occ' => array('TEXT_UNI', ''),
- 'user_interests' => array('TEXT_UNI', ''),
- 'user_actkey' => array('VCHAR:32', ''),
- 'user_newpasswd' => array('VCHAR_UNI:40', ''),
- 'user_form_salt' => array('VCHAR_UNI:32', ''),
-
- ),
- 'PRIMARY_KEY' => 'user_id',
- 'KEYS' => array(
- 'user_birthday' => array('INDEX', 'user_birthday'),
- 'user_email_hash' => array('INDEX', 'user_email_hash'),
- 'user_type' => array('INDEX', 'user_type'),
- 'username_clean' => array('UNIQUE', 'username_clean'),
- ),
-);
-
-$schema_data['phpbb_warnings'] = array(
- 'COLUMNS' => array(
- 'warning_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'post_id' => array('UINT', 0),
- 'log_id' => array('UINT', 0),
- 'warning_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'warning_id',
-);
-
-$schema_data['phpbb_words'] = array(
- 'COLUMNS' => array(
- 'word_id' => array('UINT', NULL, 'auto_increment'),
- 'word' => array('VCHAR_UNI', ''),
- 'replacement' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'word_id',
-);
-
-$schema_data['phpbb_zebra'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'zebra_id' => array('UINT', 0),
- 'friend' => array('BOOL', 0),
- 'foe' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'zebra_id'),
-);
-
-?>