diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2009-07-24 09:01:29 +0000 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2009-07-24 09:01:29 +0000 |
commit | 780854818b22ccdf36fe50e4e4bf5e68027c9e2b (patch) | |
tree | 5bbea1b2486ca642d37918aae91c7087c8f05bd5 /phpBB/includes/functions_posting.php | |
parent | 433f03107de1162744a1d0b8c9fa3c4ba1b3ed21 (diff) | |
download | forums-780854818b22ccdf36fe50e4e4bf5e68027c9e2b.tar forums-780854818b22ccdf36fe50e4e4bf5e68027c9e2b.tar.gz forums-780854818b22ccdf36fe50e4e4bf5e68027c9e2b.tar.bz2 forums-780854818b22ccdf36fe50e4e4bf5e68027c9e2b.tar.xz forums-780854818b22ccdf36fe50e4e4bf5e68027c9e2b.zip |
Fix bug #48265 - Correctly set attachment flag for topics, posts and pms after deleting attachments - Patch by WorldWar and nickvergessen
Authorised by: AcydBurn
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9843 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r-- | phpBB/includes/functions_posting.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 7db2875cda..e348694cfe 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1549,6 +1549,21 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) break; } + if (($post_mode == 'delete') || ($post_mode == 'delete_last_post') || ($post_mode == 'delete_first_post')) + { + $sql = 'SELECT 1 AS has_attachments + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $result = $db->sql_query($sql); + $has_attachments = (int) $db->sql_fetchfield('has_attachments'); + $db->sql_freeresult($result); + + if (!$has_attachments) + { + $sql_data[TOPICS_TABLE] .= ', topic_attachment = 0'; + } + } + // $sql_data[USERS_TABLE] = ($data['post_postcount']) ? 'user_posts = user_posts - 1' : ''; $db->sql_transaction('begin'); |