aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php781
1 files changed, 323 insertions, 458 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 5c2e7e58a3..c458e94bb7 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -8,7 +8,6 @@
*
* $Id$
*
- *
***************************************************************************/
/***************************************************************************
@@ -29,32 +28,20 @@ include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
//
// Start initial var setup
//
-if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) )
-{
- $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);
-}
-else if ( isset($HTTP_GET_VARS['topic']) )
-{
- $topic_id = intval($HTTP_GET_VARS['topic']);
-}
-
-if ( isset($HTTP_GET_VARS[POST_POST_URL]))
-{
- $post_id = intval($HTTP_GET_VARS[POST_POST_URL]);
-}
-
+$topic_id = ( isset($HTTP_GET_VARS['t']) ) ? intval($HTTP_GET_VARS['t']) : 0;
+$post_id = ( isset($HTTP_GET_VARS['p'])) ? intval($HTTP_GET_VARS['p']) : 0;
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
-if ( !isset($topic_id) && !isset($post_id) )
+if ( empty($topic_id) && empty($post_id) )
{
- message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
+ message_die(MESSAGE, 'Topic_post_not_exist');
}
//
// Find topic id if user requested a newer
// or older topic
//
-if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
+if ( isset($HTTP_GET_VARS['view']) && empty($post_id) )
{
if ( $HTTP_GET_VARS['view'] == 'newest' )
{
@@ -71,26 +58,24 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
WHERE s.session_id = '$session_id'
AND u.user_id = s.session_user_id
AND p.topic_id = $topic_id
+ AND p.post_approved = " . TRUE . "
AND p.post_time >= u.user_lastvisit
ORDER BY p.post_time ASC
LIMIT 1";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql);
- }
+ $result = $db->sql_query($sql);
if ( !($row = $db->sql_fetchrow($result)) )
{
- message_die(GENERAL_MESSAGE, 'No_new_posts_last_visit');
+ message_die(MESSAGE, 'No_new_posts_last_visit');
}
$post_id = $row['post_id'];
- header($header_location . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true));
+ header($header_location . 'viewtopic.' . $phpEx . '?sid=' . $session_id . '&p=' . $post_id . '#' . $post_id);
exit;
}
}
- header($header_location . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
+ header($header_location . 'viewtopic.' . $phpEx . $SID . '&t=' . $topic_id);
exit;
}
else if ( $HTTP_GET_VARS['view'] == 'next' || $HTTP_GET_VARS['view'] == 'previous' )
@@ -104,25 +89,17 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
AND p2.post_id = t2.topic_last_post_id
AND t.forum_id = t2.forum_id
AND p.post_id = t.topic_last_post_id
+ AND p.post_approved = " . TRUE . "
AND p.post_time $sql_condition p2.post_time
AND p.topic_id = t.topic_id
ORDER BY p.post_time $sql_ordering
LIMIT 1";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
- }
+ $result = $db->sql_query($sql);
if ( !($row = $db->sql_fetchrow($result)) )
{
- if( $HTTP_GET_VARS['view'] == 'next' )
- {
- message_die(GENERAL_MESSAGE, 'No_newer_topics');
- }
- else
- {
- message_die(GENERAL_MESSAGE, 'No_older_topics');
- }
+ $message = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'No_newer_topics' : 'No_older_topics';
+ message_die(MESSAGE, $message);
}
else
{
@@ -132,220 +109,166 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
}
//
+// Start session management
+//
+$userdata = $session->start();
+//
+// End session management
+//
+
+if ( $userdata['user_id'] != ANONYMOUS && isset($HTTP_POST_VARS['rating']) )
+{
+ $sql = "SELECT rating
+ FROM " . TOPICS_RATINGS_TABLE . "
+ WHERE topic_id = $topic_id
+ AND user_id = " . $userdata['user_id'];
+ $result = $db->sql_query($sql);
+
+ $rating = ( $row = $db->sql_fetchrow($result) ) ? $row['rating'] : '';
+
+ if ( empty($HTTP_POST_VARS['rating_value']) && $rating != '' )
+ {
+ }
+ else
+ {
+ $new_rating = intval($HTTP_POST_VARS['rating']);
+
+ $sql = ( $rating != '' ) ? "UPDATE " . TOPICS_RATING_TABLE . " SET rating = $new_rating WHERE user_id = " . $userdata['user_id'] . " AND topic_id = $topic_id" : "INSERT INTO " . TOPICS_RATING_TABLE . " (topic_id, user_id, rating) VALUES ($topic_id, " . $userdata['user_id'] . ", $new_rating)";
+ }
+}
+
+//
// This rather complex gaggle of code handles querying for topics but
// also allows for direct linking to a post (and the calculation of which
// page the post is on and the correct display of viewtopic)
//
-$join_sql_table = ( !isset($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";
-$join_sql = ( !isset($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id";
-$count_sql = ( !isset($post_id) ) ? '' : ", COUNT(p2.post_id) AS prev_posts";
+$join_sql_table = ( !$post_id ) ? '' : ', ' . POSTS_TABLE . ' p, ' . POSTS_TABLE . ' p2 ';
+$join_sql = ( !$post_id ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND p.post_approved = " . TRUE . " AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_approved = " . TRUE . " AND p2.post_id <= $post_id";
+$count_sql = ( !$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.topic_vote, f.forum_name, f.forum_status, f.forum_id ORDER BY p.post_id ASC";
-$order_sql = ( !isset($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.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";
-
-$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
+$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id " . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
-if ( !($result = $db->sql_query($sql)) )
-{
- message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
-}
+$result = $db->sql_query($sql);
-if ( !($forum_row = $db->sql_fetchrow($result)) )
+if ( !($forum_data = $db->sql_fetchrow($result)) )
{
- message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
+ message_die(MESSAGE, 'Topic_post_not_exist');
}
-$forum_id = $forum_row['forum_id'];
-
//
-// Start session management
-//
-$userdata = session_pagestart($user_ip, $forum_id);
-init_userprefs($userdata);
-//
-// End session management
+// Configure style, language, etc.
//
+$userdata['user_style'] = ( $forum_data['forum_style'] ) ? $forum_data['user_style'] : $userdata['user_style'];
+$session->configure($userdata);
+
+$forum_id = $forum_data['forum_id'];
+
+$acl = new auth('forum', $userdata, $forum_id);
//
// Start auth check
//
-$is_auth = array();
-$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
-
-if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
+if ( !$acl->get_acl($forum_id, 'forum', 'read') )
{
- if ( !$userdata['session_logged_in'] )
+ if ( $userdata['user_id'] != ANONYMOUS )
{
- $redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
+ $redirect = ( isset($post_id) ) ? "p=$post_id" : "t=$topic_id";
$redirect .= ( 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=viewtopic.$phpEx&$redirect", true));
+ $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
+ header($header_location . 'login.' . $phpEx . $SID . '&redirect=viewtopic.' . $phpEx . '&' . $redirect);
+ exit;
}
- $message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
+ $message = sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
- message_die(GENERAL_MESSAGE, $message);
+ message_die(MESSAGE, $message);
}
//
// End auth check
//
-$forum_name = $forum_row['forum_name'];
-$topic_title = $forum_row['topic_title'];
-$topic_id = $forum_row['topic_id'];
-$topic_time = $forum_row['topic_time'];
+$forum_name = $forum_data['forum_name'];
+$topic_title = $forum_data['topic_title'];
+$topic_id = $forum_data['topic_id'];
+$topic_time = $forum_data['topic_time'];
if ( !empty($post_id) )
{
- $start = floor(($forum_row['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
+ $start = floor(($forum_data['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
}
+$s_watching_topic = '';
+$s_watching_topic_img = '';
+watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $userdata['user_id'], $topic_id);
+
//
-// Is user watching this thread?
+// Post ordering options
//
-if( $userdata['session_logged_in'] )
-{
- $can_watch_topic = TRUE;
+$previous_days = array(0 => $lang['All_Posts'], 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'], 's' => $lang['Subject']);
+$sort_by = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'pt.post_subject');
- $sql = "SELECT notify_status
- FROM " . TOPICS_WATCH_TABLE . "
- WHERE topic_id = $topic_id
- AND user_id = " . $userdata['user_id'];
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not obtain topic watch information", '', __LINE__, __FILE__, $sql);
- }
-
- if ( $row = $db->sql_fetchrow($result) )
+if ( isset($HTTP_POST_VARS['sort']) )
+{
+ if ( !empty($HTTP_POST_VARS['sort_days']) )
{
- if ( isset($HTTP_GET_VARS['unwatch']) )
- {
- if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
- {
- $is_watching_topic = 0;
+ $sort_days = ( !empty($HTTP_POST_VARS['sort_days']) ) ? intval($HTTP_POST_VARS['sort_days']) : intval($HTTP_GET_VARS['sort_days']);
+ $min_post_time = time() - ( $sort_days * 86400 );
- $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
- $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . "
- WHERE topic_id = $topic_id
- AND user_id = " . $userdata['user_id'];
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql);
- }
- }
-
- $template->assign_vars(array(
- 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">')
- );
-
- $message = $lang['No_longer_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">', '</a>');
- message_die(GENERAL_MESSAGE, $message);
- }
- else
- {
- $is_watching_topic = TRUE;
+ $sql = "SELECT COUNT(post_id) AS num_posts
+ FROM " . POSTS_TABLE . "
+ WHERE topic_id = $topic_id
+ AND post_time >= $min_post_time
+ AND post_approved = " . TRUE;
+ $result = $db->sql_query($sql);
- if ( $row['notify_status'] )
- {
- $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
- $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . "
- SET notify_status = 0
- WHERE topic_id = $topic_id
- AND user_id = " . $userdata['user_id'];
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not update topic watch information", '', __LINE__, __FILE__, $sql);
- }
- }
- }
+ $start = 0;
+ $total_replies = ( $row = $db->sql_fetchrow($result) ) ? $row['num_posts'] : 0;
+ $limit_posts_time = "AND p.post_time >= $min_post_time ";
}
else
{
- if ( isset($HTTP_GET_VARS['watch']) )
- {
- if ( $HTTP_GET_VARS['watch'] == 'topic' )
- {
- $is_watching_topic = TRUE;
-
- $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : '';
- $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
- VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql);
- }
- }
-
- $template->assign_vars(array(
- 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">')
- );
-
- $message = $lang['You_are_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start") . '">', '</a>');
- message_die(GENERAL_MESSAGE, $message);
- }
- else
- {
- $is_watching_topic = 0;
- }
+ $total_replies = ( $forum_data['topic_replies'] ) ? $forum_data['topic_replies'] + 1 : 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
{
- if ( isset($HTTP_GET_VARS['unwatch']) )
- {
- if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
- {
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true));
- }
- }
- else
- {
- $can_watch_topic = 0;
- $is_watching_topic = 0;
- }
+ $total_replies = $forum_data['topic_replies'] + 1;
+ $limit_posts_time = '';
+
+ $sort_days = 0;
+ $sort_key = 't';
+ $sort_dir = 'a';
}
-//
-// Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
-// then get it's value, find the number of topics with dates newer than it (to properly
-// handle pagination) and alter the main query
-//
-$previous_days = array(0, 1, 7, 14, 30, 90, 180, 364);
-$previous_days_text = array($lang['All_Posts'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']);
+$sort_order = $sort_by[$sort_key] . ' ' . ( ( $sort_dir == 'd' ) ? 'DESC' : 'ASC' );
-if( !empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']) )
+$select_sort_days = '<select name="sort_days">';
+foreach ( $previous_days as $day => $text )
{
- $post_days = ( !empty($HTTP_POST_VARS['postdays']) ) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays'];
- $min_post_time = time() - ($post_days * 86400);
-
- $sql = "SELECT COUNT(post_id) AS num_posts
- FROM " . POSTS_TABLE . "
- WHERE topic_id = $topic_id
- AND post_time >= $min_post_time";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not obtain limited topics count information", '', __LINE__, __FILE__, $sql);
- }
-
- $total_replies = ( $row = $db->sql_fetchrow($result) ) ? $row['num_posts'] : 0;
-
- $limit_posts_time = "AND p.post_time >= $min_post_time ";
-
- if ( !empty($HTTP_POST_VARS['postdays']))
- {
- $start = 0;
- }
+ $selected = ( $sort_days == $day ) ? ' selected="selected"' : '';
+ $select_sort_days .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
}
-else
-{
- $total_replies = $forum_row['topic_replies'] + 1;
+$select_sort_days .= '</select>';
- $limit_posts_time = '';
- $post_days = 0;
+$select_sort = '<select name="sort_key">';
+foreach ( $sort_by_text as $key => $text )
+{
+ $selected = ( $sort_key == $key ) ? ' selected="selected"' : '';
+ $select_sort .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
}
+$select_sort .= '</select>';
+
+$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>';
$select_post_days = '<select name="postdays">';
for($i = 0; $i < count($previous_days); $i++)
@@ -361,7 +284,7 @@ $select_post_days .= '</select>';
if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) )
{
$post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder'];
- $post_time_order = ($post_order == "asc") ? "ASC" : "DESC";
+ $post_time_order = ( $post_order == 'asc' ) ? 'ASC' : 'DESC';
}
else
{
@@ -385,16 +308,14 @@ $select_post_order .= '</select>';
//
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
- WHERE p.topic_id = $topic_id
+ WHERE p.topic_id = $topic_id
+ AND p.post_approved = " . TRUE . "
$limit_posts_time
AND pt.post_id = p.post_id
AND u.user_id = p.poster_id
- ORDER BY p.post_time $post_time_order
- LIMIT $start, ".$board_config['posts_per_page'];
-if ( !($result = $db->sql_query($sql)) )
-{
- message_die(GENERAL_ERROR, "Could not obtain post/user information.", '', __LINE__, __FILE__, $sql);
-}
+ ORDER BY $sort_order
+ LIMIT $start, " . $board_config['posts_per_page'];
+$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
@@ -410,16 +331,13 @@ if ( $row = $db->sql_fetchrow($result) )
}
else
{
- message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
+ message_die(MESSAGE, $lang['No_posts_topic']);
}
$sql = "SELECT *
FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min";
-if ( !($result = $db->sql_query($sql)) )
-{
- message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql);
-}
+$result = $db->sql_query($sql);
$ranksrow = array();
while ( $row = $db->sql_fetchrow($result) )
@@ -428,19 +346,26 @@ while ( $row = $db->sql_fetchrow($result) )
}
$db->sql_freeresult($result);
-//
-// Define censored word matches
-//
-$orig_word = array();
-$replacement_word = array();
-obtain_word_list($orig_word, $replacement_word);
-
-//
-// Censor topic title
-//
-if ( count($orig_word) )
+$rating = '';
+if ( $userdata['user_id'] != ANONYMOUS )
{
- $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
+ $rating_text = array(-5 => $lang['Very_poor'], -2 => $lang['Quite_poor'], 0 => $lang['Unrated'], 2 => $lang['Quite_good'], 5 => $lang['Very_good']);
+
+ $sql = "SELECT rating
+ FROM " . TOPICS_RATINGS_TABLE . "
+ WHERE topic_id = $topic_id
+ AND user_id = " . $userdata['user_id'];
+ $result = $db->sql_query($sql);
+
+ $user_rating = ( $row = $db->sql_fetchrow($result) ) ? $row['rating'] : 0;
+
+ for($i = -5; $i < 6; $i++)
+ {
+ $selected = ( $user_rating == $i ) ? ' selected="selected"' : '';
+ $rating .= '<option value="' . $i . '"' . $selected . '>' . $i . ( ( !empty($rating_text[$i]) ) ? ' > ' . $rating_text[$i] : '' ) . '</option>';
+ }
+
+ $rating = '<select name="rating">' . $rating . '</select>';
}
//
@@ -461,7 +386,7 @@ if ( isset($HTTP_GET_VARS['highlight']) )
{
if ( trim($words[$i]) != '' )
{
- $highlight_match[] = '#\b(' . str_replace("*", "([\w]+)?", $words[$i]) . ')\b#is';
+ $highlight_match[] = '#\b(' . str_replace('*', '([\w]+)?', $words[$i]) . ')\b#is';
}
}
@@ -473,40 +398,50 @@ else
}
//
-// Post, reply and other URL generation for
-// templating vars
+// Define censored word matches
//
-$new_topic_url = append_sid("posting.$phpEx?mode=newtopic&amp;" . POST_FORUM_URL . "=$forum_id");
-$reply_topic_url = append_sid("posting.$phpEx?mode=reply&amp;" . POST_TOPIC_URL . "=$topic_id");
-$view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id");
-$view_prev_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=previous");
-$view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=next");
+$orig_word = array();
+$replacement_word = array();
+obtain_word_list($orig_word, $replacement_word);
//
-// Mozilla navigation bar
+// User authorisation levels output
//
-$nav_links['prev'] = array(
- 'url' => $view_prev_topic_url,
- 'title' => $lang['View_previous_topic']
-);
-$nav_links['next'] = array(
- 'url' => $view_next_topic_url,
- 'title' => $lang['View_next_topic']
-);
-$nav_links['up'] = array(
- 'url' => $view_forum_url,
- 'title' => $forum_name
-);
+$s_forum_rules = '';
+get_forum_rules('topic', $s_forum_rules, $forum_id);
+
+$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'lock') ) ? ( ( $forum_data['topic_status'] == TOPIC_UNLOCKED ) ? '<a href="' . "modcp.$phpEx?t=$topic_id&amp;mode=lock" . '"><img src="' . $theme['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a>&nbsp;' : '<a href="' . "modcp.$phpEx$SID&amp;t=$topic_id&amp;mode=unlock" . '"><img src="' . $theme['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a>&nbsp;' ) : '';
-$reply_img = ( $forum_row['forum_status'] == FORUM_LOCKED || $forum_row['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new'];
-$reply_alt = ( $forum_row['forum_status'] == FORUM_LOCKED || $forum_row['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Reply_to_topic'];
-$post_img = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'];
-$post_alt = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'];
+$topic_mod = ( $acl->get_acl($forum_id, 'mod', 'delete') ) ? '<a href="' . "modcp.$phpEx$SID&amp;t=$topic_id&amp;mode=delete" . '"><img src="' . $theme['topic_mod_delete'] . '" alt="' . $lang['Delete_topic'] . '" title="' . $lang['Delete_topic'] . '" border="0" /></a>&nbsp;' : '';
+
+$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'move') ) ? '<a href="' . "modcp.$phpEx$SID&amp;t=$topic_id&amp;mode=move". '"><img src="' . $theme['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a>&nbsp;' : '';
+
+$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'split') ) ? '<a href="' . "modcp.$phpEx$SID&amp;t=$topic_id&amp;mode=split" . '"><img src="' . $theme['topic_mod_split'] . '" alt="' . $lang['Split_topic'] . '" title="' . $lang['Split_topic'] . '" border="0" /></a>&nbsp;' : '';
+
+$topic_mod .= ( $acl->get_acl($forum_id, 'mod', 'merge') ) ? '<a href="' . "modcp.$phpEx$SID&amp;t=$topic_id&amp;mode=merge" . '"><img src="' . $theme['topic_mod_merge'] . '" alt="' . $lang['Merge_topic'] . '" title="' . $lang['Merge_topic'] . '" border="0" /></a>&nbsp;' : '';
+
+//
+// If we've got a hightlight set pass it on to pagination.
+//
+$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx$SID&amp;t=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order&amp;highlight=" . $HTTP_GET_VARS['highlight'], $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx$SID&amp;t=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);
+
+//
+// Post, reply and other URL generation for
+// templating vars
+//
+$new_topic_url = 'posting.' . $phpEx . $SID . '&amp;mode=newtopic&amp;f=' . $forum_id;
+$reply_topic_url = 'posting.' . $phpEx . $SID . '&amp;mode=reply&amp;f=' . $forum_id . '&amp;t=' . $topic_id;
+$view_forum_url = 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id;
+$view_prev_topic_url = 'viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;view=previous';
+$view_next_topic_url = 'viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;view=next';
+
+$reply_img = ( $forum_data['forum_status'] == FORUM_LOCKED || $forum_data['topic_status'] == TOPIC_LOCKED ) ? create_img($theme['reply_locked'], $lang['Topic_locked']) : create_img($theme['reply_new'], $lang['Reply_to_topic']);
+$post_img = ( $forum_data['forum_status'] == FORUM_LOCKED ) ? create_img($theme['post_locked'], $lang['Forum_locked']) : create_img($theme['post_new'], $lang['Post_new_topic']);
//
// Set a cookie for this topic
//
-if ( $userdata['session_logged_in'] )
+if ( $userdata['user_id'] != ANONYMOUS )
{
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
@@ -539,7 +474,7 @@ if ( $userdata['session_logged_in'] )
// Load templates
//
$template->set_filenames(array(
- 'body' => 'viewtopic_body.tpl')
+ 'body' => 'viewtopic_body.html')
);
make_jumpbox('viewforum.'.$phpEx, $forum_id);
@@ -549,53 +484,12 @@ make_jumpbox('viewforum.'.$phpEx, $forum_id);
$page_title = $lang['View_topic'] .' - ' . $topic_title;
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
-//
-// User authorisation levels output
-//
-$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>');
-
- $topic_mod = '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=delete") . '"><img src="' . $images['topic_mod_delete'] . '" alt="' . $lang['Delete_topic'] . '" title="' . $lang['Delete_topic'] . '" border="0" /></a>&nbsp;';
-
- $topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=move"). '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a>&nbsp;';
-
- $topic_mod .= ( $forum_row['topic_status'] == TOPIC_UNLOCKED ) ? '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=lock") . '"><img src="' . $images['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a>&nbsp;' : '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=unlock") . '"><img src="' . $images['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a>&nbsp;';
-
- $topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=split") . '"><img src="' . $images['topic_mod_split'] . '" alt="' . $lang['Split_topic'] . '" title="' . $lang['Split_topic'] . '" border="0" /></a>&nbsp;';
-}
-
-//
-// Topic watch information
-//
-$s_watching_topic = '';
-if ( $can_watch_topic )
+if ( count($orig_word) )
{
- if ( $is_watching_topic )
- {
- $s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start") . '">' . $lang['Stop_watching_topic'] . '</a>';
- $s_watching_topic_img = ( isset($images['Topic_un_watch']) ) ? '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start") . '"><img src="' . $images['Topic_un_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Stop_watching_topic'] . '" border="0"></a>' : '';
- }
- else
- {
- $s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start") . '">' . $lang['Start_watching_topic'] . '</a>';
- $s_watching_topic_img = ( isset($images['Topic_watch']) ) ? '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start") . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>' : '';
- }
+ $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); // Censor topic title
}
//
-// If we've got a hightlight set pass it on to pagination,
-// I get annoyed when I lose my highlight after the first page.
-//
-$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order&amp;highlight=" . $HTTP_GET_VARS['highlight'], $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);
-
-//
// Send vars to template
//
$template->assign_vars(array(
@@ -615,8 +509,6 @@ $template->assign_vars(array(
'L_POST_SUBJECT' => $lang['Post_subject'],
'L_VIEW_NEXT_TOPIC' => $lang['View_next_topic'],
'L_VIEW_PREVIOUS_TOPIC' => $lang['View_previous_topic'],
- 'L_POST_NEW_TOPIC' => $post_alt,
- 'L_POST_REPLY_TOPIC' => $reply_alt,
'L_BACK_TO_TOP' => $lang['Back_to_top'],
'L_DISPLAY_POSTS' => $lang['Display_posts'],
'L_LOCK_TOPIC' => $lang['Lock_topic'],
@@ -625,16 +517,20 @@ $template->assign_vars(array(
'L_SPLIT_TOPIC' => $lang['Split_topic'],
'L_DELETE_TOPIC' => $lang['Delete_topic'],
'L_GOTO_PAGE' => $lang['Goto_page'],
-
- 'S_TOPIC_LINK' => POST_TOPIC_URL,
- 'S_SELECT_POST_DAYS' => $select_post_days,
- 'S_SELECT_POST_ORDER' => $select_post_order,
- 'S_POST_DAYS_ACTION' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . "&amp;start=$start"),
- 'S_AUTH_LIST' => $s_auth_can,
+ 'L_SORT_BY' => $lang['Sort_by'],
+ 'L_RATE_TOPIC' => $lang['Rate_topic'],
+
+ 'S_TOPIC_LINK' => 't',
+ 'S_SELECT_SORT_DIR' => $select_sort_dir,
+ 'S_SELECT_SORT_KEY' => $select_sort,
+ 'S_SELECT_SORT_DAYS' => $select_sort_days,
+ 'S_SELECT_RATING' => $rating,
+ 'S_TOPIC_ACTION' => "viewtopic.$phpEx$SID&amp;t=" . $topic_id . "&amp;start=$start",
+ 'S_AUTH_LIST' => $s_forum_rules,
'S_TOPIC_ADMIN' => $topic_mod,
'S_WATCH_TOPIC' => $s_watching_topic,
- 'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;start=$start&amp;postdays=$post_days&amp;postorder=$post_order&amp;highlight=" . $HTTP_GET_VARS['highlight']),
+ 'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;start=$start&amp;postdays=$post_days&amp;postorder=$post_order&amp;highlight=" . $HTTP_GET_VARS['highlight'],
'U_VIEW_FORUM' => $view_forum_url,
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
@@ -643,19 +539,32 @@ $template->assign_vars(array(
);
//
+// Mozilla navigation bar
+//
+$nav_links['prev'] = array(
+ 'url' => $view_prev_topic_url,
+ 'title' => $lang['View_previous_topic']
+);
+$nav_links['next'] = array(
+ 'url' => $view_next_topic_url,
+ 'title' => $lang['View_next_topic']
+);
+$nav_links['up'] = array(
+ 'url' => $view_forum_url,
+ 'title' => $forum_name
+);
+
+//
// Does this topic contain a poll?
//
-if ( !empty($forum_row['topic_vote']) )
+if ( !empty($forum_data['topic_vote']) )
{
$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id ASC";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not obtain vote data for this topic", '', __LINE__, __FILE__, $sql);
- }
+ $result = $db->sql_query($sql);
if ( $vote_info = $db->sql_fetchrowset($result) )
{
@@ -669,10 +578,7 @@ if ( !empty($forum_row['topic_vote']) )
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Could not obtain user vote data for this topic", '', __LINE__, __FILE__, $sql);
- }
+ $result = $db->sql_query($sql);
$user_voted = ( $row = $db->sql_fetchrow($result) ) ? TRUE : 0;
$db->sql_freeresult($result);
@@ -688,46 +594,38 @@ if ( !empty($forum_row['topic_vote']) )
$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;
- if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_row['topic_status'] == TOPIC_LOCKED )
+ if ( $user_voted || $view_result || $poll_expired || !$acl->get_acl($forum_id, 'forum', 'vote') || $forum_data['topic_status'] == TOPIC_LOCKED )
{
- $template->set_filenames(array(
- 'pollbox' => 'viewtopic_poll_result.tpl')
- );
-
$vote_results_sum = 0;
-
for($i = 0; $i < $vote_options; $i++)
{
$vote_results_sum += $vote_info[$i]['vote_result'];
}
- $vote_graphic = 0;
- $vote_graphic_max = count($images['voting_graphic']);
-
for($i = 0; $i < $vote_options; $i++)
{
$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
- $vote_graphic_length = round($vote_percent * $board_config['vote_graphic_length']);
-
- $vote_graphic_img = $images['voting_graphic'][$vote_graphic];
- $vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;
+ $poll_length = round($vote_percent * $board_config['vote_graphic_length']);
+ $vote_percent = sprintf("%.1d%%", ($vote_percent * 100));
+ $vote_graphic_img = create_img($theme['voting_graphic'] . ' width="' . $poll_length . '"', $vote_percent);
if ( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
- $template->assign_block_vars("poll_option", array(
+ $template->assign_block_vars('poll_option', array(
'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'],
'POLL_OPTION_RESULT' => $vote_info[$i]['vote_result'],
- 'POLL_OPTION_PERCENT' => sprintf("%.1d%%", ($vote_percent * 100)),
+ 'POLL_OPTION_PERCENT' => $vote_percent,
- 'POLL_OPTION_IMG' => $vote_graphic_img,
- 'POLL_OPTION_IMG_WIDTH' => $vote_graphic_length)
+ 'POLL_OPTION_IMG' => $vote_graphic_img)
);
}
$template->assign_vars(array(
+ 'S_HAS_POLL_DISPLAY' => true,
+
'L_TOTAL_VOTES' => $lang['Total_votes'],
'TOTAL_VOTES' => $vote_results_sum)
);
@@ -735,10 +633,6 @@ if ( !empty($forum_row['topic_vote']) )
}
else
{
- $template->set_filenames(array(
- 'pollbox' => 'viewtopic_poll_ballot.tpl')
- );
-
for($i = 0; $i < $vote_options; $i++)
{
if ( count($orig_word) )
@@ -746,17 +640,19 @@ if ( !empty($forum_row['topic_vote']) )
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
- $template->assign_block_vars("poll_option", array(
+ $template->assign_block_vars('poll_option', array(
'POLL_OPTION_ID' => $vote_info[$i]['vote_option_id'],
'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'])
);
}
$template->assign_vars(array(
+ 'S_HAS_POLL_OPTIONS' => true,
+
'L_SUBMIT_VOTE' => $lang['Submit_vote'],
'L_VIEW_RESULTS' => $lang['View_results'],
- 'U_VIEW_RESULTS' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order&amp;vote=viewresult"))
+ 'U_VIEW_RESULTS' => "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;postdays=$post_days&amp;postorder=$post_order&amp;vote=viewresult")
);
$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '"><input type="hidden" name="mode" value="vote">';
@@ -771,10 +667,8 @@ if ( !empty($forum_row['topic_vote']) )
'POLL_QUESTION' => $vote_title,
'S_HIDDEN_FIELDS' => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : '',
- 'S_POLL_ACTION' => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
+ 'S_POLL_ACTION' => "posting.$phpEx$SID&amp;t=$topic_id")
);
-
- $template->assign_var_from_handle('POLL_DISPLAY', 'pollbox');
}
}
@@ -784,10 +678,12 @@ if ( !empty($forum_row['topic_vote']) )
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_views = topic_views + 1
WHERE topic_id = $topic_id";
-if ( !$db->sql_query($sql) )
-{
- message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql);
-}
+$db->sql_query($sql);
+
+//
+// Container for user details, only process once
+//
+$poster_details = array();
//
// Okay, let's do the loop, yeah come on baby let's do the loop
@@ -806,19 +702,18 @@ for($i = 0; $i < $total_posts; $i++)
$poster_joined = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ': ' . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_regdate'], $board_config['board_timezone']) : '';
- $poster_avatar = '';
- if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] )
+ if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] && !isset($poster_details[$poster_id]) )
{
switch( $postrow[$i]['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
- $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
+ $poster_details[$poster_id]['avatar'] = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '" width="' . $postrow[$i]['user_avatar_width'] . '" height="' . $postrow[$i]['user_avatar_height'] . '" border="0" alt="" />' : '';
break;
case USER_AVATAR_REMOTE:
- $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
+ $poster_details[$poster_id]['avatar'] = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" width="' . $postrow[$i]['user_avatar_width'] . '" height="' . $postrow[$i]['user_avatar_height'] . '" border="0" alt="" />' : '';
break;
case USER_AVATAR_GALLERY:
- $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
+ $poster_details[$poster_id]['avatar'] = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" width="' . $postrow[$i]['user_avatar_width'] . '" height="' . $postrow[$i]['user_avatar_height'] . '" border="0" alt="" />' : '';
break;
}
}
@@ -826,46 +721,33 @@ for($i = 0; $i < $total_posts; $i++)
//
// Define the little post icon
//
- if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read )
- {
- $mini_post_img = $images['icon_minipost_new'];
- $mini_post_alt = $lang['New_post'];
- }
- else
- {
- $mini_post_img = $images['icon_minipost'];
- $mini_post_alt = $lang['Post'];
- }
+ $mini_post_img = ( $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read ) ? create_img($theme['goto_post_new'], $lang['New_post']) : create_img($theme['goto_post'], $lang['Post']);
- $mini_post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $postrow[$i]['post_id']) . '#' . $postrow[$i]['post_id'];
-
//
// Generate ranks, set them to empty string initially.
//
- $poster_rank = '';
- $rank_image = '';
- if ( $postrow[$i]['user_id'] == ANONYMOUS )
- {
- }
- else if ( $postrow[$i]['user_rank'] )
+ if ( !isset($poster_details[$poster_id]['rank_title']) )
{
- for($j = 0; $j < count($ranksrow); $j++)
+ if ( $postrow[$i]['user_rank'] )
{
- if ( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
+ for($j = 0; $j < count($ranksrow); $j++)
{
- $poster_rank = $ranksrow[$j]['rank_title'];
- $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
+ if ( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
+ {
+ $poster_details[$poster_id]['rank_title'] = $ranksrow[$j]['rank_title'];
+ $poster_details[$poster_id]['rank_image'] = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" border="0" alt="' . $poster_rank . '" title="' . $poster_rank . '" /><br />' : '';
+ }
}
}
- }
- else
- {
- for($j = 0; $j < count($ranksrow); $j++)
+ else
{
- if ( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )
+ for($j = 0; $j < count($ranksrow); $j++)
{
- $poster_rank = $ranksrow[$j]['rank_title'];
- $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
+ if ( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )
+ {
+ $poster_details[$poster_id]['rank_title'] = $ranksrow[$j]['rank_title'];
+ $poster_details[$poster_id]['rank_image'] = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" border="0" alt="' . $poster_rank . '" title="' . $poster_rank . '" /><br />' : '';
+ }
}
}
}
@@ -883,19 +765,19 @@ for($i = 0; $i < $total_posts; $i++)
if ( $poster_id != ANONYMOUS )
{
- $temp_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$poster_id");
- $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
+ $temp_url = "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=$poster_id";
+ $profile_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_profile'], $lang['Read_profile']) . '</a>';
$profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
- $temp_url = append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$poster_id");
- $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
+ $temp_url = "privmsg.$phpEx$SID&amp;mode=post&amp;u=$poster_id";
+ $pm_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_pm'], $lang['Send_private_message']) . '</a>';
$pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
- if ( !empty($postrow[$i]['user_viewemail']) || $is_auth['auth_mod'] )
+ if ( !empty($postrow[$i]['user_viewemail']) || $acl->get_acl($forum_id, 'mod') )
{
- $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL .'=' . $poster_id) : 'mailto:' . $postrow[$i]['user_email'];
+ $email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&amp;mode=email&amp;u=" . $poster_id : 'mailto:' . $postrow[$i]['user_email'];
- $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
+ $email_img = '<a href="' . $email_uri . '">' . create_img($theme['icon_email'], $lang['Send_email']) . '</a>';
$email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
}
else
@@ -904,13 +786,13 @@ for($i = 0; $i < $total_posts; $i++)
$email = '';
}
- $www_img = ( $postrow[$i]['user_website'] ) ? '<a href="' . $postrow[$i]['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '';
+ $www_img = ( $postrow[$i]['user_website'] ) ? '<a href="' . $postrow[$i]['user_website'] . '" target="_userwww">' . create_img($theme['icon_www'], $lang['Visit_website']) . '</a>' : '';
$www = ( $postrow[$i]['user_website'] ) ? '<a href="' . $postrow[$i]['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : '';
if ( !empty($postrow[$i]['user_icq']) )
{
$icq_status_img = '<a href="http://wwp.icq.com/' . $postrow[$i]['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $postrow[$i]['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
- $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
+ $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '">' . create_img($theme['icon_icq'], $lang['ICQ']) . '</a>';
$icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '">' . $lang['ICQ'] . '</a>';
}
else
@@ -920,14 +802,14 @@ for($i = 0; $i < $total_posts; $i++)
$icq = '';
}
- $aim_img = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&amp;message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '';
+ $aim_img = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&amp;message=Hello+Are+you+there?">' . create_img($theme['icon_aim'], $lang['AIM']) . '</a>' : '';
$aim = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&amp;message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';
- $temp_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$poster_id");
- $msn_img = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
+ $temp_url = "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=$poster_id";
+ $msn_img = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '">' . create_img($theme['icon_msnm'], $lang['MSNM']) . '</a>' : '';
$msn = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';
- $yim_img = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&amp;.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
+ $yim_img = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&amp;.src=pg">' . create_img($theme['icon_yim'], $lang['YIM']) . '</a>' : '';
$yim = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
}
else
@@ -951,18 +833,26 @@ for($i = 0; $i < $total_posts; $i++)
$yim = '';
}
- $temp_url = append_sid("posting.$phpEx?mode=quote&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
- $quote_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_quote'] . '" alt="' . $lang['Reply_with_quote'] . '" title="' . $lang['Reply_with_quote'] . '" border="0" /></a>';
+ $temp_url = 'posting.' . $phpEx . $SID . '&amp;mode=quote&amp;p=' . $postrow[$i]['post_id'];
+ $quote_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_quote'], $lang['Reply_with_quote']) . '</a>';
$quote = '<a href="' . $temp_url . '">' . $lang['Reply_with_quote'] . '</a>';
- $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($postrow[$i]['username']) . "&amp;showresults=posts");
- $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
- $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
+ if ( $acl->get_acl($forum_id, 'forum', 'search') )
+ {
+ $temp_url = 'search.' . $phpEx . $SID . '&amp;search_author=' . urlencode($postrow[$i]['username']) .'"&amp;showresults=posts';
+ $search_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_search'], $lang['Search_user_posts']) . '</a>';
+ $search ='<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
+ }
+ else
+ {
+ $search_img = '';
+ $search = '';
+ }
- if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] )
+ if ( ( $userdata['user_id'] == $poster_id && $acl->get_acl($forum_id, 'forum', 'edit') ) || $acl->get_acl($forum_id, 'mod', 'edit') )
{
- $temp_url = append_sid("posting.$phpEx?mode=editpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
- $edit_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_edit'] . '" alt="' . $lang['Edit_delete_post'] . '" title="' . $lang['Edit_delete_post'] . '" border="0" /></a>';
+ $temp_url = "posting.$phpEx$SID&amp;mode=editpost&amp;p=" . $postrow[$i]['post_id'];
+ $edit_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_edit'], $lang['Edit_delete_post']) . '</a>';
$edit = '<a href="' . $temp_url . '">' . $lang['Edit_delete_post'] . '</a>';
}
else
@@ -971,32 +861,28 @@ for($i = 0; $i < $total_posts; $i++)
$edit = '';
}
- if ( $is_auth['auth_mod'] )
+ if ( $acl->get_acl($forum_id, 'mod', 'ip') )
{
- $temp_url = append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&amp;" . POST_TOPIC_URL . "=" . $topic_id);
- $ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
+ $temp_url = "modcp.$phpEx$SID&amp;mode=ip&amp;p=" . $postrow[$i]['post_id'] . "&amp;t=" . $topic_id;
+ $ip_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_ip'], $lang['View_IP']) . '</a>';
$ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';
-
- $temp_url = append_sid("posting.$phpEx?mode=delete&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
- $delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
- $delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
}
else
{
$ip_img = '';
$ip = '';
+ }
- if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $i == $total_replies - 1 )
- {
- $temp_url = append_sid("posting.$phpEx?mode=delete&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
- $delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
- $delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
- }
- else
- {
- $delpost_img = '';
- $delpost = '';
- }
+ if ( ( $userdata['user_id'] == $poster_id && $acl->get_acl($forum_id, 'forum', 'delete') && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] ) || $acl->get_acl($forum_id, 'mod', 'delete') )
+ {
+ $temp_url = "posting.$phpEx$SID&amp;mode=delete&amp;p=" . $postrow[$i]['post_id'];
+ $delpost_img = '<a href="' . $temp_url . '">' . create_img($theme['icon_delete'], $lang['Delete_post']) . '</a>';
+ $delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
+ }
+ else
+ {
+ $delpost_img = '';
+ $delpost = '';
}
$post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : '';
@@ -1008,7 +894,7 @@ for($i = 0; $i < $total_posts; $i++)
$user_sig_bbcode_uid = $postrow[$i]['user_sig_bbcode_uid'];
//
- // Note! The order used for parsing the message _is_ important, moving things around could break any
+ // Note! The order used for parsing the message _is_ important, moving things around could break
// output
//
@@ -1016,14 +902,14 @@ for($i = 0; $i < $total_posts; $i++)
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
- if ( !$board_config['allow_html'] )
+ if ( !$acl->get_acl($forum_id, 'forum', 'html') )
{
if ( $user_sig != '' && $userdata['user_allowhtml'] )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
}
- if ( $postrow[$i]['enable_html'] )
+ if ( $postrow[$i]['enable_html'] && $acl->get_acl($forum_id, 'forum', 'bbcode') )
{
$message = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
}
@@ -1032,24 +918,28 @@ for($i = 0; $i < $total_posts; $i++)
//
// Parse message and/or sig for BBCode if reqd
//
- if ( $board_config['allow_bbcode'] )
+ if ( $user_sig != '' && $user_sig_bbcode_uid != '' && !isset($poster_details[$poster_id]['sig']) && $acl->get_acl($forum_id, 'forum', 'sigs') )
{
- if ( $user_sig != '' && $user_sig_bbcode_uid != '' )
- {
- $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
- }
+ $poster_details[$poster_id]['sig'] = bbencode_second_pass($user_sig, $user_sig_bbcode_uid, $acl->get_acl($forum_id, 'forum', 'img'));
+ $poster_details[$poster_id]['sig'] = make_clickable($poster_details[$poster_id]['sig']);
- if ( $bbcode_uid != '' )
+ if ( $postrow[$i]['user_allowsmile'] )
{
- $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
+ $poster_details[$poster_id]['sig'] = smilies_pass($poster_details[$poster_id]['sig']);
}
+
+ $poster_details[$poster_id]['sig'] = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $poster_details[$poster_id]['sig']);
}
- if ( $user_sig != '' && $board_config['allow_sig'] )
+ if ( $bbcode_uid != '' )
{
- $user_sig = make_clickable($user_sig);
+ $message = ( $acl->get_acl($forum_id, 'forum', 'bbcode') ) ? bbencode_second_pass($message, $bbcode_uid, $acl->get_acl($forum_id, 'forum', 'img')) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
+ }
+
+ if ( $postrow[$i]['enable_magic_url'] )
+ {
+ $message = make_clickable($message);
}
- $message = make_clickable($message);
//
// Highlight active words (primarily for search)
@@ -1143,29 +1033,9 @@ for($i = 0; $i < $total_posts; $i++)
$message = preg_replace($orig_word, $replacement_word, $message);
}
- //
- // Parse smilies
- //
- if ( $board_config['allow_smilies'] )
+ if ( $postrow[$i]['enable_smilies'] && $acl->get_acl($forum_id, 'forum', 'smilies') )
{
- if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
- {
- $user_sig = smilies_pass($user_sig);
- }
-
- if ( $postrow[$i]['enable_smilies'] )
- {
- $message = smilies_pass($message);
- }
- }
-
- //
- // Replace newlines (we use this rather than nl2br because
- // till recently it wasn't XHTML compliant)
- //
- if ( $user_sig != '' )
- {
- $user_sig = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $user_sig);
+ $message = smilies_pass($message);
}
$message = str_replace("\n", "\n<br />\n", $message);
@@ -1188,23 +1058,18 @@ for($i = 0; $i < $total_posts; $i++)
// Again this will be handled by the templating
// code at some point
//
- $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
- $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
-
$template->assign_block_vars('postrow', array(
- 'ROW_COLOR' => '#' . $row_color,
- 'ROW_CLASS' => $row_class,
'POSTER_NAME' => $poster,
- 'POSTER_RANK' => $poster_rank,
- 'RANK_IMAGE' => $rank_image,
+ 'POSTER_RANK' => $poster_details[$poster_id]['rank_title'],
+ 'RANK_IMAGE' => $poster_details[$poster_id]['rank_image'],
'POSTER_JOINED' => $poster_joined,
'POSTER_POSTS' => $poster_posts,
'POSTER_FROM' => $poster_from,
- 'POSTER_AVATAR' => $poster_avatar,
+ 'POSTER_AVATAR' => $poster_details[$poster_id]['avatar'],
'POST_DATE' => $post_date,
'POST_SUBJECT' => $post_subject,
'MESSAGE' => $message,
- 'SIGNATURE' => $user_sig,
+ 'SIGNATURE' => $poster_details[$poster_id]['sig'],
'EDITED_MESSAGE' => $l_edited_by,
'MINI_POST_IMG' => $mini_post_img,
@@ -1238,13 +1103,13 @@ for($i = 0; $i < $total_posts; $i++)
'L_MINI_POST_ALT' => $mini_post_alt,
+ 'S_ROW_COUNT' => $i,
+
'U_MINI_POST' => $mini_post_url,
'U_POST_ID' => $postrow[$i]['post_id'])
);
}
-$template->pparse('body');
-
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> \ No newline at end of file