diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-09-19 15:39:43 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-09-19 15:39:43 +0000 |
commit | e12fce5f3d74d97b93b5a5931e59f9ddc2355a77 (patch) | |
tree | 657715e9aea129e4160e9b04fdafcaff3d229bc6 /phpBB/includes/functions_privmsgs.php | |
parent | a2a9b8b7ab5769f65ea38bd1effdfba8f706cbb2 (diff) | |
download | forums-e12fce5f3d74d97b93b5a5931e59f9ddc2355a77.tar forums-e12fce5f3d74d97b93b5a5931e59f9ddc2355a77.tar.gz forums-e12fce5f3d74d97b93b5a5931e59f9ddc2355a77.tar.bz2 forums-e12fce5f3d74d97b93b5a5931e59f9ddc2355a77.tar.xz forums-e12fce5f3d74d97b93b5a5931e59f9ddc2355a77.zip |
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
Diffstat (limited to 'phpBB/includes/functions_privmsgs.php')
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 14 |
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; } |