aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_privmsgs.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_privmsgs.php')
-rw-r--r--phpBB/includes/functions_privmsgs.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index d01d89a7e3..ec09e168bc 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -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;
}