aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewforum.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/viewforum.php')
-rw-r--r--phpBB/viewforum.php755
1 files changed, 264 insertions, 491 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 7771284c6f..1ccf2e4605 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -8,7 +8,6 @@
*
* $Id$
*
- *
***************************************************************************/
/***************************************************************************
@@ -26,31 +25,35 @@ include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
+// Start session management
+//
+$userdata = $session->start();
+//
+// End session management
+//
+
+//
// Start initial var setup
//
-if ( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
+if ( isset($HTTP_GET_VARS['f']) || isset($HTTP_POST_VARS['f']) )
{
- $forum_id = ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]);
-}
-else if ( isset($HTTP_GET_VARS['forum']))
-{
- $forum_id = intval($HTTP_GET_VARS['forum']);
+ $forum_id = ( isset($HTTP_GET_VARS['f']) ) ? intval($HTTP_GET_VARS['f']) : intval($HTTP_POST_VARS['f']);
}
else
{
$forum_id = '';
}
-$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
-
if ( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) )
{
- $mark_read = (isset($HTTP_POST_VARS['mark'])) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
+ $mark_read = ( isset($HTTP_POST_VARS['mark']) ) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
}
else
{
$mark_read = '';
}
+
+$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
//
// End initial var setup
//
@@ -64,185 +67,69 @@ if ( !empty($forum_id) )
$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
- }
+ $result = $db->sql_query($sql);
}
else
{
- message_die(GENERAL_MESSAGE, 'Forum_not_exist');
+ message_die(MESSAGE, 'Forum_not_exist');
}
-//
-// If the query doesn't return any rows this isn't a valid forum. Inform
-// the user.
-//
-if ( !($forum_row = $db->sql_fetchrow($result)) )
+if ( !($forum_data = $db->sql_fetchrow($result)) )
{
- message_die(GENERAL_MESSAGE, 'Forum_not_exist');
+ message_die(MESSAGE, 'Forum_not_exist');
}
//
-// Start session management
-//
-$userdata = session_pagestart($user_ip, $forum_id);
-init_userprefs($userdata);
-//
-// End session management
+// Configure style, language, etc.
//
+$acl = new auth('forum', $userdata, $forum_id);
+$userdata['user_style'] = ( $forum_data['forum_style'] ) ? $forum_data['user_style'] : $userdata['user_style'];
+$session->configure($userdata);
//
-// Start auth check
+// Auth check
//
-$is_auth = array();
-$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
-
-if ( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
+if ( !$acl->get_acl($forum_id, 'forum', 'list') || !$acl->get_acl($forum_id, 'forum', 'read') )
{
- if ( !$userdata['session_logged_in'] )
+ if ( $userdata['user_id'] == ANONYMOUS )
{
- $redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : "" );
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("login.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
+ $redirect = "f=$forum_id" . ( ( isset($start) ) ? "&start=$start" : '' );
+ $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
+ header($header_location . "login.$phpEx$SID&redirect=viewforum.$phpEx&$redirect");
+ exit;
}
+
//
// The user is not authed to read this forum ...
//
- $message = ( !$is_auth['auth_view'] ) ? $lang['Forum_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
+ $message = ( !$acl->get_acl($forum_id, 'forum', 'list') ) ? $lang['Forum_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth[$forum_id]['auth_read_type']);
- message_die(GENERAL_MESSAGE, $message);
+ message_die(MESSAGE, $message);
}
//
// End of auth check
//
//
-// Is user watching this thread?
+// Topic read tracking cookie info
//
-if( $userdata['session_logged_in'] )
-{
- $can_watch_forum = TRUE;
-
- $sql = "SELECT notify_status
- FROM " . FORUMS_WATCH_TABLE . "
- WHERE forum_id = $forum_id
- AND user_id = " . $userdata['user_id'];
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not obtain forum watch information", '', __LINE__, __FILE__, $sql);
- }
-
- if ( $row = $db->sql_fetchrow($result) )
- {
- if ( isset($HTTP_GET_VARS['unwatch']) )
- {
- if ( $HTTP_GET_VARS['unwatch'] == 'forum' )
- {
- $is_watching_forum = 0;
-
- $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
- $sql = "DELETE $sql_priority FROM " . FORUMS_WATCH_TABLE . "
- WHERE forum_id = $forum_id
- AND user_id = " . $userdata['user_id'];
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not delete forum watch information", '', __LINE__, __FILE__, $sql);
- }
- }
-
- $template->assign_vars(array(
- 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;start=$start") . '">')
- );
-
- $message = $lang['No_longer_watching_forum'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;start=$start") . '">', '</a>');
- message_die(GENERAL_MESSAGE, $message);
- }
- else
- {
- $is_watching_forum = TRUE;
-
- if ( $row['notify_status'] )
- {
- $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
- $sql = "UPDATE $sql_priority " . FORUMS_WATCH_TABLE . "
- SET notify_status = 0
- WHERE forum_id = $forum_id
- AND user_id = " . $userdata['user_id'];
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not update forum watch information", '', __LINE__, __FILE__, $sql);
- }
- }
- }
- }
- else
- {
- if ( isset($HTTP_GET_VARS['watch']) )
- {
- if ( $HTTP_GET_VARS['watch'] == 'forum' )
- {
- $is_watching_forum = TRUE;
-
- $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
- $sql = "INSERT $sql_priority INTO " . FORUMS_WATCH_TABLE . " (user_id, forum_id, notify_status)
- VALUES (" . $userdata['user_id'] . ", $forum_id, 0)";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not insert forum watch information", '', __LINE__, __FILE__, $sql);
- }
- }
-
- $template->assign_vars(array(
- 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;start=$start") . '">')
- );
-
- $message = $lang['You_are_watching_forum'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;start=$start") . '">', '</a>');
- message_die(GENERAL_MESSAGE, $message);
- }
- else
- {
- $is_watching_forum = 0;
- }
- }
-}
-else
-{
- if ( isset($HTTP_GET_VARS['unwatch']) )
- {
- if ( $HTTP_GET_VARS['unwatch'] == 'forum' )
- {
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("login.$phpEx?redirect=viewforum.$phpEx&" . POST_FORUM_URL . "=$forum_id&unwatch=forum", true));
- }
- }
- else
- {
- $can_watch_forum = 0;
- $is_watching_forum = 0;
- }
-}
+$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : '';
+$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : '';
//
// Handle marking posts
//
if ( $mark_read == 'topics' )
{
- if ( $userdata['session_logged_in'] )
+ if ( $userdata['user_id'] != ANONYMOUS )
{
$sql = "SELECT MAX(post_time) AS last_post
FROM " . POSTS_TABLE . "
WHERE forum_id = $forum_id";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
- }
+ $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
- $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
- $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
-
if ( ( count($tracking_forums) + count($tracking_topics) ) >= 150 && empty($tracking_forums[$forum_id]) )
{
asort($tracking_forums);
@@ -258,28 +145,24 @@ if ( $mark_read == 'topics' )
}
$template->assign_vars(array(
- 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')
+ 'META' => '<meta http-equiv="refresh" content="3;url=' . "viewforum.$phpEx$SID&amp;f=$forum_id" . '">')
);
}
- $message = $lang['Topics_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a> ');
- message_die(GENERAL_MESSAGE, $message);
+ $message = $lang['Topics_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . "viewforum.$phpEx$SID&amp;f=$forum_id" . '">', '</a> ');
+ message_die(MESSAGE, $message);
}
//
// End handle marking posts
//
-$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : '';
-$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : '';
-
//
// Do the forum Prune
//
-if ( $is_auth['auth_mod'] && $board_config['prune_enable'] )
+if ( $acl->get_acl($forum_id, 'mod', 'prune') && $board_config['prune_enable'] )
{
- if ( $forum_row['prune_next'] < time() && $forum_row['prune_enable'] )
+ if ( $forum_data['prune_next'] < time() && $forum_data['prune_enable'] )
{
- include($phpbb_root_path . 'includes/prune.'.$phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
auto_prune($forum_id);
}
@@ -289,394 +172,286 @@ if ( $is_auth['auth_mod'] && $board_config['prune_enable'] )
//
//
-// Obtain list of moderators of each forum
-// First users, then groups ... broken into two queries
+// Forum rules, subscription info and word censors
//
-$sql = "SELECT u.user_id, u.username
- FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
- WHERE aa.forum_id = $forum_id
- AND aa.auth_mod = " . TRUE . "
- AND g.group_single_user = 1
- AND ug.group_id = aa.group_id
- AND g.group_id = aa.group_id
- AND u.user_id = ug.user_id
- GROUP BY u.user_id, u.username
- ORDER BY u.user_id";
-if ( !($result = $db->sql_query($sql)) )
-{
- message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
-}
-
-$moderators = array();
-while( $row = $db->sql_fetchrow($result) )
-{
- $moderators[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
-}
+$s_watching_forum = '';
+$s_watching_forum_img = '';
+watch_topic_forum('forum', $s_watching_forum, $s_watching_forum_img, $userdata['user_id'], $forum_id);
-$sql = "SELECT g.group_id, g.group_name
- FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
- WHERE aa.forum_id = $forum_id
- AND aa.auth_mod = " . TRUE . "
- AND g.group_single_user = 0
- AND g.group_type <> ". GROUP_HIDDEN ."
- AND ug.group_id = aa.group_id
- AND g.group_id = aa.group_id
- GROUP BY g.group_id, g.group_name
- ORDER BY g.group_id";
-if ( !($result = $db->sql_query($sql)) )
-{
- message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
-}
+$s_forum_rules = '';
+get_forum_rules('forum', $s_forum_rules, $forum_id);
-while( $row = $db->sql_fetchrow($result) )
-{
- $moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
-}
-
-$l_moderators = ( count($moderators) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
-$forum_moderators = ( count($moderators) ) ? implode(', ', $moderators) : $lang['None'];
-unset($moderators);
+$orig_word = array();
+$replacement_word = array();
+obtain_word_list($orig_word, $replacement_word);
//
-// Generate a 'Show topics in previous x days' select box. If the topicsdays var is sent
-// then get it's value, find the number of topics with dates newer than it (to properly
-// handle pagination) and alter the main query
+// Topic ordering options
//
-$previous_days = array(0, 1, 7, 14, 30, 90, 180, 364);
-$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']);
+$previous_days = array(0 => $lang['All_Topics'], 1 => $lang['1_Day'], 7 => $lang['7_Days'], 14 => $lang['2_Weeks'], 30 => $lang['1_Month'], 90 => $lang['3_Months'], 180 => $lang['6_Months'], 364 => $lang['1_Year']);
+$sort_by_text = array('a' => $lang['Author'], 't' => $lang['Post_time'], 'r' => $lang['Replies'], 's' => $lang['Subject'], 'v' => $lang['Views']);
+$sort_by = array('a' => 'u.username', 't' => 't.topic_last_post_id', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
-if ( !empty($HTTP_POST_VARS['topicdays']) || !empty($HTTP_GET_VARS['topicdays']) )
+if ( isset($HTTP_POST_VARS['sort']) )
{
- $topic_days = ( !empty($HTTP_POST_VARS['topicdays']) ) ? $HTTP_POST_VARS['topicdays'] : $HTTP_GET_VARS['topicdays'];
- $min_topic_time = time() - ($topic_days * 86400);
-
- $sql = "SELECT COUNT(t.topic_id) AS forum_topics
- FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
- WHERE t.forum_id = $forum_id
- AND p.post_id = t.topic_last_post_id
- AND p.post_time >= $min_topic_time";
-
- if ( !($result = $db->sql_query($sql)) )
+ if ( !empty($HTTP_POST_VARS['sort_days']) )
{
- message_die(GENERAL_ERROR, 'Could not obtain limited topics count information', '', __LINE__, __FILE__, $sql);
- }
- $row = $db->sql_fetchrow($result);
+ $sort_days = ( !empty($HTTP_POST_VARS['sort_days']) ) ? intval($HTTP_POST_VARS['sort_days']) : intval($HTTP_GET_VARS['sort_days']);
+ $min_topic_time = time() - ($sort_days * 86400);
- $topics_count = ( $forum_row['forum_topics'] ) ? $forum_row['forum_topics'] : 1;
- $limit_topics_time = "AND p.post_time >= $min_topic_time";
+ $sql = "SELECT COUNT(t.topic_id) AS forum_topics
+ FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
+ WHERE t.forum_id = $forum_id
+ AND p.post_id = t.topic_last_post_id
+ AND p.post_time >= $min_topic_time";
+ $result = $db->sql_query($sql);
- if ( !empty($HTTP_POST_VARS['topicdays']) )
- {
$start = 0;
+ $topics_count = ( $row = $db->sql_fetchrow($result) ) ? $row['forum_topics'] : 0;
+ $limit_topics_time = "AND p.post_time >= $min_topic_time";
}
+ else
+ {
+ $topics_count = ( $forum_data['forum_topics'] ) ? $forum_data['forum_topics'] : 1;
+ }
+
+ $sort_key = ( isset($HTTP_POST_VARS['sort_key']) ) ? $HTTP_POST_VARS['sort_key'] : $HTTP_GET_VARS['sort_key'];
+ $sort_dir = ( isset($HTTP_POST_VARS['sort_dir']) ) ? $HTTP_POST_VARS['sort_dir'] : $HTTP_GET_VARS['sort_dir'];
}
else
{
- $topics_count = ( $forum_row['forum_topics'] ) ? $forum_row['forum_topics'] : 1;
-
+ $topics_count = ( $forum_data['forum_topics'] ) ? $forum_data['forum_topics'] : 1;
$limit_topics_time = '';
- $topic_days = 0;
-}
-$select_topic_days = '<select name="topicdays">';
-for($i = 0; $i < count($previous_days); $i++)
-{
- $selected = ($topic_days == $previous_days[$i]) ? ' selected="selected"' : '';
- $select_topic_days .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>';
+ $sort_days = 0;
+ $sort_key = 't';
+ $sort_dir = 'd';
}
-$select_topic_days .= '</select>';
-
-//
-// All announcement data, this keeps announcements
-// on each viewforum page ...
-//
-$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username
- FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
- WHERE t.forum_id = $forum_id
- AND t.topic_poster = u.user_id
- AND p.post_id = t.topic_last_post_id
- AND p.poster_id = u2.user_id
- AND t.topic_type = " . POST_ANNOUNCE . "
- ORDER BY t.topic_last_post_id DESC ";
-if ( !($result = $db->sql_query($sql)) )
-{
- message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
-}
+$sort_order = $sort_by[$sort_key] . ' ' . ( ( $sort_dir == 'd' ) ? 'DESC' : 'ASC' );
-$topic_rowset = array();
-$total_announcements = 0;
-while( $row = $db->sql_fetchrow($result) )
+$select_sort_days = '<select name="sort_days">';
+foreach ( $previous_days as $day => $text )
{
- $topic_rowset[] = $row;
- $total_announcements++;
+ $selected = ( $sort_days == $day ) ? ' selected="selected"' : '';
+ $select_sort_days .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
}
+$select_sort_days .= '</select>';
-$db->sql_freeresult($result);
-
-//
-// Grab all the basic data (all topics except announcements)
-// for this forum
-//
-$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
- FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
- WHERE t.forum_id = $forum_id
- AND t.topic_poster = u.user_id
- AND p.post_id = t.topic_first_post_id
- AND p2.post_id = t.topic_last_post_id
- AND u2.user_id = p2.poster_id
- AND t.topic_type <> " . POST_ANNOUNCE . "
- $limit_topics_time
- ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
- LIMIT $start, ".$board_config['topics_per_page'];
-if ( !($result = $db->sql_query($sql)) )
+$select_sort = '<select name="sort_key">';
+foreach ( $sort_by_text as $key => $text )
{
- message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
+ $selected = ( $sort_key == $key ) ? ' selected="selected"' : '';
+ $select_sort .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
}
+$select_sort .= '</select>';
-$total_topics = 0;
-while( $row = $db->sql_fetchrow($result) )
-{
- $topic_rowset[] = $row;
- $total_topics++;
-}
+$select_sort_dir = '<select name="sort_dir">';
+$select_sort_dir .= ( $sort_dir == 'a' ) ? '<option value="a" selected="selected">' . $lang['Ascending'] . '</option><option value="d">' . $lang['Descending'] . '</option>' : '<option value="a">' . $lang['Ascending'] . '</option><option value="d" selected="selected">' . $lang['Descending'] . '</option>';
+$select_sort_dir .= '</select>';
-$db->sql_freeresult($result);
+$post_alt = ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'];
+$post_img = '<img src=' . (( $forum_data['forum_status'] == FORUM_LOCKED ) ? $theme['post_locked'] : $theme['post_new'] ) . ' border="0" alt="' . $post_alt . '" title="' . $post_alt . '" />';
-//
-// Total topics ...
-//
-$total_topics += $total_announcements;
-
-//
-// Define censored word matches
-//
-$orig_word = array();
-$replacement_word = array();
-obtain_word_list($orig_word, $replacement_word);
-
-//
-// Post URL generation for templating vars
-//
$template->assign_vars(array(
- 'L_DISPLAY_TOPICS' => $lang['Display_topics'],
-
- 'U_POST_NEW_TOPIC' => append_sid("posting.$phpEx?mode=newtopic&amp;" . POST_FORUM_URL . "=$forum_id"),
+ 'FORUM_ID' => $forum_id,
+ 'FORUM_NAME' => $forum_data['forum_name'],
+ 'POST_IMG' => $post_img,
+ 'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&amp;f=$forum_id&amp;topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
+ 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),
+
+ 'FOLDER_IMG' => create_img($theme['folder'], $lang['No_new_posts']),
+ 'FOLDER_NEW_IMG' => create_img($theme['folder_new'], $lang['New_posts']),
+ 'FOLDER_HOT_IMG' => create_img($theme['folder_hot'], $lang['No_new_posts_hot']),
+ 'FOLDER_HOT_NEW_IMG' => create_img($theme['folder_hot_new'], $lang['New_posts_hot']),
+ 'FOLDER_LOCKED_IMG' => create_img($theme['folder_locked'], $lang['No_new_posts_locked']),
+ 'FOLDER_LOCKED_NEW_IMG' => create_img($theme['folder_locked_new'], $lang['New_posts_locked']),
+ 'FOLDER_STICKY_IMG' => create_img($theme['folder_sticky'], $lang['Post_Sticky']),
+ 'FOLDER_STICKY_NEW_IMG' => create_img($theme['folder_sticky_new'], $lang['Post_Sticky']),
+ 'FOLDER_ANNOUNCE_IMG' => create_img($theme['folder_announce'], $lang['Post_Announcement']),
+ 'FOLDER_ANNOUNCE_NEW_IMG' => create_img($theme['folder_announce_new'], $lang['Post_Announcement']),
+
+ 'L_TOPICS' => $lang['Topics'],
+ 'L_REPLIES' => $lang['Replies'],
+ 'L_VIEWS' => $lang['Views'],
+ 'L_POSTS' => $lang['Posts'],
+ 'L_LASTPOST' => $lang['Last_Post'],
+ 'L_VIEW_MODERATORS' => $lang['View_moderators'],
+ 'L_DISPLAY_TOPICS' => $lang['Display_topics'],
+ 'L_SORT_BY' => $lang['Sort_by'],
+ 'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'],
+ 'L_NO_NEW_POSTS' => $lang['No_new_posts'],
+ 'L_NEW_POSTS' => $lang['New_posts'],
+ 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
+ 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
+ 'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'],
+ 'L_NEW_POSTS_HOT' => $lang['New_posts_hot'],
+ 'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
+ 'L_STICKY' => $lang['Post_Sticky'],
+ 'L_POSTED' => $lang['Posted'],
+ 'L_JOINED' => $lang['Joined'],
+ 'L_AUTHOR' => $lang['Author'],
+ 'L_NO_TOPICS' => ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['No_topics_post_one'],
+ 'L_GOTO_PAGE' => $lang['Goto_page'],
+
+ 'S_SELECT_SORT_DIR' => $select_sort_dir,
+ 'S_SELECT_SORT_KEY' => $select_sort,
+ 'S_SELECT_SORT_DAYS' => $select_sort_days,
+ 'S_AUTH_LIST' => $s_forum_rules,
+ 'S_WATCH_FORUM' => $s_watching_forum,
+ 'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . "&amp;start=$start",
- 'S_SELECT_TOPIC_DAYS' => $select_topic_days,
- 'S_POST_DAYS_ACTION' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&amp;start=$start"))
+ 'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&amp;mode=newtopic&amp;f=' . $forum_id,
+ 'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id,
+ 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&amp;mode=moderators&amp;f=' . $forum_id,
+ 'U_MARK_READ' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;mark=topics')
);
//
-// User authorisation levels output
+// Grab all the basic data. If we're not on page 1 we also grab any
+// announcements that may exist.
//
-$s_auth_can = ( ( $is_auth['auth_post'] ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br />';
-$s_auth_can .= ( ( $is_auth['auth_reply'] ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br />';
-$s_auth_can .= ( ( $is_auth['auth_edit'] ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '<br />';
-$s_auth_can .= ( ( $is_auth['auth_delete'] ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '<br />';
-$s_auth_can .= ( ( $is_auth['auth_vote'] ) ? $lang['Rules_vote_can'] : $lang['Rules_vote_cannot'] ) . '<br />';
-
-if ( $is_auth['auth_mod'] )
-{
- $s_auth_can .= sprintf($lang['Rules_moderate'], '<a href="' . append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
-}
+$total_topics = 0;
+$topic_rowset = array();
-$s_watching_forum = '';
-if ( $can_watch_forum )
+if ( $start )
{
- if ( $is_watching_forum )
- {
- $watch_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;unwatch=forum&amp;start=$start");
- $s_watching_forum = '<a href="' . $watch_url . '">' . $lang['Stop_watching_forum'] . '</a>';
- $s_watching_forum_img = ( isset($images['Forum_un_watch']) ) ? '<a href="' . $watch_url . '"><img src="' . $images['Forum_un_watch'] . '" alt="' . $lang['Stop_watching_forum'] . '" title="' . $lang['Stop_watching_forum'] . '" border="0"></a>' : '';
- }
- else
+ $sql = "SELECT t.*, i.icons_url, i.icons_width, i.icons_height, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username AS post_username2
+ FROM " . TOPICS_TABLE . " t, " . ICONS_TABLE . " i, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
+ WHERE t.forum_id = $forum_id
+ AND t.topic_type = " . POST_ANNOUNCE . "
+ AND i.icons_id = t.topic_icon
+ AND u.user_id = t.topic_poster
+ AND p.post_id = t.topic_last_post_id
+ AND u2.user_id = p.poster_id
+ ORDER BY $sort_order
+ LIMIT " . $board_config['topics_per_page'];
+ $result = $db->sql_query($sql);
+
+ while( $row = $db->sql_fetchrow($result) )
{
- $watch_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;watch=forum&amp;start=$start");
- $s_watching_forum = '<a href="' . $watch_url . '">' . $lang['Start_watching_forum'] . '</a>';
- $s_watching_forum_img = ( isset($images['Forum_watch']) ) ? '<a href="' . $watch_url . '"><img src="' . $images['Forum_watch'] . '" alt="' . $lang['Stop_watching_forum'] . '" title="' . $lang['Start_watching_forum'] . '" border="0"></a>' : '';
+ $topic_rowset[] = $row;
+ $total_topics++;
}
}
-//
-// Mozilla navigation bar
-//
-$nav_links['up'] = array(
- 'url' => append_sid('index.'.$phpEx),
- 'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
-);
-
-//
-// Dump out the page header and load viewforum template
-//
-$page_title = $lang['View_forum'] . ' - ' . $forum_row['forum_name'];
-include($phpbb_root_path . 'includes/page_header.'.$phpEx);
-
-$template->set_filenames(array(
- 'body' => 'viewforum_body.tpl')
-);
-make_jumpbox('viewforum.'.$phpEx);
-
-$template->assign_vars(array(
- 'FORUM_ID' => $forum_id,
- 'FORUM_NAME' => $forum_row['forum_name'],
- 'MODERATORS' => $forum_moderators,
- 'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'],
-
- 'FOLDER_IMG' => $images['folder'],
- 'FOLDER_NEW_IMG' => $images['folder_new'],
- 'FOLDER_HOT_IMG' => $images['folder_hot'],
- 'FOLDER_HOT_NEW_IMG' => $images['folder_hot_new'],
- 'FOLDER_LOCKED_IMG' => $images['folder_locked'],
- 'FOLDER_LOCKED_NEW_IMG' => $images['folder_locked_new'],
- 'FOLDER_STICKY_IMG' => $images['folder_sticky'],
- 'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'],
- 'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'],
- 'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'],
-
- 'L_TOPICS' => $lang['Topics'],
- 'L_REPLIES' => $lang['Replies'],
- 'L_VIEWS' => $lang['Views'],
- 'L_POSTS' => $lang['Posts'],
- 'L_LASTPOST' => $lang['Last_Post'],
- 'L_MODERATOR' => $l_moderators,
- 'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'],
- 'L_POST_NEW_TOPIC' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'],
- 'L_NO_NEW_POSTS' => $lang['No_new_posts'],
- 'L_NEW_POSTS' => $lang['New_posts'],
- 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
- 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
- 'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'],
- 'L_NEW_POSTS_HOT' => $lang['New_posts_hot'],
- 'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
- 'L_STICKY' => $lang['Post_Sticky'],
- 'L_POSTED' => $lang['Posted'],
- 'L_JOINED' => $lang['Joined'],
- 'L_AUTHOR' => $lang['Author'],
-
- 'S_AUTH_LIST' => $s_auth_can,
- 'S_WATCH_FORUM' => $s_watching_forum,
+$sql = "SELECT t.*, i.icons_url, i.icons_width, i.icons_height, 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
+ FROM " . TOPICS_TABLE . " t, " . ICONS_TABLE . " i, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
+ WHERE t.forum_id = $forum_id
+ AND i.icons_id = t.topic_icon
+ AND u.user_id = t.topic_poster
+ AND p.post_id = t.topic_first_post_id
+ AND p2.post_id = t.topic_last_post_id
+ AND u2.user_id = p2.poster_id
+ $limit_topics_time
+ ORDER BY t.topic_type DESC, $sort_order
+ LIMIT $start, " . $board_config['topics_per_page'];
+$result = $db->sql_query($sql);
- 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
+while( $row = $db->sql_fetchrow($result) )
+{
+ $topic_rowset[] = $row;
+ $total_topics++;
+}
- 'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"))
-);
-//
-// End header
-//
+$db->sql_freeresult($result);
//
// Okay, lets dump out the page ...
//
-if( $total_topics )
+if ( $total_topics )
{
+ $row_count = 0;
+
for($i = 0; $i < $total_topics; $i++)
{
$topic_id = $topic_rowset[$i]['topic_id'];
$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
- $replies = $topic_rowset[$i]['topic_replies'];
-
$topic_type = $topic_rowset[$i]['topic_type'];
- if( $topic_type == POST_ANNOUNCE )
- {
- $topic_type = $lang['Topic_Announcement'] . ' ';
- }
- else if( $topic_type == POST_STICKY )
- {
- $topic_type = $lang['Topic_Sticky'] . ' ';
- }
- else
- {
- $topic_type = '';
- }
-
- if( $topic_rowset[$i]['topic_vote'] )
- {
- $topic_type .= $lang['Topic_Poll'] . ' ';
- }
-
- if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
+ $topic_type = '';
+ if ( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
{
$topic_type = $lang['Topic_Moved'] . ' ';
$topic_id = $topic_rowset[$i]['topic_moved_id'];
- $folder_image = $images['folder'];
+ $folder_image = $theme['folder'];
$folder_alt = $lang['Topic_Moved'];
$newest_post_img = '';
}
else
{
- if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
- {
- $folder = $images['folder_announce'];
- $folder_new = $images['folder_announce_new'];
- }
- else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
- {
- $folder = $images['folder_sticky'];
- $folder_new = $images['folder_sticky_new'];
- }
- else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
- {
- $folder = $images['folder_locked'];
- $folder_new = $images['folder_locked_new'];
- }
- else
+ switch ( $topic_rowset[$i]['topic_type'] )
{
- if($replies >= $board_config['hot_threshold'])
- {
- $folder = $images['folder_hot'];
- $folder_new = $images['folder_hot_new'];
- }
- else
- {
- $folder = $images['folder'];
- $folder_new = $images['folder_new'];
- }
+ case POST_ANNOUNCE:
+ $topic_type = $lang['Topic_Announcement'] . ' ';
+ $folder = $theme['folder_announce'];
+ $folder_new = $theme['folder_announce_new'];
+ break;
+ case POST_STICKY:
+ $topic_type = $lang['Topic_Sticky'] . ' ';
+ $folder = $theme['folder_sticky'];
+ $folder_new = $theme['folder_sticky_new'];
+ break;
+ case TOPIC_LOCKED:
+ $folder = $theme['folder_locked'];
+ $folder_new = $theme['folder_locked_new'];
+ break;
+ default:
+ if ( $replies >= $board_config['hot_threshold'] )
+ {
+ $folder = $theme['folder_hot'];
+ $folder_new = $theme['folder_hot_new'];
+ }
+ else
+ {
+ $folder = $theme['folder'];
+ $folder_new = $theme['folder_new'];
+ }
+ break;
}
$newest_post_img = '';
- if( $userdata['session_logged_in'] )
+ if ( $userdata['user_id'] != ANONYMOUS )
{
- if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] )
+ if ( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] )
{
- if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
+ if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
$unread_topics = true;
- if( !empty($tracking_topics[$topic_id]) )
+ if ( !empty($tracking_topics[$topic_id]) )
{
- if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
+ if ( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
{
$unread_topics = false;
}
}
- if( !empty($tracking_forums[$forum_id]) )
+ if ( !empty($tracking_forums[$forum_id]) )
{
- if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] )
+ if ( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] )
{
$unread_topics = false;
}
}
- if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
+ if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
- if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] )
+ if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] )
{
$unread_topics = false;
}
}
- if( $unread_topics )
+ if ( $unread_topics )
{
$folder_image = $folder_new;
$folder_alt = $lang['New_posts'];
- $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
+ $newest_post_img = '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '&amp;view=newest">' . create_img($theme['goto_post_newest'], $lang['View_newest_post']) . '</a> ';
}
else
{
@@ -691,7 +466,7 @@ if( $total_topics )
$folder_image = $folder_new;
$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
- $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
+ $newest_post_img = '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '&amp;view=newest">' . create_img($theme['goto_post_newest'], $lang['View_newest_post']) . '</a> ';
}
}
else
@@ -711,16 +486,21 @@ if( $total_topics )
}
}
- if( ( $replies + 1 ) > $board_config['posts_per_page'] )
+ if ( $topic_rowset[$i]['topic_vote'] )
+ {
+ $topic_type .= $lang['Topic_Poll'] . ' ';
+ }
+
+ if ( ( $replies + 1 ) > $board_config['posts_per_page'] )
{
$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
- $goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
+ $goto_page = ' [ <img src=' . $theme['goto_post'] . ' alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
$times = 1;
for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
{
- $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&amp;start=$j") . '">' . $times . '</a>';
- if( $times == 1 && $total_pages > 4 )
+ $goto_page .= '<a href="viewtopic.' . $phpEx . $SID . '&amp;t=' . $topic_id . '&amp;start=' . $j . '">' . $times . '</a>';
+ if ( $times == 1 && $total_pages > 4 )
{
$goto_page .= ' ... ';
$times = $total_pages - 3;
@@ -739,9 +519,9 @@ if( $total_topics )
$goto_page = '';
}
- $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
+ $view_topic_url = 'viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id;
- $topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
+ $topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="profile.' . $phpEx . $SID . '&amp;mode=viewprofile&amp;u=' . $topic_rowset[$i]['user_id'] . '">' : '';
$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );
$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';
@@ -750,68 +530,61 @@ if( $total_topics )
$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);
- $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&amp;" . POST_USERS_URL . '=' . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';
+ $last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ( $topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="profile.' . $phpEx . $SID . '&amp;mode=viewprofile&amp;u=' . $topic_rowset[$i]['id2'] . '">' . $topic_rowset[$i]['user2'] . '</a>';
- $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>';
+ $last_post_url = '<a href="viewtopic.' . $phpEx . $SID . '&amp;p=' . $topic_rowset[$i]['topic_last_post_id'] . '#' . $topic_rowset[$i]['topic_last_post_id'] . '">' . create_img($theme['goto_post_latest'], $lang['View_latest_post']) . '</a>';
$views = $topic_rowset[$i]['topic_views'];
-
- $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
- $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
+ $replies = $topic_rowset[$i]['topic_replies'];
+
+ $topic_icon = ( !empty($topic_rowset[$i]['icons_url']) ) ? '<img src="' . $board_config['icons_path'] . '/' . $topic_rowset[$i]['icons_url'] . '" width="' . $topic_rowset[$i]['icons_width'] . '" height="' . $topic_rowset[$i]['icons_height'] . '" alt="" title="" />' : '';
+
+ $topic_rating = ( !empty($topic_rowset[$i]['topic_rating']) ) ? '<img src=' . str_replace('{RATE}', $topic_rowset[$i]['topic_rating'], $theme['rating']) . ' alt="' . $topic_rowset[$i]['topic_rating'] . '" title="' . $topic_rowset[$i]['topic_rating'] . '" />' : '';
$template->assign_block_vars('topicrow', array(
- 'ROW_COLOR' => $row_color,
- 'ROW_CLASS' => $row_class,
'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id,
- 'TOPIC_FOLDER_IMG' => $folder_image,
+ 'TOPIC_FOLDER_IMG' => create_img($folder_image, $folder_alt),
'TOPIC_AUTHOR' => $topic_author,
'GOTO_PAGE' => $goto_page,
'REPLIES' => $replies,
'NEWEST_POST_IMG' => $newest_post_img,
'TOPIC_TITLE' => $topic_title,
'TOPIC_TYPE' => $topic_type,
+ 'TOPIC_ICON' => $topic_icon,
+ 'TOPIC_RATING' => $topic_rating,
'VIEWS' => $views,
'FIRST_POST_TIME' => $first_post_time,
'LAST_POST_TIME' => $last_post_time,
'LAST_POST_AUTHOR' => $last_post_author,
'LAST_POST_IMG' => $last_post_url,
- 'L_TOPIC_FOLDER_ALT' => $folder_alt,
+ 'S_ROW_COUNT' => $i,
'U_VIEW_TOPIC' => $view_topic_url)
);
- }
-
- $template->assign_vars(array(
- 'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
- 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),
-
- 'L_GOTO_PAGE' => $lang['Goto_page'])
- );
-}
-else
-{
- //
- // No topics
- //
- $no_topics_msg = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['No_topics_post_one'];
- $template->assign_vars(array(
- 'L_NO_TOPICS' => $no_topics_msg)
- );
-
- $template->assign_block_vars('switch_no_topics', array() );
+ $row_count++;
+ }
}
//
-// Parse the page and print
+// Dump out the page header and load viewforum template
//
-$template->pparse('body');
+$page_title = $lang['View_forum'] . ' - ' . $forum_data['forum_name'];
+
+$nav_links['up'] = array(
+ 'url' => 'index.' . $phpEx . $SID,
+ 'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
+);
+
+include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+$template->set_filenames(array(
+ 'body' => 'viewforum_body.html')
+);
+make_jumpbox('viewforum.'.$phpEx);
-//
-// Page footer
-//
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> \ No newline at end of file