diff options
author | Chris Smith <toonarmy@phpbb.com> | 2009-03-16 22:39:37 +0000 |
---|---|---|
committer | Chris Smith <toonarmy@phpbb.com> | 2009-03-16 22:39:37 +0000 |
commit | b933bc87e207a5e4c3ddf695e9b65fbb8dbb7079 (patch) | |
tree | afd5381c4fda783b3a70b6649382b27d11dba55e /phpBB/includes/functions_admin.php | |
parent | 272cde82514dbaa547e584b9c59824f6fc4133c8 (diff) | |
download | forums-b933bc87e207a5e4c3ddf695e9b65fbb8dbb7079.tar forums-b933bc87e207a5e4c3ddf695e9b65fbb8dbb7079.tar.gz forums-b933bc87e207a5e4c3ddf695e9b65fbb8dbb7079.tar.bz2 forums-b933bc87e207a5e4c3ddf695e9b65fbb8dbb7079.tar.xz forums-b933bc87e207a5e4c3ddf695e9b65fbb8dbb7079.zip |
Deleting private message attachments could delete post attachments. #42815
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9379 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r-- | phpBB/includes/functions_admin.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5ec51e44cf..5da18d250c 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -814,11 +814,14 @@ function delete_attachments($mode, $ids, $resync = true) return false; } + $sql_where = ''; + switch ($mode) { case 'post': case 'message': $sql_id = 'post_msg_id'; + $sql_where = ' AND in_message = ' . ($mode == 'message' ? 1 : 0); break; case 'topic': @@ -842,6 +845,9 @@ function delete_attachments($mode, $ids, $resync = true) $sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set($sql_id, $ids); + + $sql .= $sql_where; + $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -867,6 +873,9 @@ function delete_attachments($mode, $ids, $resync = true) // Delete attachments $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set($sql_id, $ids); + + $sql .= $sql_where; + $db->sql_query($sql); $num_deleted = $db->sql_affectedrows(); |