diff options
| -rw-r--r-- | phpBB/templates/subSilver/viewtopic_body.html | 2 | ||||
| -rw-r--r-- | phpBB/viewtopic.php | 52 |
2 files changed, 34 insertions, 20 deletions
diff --git a/phpBB/templates/subSilver/viewtopic_body.html b/phpBB/templates/subSilver/viewtopic_body.html index 7ce5b6ec36..1277d2aa86 100644 --- a/phpBB/templates/subSilver/viewtopic_body.html +++ b/phpBB/templates/subSilver/viewtopic_body.html @@ -198,7 +198,7 @@ <tr class="row2"> <!-- ENDIF --> - <td class="nav" width="150" align="center" valign="middle"><a href="#top">{L_BACK_TO_TOP}</a></td> + <td class="nav" width="150" align="center" valign="middle"><!-- IF MCP --><a href="{postrow.U_MCP_DETAILS}">{L_POST_DETAILS}</a><!-- ELSE --><a href="#top">{L_BACK_TO_TOP}</a><!-- ENDIF --></td> <td width="100%" height="28" valign="bottom" nowrap="nowrap"><table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="middle" nowrap="nowrap"><!-- IF postrow.U_PROFILE --><a href="{postrow.U_PROFILE}">{PROFILE_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_PM --><a href="{postrow.U_PM}">{PM_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_EMAIL --><a href="{postrow.U_EMAIL}">{EMAIL_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_WWW --><a href="{postrow.U_WWW}" target="_userwww">{WWW_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_AIM --><a href="{postrow.U_AIM}" onclick="im_popup('{postrow.U_AIM}', 550, 320); return false">{AIM_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_YIM --><a href="{postrow.U_YIM}" onclick="im_popup('{postrow.U_YIM}', 780, 550); return false">{YIM_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_MSN --><a href="{postrow.U_MSN}" onclick="im_popup('{postrow.U_MSN}', 550, 320); return false">{MSN_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_JABBER --><a href="{postrow.U_JABBER}" onclick="im_popup('{postrow.U_JABBER}', 550, 320); return false">{JABBER_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_ICQ --><script language="JavaScript" type="text/javascript"><!-- diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ddbf82b345..6b1858f8f0 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -147,8 +147,8 @@ else $join_sql = (!$post_id) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND p.post_approved = 1 AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_approved = 1 AND p2.post_id <= $post_id"; } } -$extra_fields = (!$post_id) ? '' : ", COUNT(p2.post_id) AS prev_posts"; -$order_sql = (!$post_id) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password ORDER BY p.post_id ASC"; +$extra_fields = (!$post_id) ? '' : ', COUNT(p2.post_id) AS prev_posts'; +$order_sql = (!$post_id) ? '' : 'GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password ORDER BY p.post_id ASC'; if ($user->data['user_id'] != ANONYMOUS) { @@ -169,7 +169,20 @@ if ($user->data['user_id'] != ANONYMOUS) // 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 = 'SELECT t.topic_id, t.forum_id AS real_forum_id, t.topic_title, t.topic_attachment, t.topic_status, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_time, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . ' + +// NOTE: for global announcements, set forum_id to the forum they should be +// displayed by default. Change this query to user POST_GLOBAL rather than +// "forum_id = 0". NOTE2: if you read this I forgot to remove this note before I committed my files. + +$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_time, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . ' + FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . " + WHERE $join_sql + AND (f.forum_id = t.forum_id + " . ((!$forum_id) ? '' : 'OR (t.topic_type = ' . POST_GLOBAL . " AND f.forum_id = $forum_id)") . " + ) + $order_sql"; + +$sql = 'SELECT t.topic_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_replies, t.topic_replies_real, t.topic_last_post_id, t.topic_time, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . ' FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . " WHERE $join_sql AND (f.forum_id = t.forum_id @@ -184,22 +197,26 @@ if (!$topic_data = $db->sql_fetchrow($result)) trigger_error('NO_TOPIC'); } +// Extract the data +extract($topic_data); + +if (!$topic_approved && !$auth->acl_get('m_approve', $forum_id)) +{ + trigger_error('NO_TOPIC'); +} // Setup look and feel -$user->setup(false, $topic_data['forum_style']); - +$user->setup(false, $forum_style); +// TODO: shouldn't this be moved after the f_read check? // Forum is passworded ... check whether access has been granted to this // user this session, if not show login box -if ($topic_data['forum_password']) +if ($forum_password) { login_forum_box($topic_data); } -// Extract the data -extract($topic_data); - // Start auth check if (!$auth->acl_get('f_read', $forum_id)) @@ -438,8 +455,8 @@ $topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '<option value="merge">' $topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="fork">' . $user->lang['FORK_TOPIC'] . '</option>' : ''; $topic_mod .= ($auth->acl_get('m_', $forum_id) && $topic_type != POST_NORMAL) ? '<option value="make_normal">' . $user->lang['MAKE_NORMAL'] . '</option>' : ''; $topic_mod .= ($auth->acl_get('f_sticky', $forum_id) && $topic_type != POST_STICKY) ? '<option value="make_sticky">' . $user->lang['MAKE_STICKY'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('f_announce', $forum_id) && ($topic_type != POST_ANNOUNCE || $real_forum_id == 0)) ? '<option value="make_announce">' . $user->lang['MAKE_ANNOUNCE'] . '</option>' : ''; -$topic_mod .= ($auth->acl_get('f_announce', $forum_id) && ($topic_type != POST_ANNOUNCE || $real_forum_id > 0)) ? '<option value="make_global">' . $user->lang['MAKE_GLOBAL'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('f_announce', $forum_id) && $topic_type != POST_ANNOUNCE) ? '<option value="make_announce">' . $user->lang['MAKE_ANNOUNCE'] . '</option>' : ''; +$topic_mod .= ($auth->acl_get('f_announce', $forum_id) && $topic_type != POST_GLOBAL) ? '<option value="make_global">' . $user->lang['MAKE_GLOBAL'] . '</option>' : ''; $topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="viewlogs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : ''; // If we've got a hightlight set pass it on to pagination. @@ -516,11 +533,11 @@ $template->assign_vars(array( 'U_TOPIC' => $server_path . "viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_FORUM' => $server_path, - 'U_VIEW_UNREAD_POST' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=unread#unread", + 'U_VIEW_UNREAD_POST' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=unread#unread", 'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start&$u_sort_param&hilit=$highlight", 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$forum_id", 'U_VIEW_OLDER_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=previous", - 'U_VIEW_NEWER_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=next", + 'U_VIEW_NEWER_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=next", 'U_PRINT_TOPIC' => ($auth->acl_get('f_print', $forum_id)) ? "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&$u_sort_param&view=print" : '', 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? "memberlist.$phpEx$SID&mode=email&t=$topic_id" : '', @@ -554,13 +571,9 @@ if (!empty($poll_start)) $result = $db->sql_query($sql); $voted_id = array(); - if ($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { - do - { - $voted_id[] = $row['poll_option_id']; - } - while ($row = $db->sql_fetchrow($result)); + $voted_id[] = $row['poll_option_id']; } $db->sql_freeresult($result); } @@ -1116,6 +1129,7 @@ foreach ($rowset as $i => $row) 'U_REPORT' => "report.$phpEx$SID&p=" . $row['post_id'], 'U_MCP_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? "mcp.$phpEx$SID&mode=post_details&p=" . $row['post_id'] : '', 'U_MCP_APPROVE' => "mcp.$phpEx$SID&mode=approve&p=" . $row['post_id'], + 'U_MCP_DETAILS' => "mcp.$phpEx$SID&mode=post_details&p=" . $row['post_id'], 'U_MINI_POST' => "viewtopic.$phpEx$SID&p=" . $row['post_id'] . '#' . $row['post_id'], 'U_POST_ID' => ($unread_post_id == $row['post_id']) ? 'unread' : $row['post_id'], |
