- fixed bug within the database update script

- #6254
- #6242
- #6184
- #6160
- #6020


git-svn-id: file:///svn/phpbb/trunk@6770 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-12-15 14:54:52 +00:00
parent 11e70be6ed
commit 2e4cd16058
7 changed files with 27 additions and 14 deletions

View file

@ -206,7 +206,7 @@ class acp_bots
} }
else if ($bot_id) else if ($bot_id)
{ {
$sql = 'SELECT user_id $sql = 'SELECT user_id, bot_name
FROM ' . BOTS_TABLE . " FROM ' . BOTS_TABLE . "
WHERE bot_id = $bot_id"; WHERE bot_id = $bot_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -218,10 +218,18 @@ class acp_bots
trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING);
} }
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( $sql_ary = array(
'user_style' => (int) $bot_row['bot_style'], 'user_style' => (int) $bot_row['bot_style'],
'user_lang' => (string) $bot_row['bot_lang']) 'user_lang' => (string) $bot_row['bot_lang'],
) . " WHERE user_id = {$row['user_id']}"; );
if ($bot_row['bot_name'] !== $row['bot_name'])
{
$sql_ary['username'] = (string) $bot_row['bot_name'];
$sql_ary['username_clean'] = (string) utf8_clean_string($bot_row['bot_name']);
}
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$row['user_id']}";
$db->sql_query($sql); $db->sql_query($sql);
$sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
@ -232,6 +240,12 @@ class acp_bots
) . " WHERE bot_id = $bot_id"; ) . " WHERE bot_id = $bot_id";
$db->sql_query($sql); $db->sql_query($sql);
// Updated username?
if ($bot_row['bot_name'] !== $row['bot_name'])
{
user_update_name($row['bot_name'], $bot_row['bot_name']);
}
$log = 'UPDATED'; $log = 'UPDATED';
} }

View file

@ -1324,12 +1324,12 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$db->sql_transaction('commit'); $db->sql_transaction('commit');
// Adjust posted info for this user by looking for a post by him/her within this topic... // Adjust posted info for this user by looking for a post by him/her within this topic...
if ($post_mode != 'delete_topic' && $config['load_db_track'] && $user->data['is_registered']) if ($post_mode != 'delete_topic' && $config['load_db_track'] && $data['poster_id'] != ANONYMOUS)
{ {
$sql = 'SELECT poster_id $sql = 'SELECT poster_id
FROM ' . POSTS_TABLE . ' FROM ' . POSTS_TABLE . '
WHERE topic_id = ' . $topic_id . ' WHERE topic_id = ' . $topic_id . '
AND poster_id = ' . $user->data['user_id']; AND poster_id = ' . $data['poster_id'];
$result = $db->sql_query_limit($sql, 1); $result = $db->sql_query_limit($sql, 1);
$poster_id = (int) $db->sql_fetchfield('poster_id'); $poster_id = (int) $db->sql_fetchfield('poster_id');
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -1339,7 +1339,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
{ {
$sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
WHERE topic_id = ' . $topic_id . ' WHERE topic_id = ' . $topic_id . '
AND user_id = ' . $user->data['user_id']; AND user_id = ' . $data['poster_id'];
$db->sql_query($sql); $db->sql_query($sql);
} }
} }

View file

@ -488,7 +488,7 @@ flush();
$no_updates = true; $no_updates = true;
// some code magic // some code magic
if (version_compare($current_version, '3.0.b3', '<')) if (version_compare($current_version, '3.0.b3', '<='))
{ {
// Set group_founder_manage for administrators group // Set group_founder_manage for administrators group
$sql = 'SELECT group_id $sql = 'SELECT group_id
@ -510,7 +510,7 @@ if (version_compare($current_version, '3.0.b3', '<'))
$no_updates = false; $no_updates = false;
} }
if (version_compare($current_version, '3.0.b4', '<')) if (version_compare($current_version, '3.0.b4', '<='))
{ {
// Add config values // Add config values
set_config('script_path', '/'); set_config('script_path', '/');

View file

@ -471,13 +471,13 @@ 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 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = '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_';
# Read Only Access (f_) # Read Only Access (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 17, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_search', 'f_subscribe'); INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 17, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_search', 'f_subscribe', 'f_print');
# Limited Access (f_) # Limited Access (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 18, 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_poll', 'f_sticky', 'f_user_lock', 'f_votechg'); INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 18, 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_poll', 'f_sticky', 'f_user_lock', 'f_votechg');
# Bot Access (f_) # Bot Access (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 19, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read'); INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 19, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_print');
# On Moderation Queue (f_) # On Moderation Queue (f_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove'); INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove');

View file

@ -127,7 +127,6 @@ $lang = array_merge($lang, array(
'NO_POLL_TITLE' => 'You have to enter a poll title', 'NO_POLL_TITLE' => 'You have to enter a poll title',
'NO_POST' => 'The requested post does not exist.', 'NO_POST' => 'The requested post does not exist.',
'NO_POST_MODE' => 'No post mode specified', 'NO_POST_MODE' => 'No post mode specified',
'NO_TOPIC_ICON' => 'None',
'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded', 'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded',
'PHP_SIZE_NA' => 'The attachments filesize is too large.<br />Could not determine the maximum size defined by PHP in php.ini.', 'PHP_SIZE_NA' => 'The attachments filesize is too large.<br />Could not determine the maximum size defined by PHP in php.ini.',

View file

@ -1388,7 +1388,7 @@ function show_profile($data)
$rank_title = $rank_img = $rank_img_src = ''; $rank_title = $rank_img = $rank_img_src = '';
get_user_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src); get_user_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src);
if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_email')) if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_email'))
{ {
$email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&amp;u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $data['user_email']); $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&amp;u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $data['user_email']);

View file

@ -22,7 +22,7 @@
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<tr> <tr>
<td align="center"><!-- IF USER_COLOR --><b class="gen" style="color: #{USER_COLOR}"><!-- ELSE --><b class="gen"><!-- ENDIF -->{USERNAME}</b><!-- IF U_USER_ADMIN --><span class="genmed"> [ <a href="{U_USER_ADMIN}">{L_USER_ADMIN}</a> ]</span><!-- ENDIF --></td> <td align="center"><!-- IF USER_COLOR --><b class="gen" style="color: {USER_COLOR}"><!-- ELSE --><b class="gen"><!-- ENDIF -->{USERNAME}</b><!-- IF U_USER_ADMIN --><span class="genmed"> [ <a href="{U_USER_ADMIN}">{L_USER_ADMIN}</a> ]</span><!-- ENDIF --></td>
</tr> </tr>
<!-- IF RANK --> <!-- IF RANK -->
<tr> <tr>