mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10950] Check $delete_ids to be not empty
PHPBB3-10950
This commit is contained in:
parent
5c8c7b1352
commit
338d29072f
1 changed files with 25 additions and 22 deletions
|
@ -1216,31 +1216,34 @@ function phpbb_delete_user_pms($user_id)
|
||||||
WHERE user_id = ' . (int) $user_id;
|
WHERE user_id = ' . (int) $user_id;
|
||||||
$db->sql_query($sql);
|
$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))
|
if (!empty($delete_ids))
|
||||||
{
|
{
|
||||||
// Check if there are any attachments we need to remove
|
// Now we have to check which messages we can delete completely
|
||||||
if (!function_exists('delete_attachments'))
|
$sql = 'SELECT msg_id
|
||||||
{
|
FROM ' . PRIVMSGS_TO_TABLE . '
|
||||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete_attachments('message', $delete_ids, false);
|
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
|
|
||||||
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
|
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
|
||||||
$db->sql_query($sql);
|
$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'))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// Set the remaining author id to anonymous
|
||||||
|
|
Loading…
Add table
Reference in a new issue