diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2012-07-04 13:14:19 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2012-07-04 13:14:19 +0200 |
| commit | 338d29072fd5581968f404576c6faa2dffc4f883 (patch) | |
| tree | 254d9efe364eb2bd1889fb6efb07ff878ac944c1 /phpBB/includes | |
| parent | 5c8c7b1352454fc8d1bb6e689d52d31b346d5fdb (diff) | |
| download | forums-338d29072fd5581968f404576c6faa2dffc4f883.tar forums-338d29072fd5581968f404576c6faa2dffc4f883.tar.gz forums-338d29072fd5581968f404576c6faa2dffc4f883.tar.bz2 forums-338d29072fd5581968f404576c6faa2dffc4f883.tar.xz forums-338d29072fd5581968f404576c6faa2dffc4f883.zip | |
[ticket/10950] Check $delete_ids to be not empty
PHPBB3-10950
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/functions_privmsgs.php | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 88388841ed..6c0adccbed 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1216,31 +1216,34 @@ function phpbb_delete_user_pms($user_id) WHERE user_id = ' . (int) $user_id; $db->sql_query($sql); - // Now we have to check which messages we can delete completely - $sql = 'SELECT msg_id - FROM ' . PRIVMSGS_TO_TABLE . ' - WHERE ' . $db->sql_in_set('msg_id', $delete_ids); - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - unset($delete_ids[$row['msg_id']]); - } - $db->sql_freeresult($result); - if (!empty($delete_ids)) { - // Check if there are any attachments we need to remove - if (!function_exists('delete_attachments')) + // Now we have to check which messages we can delete completely + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + unset($delete_ids[$row['msg_id']]); } + $db->sql_freeresult($result); - delete_attachments('message', $delete_ids, false); + if (!empty($delete_ids)) + { + // Check if there are any attachments we need to remove + if (!function_exists('delete_attachments')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } - $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' - WHERE ' . $db->sql_in_set('msg_id', $delete_ids); - $db->sql_query($sql); + delete_attachments('message', $delete_ids, false); + + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $db->sql_query($sql); + } } // Set the remaining author id to anonymous |
