diff --git a/includes/ucp/ucp_pm_compose.php b/includes/ucp/ucp_pm_compose.php index 8bd227e9..4b376896 100644 --- a/includes/ucp/ucp_pm_compose.php +++ b/includes/ucp/ucp_pm_compose.php @@ -686,6 +686,13 @@ function compose_pm($id, $mode, $action, $user_folders = array()) ); $db->sql_query($sql); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', array_map(function ($attach) + { + return (int) $attach['attach_id']; + }, $message_parser->attachment_data)); + $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=$mode"); meta_refresh(3, $redirect_url); diff --git a/posting.php b/posting.php index 4efdf029..c7437204 100644 --- a/posting.php +++ b/posting.php @@ -756,6 +756,13 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( ); $db->sql_query($sql); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', array_map(function ($attach) + { + return (int) $attach['attach_id']; + }, $message_parser->attachment_data)); + $meta_info = ($mode == 'post') ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); meta_refresh(3, $meta_info);