aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 4553917d80..385a4cfe55 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1,9 +1,13 @@
<?php
/**
*
-* @package phpBB3
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
@@ -931,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;
@@ -1042,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;
}
}
@@ -1346,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 . "
@@ -1356,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
{