1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

- fixed some convertor bugs

- adjusted forum standard access (+polls) role to include f_delete (no update, only new installations will have the change included)


git-svn-id: file:///svn/phpbb/trunk@7040 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-02-23 13:50:27 +00:00
parent 85a4e31881
commit e855a348e3
8 changed files with 119 additions and 56 deletions

View File

@@ -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' => '<a href="http://www.phpbb.com/">phpBB Group</a>',
'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, ''),

View File

@@ -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);
}
}
}