diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-28 21:45:39 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-05-28 21:45:39 +0200 |
commit | e2308df14d61c91ab93a6da191b7df6f83ee5af8 (patch) | |
tree | 31da598c3aaf7012a30a43ada5131e2a83f7b4c8 /phpBB/viewtopic.php | |
parent | c8e7b2c5d4a8bbc33cc9cf394fa2a4f978cca63c (diff) | |
parent | ad4a373557adc93c0490471b472312483ac0b1a0 (diff) | |
download | forums-e2308df14d61c91ab93a6da191b7df6f83ee5af8.tar forums-e2308df14d61c91ab93a6da191b7df6f83ee5af8.tar.gz forums-e2308df14d61c91ab93a6da191b7df6f83ee5af8.tar.bz2 forums-e2308df14d61c91ab93a6da191b7df6f83ee5af8.tar.xz forums-e2308df14d61c91ab93a6da191b7df6f83ee5af8.zip |
Merge pull request #2426 from Nicofuma/ticket/12174
[ticket/12174] Update topic_attachment flag when a post is soft-deleted
* Nicofuma/ticket/12174:
[ticket/12174] Add tests
[ticket/12174] Coding style
[ticket/12174] Remove $update_topic_attachments_flag
[ticket/12174] Don't update the flag for a post without attachment
[ticket/12174] Update the conditions
[ticket/12174] Remove inline assignment
[ticket/12174] Update sql query
[ticket/12174] Revert the changes on $topic_update_array
[ticket/12174] Corrections
[ticket/12174] Update topic_attachment flag when a post is soft-deleted
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 6c72cd2ce5..385a4cfe55 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -935,7 +935,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; @@ -1046,7 +1046,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; } } @@ -1350,7 +1354,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 . " @@ -1360,6 +1364,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 { |