aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-12-15 14:54:52 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-12-15 14:54:52 +0000
commit2e4cd16058cc548068a94047c9c31e5a9ad272d0 (patch)
tree5e2bceadc56306b886482703702b0f21a0aba3a1 /phpBB/includes
parent11e70be6edd39fb0956541117e8bf327c94f651e (diff)
downloadforums-2e4cd16058cc548068a94047c9c31e5a9ad272d0.tar
forums-2e4cd16058cc548068a94047c9c31e5a9ad272d0.tar.gz
forums-2e4cd16058cc548068a94047c9c31e5a9ad272d0.tar.bz2
forums-2e4cd16058cc548068a94047c9c31e5a9ad272d0.tar.xz
forums-2e4cd16058cc548068a94047c9c31e5a9ad272d0.zip
- 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
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_bots.php22
-rw-r--r--phpBB/includes/functions_posting.php6
2 files changed, 21 insertions, 7 deletions
diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php
index 0b1cdb122f..7e1c31dc44 100644
--- a/phpBB/includes/acp/acp_bots.php
+++ b/phpBB/includes/acp/acp_bots.php
@@ -206,7 +206,7 @@ class acp_bots
}
else if ($bot_id)
{
- $sql = 'SELECT user_id
+ $sql = 'SELECT user_id, bot_name
FROM ' . BOTS_TABLE . "
WHERE bot_id = $bot_id";
$result = $db->sql_query($sql);
@@ -218,10 +218,18 @@ class acp_bots
trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&amp;id=$bot_id&amp;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_lang' => (string) $bot_row['bot_lang'])
- ) . " WHERE user_id = {$row['user_id']}";
+ 'user_lang' => (string) $bot_row['bot_lang'],
+ );
+
+ 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);
$sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
@@ -232,6 +240,12 @@ class acp_bots
) . " WHERE bot_id = $bot_id";
$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';
}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 49ed4932a3..51bcf2e583 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1324,12 +1324,12 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$db->sql_transaction('commit');
// 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
FROM ' . POSTS_TABLE . '
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);
$poster_id = (int) $db->sql_fetchfield('poster_id');
$db->sql_freeresult($result);
@@ -1339,7 +1339,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
{
$sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
WHERE topic_id = ' . $topic_id . '
- AND user_id = ' . $user->data['user_id'];
+ AND user_id = ' . $data['poster_id'];
$db->sql_query($sql);
}
}