diff options
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r-- | phpBB/viewtopic.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 858a42920c..28522cfc12 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -198,7 +198,21 @@ else $sql_array['FROM'][POSTS_TABLE] = 'p'; } -$sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id ' . ((!$forum_id) ? 'OR t.topic_type = ' . POST_GLOBAL : 'OR (t.topic_type = ' . POST_GLOBAL . " AND f.forum_id = $forum_id)") . ')'; +$sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id'; + +if (!$forum_id) +{ + // If it is a global announcement make sure to set the forum id to a postable forum + $sql_array['WHERE'] .= ' OR (t.topic_type = ' . POST_GLOBAL . ' + AND f.forum_type = ' . FORUM_POST . ')'; +} +else +{ + $sql_array['WHERE'] .= ' OR (t.topic_type = ' . POST_GLOBAL . " + AND f.forum_id = $forum_id)"; +} + +$sql_array['WHERE'] .= ')'; $sql_array['FROM'][TOPICS_TABLE] = 't'; // Join to forum table on topic forum_id unless topic forum_id is zero @@ -1359,7 +1373,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '', 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', - 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '') . '#p' . $row['post_id'], 'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', 'U_PREV_POST_ID' => $prev_post_id, 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', |