diff options
| author | Tristan Darricau <github@nicofuma.fr> | 2014-05-08 01:37:53 +0200 |
|---|---|---|
| committer | Tristan Darricau <github@nicofuma.fr> | 2014-05-08 01:43:56 +0200 |
| commit | 79353883066f1a9d5d7b0c40cbd96ce759e94382 (patch) | |
| tree | a4c884c481e2fcae9942be09d9631e0878bdcab3 /phpBB/viewtopic.php | |
| parent | 571d6ae852fd6bc6d3ce57b00cb1faed84f45434 (diff) | |
| download | forums-79353883066f1a9d5d7b0c40cbd96ce759e94382.tar forums-79353883066f1a9d5d7b0c40cbd96ce759e94382.tar.gz forums-79353883066f1a9d5d7b0c40cbd96ce759e94382.tar.bz2 forums-79353883066f1a9d5d7b0c40cbd96ce759e94382.tar.xz forums-79353883066f1a9d5d7b0c40cbd96ce759e94382.zip | |
[ticket/12174] Update topic_attachment flag when a post is soft-deleted
https://tracker.phpbb.com/browse/PHPBB3-12174
PHPBB3-12174
Diffstat (limited to 'phpBB/viewtopic.php')
| -rw-r--r-- | phpBB/viewtopic.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 84040af2bb..a6c20ddc8a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -930,7 +930,7 @@ else // Container for user details, only process once $post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = $post_delete_list = array(); -$has_attachments = $display_notice = false; +$has_unapproved_attachments = $has_approved_attachments = $display_notice = false; $bbcode_bitfield = ''; $i = $i_total = 0; @@ -1041,7 +1041,11 @@ while ($row = $db->sql_fetchrow($result)) if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) { - $has_attachments = true; + $has_unapproved_attachments = true; + } + else if ($row['post_visibility'] == ITEM_APPROVED) + { + $has_approved_attachments = true; } } @@ -1345,7 +1349,7 @@ if (sizeof($attach_list)) $db->sql_query($sql); } } - else if ($has_attachments && !$topic_data['topic_attachment']) + else if ($has_approved_attachments && !$topic_data['topic_attachment']) { // Topic has approved attachments but its flag is wrong $sql = 'UPDATE ' . TOPICS_TABLE . " @@ -1355,6 +1359,11 @@ if (sizeof($attach_list)) $topic_data['topic_attachment'] = 1; } + else if ($has_unapproved_attachments && !$topic_data['topic_attachment']) + { + // Topic has only unapproved attachments but we have the right to see and download them + $topic_data['topic_attachment'] = 1; + } } else { |
