aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewforum.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2010-03-25 12:31:37 +0100
committerJoas Schilling <nickvergessen@gmx.de>2011-04-07 13:47:10 +0200
commit0b85dded29b87feb09449d5a12388ccb23e9d1f2 (patch)
tree0d193d9d1195c71bab31dfb77b6b1f254c642d15 /phpBB/viewforum.php
parent712a51caeadef42eff9131ed2e97ee2ab5291888 (diff)
downloadforums-0b85dded29b87feb09449d5a12388ccb23e9d1f2.tar
forums-0b85dded29b87feb09449d5a12388ccb23e9d1f2.tar.gz
forums-0b85dded29b87feb09449d5a12388ccb23e9d1f2.tar.bz2
forums-0b85dded29b87feb09449d5a12388ccb23e9d1f2.tar.xz
forums-0b85dded29b87feb09449d5a12388ccb23e9d1f2.zip
[ticket/9684] View origin-forumname for GAs in topic-list
Correct some links using ['forum_id'] instead of $forum_id. Correctly handle from "sort by day"-viewforum when there are global announcements displayed in the forum. PHPBB3-9684
Diffstat (limited to 'phpBB/viewforum.php')
-rw-r--r--phpBB/viewforum.php41
1 files changed, 22 insertions, 19 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 0c673f1b74..c53150d89b 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -177,8 +177,7 @@ if ($mark_read == 'topics')
$token = request_var('hash', '');
if (check_link_hash($token, 'global'))
{
- // Add 0 to forums array to mark global announcements correctly
- markread('topics', array($forum_id, 0));
+ markread('topics', array($forum_id));
}
$redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
meta_refresh(3, $redirect_url);
@@ -238,9 +237,10 @@ if ($sort_days)
$sql = 'SELECT COUNT(topic_id) AS num_topics
FROM ' . TOPICS_TABLE . "
WHERE forum_id = $forum_id
- AND ((topic_type <> " . POST_GLOBAL . " AND topic_last_post_time >= $min_post_time)
- OR topic_type = " . POST_ANNOUNCE . ")
- " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND topic_approved = 1');
+ AND (topic_last_post_time >= $min_post_time
+ OR topic_type = " . POST_ANNOUNCE . '
+ OR topic_type = ' . POST_GLOBAL . ')
+ ' . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND topic_approved = 1');
$result = $db->sql_query($sql);
$topics_count = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);
@@ -363,11 +363,15 @@ if ($forum_data['forum_type'] == FORUM_POST)
$g_forum_ary = $auth->acl_getf('f_read', true);
$g_forum_ary = array_unique(array_keys($g_forum_ary));
+ $sql_anounce_array['LEFT_JOIN'] = $sql_array['LEFT_JOIN'];
+ $sql_anounce_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id');
+ $sql_anounce_array['SELECT'] = $sql_array['SELECT'] . ', f.forum_name';
+
// Obtain announcements ... removed sort ordering, sort by time in all cases
$sql = $db->sql_build_query('SELECT', array(
- 'SELECT' => $sql_array['SELECT'],
+ 'SELECT' => $sql_anounce_array['SELECT'],
'FROM' => $sql_array['FROM'],
- 'LEFT_JOIN' => $sql_array['LEFT_JOIN'],
+ 'LEFT_JOIN' => $sql_anounce_array['LEFT_JOIN'],
'WHERE' => '(t.forum_id = ' . $forum_id . '
AND t.topic_type = ' . POST_ANNOUNCE . ') OR
@@ -383,12 +387,9 @@ if ($forum_data['forum_type'] == FORUM_POST)
$rowset[$row['topic_id']] = $row;
$announcement_list[] = $row['topic_id'];
- if ($forum_id == $row['forum_id'])
- {
- $topics_count--;
- }
- else
+ if ($forum_id != $row['forum_id'])
{
+ $topics_count++;
$global_announce_forums[] = $row['forum_id'];
}
}
@@ -649,16 +650,16 @@ if (sizeof($topic_list))
topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
// Generate all the URIs ...
- $view_topic_url_params = 'f=' . $topic_forum_id . '&amp;t=' . $topic_id;
+ $view_topic_url_params = 'f=' . $row['forum_id'] . '&amp;t=' . $topic_id;
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
- $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $topic_forum_id)) ? true : false;
- $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $topic_forum_id)) ? true : false;
+ $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
+ $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&amp;t=$topic_id", true, $user->session_id) : '';
// Send vars to template
$template->assign_block_vars('topicrow', array(
- 'FORUM_ID' => $topic_forum_id,
+ 'FORUM_ID' => $row['forum_id'],
'TOPIC_ID' => $topic_id,
'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
@@ -676,6 +677,7 @@ if (sizeof($topic_list))
'VIEWS' => $row['topic_views'],
'TOPIC_TITLE' => censor_text($row['topic_title']),
'TOPIC_TYPE' => $topic_type,
+ 'FORUM_NAME' => (isset($row['forum_name'])) ? $row['forum_name'] : $forum_data['forum_name'],
'TOPIC_IMG_STYLE' => $folder_img,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
@@ -687,13 +689,13 @@ if (sizeof($topic_list))
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
- 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
+ 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['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_TYPE' => $row['topic_type'],
'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
'S_UNREAD_TOPIC' => $unread_topic,
- 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $topic_forum_id)) ? true : false,
+ 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
'S_HAS_POLL' => ($row['poll_start']) ? true : false,
@@ -708,7 +710,8 @@ if (sizeof($topic_list))
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'U_VIEW_TOPIC' => $view_topic_url,
- 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=reports&amp;f=' . $topic_forum_id . '&amp;t=' . $topic_id, true, $user->session_id),
+ 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
+ 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=reports&amp;f=' . $row['forum_id'] . '&amp;t=' . $topic_id, true, $user->session_id),
'U_MCP_QUEUE' => $u_mcp_queue,
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)