aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php26
1 files changed, 20 insertions, 6 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 95bee9789f..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.
*
*/
@@ -642,6 +646,7 @@ $template->assign_vars(array(
'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&amp;t=$topic_id",
'U_FORUM' => $server_path,
'U_VIEW_TOPIC' => $viewtopic_url,
+ 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . ((strlen($u_sort_param)) ? "&amp;$u_sort_param" : '') . (($start) ? "&amp;start=$start" : ''), true, ''),
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=previous"),
'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=next"),
@@ -930,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;
@@ -1041,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;
}
}
@@ -1345,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 . "
@@ -1355,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
{