diff options
| author | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-07-02 22:36:10 +0000 |
|---|---|---|
| committer | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-07-02 22:36:10 +0000 |
| commit | 2b16fc0874d39c2904b88d52828420ea8a2dd4d2 (patch) | |
| tree | c8f1b6d828262a874141d57251d10c4da1b34976 /phpBB/viewtopic.php | |
| parent | c7322203087998da38f840924a51fd0852d8d75b (diff) | |
| download | forums-2b16fc0874d39c2904b88d52828420ea8a2dd4d2.tar forums-2b16fc0874d39c2904b88d52828420ea8a2dd4d2.tar.gz forums-2b16fc0874d39c2904b88d52828420ea8a2dd4d2.tar.bz2 forums-2b16fc0874d39c2904b88d52828420ea8a2dd4d2.tar.xz forums-2b16fc0874d39c2904b88d52828420ea8a2dd4d2.zip | |
Added a quick link to post details for moderators
git-svn-id: file:///svn/phpbb/trunk@4192 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewtopic.php')
| -rw-r--r-- | phpBB/viewtopic.php | 52 |
1 files changed, 33 insertions, 19 deletions
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'], |
