diff options
author | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-01 00:26:47 +0200 |
---|---|---|
committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2016-08-01 00:26:47 +0200 |
commit | f222f8a84aebd2f675f503a7a2abd79efd84873b (patch) | |
tree | 1714cf60b2e2e7bf6ebca219c59a48d3177efde7 /phpBB/includes | |
parent | 4ac2547d6234dc7fcc1f34d645de904f08089896 (diff) | |
download | forums-f222f8a84aebd2f675f503a7a2abd79efd84873b.tar forums-f222f8a84aebd2f675f503a7a2abd79efd84873b.tar.gz forums-f222f8a84aebd2f675f503a7a2abd79efd84873b.tar.bz2 forums-f222f8a84aebd2f675f503a7a2abd79efd84873b.tar.xz forums-f222f8a84aebd2f675f503a7a2abd79efd84873b.zip |
[ticket/14721] Avoid renaming deleted users
PHPBB3-14721
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_user.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index bfdd1badc3..8a09f055bf 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -119,19 +119,29 @@ function user_update_name($old_name, $new_name) global $config, $db, $cache, $phpbb_dispatcher; $update_ary = array( - FORUMS_TABLE => array('forum_last_poster_name'), - MODERATOR_CACHE_TABLE => array('username'), - POSTS_TABLE => array('post_username'), - TOPICS_TABLE => array('topic_first_poster_name', 'topic_last_poster_name'), + FORUMS_TABLE => array( + 'forum_last_poster_id' => 'forum_last_poster_name', + ), + MODERATOR_CACHE_TABLE => array( + 'user_id' => 'username', + ), + POSTS_TABLE => array( + 'poster_id' => 'post_username', + ), + TOPICS_TABLE => array( + 'topic_poster' => 'topic_first_poster_name', + 'topic_last_poster_id' => 'topic_last_poster_name', + ), ); foreach ($update_ary as $table => $field_ary) { - foreach ($field_ary as $field) + foreach ($field_ary as $id_field => $name_field) { $sql = "UPDATE $table - SET $field = '" . $db->sql_escape($new_name) . "' - WHERE $field = '" . $db->sql_escape($old_name) . "'"; + SET $name_field = '" . $db->sql_escape($new_name) . "' + WHERE $name_field = '" . $db->sql_escape($old_name) . "' + AND $id_field <> " . ANONYMOUS; $db->sql_query($sql); } } |