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 | |
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
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 3 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f43d08c8e1..ab3f01af71 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -120,6 +120,7 @@ <li>[Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)</li> <li>[Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)</li> <li>[Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)</li> + <li>[Fix] Deleting private message attachments could delete post attachments. (Bug #42815)</li> <li>[Change] Allow download of conflicting file for later reference in automatic updater</li> <li>[Change] Default difference view is now 'inline' instead of 'side by side'</li> <li>[Change] Added new option for merging differences to conflicting files in automatic updater</li> @@ -861,4 +862,4 @@ </div> </body> -</html>
\ No newline at end of file +</html> 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(); |