aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2010-03-11 00:38:56 +0100
committerJoas Schilling <nickvergessen@gmx.de>2011-04-07 13:45:44 +0200
commit3352141264993982215b714ac7a128854494ac1f (patch)
tree1fc4a4d85919402e957b1ce6448764aad791bc0d
parentMerge branch 'develop-olympus' into develop (diff)
downloadphpbb-3352141264993982215b714ac7a128854494ac1f.tar.gz
phpbb-3352141264993982215b714ac7a128854494ac1f.tar.bz2
phpbb-3352141264993982215b714ac7a128854494ac1f.zip
[ticket/9684] Remove code for global announcement in root-files
PHPBB3-9684
-rw-r--r--phpBB/feed.php116
-rw-r--r--phpBB/includes/mcp/mcp_main.php169
-rw-r--r--phpBB/mcp.php14
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/posting.php60
-rw-r--r--phpBB/report.php2
-rw-r--r--phpBB/search.php31
-rw-r--r--phpBB/styles/prosilver/template/search_results.html11
-rw-r--r--phpBB/viewforum.php4
-rw-r--r--phpBB/viewtopic.php72
10 files changed, 52 insertions, 429 deletions
diff --git a/phpBB/feed.php b/phpBB/feed.php
index 7af422629d..1a09e4da23 100644
--- a/phpBB/feed.php
+++ b/phpBB/feed.php
@@ -775,9 +775,6 @@ class phpbb_feed_overall extends phpbb_feed_post_base
return false;
}
- // Add global forum id
- $forum_ids[] = 0;
-
// m_approve forums
$fid_m_approve = $this->get_moderator_approve_forums();
$sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $db->sql_in_set('forum_id', $fid_m_approve) : '';
@@ -915,12 +912,11 @@ class phpbb_feed_forum extends phpbb_feed_post_base
global $auth, $db;
$m_approve = ($auth->acl_get('m_approve', $this->forum_id)) ? true : false;
- $forum_ids = array(0, $this->forum_id);
// Determine topics with recent activity
$sql = 'SELECT topic_id, topic_last_post_time
FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . '
+ WHERE forum_id = ' . $this->forum_id . '
AND topic_moved_id = 0
' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . '
ORDER BY topic_last_post_time DESC';
@@ -1009,96 +1005,37 @@ class phpbb_feed_topic extends phpbb_feed_post_base
trigger_error('NO_TOPIC');
}
- if ($this->topic_data['topic_type'] == POST_GLOBAL)
- {
- // We need to find at least one postable forum where feeds are enabled,
- // that the user can read and maybe also has approve permissions.
- $in_fid_ary = $this->get_readable_forums();
-
- if (empty($in_fid_ary))
- {
- // User cannot read any forums
- trigger_error('SORRY_AUTH_READ');
- }
-
- if (!$this->topic_data['topic_approved'])
- {
- // Also require m_approve
- $in_fid_ary = array_intersect($in_fid_ary, $this->get_moderator_approve_forums());
-
- if (empty($in_fid_ary))
- {
- trigger_error('SORRY_AUTH_READ');
- }
- }
-
- // Diff excluded forums
- $in_fid_ary = array_diff($in_fid_ary, $this->get_excluded_forums());
-
- if (empty($in_fid_ary))
- {
- trigger_error('SORRY_AUTH_READ');
- }
-
- // Also exclude passworded forums
- $in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums());
-
- if (empty($in_fid_ary))
- {
- trigger_error('SORRY_AUTH_READ');
- }
-
- $sql = 'SELECT forum_id, left_id
- FROM ' . FORUMS_TABLE . '
- WHERE forum_type = ' . FORUM_POST . '
- AND ' . $db->sql_in_set('forum_id', $in_fid_ary) . '
- ORDER BY left_id ASC';
- $result = $db->sql_query_limit($sql, 1);
- $this->forum_data = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (empty($this->forum_data))
- {
- // No forum found.
- trigger_error('SORRY_AUTH_READ');
- }
+ $this->forum_id = (int) $this->topic_data['forum_id'];
- unset($in_fid_ary);
+ // Make sure topic is either approved or user authed
+ if (!$this->topic_data['topic_approved'] && !$auth->acl_get('m_approve', $this->forum_id))
+ {
+ trigger_error('SORRY_AUTH_READ');
}
- else
+
+ // Make sure forum is not excluded from feed
+ if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options']))
{
- $this->forum_id = (int) $this->topic_data['forum_id'];
+ trigger_error('NO_FEED');
+ }
- // Make sure topic is either approved or user authed
- if (!$this->topic_data['topic_approved'] && !$auth->acl_get('m_approve', $this->forum_id))
- {
- trigger_error('SORRY_AUTH_READ');
- }
+ // Make sure we can read this forum
+ if (!$auth->acl_get('f_read', $this->forum_id))
+ {
+ trigger_error('SORRY_AUTH_READ');
+ }
- // Make sure forum is not excluded from feed
- if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options']))
- {
- trigger_error('NO_FEED');
- }
+ // Make sure forum is not passworded or user is authed
+ if ($this->topic_data['forum_password'])
+ {
+ $forum_ids_passworded = $this->get_passworded_forums();
- // Make sure we can read this forum
- if (!$auth->acl_get('f_read', $this->forum_id))
+ if (isset($forum_ids_passworded[$this->forum_id]))
{
trigger_error('SORRY_AUTH_READ');
}
- // Make sure forum is not passworded or user is authed
- if ($this->topic_data['forum_password'])
- {
- $forum_ids_passworded = $this->get_passworded_forums();
-
- if (isset($forum_ids_passworded[$this->forum_id]))
- {
- trigger_error('SORRY_AUTH_READ');
- }
-
- unset($forum_ids_passworded);
- }
+ unset($forum_ids_passworded);
}
}
@@ -1245,9 +1182,6 @@ class phpbb_feed_news extends phpbb_feed_topic_base
return false;
}
- // Add global forum
- $in_fid_ary[] = 0;
-
// We really have to get the post ids first!
$sql = 'SELECT topic_first_post_id, topic_time
FROM ' . TOPICS_TABLE . '
@@ -1318,9 +1252,6 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
return false;
}
- // Add global forum
- $in_fid_ary[] = 0;
-
// We really have to get the post ids first!
$sql = 'SELECT topic_first_post_id, topic_time
FROM ' . TOPICS_TABLE . '
@@ -1410,9 +1341,6 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
return false;
}
- // Add global forum
- $in_fid_ary[] = 0;
-
// Search for topics in last X days
$last_post_time_sql = ($this->sort_days) ? ' AND topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : '';
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index db7bc7c7ea..b9964f48a7 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -333,131 +333,22 @@ function change_topic_type($action, $topic_ids)
if (confirm_box(true))
{
- if ($new_topic_type != POST_GLOBAL)
+ $sql = 'UPDATE ' . TOPICS_TABLE . "
+ SET topic_type = $new_topic_type
+ WHERE " . $db->sql_in_set('topic_id', $topic_ids);
+ $db->sql_query($sql);
+
+ if (($new_topic_type == POST_GLOBAL) && sizeof($topic_ids))
{
+ // Delete topic shadows for global announcements
+ $sql = 'DELETE FROM ' . TOPICS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids);
+ $db->sql_query($sql);
+
$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type
- WHERE " . $db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id <> 0';
+ WHERE " . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);
-
- // Reset forum id if a global topic is within the array
- $to_forum_id = request_var('to_forum_id', 0);
-
- if ($to_forum_id)
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_type = $new_topic_type, forum_id = $to_forum_id
- WHERE " . $db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id = 0';
- $db->sql_query($sql);
-
- // Update forum_ids for all posts
- $sql = 'UPDATE ' . POSTS_TABLE . "
- SET forum_id = $to_forum_id
- WHERE " . $db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id = 0';
- $db->sql_query($sql);
-
- // Do a little forum sync stuff
- $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed
- FROM ' . TOPICS_TABLE . ' t
- WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids);
- $result = $db->sql_query($sql);
- $row_data = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $sync_sql = array();
-
- if ($row_data['topic_posts'])
- {
- $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . (int) $row_data['topic_posts'];
- }
-
- if ($row_data['topics_authed'])
- {
- $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . (int) $row_data['topics_authed'];
- }
-
- $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . (int) sizeof($topic_ids);
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- $db->sql_query($sql);
- }
-
- sync('forum', 'forum_id', $to_forum_id);
- }
- }
- else
- {
- // Get away with those topics already being a global announcement by re-calculating $topic_ids
- $sql = 'SELECT topic_id
- FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id <> 0';
- $result = $db->sql_query($sql);
-
- $topic_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $topic_ids[] = $row['topic_id'];
- }
- $db->sql_freeresult($result);
-
- if (sizeof($topic_ids))
- {
- // Delete topic shadows for global announcements
- $sql = 'DELETE FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids);
- $db->sql_query($sql);
-
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_type = $new_topic_type, forum_id = 0
- WHERE " . $db->sql_in_set('topic_id', $topic_ids);
- $db->sql_query($sql);
-
- // Update forum_ids for all posts
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET forum_id = 0
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
- $db->sql_query($sql);
-
- // Do a little forum sync stuff
- $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed
- FROM ' . TOPICS_TABLE . ' t
- WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids);
- $result = $db->sql_query($sql);
- $row_data = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $sync_sql = array();
-
- if ($row_data['topic_posts'])
- {
- $sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . (int) $row_data['topic_posts'];
- }
-
- if ($row_data['topics_authed'])
- {
- $sync_sql[$forum_id][] = 'forum_topics = forum_topics - ' . (int) $row_data['topics_authed'];
- }
-
- $sync_sql[$forum_id][] = 'forum_topics_real = forum_topics_real - ' . (int) sizeof($topic_ids);
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- $db->sql_query($sql);
- }
-
- sync('forum', 'forum_id', $forum_id);
- }
}
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
@@ -474,41 +365,7 @@ function change_topic_type($action, $topic_ids)
}
else
{
- // Global topic involved?
- $global_involved = false;
-
- if ($new_topic_type != POST_GLOBAL)
- {
- $sql = 'SELECT forum_id
- FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
- AND forum_id = 0';
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if ($row)
- {
- $global_involved = true;
- }
- }
-
- if ($global_involved)
- {
- global $template;
-
- $template->assign_vars(array(
- 'S_FORUM_SELECT' => make_forum_select(request_var('f', $forum_id), false, false, true, true),
- 'S_CAN_LEAVE_SHADOW' => false,
- 'ADDITIONAL_MSG' => (sizeof($topic_ids) == 1) ? $user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENT'] : $user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENTS'])
- );
-
- confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields), 'mcp_move.html');
- }
- else
- {
- confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields));
- }
+ confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields));
}
$redirect = request_var('redirect', "index.$phpEx");
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 401a12d0f9..0029d224cd 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -85,7 +85,7 @@ if ($post_id)
$db->sql_freeresult($result);
$topic_id = (int) $row['topic_id'];
- $forum_id = (int) ($row['forum_id']) ? $row['forum_id'] : $forum_id;
+ $forum_id = (int) $row['forum_id'];
}
else if ($topic_id)
{
@@ -400,12 +400,6 @@ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false)
while ($row = $db->sql_fetchrow($result))
{
- if (!$row['forum_id'])
- {
- // Global Announcement?
- $row['forum_id'] = request_var('f', 0);
- }
-
$rowset[$row['topic_id']] = $row;
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
@@ -485,12 +479,6 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
while ($row = $db->sql_fetchrow($result))
{
- if (!$row['forum_id'])
- {
- // Global Announcement?
- $row['forum_id'] = request_var('f', 0);
- }
-
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
{
continue;
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index ff74d0d0cd..64d29d18bd 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1136,7 +1136,7 @@ switch ($mode)
$sql = 'SELECT DISTINCT poster_id
FROM ' . POSTS_TABLE . '
WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips)
- AND forum_id IN (0, " . implode(', ', $ip_forums) . ')';
+ AND forum_id IN (" . implode(', ', $ip_forums) . ')';
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 41559056b9..2fcfd126eb 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -87,8 +87,7 @@ switch ($mode)
$sql = 'SELECT f.*, t.*
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE t.topic_id = $topic_id
- AND (f.forum_id = t.forum_id
- OR f.forum_id = $forum_id)" .
+ AND f.forum_id = t.forum_id" .
(($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1');
break;
@@ -116,8 +115,7 @@ switch ($mode)
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND u.user_id = p.poster_id
- AND (f.forum_id = t.forum_id
- OR f.forum_id = $forum_id)" .
+ AND f.forum_id = t.forum_id" .
(($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1');
break;
@@ -1005,60 +1003,6 @@ if ($submit || $preview || $refresh)
// Store message, sync counters
if (!sizeof($error) && $submit)
{
- // Check if we want to de-globalize the topic... and ask for new forum
- if ($post_data['topic_type'] != POST_GLOBAL)
- {
- $sql = 'SELECT topic_type, forum_id
- FROM ' . TOPICS_TABLE . "
- WHERE topic_id = $topic_id";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if ($row && !$row['forum_id'] && $row['topic_type'] == POST_GLOBAL)
- {
- $to_forum_id = request_var('to_forum_id', 0);
-
- if ($to_forum_id)
- {
- $sql = 'SELECT forum_type
- FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . $to_forum_id;
- $result = $db->sql_query($sql);
- $forum_type = (int) $db->sql_fetchfield('forum_type');
- $db->sql_freeresult($result);
-
- if ($forum_type != FORUM_POST || !$auth->acl_get('f_post', $to_forum_id) || (!$auth->acl_get('m_approve', $to_forum_id) && !$auth->acl_get('f_noapprove', $to_forum_id)))
- {
- $to_forum_id = 0;
- }
- }
-
- if (!$to_forum_id)
- {
- include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
-
- $template->assign_vars(array(
- 'S_FORUM_SELECT' => make_forum_select(false, false, false, true, true, true),
- 'S_UNGLOBALISE' => true)
- );
-
- $submit = false;
- $refresh = true;
- }
- else
- {
- if (!$auth->acl_get('f_post', $to_forum_id))
- {
- // This will only be triggered if the user tried to trick the forum.
- trigger_error('NOT_AUTHORISED');
- }
-
- $forum_id = $to_forum_id;
- }
- }
- }
-
if ($submit)
{
// Lock/Unlock Topic
diff --git a/phpBB/report.php b/phpBB/report.php
index 8e780813ff..a30914392b 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -70,7 +70,7 @@ if ($post_id)
trigger_error('POST_NOT_EXIST');
}
- $forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id;
+ $forum_id = (int) $report_data['forum_id'];
$topic_id = (int) $report_data['topic_id'];
$sql = 'SELECT *
diff --git a/phpBB/search.php b/phpBB/search.php
index 7f5c49f4fc..c68931f33f 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -832,35 +832,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$result_topic_id = $row['topic_id'];
$topic_title = censor_text($row['topic_title']);
- // we need to select a forum id for this global topic
- if (!$forum_id)
- {
- if (!isset($g_forum_id))
- {
- // Get a list of forums the user cannot read
- $forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));
-
- // Determine first forum the user is able to read (must not be a category)
- $sql = 'SELECT forum_id
- FROM ' . FORUMS_TABLE . '
- WHERE forum_type = ' . FORUM_POST;
-
- if (sizeof($forum_ary))
- {
- $sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
- }
-
- $result = $db->sql_query_limit($sql, 1);
- $g_forum_id = (int) $db->sql_fetchfield('forum_id');
- }
- $u_forum_id = $g_forum_id;
- }
- else
- {
- $u_forum_id = $forum_id;
- }
-
- $view_topic_url_params = "f=$u_forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
+ $view_topic_url_params = "f=$forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
@@ -911,7 +883,6 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
- 'S_TOPIC_GLOBAL' => (!$forum_id) ? true : false,
'S_TOPIC_TYPE' => $row['topic_type'],
'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false,
'S_UNREAD_TOPIC' => $unread_topic,
diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html
index fec71c1051..942d154d44 100644
--- a/phpBB/styles/prosilver/template/search_results.html
+++ b/phpBB/styles/prosilver/template/search_results.html
@@ -58,8 +58,7 @@
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF -->
<!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
<!-- IF searchresults.PAGINATION --><strong class="pagination"><span>{searchresults.PAGINATION}</span></strong><!-- ENDIF -->
- {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} &raquo; {searchresults.FIRST_POST_TIME}
- <!-- IF not searchresults.S_TOPIC_GLOBAL -->{L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a><!-- ELSE --> ({L_GLOBAL})<!-- ENDIF -->
+ {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} &raquo; {searchresults.FIRST_POST_TIME} &raquo; {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a>
</dt>
<dd class="posts">{searchresults.TOPIC_REPLIES}</dd>
<dd class="views">{searchresults.TOPIC_VIEWS}</dd>
@@ -102,12 +101,8 @@
<dt class="author">{L_POST_BY_AUTHOR} {searchresults.POST_AUTHOR_FULL}</dt>
<dd>{searchresults.POST_DATE}</dd>
<dd>&nbsp;</dd>
- <!-- IF searchresults.FORUM_TITLE -->
- <dd>{L_FORUM}: <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></dd>
- <dd>{L_TOPIC}: <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a></dd>
- <!-- ELSE -->
- <dd>{L_GLOBAL}: <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a></dd>
- <!-- ENDIF -->
+ <dd>{L_FORUM}: <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></dd>
+ <dd>{L_TOPIC}: <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a></dd>
<dd>{L_REPLIES}: <strong>{searchresults.TOPIC_REPLIES}</strong></dd>
<dd>{L_VIEWS}: <strong>{searchresults.TOPIC_VIEWS}</strong></dd>
</dl>
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 16d8b56d88..ebf2dc3501 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -365,8 +365,8 @@ if ($forum_data['forum_type'] == FORUM_POST)
'FROM' => $sql_array['FROM'],
'LEFT_JOIN' => $sql_array['LEFT_JOIN'],
- 'WHERE' => 't.forum_id IN (' . $forum_id . ', 0)
- AND t.topic_type IN (' . POST_ANNOUNCE . ', ' . POST_GLOBAL . ')',
+ 'WHERE' => '(t.forum_id = ' . $forum_id . '
+ AND t.topic_type = ' . POST_ANNOUNCE . ') OR t.topic_type = ' . POST_GLOBAL,
'ORDER_BY' => 't.topic_time DESC',
));
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 6c188eeee3..53119e2ae7 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -152,26 +152,12 @@ if ($view && !$post_id)
else
{
$topic_id = $row['topic_id'];
-
- // Check for global announcement correctness?
- if (!$row['forum_id'] && !$forum_id)
- {
- trigger_error('NO_TOPIC');
- }
- else if ($row['forum_id'])
- {
- $forum_id = $row['forum_id'];
- }
+ $forum_id = $row['forum_id'];
}
}
}
- // Check for global announcement correctness?
- if ((!isset($row) || !$row['forum_id']) && !$forum_id)
- {
- trigger_error('NO_TOPIC');
- }
- else if (isset($row) && $row['forum_id'])
+ if (isset($row) && $row['forum_id'])
{
$forum_id = $row['forum_id'];
}
@@ -186,13 +172,6 @@ $sql_array = array(
'FROM' => array(FORUMS_TABLE => 'f'),
);
-// Firebird handles two columns of the same name a little differently, this
-// addresses that by forcing the forum_id to come from the forums table.
-if ($db->sql_layer === 'firebird')
-{
- $sql_array['SELECT'] = 'f.forum_id AS forum_id, ' . $sql_array['SELECT'];
-}
-
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
if ($post_id)
{
@@ -247,26 +226,8 @@ else
$sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id";
}
-$sql_array['WHERE'] .= ' AND (f.forum_id = t.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'] .= ')';
-
-// Join to forum table on topic forum_id unless topic forum_id is zero
-// whereupon we join on the forum_id passed as a parameter ... this
-// is done so navigation, forum name, etc. remain consistent with where
-// user clicked to view a global topic
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
$topic_data = $db->sql_fetchrow($result);
@@ -1540,7 +1501,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 . '&amp;p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $forum_id . '&amp;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&amp;mode=approve_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
- 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&amp;f=' . $forum_id : '') . '#p' . $row['post_id'],
+ 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_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&amp;mode=user_notes&amp;u=' . $poster_id, true, $user->session_id) : '',
@@ -1616,34 +1577,13 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use
}
}
-// Get last post time for all global announcements
-// to keep proper forums tracking
-if ($topic_data['topic_type'] == POST_GLOBAL)
-{
- $sql = 'SELECT topic_last_post_time as forum_last_post_time
- FROM ' . TOPICS_TABLE . '
- WHERE forum_id = 0
- ORDER BY topic_last_post_time DESC';
- $result = $db->sql_query_limit($sql, 1);
- $topic_data['forum_last_post_time'] = (int) $db->sql_fetchfield('forum_last_post_time');
- $db->sql_freeresult($result);
-
- $sql = 'SELECT mark_time as forum_mark_time
- FROM ' . FORUMS_TRACK_TABLE . '
- WHERE forum_id = 0
- AND user_id = ' . $user->data['user_id'];
- $result = $db->sql_query($sql);
- $topic_data['forum_mark_time'] = (int) $db->sql_fetchfield('forum_mark_time');
- $db->sql_freeresult($result);
-}
-
// Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed.
if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id])
{
- markread('topic', (($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_id, $max_post_time);
+ markread('topic', $forum_id, $topic_id, $max_post_time);
// Update forum info
- $all_marked_read = update_forum_tracking_info((($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false);
+ $all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false);
}
else
{