diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 5acaae113b..0884ef01e8 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -822,7 +822,10 @@ function get_avatar_dim($src, $axis, $func = false, $arg1 = false, $arg2 = false break; default: - return $axis ? DEFAULT_AVATAR_Y : DEFAULT_AVATAR_X; + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + return $axis ? $default_y : $default_x; break; } } @@ -868,7 +871,10 @@ function get_upload_avatar_dim($source, $axis) if (empty($cachedims) || empty($cachedims[0]) || empty($cachedims[1])) { - $cachedims = array(DEFAULT_AVATAR_X, DEFAULT_AVATAR_Y); + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + $cachedims = array($default_x, $default_y); } return $cachedims[$axis]; @@ -909,7 +915,10 @@ function get_gallery_avatar_dim($source, $axis) if (empty($avatar_cache[$orig_source]) || empty($avatar_cache[$orig_source][0]) || empty($avatar_cache[$orig_source][1])) { - $avatar_cache[$orig_source] = array(DEFAULT_AVATAR_X, DEFAULT_AVATAR_Y); + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + $avatar_cache[$orig_source] = array($default_x, $default_y); } return $avatar_cache[$orig_source][$axis]; @@ -938,7 +947,10 @@ function get_remote_avatar_dim($src,$axis) if (empty($avatar_cache[$src]) || empty($avatar_cache[$src][0]) || empty($avatar_cache[$src][1])) { - $avatar_cache[$src] = array(DEFAULT_AVATAR_X, DEFAULT_AVATAR_Y); + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + $avatar_cache[$src] = array($default_x, $default_y); } return $avatar_cache[$src][$axis]; @@ -1805,8 +1817,15 @@ function update_dynamic_config() // Get latest username $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' - WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') - ORDER BY user_id DESC'; + WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + + if (!empty($config['increment_user_id'])) + { + $sql .= ' AND user_id <> ' . $config['increment_user_id']; + } + + $sql .= ' ORDER BY user_id DESC'; + $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 4e159919ff..1cd03d3667 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -31,7 +31,7 @@ unset($dbpasswd); */ $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', - 'version' => '0.9', + 'version' => '0.92', 'phpbb_version' => '3.0.0', 'author' => 'phpBB Group', 'dbms' => $dbms, @@ -42,7 +42,7 @@ $convertor_data = array( 'dbname' => $dbname, 'table_prefix' => 'phpbb_', 'forum_path' => '../forums', - 'author_notes' => 'Avatars may be on a different width/height than with the old forum. This is due to dimensions being stored within phpBB3 but not within phpBB2. The default dimension was set to 80x80 for avatars where dimension settings could not be determined. You might wish to instruct your users to check their profiles after the conversion to ensure that the size is correct.', + 'author_notes' => '', ); /** @@ -206,13 +206,24 @@ if (!$get_info) // If there is a user id 1, we need to increment user ids. :/ if ($user_id === 1) { - set_config('increment_user_id', 1, true); + // 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')); + /** * Description on how to use the convertor framework. * @@ -636,7 +647,7 @@ if (!$get_info) 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', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')), + 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, ''), diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 2c53e5ccd1..598bb46a9a 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -456,6 +456,13 @@ function phpbb_user_id($user_id) $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'"); @@ -464,8 +471,8 @@ function phpbb_user_id($user_id) // If there is a user id 1, we need to increment user ids. :/ if ($id === 1) { - set_config('increment_user_id', 1, true); - $config['increment_user_id'] = 1; + set_config('increment_user_id', ($max_id + 1), true); + $config['increment_user_id'] = $max_id + 1; } else { @@ -487,9 +494,9 @@ function phpbb_user_id($user_id) return ANONYMOUS; } - if (!empty($config['increment_user_id'])) + if (!empty($config['increment_user_id']) && $user_id == 1) { - $user_id++; + return $config['increment_user_id']; } return $user_id; @@ -591,8 +598,8 @@ function phpbb_convert_authentication($mode) // Add Forum Access List $auth_map = array( 'auth_view' => array('f_', 'f_list'), - 'auth_read' => 'f_read', - 'auth_post' => array('f_post', 'f_bbcode', 'f_smilies', 'f_img', 'f_sigs', 'f_search', 'f_postcount'), + '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', @@ -600,7 +607,7 @@ function phpbb_convert_authentication($mode) 'auth_vote' => 'f_vote', 'auth_announce' => 'f_announce', 'auth_sticky' => 'f_sticky', - 'auth_attachments' => 'f_attach', + 'auth_attachments' => array('f_attach', 'f_download'), 'auth_download' => 'f_download', ); @@ -705,18 +712,33 @@ function phpbb_convert_authentication($mode) user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS, false); // Selecting from old table - $auth_sql = 'SELECT '; - $auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id'; - $auth_sql .= ', {ADMINISTRATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1'; + 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); - 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); + } - // Put administrators into global moderators group too... - $auth_sql = 'SELECT '; - $auth_sql .= (!empty($config['increment_user_id'])) ? 'user_id + 1 as user_id' : 'user_id'; - $auth_sql .= ', {GLOBAL_MODERATORS} FROM ' . $convert->src_table_prefix . 'users WHERE user_level = 1'; + 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); - 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') { @@ -762,7 +784,7 @@ function phpbb_convert_authentication($mode) // no break; case 'registered_hidden': - mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_LIMITED_POLLS'); + mass_auth('group_role', $new_forum_id, 'registered', 'FORUM_STANDARD_POLLS'); break; case 'private': @@ -980,25 +1002,32 @@ function phpbb_convert_authentication($mode) if (sizeof($forum_ids)) { // Now make sure the user is able to read these forums - $hold_ary = $auth->acl_group_raw_data(get_group_id('guests'), 'f_list', $forum_ids); + $hold_ary = $auth->acl_group_raw_data(false, 'f_list', $forum_ids); - if (!empty($hold_ary)) + if (empty($hold_ary)) { - mass_auth('group', $row['forum_id'], 'guests', 'f_list', ACL_YES); - mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES); - mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES); - mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES); + continue; } - else - { - // Now make sure the user is able to read these forums - $hold_ary = $auth->acl_group_raw_data(get_group_id('registered'), 'f_list', $forum_ids); - if (!empty($hold_ary)) + foreach ($hold_ary as $g_id => $f_id_ary) + { + $set_group = false; + + foreach ($f_id_ary as $f_id => $auth_ary) { - mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES); - mass_auth('group', $row['forum_id'], 'registered_coppa', 'f_list', ACL_YES); - mass_auth('group', $row['forum_id'], 'bots', 'f_list', ACL_YES); + 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); } } } diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 54b8ee3a3d..49ce3689bd 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -141,7 +141,6 @@ class install_convert extends module } $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); @@ -168,13 +167,13 @@ class install_convert extends module // This information should have already been checked once, but do it again for safety if (!empty($options) && !empty($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'])) + 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']; @@ -943,7 +942,12 @@ class install_convert extends module 'dbpasswd' => $convert->src_dbpasswd, )), true); - $msg = $user->lang['PRE_CONVERT_COMPLETE'] . '
' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']); + $msg = $user->lang['PRE_CONVERT_COMPLETE']; + + if ($convert->convertor_data['author_notes']) + { + $msg .= '
' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']); + } $url = $this->p_master->module_url . "?mode=$mode&sub=in_progress&tag={$convert->convertor_tag}$step"; $template->assign_vars(array( diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index d6703479a7..ef83d68c97 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -465,7 +465,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 14, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%'; # Standard Access (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_delete', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock'); # No Access (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = 'f_'; @@ -484,7 +484,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove'); # Standard Access + Polls (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_delete', 'f_ignoreflood', 'f_sticky', 'f_user_lock'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_ignoreflood', 'f_sticky', 'f_user_lock'); # Limited Access + Polls (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 865a68d60b..16fd53ce71 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -308,7 +308,7 @@ $lang = array_merge($lang, array( 'ENABLE_GZIP' => 'Enable GZip compression', 'FORCE_SERVER_VARS' => 'Force server URL settings', - 'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values', + 'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values.', 'ICONS_PATH' => 'Post icons storage path', 'ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/icons', 'PATH_SETTINGS' => 'Path settings', diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index e29067895a..70226c0684 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -181,7 +181,7 @@ $lang = array_merge($lang, array( 'ROLE_DESCRIPTION_FORUM_ONQUEUE' => 'Can use most forum features including attachments, but posts and topics need to be approved by a moderator.', 'ROLE_DESCRIPTION_FORUM_POLLS' => 'Like Standard Access but can also create polls.', 'ROLE_DESCRIPTION_FORUM_READONLY' => 'Can read the forum, but cannot create new topics or reply to posts.', - 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments, but cannot lock or delete own topics, and cannot create polls.', + 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments and deleting own topics, but cannot lock own topics, and cannot create polls.', 'ROLE_DESCRIPTION_MOD_FULL' => 'Can use all moderating features, including banning.', 'ROLE_DESCRIPTION_MOD_QUEUE' => 'Can use the Moderation Queue to validate and edit posts, but nothing else.', 'ROLE_DESCRIPTION_MOD_SIMPLE' => 'Can only use basic topic actions. Cannot send warnings or use moderation queue.', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 5ac27f7ee0..1e3f8b0765 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -74,7 +74,7 @@ $lang = array_merge($lang, array( 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) forum systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the forum software you wish to convert from, please check our website where further conversion modules may be available for download.', 'CONVERT_NEW_CONVERSION' => 'New conversion', 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist', - 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion progress, push the button below to begin', + 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion progress, push the button below to begin.', 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', @@ -257,7 +257,7 @@ $lang = array_merge($lang, array( 'POST_ID' => 'Post ID', 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using %s as table prefix.', 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', - 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process.', + 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually adjust several things. After conversion, especially check the permissions assigned, rebuild your search index if necessary and also make sure files got copied correctly, for example avatars and smilies.', 'PROCESS_LAST' => 'Processing last statements', 'REFRESH_PAGE' => 'Refresh page to continue conversion',