2 /***************************************************************************
5 * begin : Saturday, Feb 13, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
9 * $Id: viewforum.php,v 1.139.2.12 2004/03/13 15:08:23 acydburn Exp $
12 ***************************************************************************/
14 /***************************************************************************
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 ***************************************************************************/
23 define('IN_PHPBB', true);
24 $phpbb_root_path = './';
25 include($phpbb_root_path . 'extension.inc');
26 include($phpbb_root_path . 'common.'.$phpEx);
29 // Start initial var setup
31 if ( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
33 $forum_id = ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]);
35 else if ( isset($HTTP_GET_VARS['forum']))
37 $forum_id = intval($HTTP_GET_VARS['forum']);
44 $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
46 if ( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) )
48 $mark_read = (isset($HTTP_POST_VARS['mark'])) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
55 // End initial var setup
59 // Check if the user has actually sent a forum ID with his/her request
60 // If not give them a nice error page.
62 if ( !empty($forum_id) )
65 FROM " . FORUMS_TABLE . "
66 WHERE forum_id = $forum_id";
67 if ( !($result = $db->sql_query($sql)) )
69 message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
74 message_die(GENERAL_MESSAGE, 'Forum_not_exist');
78 // If the query doesn't return any rows this isn't a valid forum. Inform
81 if ( !($forum_row = $db->sql_fetchrow($result)) )
83 message_die(GENERAL_MESSAGE, 'Forum_not_exist');
87 // Start session management
89 $userdata = session_pagestart($user_ip, $forum_id);
90 init_userprefs($userdata);
92 // End session management
99 $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
101 if ( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
103 if ( !$userdata['session_logged_in'] )
105 $redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : '' );
106 redirect(append_sid("login.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
109 // The user is not authed to read this forum ...
111 $message = ( !$is_auth['auth_view'] ) ? $lang['Forum_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
113 message_die(GENERAL_MESSAGE, $message);
120 // Handle marking posts
122 if ( $mark_read == 'topics' )
124 if ( $userdata['session_logged_in'] )
126 $sql = "SELECT MAX(post_time) AS last_post
127 FROM " . POSTS_TABLE . "
128 WHERE forum_id = $forum_id";
129 if ( !($result = $db->sql_query($sql)) )
131 message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
134 if ( $row = $db->sql_fetchrow($result) )
136 $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
137 $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
139 if ( ( count($tracking_forums) + count($tracking_topics) ) >= 150 && empty($tracking_forums[$forum_id]) )
141 asort($tracking_forums);
142 unset($tracking_forums[key($tracking_forums)]);
145 if ( $row['last_post'] > $userdata['user_lastvisit'] )
147 $tracking_forums[$forum_id] = time();
149 setcookie($board_config['cookie_name'] . '_f', serialize($tracking_forums), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
153 $template->assign_vars(array(
154 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')
158 $message = $lang['Topics_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a> ');
159 message_die(GENERAL_MESSAGE, $message);
162 // End handle marking posts
165 $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : '';
166 $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : '';
169 // Do the forum Prune
171 if ( $is_auth['auth_mod'] && $board_config['prune_enable'] )
173 if ( $forum_row['prune_next'] < time() && $forum_row['prune_enable'] )
175 include($phpbb_root_path . 'includes/prune.'.$phpEx);
176 require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
177 auto_prune($forum_id);
181 // End of forum prune
185 // Obtain list of moderators of each forum
186 // First users, then groups ... broken into two queries
188 $sql = "SELECT u.user_id, u.username
189 FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
190 WHERE aa.forum_id = $forum_id
191 AND aa.auth_mod = " . TRUE . "
192 AND g.group_single_user = 1
193 AND ug.group_id = aa.group_id
194 AND g.group_id = aa.group_id
195 AND u.user_id = ug.user_id
196 GROUP BY u.user_id, u.username
198 if ( !($result = $db->sql_query($sql)) )
200 message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
203 $moderators = array();
204 while( $row = $db->sql_fetchrow($result) )
206 $moderators[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
209 $sql = "SELECT g.group_id, g.group_name
210 FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
211 WHERE aa.forum_id = $forum_id
212 AND aa.auth_mod = " . TRUE . "
213 AND g.group_single_user = 0
214 AND g.group_type <> ". GROUP_HIDDEN ."
215 AND ug.group_id = aa.group_id
216 AND g.group_id = aa.group_id
217 GROUP BY g.group_id, g.group_name
218 ORDER BY g.group_id";
219 if ( !($result = $db->sql_query($sql)) )
221 message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
224 while( $row = $db->sql_fetchrow($result) )
226 $moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
229 $l_moderators = ( count($moderators) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
230 $forum_moderators = ( count($moderators) ) ? implode(', ', $moderators) : $lang['None'];
234 // Generate a 'Show topics in previous x days' select box. If the topicsdays var is sent
235 // then get it's value, find the number of topics with dates newer than it (to properly
236 // handle pagination) and alter the main query
238 $previous_days = array(0, 1, 7, 14, 30, 90, 180, 364);
239 $previous_days_text = array($lang['All_Topics'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']);
241 if ( !empty($HTTP_POST_VARS['topicdays']) || !empty($HTTP_GET_VARS['topicdays']) )
243 $topic_days = ( !empty($HTTP_POST_VARS['topicdays']) ) ? intval($HTTP_POST_VARS['topicdays']) : intval($HTTP_GET_VARS['topicdays']);
244 $min_topic_time = time() - ($topic_days * 86400);
246 $sql = "SELECT COUNT(t.topic_id) AS forum_topics
247 FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
248 WHERE t.forum_id = $forum_id
249 AND p.post_id = t.topic_last_post_id
250 AND p.post_time >= $min_topic_time";
252 if ( !($result = $db->sql_query($sql)) )
254 message_die(GENERAL_ERROR, 'Could not obtain limited topics count information', '', __LINE__, __FILE__, $sql);
256 $row = $db->sql_fetchrow($result);
258 $topics_count = ( $row['forum_topics'] ) ? $row['forum_topics'] : 1;
259 $limit_topics_time = "AND p.post_time >= $min_topic_time";
261 if ( !empty($HTTP_POST_VARS['topicdays']) )
268 $topics_count = ( $forum_row['forum_topics'] ) ? $forum_row['forum_topics'] : 1;
270 $limit_topics_time = '';
274 $select_topic_days = '<select name="topicdays">';
275 for($i = 0; $i < count($previous_days); $i++)
277 $selected = ($topic_days == $previous_days[$i]) ? ' selected="selected"' : '';
278 $select_topic_days .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>';
280 $select_topic_days .= '</select>';
284 // All announcement data, this keeps announcements
285 // on each viewforum page ...
287 $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username
288 FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
289 WHERE t.forum_id = $forum_id
290 AND t.topic_poster = u.user_id
291 AND p.post_id = t.topic_last_post_id
292 AND p.poster_id = u2.user_id
293 AND t.topic_type = " . POST_ANNOUNCE . "
294 ORDER BY t.topic_last_post_id DESC ";
295 if ( !($result = $db->sql_query($sql)) )
297 message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
300 $topic_rowset = array();
301 $total_announcements = 0;
302 while( $row = $db->sql_fetchrow($result) )
304 $topic_rowset[] = $row;
305 $total_announcements++;
308 $db->sql_freeresult($result);
311 // Grab all the basic data (all topics except announcements)
314 $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
315 FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
316 WHERE t.forum_id = $forum_id
317 AND t.topic_poster = u.user_id
318 AND p.post_id = t.topic_first_post_id
319 AND p2.post_id = t.topic_last_post_id
320 AND u2.user_id = p2.poster_id
321 AND t.topic_type <> " . POST_ANNOUNCE . "
323 ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
324 LIMIT $start, ".$board_config['topics_per_page'];
325 if ( !($result = $db->sql_query($sql)) )
327 message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
331 while( $row = $db->sql_fetchrow($result) )
333 $topic_rowset[] = $row;
337 $db->sql_freeresult($result);
342 $total_topics += $total_announcements;
345 // Define censored word matches
347 $orig_word = array();
348 $replacement_word = array();
349 obtain_word_list($orig_word, $replacement_word);
352 // Post URL generation for templating vars
354 $template->assign_vars(array(
355 'L_DISPLAY_TOPICS' => $lang['Display_topics'],
357 'U_POST_NEW_TOPIC' => append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"),
359 'S_SELECT_TOPIC_DAYS' => $select_topic_days,
360 'S_POST_DAYS_ACTION' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&start=$start"))
364 // User authorisation levels output
366 $s_auth_can = ( ( $is_auth['auth_post'] ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br />';
367 $s_auth_can .= ( ( $is_auth['auth_reply'] ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br />';
368 $s_auth_can .= ( ( $is_auth['auth_edit'] ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '<br />';
369 $s_auth_can .= ( ( $is_auth['auth_delete'] ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '<br />';
370 $s_auth_can .= ( ( $is_auth['auth_vote'] ) ? $lang['Rules_vote_can'] : $lang['Rules_vote_cannot'] ) . '<br />';
372 if ( $is_auth['auth_mod'] )
374 $s_auth_can .= sprintf($lang['Rules_moderate'], "<a href=\"modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&start=" . $start . "&sid=" . $userdata['session_id'] . '">', '</a>');
378 // Mozilla navigation bar
380 $nav_links['up'] = array(
381 'url' => append_sid('index.'.$phpEx),
382 'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
386 // Dump out the page header and load viewforum template
388 define('SHOW_ONLINE', true);
389 $page_title = $lang['View_forum'] . ' - ' . $forum_row['forum_name'];
390 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
392 $template->set_filenames(array(
393 'body' => 'viewforum_body.tpl')
395 make_jumpbox('viewforum.'.$phpEx);
397 $template->assign_vars(array(
398 'FORUM_ID' => $forum_id,
399 'FORUM_NAME' => $forum_row['forum_name'],
400 'MODERATORS' => $forum_moderators,
401 'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'],
403 'FOLDER_IMG' => $images['folder'],
404 'FOLDER_NEW_IMG' => $images['folder_new'],
405 'FOLDER_HOT_IMG' => $images['folder_hot'],
406 'FOLDER_HOT_NEW_IMG' => $images['folder_hot_new'],
407 'FOLDER_LOCKED_IMG' => $images['folder_locked'],
408 'FOLDER_LOCKED_NEW_IMG' => $images['folder_locked_new'],
409 'FOLDER_STICKY_IMG' => $images['folder_sticky'],
410 'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'],
411 'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'],
412 'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'],
414 'L_TOPICS' => $lang['Topics'],
415 'L_REPLIES' => $lang['Replies'],
416 'L_VIEWS' => $lang['Views'],
417 'L_POSTS' => $lang['Posts'],
418 'L_LASTPOST' => $lang['Last_Post'],
419 'L_MODERATOR' => $l_moderators,
420 'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'],
421 'L_POST_NEW_TOPIC' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'],
422 'L_NO_NEW_POSTS' => $lang['No_new_posts'],
423 'L_NEW_POSTS' => $lang['New_posts'],
424 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
425 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
426 'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'],
427 'L_NEW_POSTS_HOT' => $lang['New_posts_hot'],
428 'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
429 'L_STICKY' => $lang['Post_Sticky'],
430 'L_POSTED' => $lang['Posted'],
431 'L_JOINED' => $lang['Joined'],
432 'L_AUTHOR' => $lang['Author'],
434 'S_AUTH_LIST' => $s_auth_can,
436 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
438 'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&mark=topics"))
445 // Okay, lets dump out the page ...
449 for($i = 0; $i < $total_topics; $i++)
451 $topic_id = $topic_rowset[$i]['topic_id'];
453 $topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
455 $replies = $topic_rowset[$i]['topic_replies'];
457 $topic_type = $topic_rowset[$i]['topic_type'];
459 if( $topic_type == POST_ANNOUNCE )
461 $topic_type = $lang['Topic_Announcement'] . ' ';
463 else if( $topic_type == POST_STICKY )
465 $topic_type = $lang['Topic_Sticky'] . ' ';
472 if( $topic_rowset[$i]['topic_vote'] )
474 $topic_type .= $lang['Topic_Poll'] . ' ';
477 if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
479 $topic_type = $lang['Topic_Moved'] . ' ';
480 $topic_id = $topic_rowset[$i]['topic_moved_id'];
482 $folder_image = $images['folder'];
483 $folder_alt = $lang['Topics_Moved'];
484 $newest_post_img = '';
488 if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
490 $folder = $images['folder_announce'];
491 $folder_new = $images['folder_announce_new'];
493 else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
495 $folder = $images['folder_sticky'];
496 $folder_new = $images['folder_sticky_new'];
498 else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
500 $folder = $images['folder_locked'];
501 $folder_new = $images['folder_locked_new'];
505 if($replies >= $board_config['hot_threshold'])
507 $folder = $images['folder_hot'];
508 $folder_new = $images['folder_hot_new'];
512 $folder = $images['folder'];
513 $folder_new = $images['folder_new'];
517 $newest_post_img = '';
518 if( $userdata['session_logged_in'] )
520 if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] )
522 if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
524 $unread_topics = true;
526 if( !empty($tracking_topics[$topic_id]) )
528 if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
530 $unread_topics = false;
534 if( !empty($tracking_forums[$forum_id]) )
536 if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] )
538 $unread_topics = false;
542 if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
544 if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] )
546 $unread_topics = false;
552 $folder_image = $folder_new;
553 $folder_alt = $lang['New_posts'];
555 $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
559 $folder_image = $folder;
560 $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
562 $newest_post_img = '';
567 $folder_image = $folder_new;
568 $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['New_posts'];
570 $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
575 $folder_image = $folder;
576 $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
578 $newest_post_img = '';
583 $folder_image = $folder;
584 $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
586 $newest_post_img = '';
590 if( ( $replies + 1 ) > $board_config['posts_per_page'] )
592 $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
593 $goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
596 for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
598 $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>';
599 if( $times == 1 && $total_pages > 4 )
601 $goto_page .= ' ... ';
602 $times = $total_pages - 3;
603 $j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
605 else if ( $times < $total_pages )
618 $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
620 $topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
621 $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );
623 $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';
625 $first_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']);
627 $last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);
629 $last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';
631 $last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
633 $views = $topic_rowset[$i]['topic_views'];
635 $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
636 $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
638 $template->assign_block_vars('topicrow', array(
639 'ROW_COLOR' => $row_color,
640 'ROW_CLASS' => $row_class,
641 'FORUM_ID' => $forum_id,
642 'TOPIC_ID' => $topic_id,
643 'TOPIC_FOLDER_IMG' => $folder_image,
644 'TOPIC_AUTHOR' => $topic_author,
645 'GOTO_PAGE' => $goto_page,
646 'REPLIES' => $replies,
647 'NEWEST_POST_IMG' => $newest_post_img,
648 'TOPIC_TITLE' => $topic_title,
649 'TOPIC_TYPE' => $topic_type,
651 'FIRST_POST_TIME' => $first_post_time,
652 'LAST_POST_TIME' => $last_post_time,
653 'LAST_POST_AUTHOR' => $last_post_author,
654 'LAST_POST_IMG' => $last_post_url,
656 'L_TOPIC_FOLDER_ALT' => $folder_alt,
658 'U_VIEW_TOPIC' => $view_topic_url)
662 $topics_count -= $total_announcements;
664 $template->assign_vars(array(
665 'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
666 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),
668 'L_GOTO_PAGE' => $lang['Goto_page'])
676 $no_topics_msg = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['No_topics_post_one'];
677 $template->assign_vars(array(
678 'L_NO_TOPICS' => $no_topics_msg)
681 $template->assign_block_vars('switch_no_topics', array() );
686 // Parse the page and print
688 $template->pparse('body');
693 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);