1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

Correctly delete message attachments. (Bug #23755) Also revamped and simplified delete_attachments() - it looks like we did not touch it for a long long time.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8890 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2008-09-19 15:39:43 +00:00
parent a2a9b8b7ab
commit e12fce5f3d
3 changed files with 103 additions and 126 deletions

View File

@@ -930,7 +930,7 @@ function handle_mark_actions($user_id, $mark_action)
*/
function delete_pm($user_id, $msg_ids, $folder_id)
{
global $db, $user;
global $db, $user, $phpbb_root_path, $phpEx;
$user_id = (int) $user_id;
$folder_id = (int) $folder_id;
@@ -979,6 +979,8 @@ function delete_pm($user_id, $msg_ids, $folder_id)
return false;
}
$db->sql_transaction('begin');
// if no one has read the message yet (meaning it is in users outbox)
// then mark the message as deleted...
if ($folder_id == PRIVMSGS_OUTBOX)
@@ -1056,11 +1058,21 @@ function delete_pm($user_id, $msg_ids, $folder_id)
if (sizeof($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);
}
$db->sql_transaction('commit');
return true;
}