Code: Select all
<?php
/***************************************************************************
* posting.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : [email protected]
*
* $Id: posting.php,v 1.6 2003/08/30 15:05:45 acydburn Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
//
// Check and set various parameters
//
$params = array('submit' => 'post', 'preview' => 'preview', 'delete' => 'delete', 'poll_delete' => 'poll_delete', 'poll_add' => 'add_poll_option', 'poll_edit' => 'edit_poll_option', 'mode' => 'mode');
while( list($var, $param) = @each($params) )
{
if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) )
{
$$var = ( !empty($HTTP_POST_VARS[$param]) ) ? htmlspecialchars($HTTP_POST_VARS[$param]) : htmlspecialchars($HTTP_GET_VARS[$param]);
}
else
{
$$var = '';
}
}
$confirm = isset($HTTP_POST_VARS['confirm']) ? true : false;
$sid = (isset($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : 0;
$params = array('forum_id' => POST_FORUM_URL, 'topic_id' => POST_TOPIC_URL, 'post_id' => POST_POST_URL, 'lock_subject' => 'lock_subject');
while( list($var, $param) = @each($params) )
{
if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) )
{
$$var = ( !empty($HTTP_POST_VARS[$param]) ) ? intval($HTTP_POST_VARS[$param]) : intval($HTTP_GET_VARS[$param]);
}
else
{
$$var = '';
}
}
$refresh = $preview || $poll_add || $poll_edit || $poll_delete;
$orig_word = $replacement_word = array();
//
// Set topic type
//
$topic_type = ( !empty($HTTP_POST_VARS['topictype']) ) ? intval($HTTP_POST_VARS['topictype']) : POST_NORMAL;
$topic_type = ( in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE, POST_GLOBAL_ANNOUNCE)) ) ?
$topic_type : POST_NORMAL;
//
// If the mode is set to topic review then output
// that review ...
//
if ( $mode == 'topicreview' )
{
require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
topic_review($topic_id, false);
exit;
}
else if ( $mode == 'smilies' )
{
generate_smilies('window', PAGE_POSTING);
exit;
}
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_POSTING);
init_userprefs($userdata);
//
// End session management
//
##=== ADR START: check user if in cell or not ===#
if(($userdata['user_cell_time'] > '0') && (!defined('CELL')) && ($userdata['session_logged_in']) && ($userdata['user_level'] != ADMIN) && (($userdata['user_cell_punishment'] == '2') || ($userdata['user_cell_punishment'] == '3'))){
redirect(append_sid("adr_cell.$phpEx", true));
}
##=== ADR END ===#
//
// Was cancel pressed? If so then redirect to the appropriate
// page, no point in continuing with any further checks
//
if ( isset($HTTP_POST_VARS['cancel']) )
{
if ( $postreport )
{
$redirect = 'viewtopic.$phpEx?' . POST_POST_URL . '=$postreport';
$post_append = '';
} else
if ( $post_id )
{
$redirect = "viewtopic.$phpEx?" . POST_POST_URL . "=$post_id";
$post_append = "#$post_id";
}
else if ( $topic_id )
{
$redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
$post_append = '';
}
else if ( $forum_id )
{
$redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id";
$post_append = '';
}
else
{
$redirect = "index.$phpEx";
$post_append = '';
}
redirect(append_sid($redirect, true) . $post_append);
}
//
// What auth type do we need to check?
//
$is_auth = array();
switch( $mode )
{
case 'newtopic':
// Start add - Global announcement MOD
if ( $topic_type == POST_GLOBAL_ANNOUNCE )
{
$is_auth_type = 'auth_globalannounce';
}
else
// End add - Global announcement MOD
if ( $topic_type == POST_ANNOUNCE )
{
$is_auth_type = 'auth_announce';
}
else if ( $topic_type == POST_STICKY )
{
$is_auth_type = 'auth_sticky';
}
else
{
$is_auth_type = 'auth_post';
}
break;
case 'reply':
case 'quote':
$is_auth_type = 'auth_reply';
break;
case 'editpost':
$is_auth_type = 'auth_edit';
break;
case 'delete':
case 'poll_delete':
$is_auth_type = 'auth_delete';
break;
case 'vote':
$is_auth_type = 'auth_vote';
break;
case 'topicreview':
$is_auth_type = 'auth_read';
break;
case 'thank':
$is_auth_type = 'auth_read';
break;
default:
message_die(GENERAL_MESSAGE, $lang['No_post_mode']);
break;
}
//
// Here we do various lookups to find topic_id, forum_id, post_id etc.
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
//
$error_msg = '';
$post_data = array();
switch ( $mode )
{
case 'newtopic':
if ( empty($forum_id) )
{
message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
}
$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
break;
case 'thank':
case 'reply':
case 'vote':
if ( empty( $topic_id) )
{
message_die(GENERAL_MESSAGE, $lang['No_topic_id']);
}
$sql = "SELECT f.*, t.topic_status, t.topic_title, t.topic_type
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id";
break;
case 'quote':
case 'editpost':
case 'delete':
case 'poll_delete':
if ( empty($post_id) )
{
message_die(GENERAL_MESSAGE, $lang['No_post_id']);
}
$select_sql = (!$submit) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, p.post_time, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : '';
$from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : '';
$where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';
$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . "
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
$where_sql";
break;
default:
message_die(GENERAL_MESSAGE, $lang['No_valid_mode']);
}
if ( ($result = $db->sql_query($sql)) && ($post_info = $db->sql_fetchrow($result)) )
{
$db->sql_freeresult($result);
$forum_id = $post_info['forum_id'];
$forum_name = $post_info['forum_name'];
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
$lock = ( isset($HTTP_POST_VARS['lock']) ) ? TRUE : FALSE;
$unlock = ( isset($HTTP_POST_VARS['unlock']) ) ? TRUE : FALSE;
if ( ($submit || $confirm) && ($lock || $unlock) && ($is_auth['auth_mod']) && ($mode != 'newtopic') && (!$refresh) )
{
$t_id = ( !isset($post_info['topic_id']) ) ? $topic_id : $post_info['topic_id'];
if ( $unlock )
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_UNLOCKED . "
WHERE topic_id = " . $t_id . "
AND topic_moved_id = 0";
}
else if ($lock)
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_LOCKED . "
WHERE topic_id = " . $t_id . "
AND topic_moved_id = 0";
}
if ($lock || $unlock)
{
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
}
}
}
if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod'])
{
message_die(GENERAL_MESSAGE, $lang['Forum_locked']);
}
else if ( $mode != 'newtopic' && $mode != 'thank' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
{
message_die(GENERAL_MESSAGE, $lang['Topic_locked']);
}
if ( $mode == 'editpost' && !$is_auth['auth_mod'] && $board_config['edit_time'] != '0' && !$submit)
{
$difference_min = ((time() - $post_info['post_time']) / 60);
if ($difference_min > $board_config['edit_time'] )
{
$message = sprintf($lang['edit_time_past'],$board_config['edit_time']) . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
}
if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' )
{
$topic_id = $post_info['topic_id'];
$post_data['poster_post'] = ( $post_info['poster_id'] == $userdata['user_id'] ) ? true : false;
$post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id ) ? true : false;
$post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id ) ? true : false;
$post_data['last_topic'] = ( $post_info['forum_last_post_id'] == $post_id ) ? true : false;
$post_data['has_poll'] = ( $post_info['topic_vote'] ) ? true : false;
$post_data['topic_type'] = $post_info['topic_type'];
$post_data['poster_id'] = $post_info['poster_id'];
if ( $post_data['first_post'] && $post_data['has_poll'] )
{
$sql = "SELECT *
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";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
}
$poll_options = array();
$poll_results_sum = 0;
if ( $row = $db->sql_fetchrow($result) )
{
$poll_title = $row['vote_text'];
$poll_id = $row['vote_id'];
$poll_length = $row['vote_length'] / 86400;
do
{
$poll_options[$row['vote_option_id']] = $row['vote_option_text'];
$poll_results_sum += $row['vote_result'];
}
while ( $row = $db->sql_fetchrow($result) );
}
$db->sql_freeresult($result);
$post_data['edit_poll'] = ( ( !$poll_results_sum || $is_auth['auth_mod'] ) && $post_data['first_post'] ) ? true : 0;
}
else
{
$post_data['edit_poll'] = ($post_data['first_post'] && $is_auth['auth_pollcreate']) ? true : false;
}
//
// Can this user edit/delete the post/poll?
//
if ( $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'] )
{
$message = ( $delete || $mode == 'delete' ) ? $lang['Delete_own_posts'] : $lang['Edit_own_posts'];
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else if ( !$post_data['last_post'] && !$is_auth['auth_mod'] && ( $mode == 'delete' || $delete ) )
{
message_die(GENERAL_MESSAGE, $lang['Cannot_delete_replied']);
}
else if ( !$post_data['edit_poll'] && !$is_auth['auth_mod'] && ( $mode == 'poll_delete' || $poll_delete ) )
{
message_die(GENERAL_MESSAGE, $lang['Cannot_delete_poll']);
}
}
else
{
if ( $mode == 'quote' )
{
$topic_id = $post_info['topic_id'];
}
if ( $mode == 'newtopic' )
{
$post_data['topic_type'] = POST_NORMAL;
}
$post_data['first_post'] = ( $mode == 'newtopic' ) ? true : 0;
$post_data['last_post'] = false;
$post_data['has_poll'] = false;
$post_data['edit_poll'] = false;
}
if ( $mode == 'poll_delete' && !isset($poll_id) )
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
//
// The user is not authed, if they're not logged in then redirect
// them, else show them an error message
//
if ( !$is_auth[$is_auth_type] )
{
if ( $userdata['session_logged_in'] )
{
message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_' . $is_auth_type], $is_auth[$is_auth_type . "_type"]));
}
switch( $mode )
{
case 'newtopic':
$redirect = "mode=newtopic&" . POST_FORUM_URL . "=" . $forum_id;
break;
case 'thank':
case 'reply':
case 'topicreview':
$redirect = "mode=reply&" . POST_TOPIC_URL . "=" . $topic_id;
break;
case 'quote':
case 'editpost':
$redirect = "mode=quote&" . POST_POST_URL ."=" . $post_id;
break;
}
$redirect .= ($post_reportid) ? '&post_reportid=$post_reportid' : '';
redirect(append_sid("login.$phpEx?redirect=posting.$phpEx&" . $redirect, true));
}
//
// Set toggles for various options
//
if ( !$board_config['allow_html'] )
{
$html_on = 0;
}
else
{
$html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
}
if ( !$board_config['allow_bbcode'] )
{
$bbcode_on = 0;
}
else
{
$bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );
}
if ( !$board_config['allow_smilies'] )
{
$smilies_on = 0;
}
else
{
$smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );
}
if ( ($submit || $refresh) && $is_auth['auth_read'])
{
$notify_user = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0;
}
else
{
if ( $mode != 'newtopic' && $userdata['session_logged_in'] && $is_auth['auth_read'] )
{
$sql = "SELECT topic_id
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);
}
$notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify'];
$db->sql_freeresult($result);
}
else
{
$notify_user = ( $userdata['session_logged_in'] && $is_auth['auth_read'] ) ? $userdata['user_notify'] : 0;
}
}
$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] );
execute_posting_attachment_handling();
// --------------------
// What shall we do?
//
if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
{
//
// Confirm deletion
//
$s_hidden_fields = '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
$s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input type="hidden" name="mode" value="delete" />' : '<input type="hidden" name="mode" value="poll_delete" />';
$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
$l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll'];
//
// Output confirmation page
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
mycal_generate_entry($mode, $topic_id, $post_id, $post_info['topic_first_post_id'], $template);
$template->set_filenames(array(
'confirm_body' => 'confirm_body.tpl')
);
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Information'],
'MESSAGE_TEXT' => $l_confirm,
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("posting.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
$template->pparse('confirm_body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
else if ( $mode == 'thank' )
{
$topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);
if ( !($userdata['session_logged_in']) )
{
$message = $lang['thanks_not_logged'];
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
if ( empty($topic_id) )
{
message_die(GENERAL_MESSAGE, 'No topic Selected');
}
$userid = $userdata['user_id'];
$thanks_date = time();
// Check if user is the topic starter
$sql = "SELECT `topic_poster`
FROM " . TOPICS_TABLE . "
WHERE topic_id = $topic_id
AND topic_poster = $userid";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't check for topic starter", '', __LINE__, __FILE__, $sql);
}
if ( ($topic_starter_check = $db->sql_fetchrow($result)) )
{
$message = $lang['t_starter'];
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
// Check if user had thanked before
$sql = "SELECT `topic_id`
FROM " . THANKS_TABLE . "
WHERE topic_id = $topic_id
AND user_id = $userid";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't check for previous thanks", '', __LINE__, __FILE__, $sql);
}
if ( !($thankfull_check = $db->sql_fetchrow($result)) )
{
// Insert thanks if he/she hasn't
$sql = "INSERT INTO " . THANKS_TABLE . " (topic_id, user_id, thanks_time)
VALUES ('" . $topic_id . "', '" . $userid . "', " . $thanks_date . ") ";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not insert thanks information", '', __LINE__, __FILE__, $sql);
}
$message = $lang['thanks_add'];
}
else
{
$message = $lang['thanked_before'];
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">')
);
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else if ( $mode == 'vote' )
{
//
// Vote in a poll
//
if ( !empty($HTTP_POST_VARS['vote_id']) )
{
$vote_option_id = intval($HTTP_POST_VARS['vote_id']);
$sql = "SELECT vd.vote_id
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
AND vr.vote_option_id = $vote_option_id
GROUP BY vd.vote_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
}
if ( $vote_info = $db->sql_fetchrow($result) )
{
$vote_id = $vote_info['vote_id'];
$sql = "SELECT *
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
if ( !($result2 = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result2)) )
{
$sql = "UPDATE " . VOTE_RESULTS_TABLE . "
SET vote_result = vote_result + 1
WHERE vote_id = $vote_id
AND vote_option_id = $vote_option_id";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql);
}
$sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip)
VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__,$sql);
}
$message = $lang['Vote_cast'];
}
else
{
$message = $lang['Already_voted'];
}
$db->sql_freeresult($result2);
}
else
{
$message = $lang['No_vote_option'];
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">')
);
$message .= '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
}
}
else if ( $submit || $confirm )
{
//
// Submit post/vote (newtopic, edit, reply, etc.)
//
$return_message = '';
$return_meta = '';
// session id check
if ($sid == '' || $sid != $userdata['session_id'])
{
$error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Session_invalid'] : $lang['Session_invalid'];
}
switch ( $mode )
{
case 'editpost':
case 'newtopic':
case 'reply':
$username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : '';
$subject = ( !empty($HTTP_POST_VARS['subject']) ) ? trim($HTTP_POST_VARS['subject']) : '';
$message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : '';
$extra_message_body = ( !empty($HTTP_POST_VARS['extra_message_body']) ) ? $HTTP_POST_VARS['extra_message_body'] : '';
$poll_title = ( isset($HTTP_POST_VARS['poll_title']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_title'] : '';
$poll_options = ( isset($HTTP_POST_VARS['poll_option_text']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_option_text'] : '';
$poll_length = ( isset($HTTP_POST_VARS['poll_length']) && $is_auth['auth_pollcreate'] ) ? $HTTP_POST_VARS['poll_length'] : '';
$bbcode_uid = '';
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length);
if ( $error_msg == '' )
{
$topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] && !$is_auth['auth_globalannounce']) ? $post_data['topic_type'] : $topic_type;
$message = ($lock_subject) ? $extra_message_body.$message : $message;
if ($lock_subject)
{
$url = "<a href='viewtopic.$phpEx?" . POST_POST_URL . "=" .$lock_subject."#".$lock_subject."'> ";
$message = addslashes(sprintf($lang['Link_to_post'],$url,"</a>")).$message;
}
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
}
break;
case 'delete':
case 'poll_delete':
delete_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id);
mycal_delete_event($topic_id, $post_id, true);
if ($error_msg != '')
{
message_die(GENERAL_MESSAGE, $error_msg);
}
break;
}
if ( $error_msg == '' )
{
if ( $mode != 'editpost' )
{
$user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id'];
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
}
$attachment_mod['posting']->insert_attachment($post_id);
if ($error_msg == '' && $mode != 'poll_delete')
{
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user);
mycal_submit_event($mode, $forum_id, $topic_id, $post_id, $post_info['topic_first_post_id'], $return_message, $return_meta);
}
if ($lock_subject)
{
$url = "<a href='".append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" .$lock_subject."#".$lock_subject)."'> ";
$return_message = $lang['Report_stored']."<br/><br/>".sprintf($lang['Send_report'],$url,"</a>");
$return_meta = str_replace($post_id,$lock_subject,$return_meta);
$sql = 'SELECT post_bluecard FROM ' . POSTS_TABLE . ' WHERE post_id = "'.$lock_subject.'"';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, "Couldn't obtain forums information.", "", __LINE__, __FILE__, $sql);
$result = $db->sql_fetchrow($result);
$blue_card = $result['post_bluecard'];
$blue_card++;
$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_bluecard="'.$blue_card.'" WHERE post_id="'.$lock_subject.'"';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, "Couldn't update blue card information");
}
if ( ( $error_msg == '' ) && ( $lock ) && ( $mode == 'newtopic' ) )
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_LOCKED . "
WHERE topic_id = " . $topic_id . "
AND topic_moved_id = 0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
}
}
if ( $mode == 'newtopic' || $mode == 'reply' )
{
$tracking_topics = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
$tracking_forums = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
if ( count($tracking_topics) + count($tracking_forums) == 100 && empty($tracking_topics[$topic_id]) )
{
asort($tracking_topics);
unset($tracking_topics[key($tracking_topics)]);
}
$tracking_topics[$topic_id] = time();
setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
$template->assign_vars(array(
'META' => $return_meta)
);
message_die(GENERAL_MESSAGE, $return_message);
}
}
if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
{
$username = ( !empty($HTTP_POST_VARS['username']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['username']))) : '';
$subject = ( !empty($HTTP_POST_VARS['subject']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['subject']))) : '';
$message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
$poll_title = ( !empty($HTTP_POST_VARS['poll_title']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['poll_title']))) : '';
$poll_length = ( isset($HTTP_POST_VARS['poll_length']) ) ? max(0, intval($HTTP_POST_VARS['poll_length'])) : 0;
$poll_options = array();
if ( !empty($HTTP_POST_VARS['poll_option_text']) )
{
while( list($option_id, $option_text) = @each($HTTP_POST_VARS['poll_option_text']) )
{
if( isset($HTTP_POST_VARS['del_poll_option'][$option_id]) )
{
unset($poll_options[$option_id]);
}
else if ( !empty($option_text) )
{
$poll_options[intval($option_id)] = htmlspecialchars(trim(stripslashes($option_text)));
}
}
}
if ( isset($poll_add) && !empty($HTTP_POST_VARS['add_poll_option_text']) )
{
$poll_options[] = htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['add_poll_option_text'])));
}
if ( $mode == 'newtopic' || $mode == 'reply')
{
$user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : '';
}
else if ( $mode == 'editpost' )
{
$user_sig = ( $post_info['user_sig'] != '' && $board_config['allow_sig'] ) ? $post_info['user_sig'] : '';
$userdata['user_sig_bbcode_uid'] = $post_info['user_sig_bbcode_uid'];
}
if( $preview )
{
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
$preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
$preview_subject = $subject;
$preview_username = $username;
//
// Finalise processing as per viewtopic
//
if( !$html_on )
{
if( $user_sig != '' || !$userdata['user_allowhtml'] )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', '<\2>', $user_sig);
}
}
if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] )
{
$user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']);
}
if( $bbcode_on )
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
}
if( !empty($orig_word) )
{
$preview_username = ( !empty($username) ) ? preg_replace($orig_word, $replacement_word, $preview_username) : '';
$preview_subject = ( !empty($subject) ) ? preg_replace($orig_word, $replacement_word, $preview_subject) : '';
$preview_message = ( !empty($preview_message) ) ? preg_replace($orig_word, $replacement_word, $preview_message) : '';
}
if( $user_sig != '' )
{
$user_sig = make_clickable($user_sig);
}
$preview_message = make_clickable($preview_message);
if( $smilies_on )
{
if( $userdata['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig);
}
$preview_message = smilies_pass($preview_message);
}
if( $attach_sig && $user_sig != '' )
{
$preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig;
}
$preview_message = str_replace("\n", '<br />', $preview_message);
$preview_message = ($lock_subject) ? stripslashes($extra_message_body).$preview_message : $preview_message;
$url = "<a href='viewtopic.$phpEx?" . POST_POST_URL . "=" .$lock_subject."#".$lock_subject."'> ";
$extra_message_body= sprintf($lang['Link_to_post'],$url,"</a>");
$preview_message = ($lock_subject) ? stripslashes($extra_message_body).$preview_message : $preview_message;
$template->set_filenames(array(
'preview' => 'posting_preview.tpl')
);
$attachment_mod['posting']->preview_attachments();
$template->assign_vars(array(
'TOPIC_TITLE' => $preview_subject,
'POST_SUBJECT' => $preview_subject,
'POSTER_NAME' => $preview_username,
'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']),
'MESSAGE' => $preview_message,
'L_POST_SUBJECT' => $lang['Post_subject'],
'L_PREVIEW' => $lang['Preview'],
'L_POSTED' => $lang['Posted'],
'L_POST' => $lang['Post'])
);
$template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview');
}
else if( $error_msg != '' )
{
$template->set_filenames(array(
'reg_header' => 'error_body.tpl')
);
$template->assign_vars(array(
'ERROR_MESSAGE' => $error_msg)
);
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
}
else
{
//
// User default entry point
//
$postreport=(isset($HTTP_GET_VARS['postreport']))? intval( $HTTP_GET_VARS['postreport']) : 0;
if ($postreport)
{
$sql = 'SELECT topic_id FROM '.POSTS_TABLE.' WHERE post_id="'.$postreport.'"';
if( !($result = $db->sql_query($sql) ))
message_die(GENERAL_ERROR, "Couldn't get post subject information");
$post_details = $db->sql_fetchrow($result);
$post_topic_id=$post_details['topic_id'];
$sql = 'SELECT f.forum_name FROM ' . FORUMS_TABLE . ' f, ' . POSTS_TABLE . ' p WHERE p.post_id="' . $postreport . '" AND p.forum_id = f.forum_id';
if( !($result = $db->sql_query($sql) ))
message_die(GENERAL_ERROR, "Couldn't get forum information".$sql);
$post_details = $db->sql_fetchrow($result);
$post_forum_name = $post_details['forum_name'];
$sql = 'SELECT pt.post_subject FROM '.POSTS_TEXT_TABLE.' pt, '.POSTS_TABLE.' p WHERE p.topic_id="'.$post_topic_id.'" AND pt.post_id=p.post_id ORDER BY p.post_time ASC LIMIT 1';
if( !($result = $db->sql_query($sql) ))
message_die(GENERAL_ERROR, "Couldn't get topic subject information".$sql);
$post_details = $db->sql_fetchrow($result);
$subject='['.$post_forum_name.']('.$postreport.')'.$post_details['post_subject'];
$url = "<a href='".append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" .$postreport."#".$postreport)."'> ";
$lock_subject=$postreport;
$extra_message_body= sprintf($lang['Link_to_post'],$url,"</a>",$post_forum_name);
} else
{
$subject = '';
$lock_subject='';
}
if ( $mode == 'newtopic' )
{
$user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
$poll_title = '';
$poll_length = '';
$message = '';
}
else if ( $mode == 'reply' )
{
$user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : '';
$username = ( $userdata['session_logged_in'] ) ? $userdata['username'] : '';
$subject = '';
$message = '';
}
else if ( $mode == 'quote' || $mode == 'editpost' )
{
$subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject'];
$message = $post_info['post_text'];
if ( $mode == 'editpost' )
{
$attach_sig = ( $post_info['enable_sig'] && $post_info['user_sig'] != '' ) ? TRUE : 0;
$user_sig = $post_info['user_sig'];
$html_on = ( $post_info['enable_html'] ) ? true : false;
$bbcode_on = ( $post_info['enable_bbcode'] ) ? true : false;
$smilies_on = ( $post_info['enable_smilies'] ) ? true : false;
}
else
{
$attach_sig = ( $userdata['user_attachsig'] ) ? TRUE : 0;
$user_sig = $userdata['user_sig'];
}
if ( $post_info['bbcode_uid'] != '' )
{
$message = preg_replace('/\:(([a-z0-9]:)?)' . $post_info['bbcode_uid'] . '/s', '', $message);
}
$message = str_replace('<', '<', $message);
$message = str_replace('>', '>', $message);
$message = str_replace('<br />', "\n", $message);
if ( $mode == 'quote' )
{
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replace_word);
$msg_date = create_date($board_config['default_dateformat'], $postrow['post_time'], $board_config['board_timezone']);
// Use trim to get rid of spaces placed there by MS-SQL 2000
$quote_username = ( trim($post_info['post_username']) != '' ) ? $post_info['post_username'] : $post_info['username'];
// $message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';
$message = '[quote="' . $quote_username . '";p="' . $post_id . '"]' . $message . '[/quote]';
if ( !empty($orig_word) )
{
$subject = ( !empty($subject) ) ? preg_replace($orig_word, $replace_word, $subject) : '';
$message = ( !empty($message) ) ? preg_replace($orig_word, $replace_word, $message) : '';
}
if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 )
{
$subject = 'Re: ' . $subject;
}
$mode = 'reply';
}
else
{
$username = ( $post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username']) ) ? $post_info['post_username'] : '';
}
}
}
//
// Signature toggle selection
//
if( $user_sig != '' )
{
$template->assign_block_vars('switch_signature_checkbox', array());
}
//
// HTML toggle selection
//
if ( $board_config['allow_html'] )
{
$html_status = $lang['HTML_is_ON'];
$template->assign_block_vars('switch_html_checkbox', array());
}
else
{
$html_status = $lang['HTML_is_OFF'];
}
//
// BBCode toggle selection
//
if ( $board_config['allow_bbcode'] )
{
$bbcode_status = $lang['BBCode_is_ON'];
$template->assign_block_vars('switch_bbcode_checkbox', array());
}
else
{
$bbcode_status = $lang['BBCode_is_OFF'];
}
//
// Smilies toggle selection
//
if ( $board_config['allow_smilies'] )
{
$smilies_status = $lang['Smilies_are_ON'];
$template->assign_block_vars('switch_smilies_checkbox', array());
}
else
{
$smilies_status = $lang['Smilies_are_OFF'];
}
if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) )
{
$template->assign_block_vars('switch_username_select', array());
}
//
// Notify checkbox - only show if user is logged in
//
if ( $userdata['session_logged_in'] && $is_auth['auth_read'] )
{
if ( $mode != 'editpost' || ( $mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS ) )
{
$template->assign_block_vars('switch_notify_checkbox', array());
}
}
//
// Delete selection
//
if ( $mode == 'editpost' && ( ( $is_auth['auth_delete'] && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $is_auth['auth_mod'] ) )
{
$template->assign_block_vars('switch_delete_checkbox', array());
}
if ( ( $mode == 'editpost' || $mode == 'reply' || $mode == 'quote' || $mode == 'newtopic' ) && ( $is_auth['auth_mod'] ) )
{
if ( $post_info['topic_status'] == TOPIC_LOCKED )
{
$template->assign_block_vars('switch_unlock_topic', array());
$template->assign_vars(array(
'L_UNLOCK_TOPIC' => $lang['Unlock_topic'],
'S_UNLOCK_CHECKED' => ( $unlock ) ? 'checked="checked"' : '')
);
}
else if ( $post_info['topic_status'] == TOPIC_UNLOCKED )
{
$template->assign_block_vars('switch_lock_topic', array());
$template->assign_vars(array(
'L_LOCK_TOPIC' => $lang['Lock_topic'],
'S_LOCK_CHECKED' => ( $lock ) ? 'checked="checked"' : '')
);
}
}
//
// Topic type selection
//
$topic_type_toggle = '';
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
{
$template->assign_block_vars('switch_type_toggle', array());
if( $is_auth['auth_sticky'] )
{
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_STICKY . '"';
if ( $post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY )
{
$topic_type_toggle .= ' checked="checked"';
}
$topic_type_toggle .= ' /> ' . $lang['Post_Sticky'] . ' ';
}
if( $is_auth['auth_announce'] )
{
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"';
if ( $post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE )
{
$topic_type_toggle .= ' checked="checked"';
}
$topic_type_toggle .= ' /> ' . $lang['Post_Announcement'] . ' ';
}
// Start add - Global announcement MOD
if( $is_auth['auth_globalannounce'] )
{
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_GLOBAL_ANNOUNCE . '"';
if ( $post_data['topic_type'] == POST_GLOBAL_ANNOUNCE || $topic_type == POST_GLOBAL_ANNOUNCE )
if ( $post_data['topic_type'] == POST_GLOBAL_ANNOUNCE )
{
$topic_type_toggle .= ' checked="checked"';
}
$topic_type_toggle .= ' /> ' . $lang['Post_global_announcement'] . ' ';
}
// End add - Global announcement MOD
if ( $topic_type_toggle != '' )
{
$topic_type_toggle = $lang['Post_topic_as'] . ': <input type="radio" name="topictype" value="' . POST_NORMAL .'"' . ( ( $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL ) ? ' checked="checked"' : '' ) . ' /> ' . $lang['Post_Normal'] . ' ' . $topic_type_toggle;
}
}
$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
$hidden_form_fields .= ($lock_subject) ? '<input type="hidden" name="lock_subject" value="'.$lock_subject.'" />':'';
$hidden_form_fields .= (!empty($extra_message_body))?'<input type="hidden" name="extra_message_body" value="'.$extra_message_body.'" />':'';
$hidden_form_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
switch( $mode )
{
case 'newtopic':
$page_title = $lang['Post_a_new_topic'];
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
break;
case 'reply':
$page_title = $lang['Post_a_reply'];
$hidden_form_fields .= '<input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" />';
break;
case 'editpost':
$page_title = $lang['Edit_Post'];
$hidden_form_fields .= '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />';
break;
}
$page_title = ($postreport || $lock_subject) ? $lang['Post_a_report']: $page_title;
// Generate smilies listing for page output
generate_smilies('inline', PAGE_POSTING);
//
// Include page header
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
mycal_generate_entry($mode, $topic_id, $post_id, $post_info['topic_first_post_id'], $template);
$template->set_filenames(array(
'body' => 'posting_body.tpl',
'pollbody' => 'posting_poll_body.tpl',
'reviewbody' => 'posting_topic_review.tpl')
);
make_jumpbox('viewforum.'.$phpEx);
$template->assign_vars(array(
'FORUM_NAME' => $forum_name,
'L_POST_A' => $page_title,
'L_POST_SUBJECT' => $lang['Post_subject'],
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
);
//
// This enables the forum/topic title to be output for posting
// but not for privmsg (where it makes no sense)
//
$template->assign_block_vars('switch_not_privmsg', array());
//
// Output the data to the template
//
$template->assign_vars(array(
'USERNAME' => $username,
'SUBJECT' => $subject,
'MESSAGE' => $message,
'HTML_STATUS' => $html_status,
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => $smilies_status,
'L_SUBJECT' => $lang['Subject'],
'L_MESSAGE_BODY' => $lang['Message_body'],
'L_OPTIONS' => $lang['Options'],
'L_PREVIEW' => $lang['Preview'],
'L_SPELLCHECK' => $lang['Spellcheck'],
'L_SUBMIT' => $lang['Submit'],
'L_CANCEL' => $lang['Cancel'],
'L_CONFIRM_DELETE' => $lang['Confirm_delete'],
'L_DISABLE_HTML' => $lang['Disable_HTML_post'],
'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'],
'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'],
'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
'L_NOTIFY_ON_REPLY' => $lang['Notify'],
'L_DELETE_POST' => $lang['Delete_post'],
'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],
'L_BBCODE_I_HELP' => $lang['bbcode_i_help'],
'L_BBCODE_U_HELP' => $lang['bbcode_u_help'],
'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'],
'L_BBCODE_C_HELP' => $lang['bbcode_c_help'],
'L_BBCODE_L_HELP' => $lang['bbcode_l_help'],
'L_BBCODE_O_HELP' => $lang['bbcode_o_help'],
'L_BBCODE_P_HELP' => $lang['bbcode_p_help'],
'L_BBCODE_W_HELP' => $lang['bbcode_w_help'],
'L_BBCODE_A_HELP' => $lang['bbcode_a_help'],
'L_BBCODE_S_HELP' => $lang['bbcode_s_help'],
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],
'L_EMPTY_MESSAGE' => $lang['Empty_message'],
'L_FONT_COLOR' => $lang['Font_color'],
'L_COLOR_DEFAULT' => $lang['color_default'],
'L_COLOR_DARK_RED' => $lang['color_dark_red'],
'L_COLOR_RED' => $lang['color_red'],
'L_COLOR_ORANGE' => $lang['color_orange'],
'L_COLOR_BROWN' => $lang['color_brown'],
'L_COLOR_YELLOW' => $lang['color_yellow'],
'L_COLOR_GREEN' => $lang['color_green'],
'L_COLOR_OLIVE' => $lang['color_olive'],
'L_COLOR_CYAN' => $lang['color_cyan'],
'L_COLOR_BLUE' => $lang['color_blue'],
'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'],
'L_COLOR_INDIGO' => $lang['color_indigo'],
'L_COLOR_VIOLET' => $lang['color_violet'],
'L_COLOR_WHITE' => $lang['color_white'],
'L_COLOR_BLACK' => $lang['color_black'],
'L_FONT_SIZE' => $lang['Font_size'],
'L_FONT_TINY' => $lang['font_tiny'],
'L_FONT_SMALL' => $lang['font_small'],
'L_FONT_NORMAL' => $lang['font_normal'],
'L_FONT_LARGE' => $lang['font_large'],
'L_FONT_HUGE' => $lang['font_huge'],
'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'],
'L_STYLES_TIP' => $lang['Styles_tip'],
'U_VIEWTOPIC' => ( $mode == 'reply' ) ? append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postorder=desc") : '',
'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? append_sid("posting.$phpEx?mode=topicreview&" . POST_TOPIC_URL . "=$topic_id") : '',
'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '',
'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '',
'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '',
'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '',
'S_NOTIFY_CHECKED' => ($is_auth['auth_read'] ) ? (( $notify_user ) ? 'checked="checked"' : '') : 'DISABLED' ,
'S_LOCK_SUBJECT' => ($lock_subject) ? ' READONLY ' : '',
'S_TYPE_TOGGLE' => $topic_type_toggle,
'S_TOPIC_ID' => $topic_id,
'S_POST_ACTION' => append_sid("posting.$phpEx"),
'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields)
);
//
// Poll entry switch/output
//
if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['edit_poll']) ) && $is_auth['auth_pollcreate'] )
{
$template->assign_vars(array(
'L_ADD_A_POLL' => $lang['Add_poll'],
'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'],
'L_POLL_QUESTION' => $lang['Poll_question'],
'L_POLL_OPTION' => $lang['Poll_option'],
'L_ADD_OPTION' => $lang['Add_option'],
'L_UPDATE_OPTION' => $lang['Update'],
'L_DELETE_OPTION' => $lang['Delete'],
'L_POLL_LENGTH' => $lang['Poll_for'],
'L_DAYS' => $lang['Days'],
'L_POLL_LENGTH_EXPLAIN' => $lang['Poll_for_explain'],
'L_POLL_DELETE' => $lang['Delete_poll'],
'POLL_TITLE' => $poll_title,
'POLL_LENGTH' => $poll_length)
);
if( $mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll'])
{
$template->assign_block_vars('switch_poll_delete_toggle', array());
}
if( !empty($poll_options) )
{
while( list($option_id, $option_text) = each($poll_options) )
{
$template->assign_block_vars('poll_option_rows', array(
'POLL_OPTION' => str_replace('"', '"', $option_text),
'S_POLL_OPTION_NUM' => $option_id)
);
}
}
$template->assign_var_from_handle('POLLBOX', 'pollbody');
}
//
// Topic review
//
if( $mode == 'reply' && $is_auth['auth_read'] )
{
require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
topic_review($topic_id, true);
$template->assign_block_vars('switch_inline_mode', array());
$template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody');
}
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Code: Select all
<?php
/***************************************************************************
* viewtopic.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : [email protected]
*
* $Id: viewtopic.php,v 1.13 2003/08/30 15:05:45 acydburn Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
#======================================================================= |
#==== Start: == Activity Mod Plus ====================================== |
#==== v1.1.0 =========================================================== |
#====
include_once($phpbb_root_path .'includes/functions_amod_plus.'. $phpEx);
$q = "SELECT *
FROM ". INA_HOF ."";
$r = $db->sql_query($q);
$hof_data = $db->sql_fetchrowset($r);
#====
#==== Author: aUsTiN [[email protected]] [http://phpbb-amod.com] === |
#==== End: ==== Activity Mod Plus ====================================== |
#======================================================================= |
//
// Start initial var setup
//
$topic_id = $post_id = 0;
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]);
}
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
$download = ( isset($HTTP_GET_VARS['download']) ) ? $HTTP_GET_VARS['download'] : '';
if(isset($HTTP_GET_VARS['printertopic']))
{
$start = ( isset($HTTP_GET_VARS['start_rel']) ) && ( isset($HTTP_GET_VARS['printertopic']) ) ? intval($HTTP_GET_VARS['start_rel']) - 1 : $start;
// $finish when positive indicates last message; when negative it indicates range; can't be 0
if(isset($HTTP_GET_VARS['finish_rel']))
{
$finish = intval($HTTP_GET_VARS['finish_rel']);
}
if(($finish >= 0) && (($finish - $start) <=0))
{
unset($finish);
}
}
if (!$topic_id && !$post_id)
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
if ( $download )
{
$sql_download = ( $download != -1 ) ? " AND p.post_id = $download " : '';
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$sql = "SELECT u.*, 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
$sql_download
AND pt.post_id = p.post_id
AND u.user_id = p.poster_id
ORDER BY p.post_time ASC, p.post_id ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not create download stream for post.", '', __LINE__, __FILE__, $sql);
}
$download_file = '';
while ( $row = $db->sql_fetchrow($result) )
{
$poster_id = $row['user_id'];
$poster = ( $poster_id == ANONYMOUS ) ? $lang['Guest'] : $row['username'];
$post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
$post_subject = ( $row['post_subject'] != '' ) ? $row['post_subject'] : '';
$bbcode_uid = $row['bbcode_uid'];
$message = $row['post_text'];
$message = strip_tags($message);
$message = preg_replace("/\[.*?:$bbcode_uid:?.*?\]/si", '', $message);
$message = preg_replace('/\[url\]|\[\/url\]/si', '', $message);
$message = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
$message = unprepare_message($message);
$message = preg_replace('/(/', '(', $message);
$message = preg_replace('/)/', ')', $message);
$message = preg_replace('/:/', ':', $message);
if (count($orig_word))
{
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
}
$break = "\n";
$line = '-----------------------------------';
$download_file .= $break.$line.$break.$poster.$break.$post_date.$break.$break.$post_subject.$break.$line.$break.$message.$break;
}
$disp_folder = ( $download == -1 ) ? 'Topic_'.$topic_id : 'Post_'.$download;
$filename = $board_config['sitename']."_".$disp_folder."_".date("Ymd",time()).".txt";
header('Content-Type: text/x-delimtext; name="'.$filename.'"');
header('Content-Disposition: attachment;filename='.$filename);
header('Content-Transfer-Encoding: plain/text');
header('Content-Length: '.strlen($download_file));
print $download_file;
exit;
}
//
// 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 ( $HTTP_GET_VARS['view'] == 'newest' )
{
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_GET_VARS['sid']) )
{
$session_id = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : $HTTP_GET_VARS['sid'];
if (!preg_match('/^[A-Za-z0-9]*$/', $session_id))
{
$session_id = '';
}
if ( $session_id )
{
$sql = "SELECT p.post_id
FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u
WHERE s.session_id = '$session_id'
AND u.user_id = s.session_user_id
AND p.topic_id = $topic_id
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);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, 'No_new_posts_last_visit');
}
$post_id = $row['post_id'];
if (isset($HTTP_GET_VARS['sid']))
{
redirect("viewtopic.$phpEx?sid=$session_id&" . POST_POST_URL . "=$post_id#$post_id");
}
else
{
redirect("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id");
}
}
}
redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
}
else if ( $HTTP_GET_VARS['view'] == 'next' || $HTTP_GET_VARS['view'] == 'previous' )
{
$sql_condition = ( $HTTP_GET_VARS['view'] == 'next' ) ? '>' : '<';
$sql_ordering = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'ASC' : 'DESC';
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t, " . TOPICS_TABLE . " t2
WHERE
t2.topic_id = $topic_id
AND t.forum_id = t2.forum_id
AND t.topic_moved_id = 0
AND t.topic_last_post_id $sql_condition t2.topic_last_post_id
ORDER BY t.topic_last_post_id $sql_ordering
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$topic_id = intval($row['topic_id']);
}
else
{
$message = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'No_newer_topics' : 'No_older_topics';
message_die(GENERAL_MESSAGE, $message);
}
}
}
//
// 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 = (!$post_id) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";
$join_sql = (!$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 = (!$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, t.topic_last_post_id, 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, f.auth_ban, f.auth_greencard, f.auth_bluecard 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, t.topic_last_post_id, 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, f.auth_ban, f.auth_greencard, f.auth_bluecard" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
mycal_alter_sql($sql, 'viewtopic');
mycal_alter_sql($sql, 'viewtopic_order');
attach_setup_viewtopic_auth($order_sql, $sql);
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
}
if ( !($forum_topic_data = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$forum_id = intval($forum_topic_data['forum_id']);
// Begin Thanks Mod
// Check if the Thanks feature is active for this forum
$sql = "SELECT `forum_thank`
FROM " . FORUMS_TABLE . "
WHERE forum_id =$forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain forum information", '', __LINE__, __FILE__, $sql);
}
if ( !($forum_thank_result = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, $lang['thank_no_exist']);
}
// Setting if feature is active or not
$show_thanks = ($forum_thank_result['forum_thank'] == FORUM_THANKABLE) ? FORUM_THANKABLE : FORUM_UNTHANKABLE;
// End Thanks Mod
$topic_first_post_id = intval($forum_topic_data['topic_first_post_id']); //mycal mod
//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
//
##=== ADR START: check user if in cell or not ===#
if(($userdata['user_cell_time'] > '0') && (!defined('CELL')) && ($userdata['session_logged_in']) && ($userdata['user_level'] != ADMIN) && ($userdata['user_cell_punishment'] == '3')){
redirect(append_sid("adr_cell.$phpEx", true));
}
##=== ADR END ===#
if(!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_printertopic.'.$phpEx)))
{
include($phpbb_root_path . 'language/lang_english/lang_printertopic.' . $phpEx);
} else
{
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_printertopic.' . $phpEx);
}
//
// Start auth check
//
$is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);
if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
{
if ( !$userdata['session_logged_in'] )
{
$redirect = ($post_id) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
$redirect .= ($start) ? "&start=$start" : '';
mycal_suggestion_redirect();
redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
}
$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
message_die(GENERAL_MESSAGE, $message);
}
//
// End auth check
//
$forum_name = $forum_topic_data['forum_name'];
$topic_title = $forum_topic_data['topic_title'];
$topic_id = intval($forum_topic_data['topic_id']);
$topic_time = $forum_topic_data['topic_time'];
if ($post_id)
{
$start = floor(($forum_topic_data['prev_posts'] - 1) / intval($board_config['posts_per_page'])) * intval($board_config['posts_per_page']);
}
//
// Is user watching this thread?
//
if( $userdata['session_logged_in'] )
{
$can_watch_topic = TRUE;
$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_GET_VARS['unwatch']) )
{
if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
{
$is_watching_topic = 0;
$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&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&start=$start") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$is_watching_topic = TRUE;
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);
}
}
}
}
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&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&start=$start") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else
{
$is_watching_topic = 0;
}
}
}
else
{
if ( isset($HTTP_GET_VARS['unwatch']) )
{
if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
{
redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true));
}
}
else
{
$can_watch_topic = 0;
$is_watching_topic = 0;
}
}
//
// 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']);
if( !empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']) )
{
$post_days = ( !empty($HTTP_POST_VARS['postdays']) ) ? intval($HTTP_POST_VARS['postdays']) : intval($HTTP_GET_VARS['postdays']);
$min_post_time = time() - (intval($post_days) * 86400);
$sql = "SELECT COUNT(p.post_id) AS num_posts
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
WHERE t.topic_id = $topic_id
AND p.topic_id = t.topic_id
AND p.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) ) ? intval($row['num_posts']) : 0;
$limit_posts_time = "AND p.post_time >= $min_post_time ";
if ( !empty($HTTP_POST_VARS['postdays']))
{
$start = 0;
}
}
else
{
$total_replies = intval($forum_topic_data['topic_replies']) + 1;
$limit_posts_time = '';
$post_days = 0;
}
$select_post_days = '<select name="postdays">';
for($i = 0; $i < count($previous_days); $i++)
{
$selected = ($post_days == $previous_days[$i]) ? ' selected="selected"' : '';
$select_post_days .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>';
}
$select_post_days .= '</select>';
//
// Decide how to order the post display
//
if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) )
{
$post_order = (!empty($HTTP_POST_VARS['postorder'])) ? htmlspecialchars($HTTP_POST_VARS['postorder']) : htmlspecialchars($HTTP_GET_VARS['postorder']);
$post_time_order = ($post_order == "asc") ? "ASC" : "DESC";
}
else
{
$post_order = 'asc';
$post_time_order = 'ASC';
}
$select_post_order = '<select name="postorder">';
if ( $post_time_order == 'ASC' )
{
$select_post_order .= '<option value="asc" selected="selected">' . $lang['Oldest_First'] . '</option><option value="desc">' . $lang['Newest_First'] . '</option>';
}
else
{
$select_post_order .= '<option value="asc">' . $lang['Oldest_First'] . '</option><option value="desc" selected="selected">' . $lang['Newest_First'] . '</option>';
}
$select_post_order .= '</select>';
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.user_trophies, u.ina_char_name,u.username, u.user_id, u.user_cell_time, 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, u.user_points, u.user_warnings, u.user_level, u.user_birthday, u.user_next_birthday_greeting, u.user_gender, 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
$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, ".(isset($finish)? ((($finish - $start) > 0)? ($finish - $start): -$finish): $board_config['posts_per_page']);
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain post/user information.", '', __LINE__, __FILE__, $sql);
}
$postrow = array();
if ($row = $db->sql_fetchrow($result))
{
do
{
$postrow[] = $row;
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
$total_posts = count($postrow);
}
else
{
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
sync('topic', $topic_id);
message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
}
$resync = FALSE;
if ($forum_topic_data['topic_replies'] + 1 < $start + count($postrow))
{
$resync = TRUE;
}
elseif ($start + $board_config['posts_per_page'] > $forum_topic_data['topic_replies'])
{
$row_id = intval($forum_topic_data['topic_replies']) % intval($board_config['posts_per_page']);
if ($postrow[$row_id]['post_id'] != $forum_topic_data['topic_last_post_id'] || $start + count($postrow) < $forum_topic_data['topic_replies'])
{
$resync = TRUE;
}
}
elseif (count($postrow) < $board_config['posts_per_page'])
{
$resync = TRUE;
}
if ($resync)
{
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
sync('topic', $topic_id);
$result = $db->sql_query('SELECT COUNT(post_id) AS total FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $topic_id);
$row = $db->sql_fetchrow($result);
$total_replies = $row['total'];
}
$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);
}
$ranksrow = array();
while ( $row = $db->sql_fetchrow($result) )
{
$ranksrow[] = $row;
}
$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) )
{
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
//
// Was a highlight request part of the URI?
//
$highlight_match = $highlight = '';
if (isset($HTTP_GET_VARS['highlight']))
{
// Split words and phrases
$words = explode(' ', trim(htmlspecialchars($HTTP_GET_VARS['highlight'])));
for($i = 0; $i < sizeof($words); $i++)
{
if (trim($words[$i]) != '')
{
$highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', preg_quote($words[$i], '#'));
}
}
unset($words);
$highlight = urlencode($HTTP_GET_VARS['highlight']);
}
//
// Post, reply and other URL generation for
// templating vars
//
$printer_topic_url = append_sid("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&vote=viewresult");
$new_topic_url = append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id");
$reply_topic_url = append_sid("posting.$phpEx?mode=reply&" . POST_TOPIC_URL . "=$topic_id");
// Begin Thanks Mod
$thank_topic_url = append_sid("posting.$phpEx?mode=thank&" . POST_TOPIC_URL . "=$topic_id");
// End Thanks Mod
$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&view=previous");
$view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=next");
//
// 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
);
$reply_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new'];
$reply_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Reply_to_topic'];
$post_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'];
$post_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'];
// Begin Thanks Mod
$thank_img = $images['thanks'];
$thank_alt = $lang['thanks_alt'];
// End Thanks Mod
$printer_img = $images['printer'];
$printer_alt = $lang['printertopic_button'];
//
// Set a cookie for this topic
//
if ( $userdata['session_logged_in'] )
{
$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();
if ( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) )
{
$topic_last_read = ( $tracking_topics[$topic_id] > $tracking_forums[$forum_id] ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id];
}
else if ( !empty($tracking_topics[$topic_id]) || !empty($tracking_forums[$forum_id]) )
{
$topic_last_read = ( !empty($tracking_topics[$topic_id]) ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id];
}
else
{
$topic_last_read = $userdata['user_lastvisit'];
}
if ( count($tracking_topics) >= 150 && empty($tracking_topics[$topic_id]) )
{
asort($tracking_topics);
unset($tracking_topics[key($tracking_topics)]);
}
$tracking_topics[$topic_id] = time();
setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
//
// Load templates
//
if(isset($HTTP_GET_VARS['printertopic']))
{
$template->set_filenames(array(
'body' => 'printertopic_body.tpl')
);
} else
{
$template->set_filenames(array(
'body' => 'viewtopic_body.tpl')
);
}
make_jumpbox('viewforum.'.$phpEx, $forum_id);
//
// Output page header
//
$page_title = $lang['View_topic'] .' - ' . $topic_title;
if(isset($HTTP_GET_VARS['printertopic']))
{
include($phpbb_root_path . 'includes/page_header_printer.'.$phpEx);
} else
{
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 />';
mycal_build_auth_levels($is_auth, $s_auth_can);
$s_auth_can .= ( $is_auth['auth_ban'] ) ? $lang['Rules_ban_can'] . "<br />" : "";
$s_auth_can .= ( $is_auth['auth_greencard'] ) ? $lang['Rules_greencard_can'] . "<br />" : "";
$s_auth_can .= ( $is_auth['auth_bluecard'] ) ? $lang['Rules_bluecard_can'] . "<br />" : "";
attach_build_auth_levels($is_auth, $s_auth_can);
$topic_mod = '';
if ( $is_auth['auth_mod'] )
{
$s_auth_can .= sprintf($lang['Rules_moderate'], "<a href=\"modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'] . '">', '</a>');
$topic_mod .= "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=delete&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_delete'] . '" alt="' . $lang['Delete_topic'] . '" title="' . $lang['Delete_topic'] . '" border="0" /></a> ';
$topic_mod .= "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a> ';
$topic_mod .= ( $forum_topic_data['topic_status'] == TOPIC_UNLOCKED ) ? "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a> ' : "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unlock&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a> ';
$topic_mod .= "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=split&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_split'] . '" alt="' . $lang['Split_topic'] . '" title="' . $lang['Split_topic'] . '" border="0" /></a> ';
$topic_mod .= '<a href="' . append_sid("merge.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id) . '"><img src="' . $images['topic_mod_merge'] . '" alt="' . $lang['Merge_topics'] . '" title="' . $lang['Merge_topics'] . '" border="0" /></a> ';
// Start add - Bin Mod
$topic_mod .= "<a href=\"bin.$phpEx?" . POST_TOPIC_URL . "=$topic_id&sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_bin'] . '" alt="' . $lang['Move_bin'] . '" title="' . $lang['Move_bin'] . '" border="0" /></a> ';
// End add - Bin Mod
}
//
// Topic watch information
//
$s_watching_topic = '';
if ( $can_watch_topic )
{
if ( $is_watching_topic )
{
$s_watching_topic = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start&sid=" . $userdata['session_id'] . '">' . $lang['Stop_watching_topic'] . '</a>';
$s_watching_topic_img = ( isset($images['topic_un_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start&sid=" . $userdata['session_id'] . '"><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=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start&sid=" . $userdata['session_id'] . '">' . $lang['Start_watching_topic'] . '</a>';
$s_watching_topic_img = ( isset($images['Topic_watch']) ) ? "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start&sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Start_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>' : '';
}
}
//
// If we've got a hightlight set pass it on to pagination,
// I get annoyed when I lose my highlight after the first page.
//
if(isset($HTTP_GET_VARS['printertopic']))
{
$pagination_printertopic = "printertopic=1&";
}
if($highlight != '')
{
$pagination_highlight = "highlight=$highlight&";
}
$pagination_ppp = $board_config['posts_per_page'];
if(isset($finish))
{
$pagination_ppp = ($finish < 0)? -$finish: ($finish - $start);
$pagination_finish_rel = "finish_rel=". -$pagination_ppp. "&";
}
$pagination =$current_page = get_page($total_replies, $board_config['posts_per_page'], $start); generate_pagination("viewtopic.$phpEx?". $pagination_printertopic . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&". $pagination_highlight . $pagination_finish_rel, $total_replies, $pagination_ppp, $start);
if($pagination != '' && isset($pagination_printertopic))
{
$pagination .= " <a href=\"viewtopic.$phpEx?". $pagination_printertopic. POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&". $pagination_highlight. "start=0&finish_rel=-10000\" title=\"" . $lang['printertopic_cancel_pagination_desc'] . "\">:| |:</a>";
}
//
// Send vars to template
//
$template->assign_vars(array(
'L_DOWNLOAD_POST' => $lang['Download_post'],
'L_DOWNLOAD_TOPIC' => $lang['Download_topic'],
'DOWNLOAD_TOPIC' => append_sid("viewtopic.$phpEx?download=-1&".POST_TOPIC_URL."=".$topic_id),
'START_REL' => ($start + 1),
'FINISH_REL' => (isset($HTTP_GET_VARS['finish_rel'])? intval($HTTP_GET_VARS['finish_rel']) : ($board_config['posts_per_page'] - $start)),
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_name,
'TOPIC_ID' => $topic_id,
'TOPIC_TITLE' => $topic_title,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $pagination_ppp ) + 1 ), ceil( $total_replies / $pagination_ppp )),
'POST_IMG' => $post_img,
'REPLY_IMG' => $reply_img,
'PRINTER_IMG' => $printer_img,
'L_AUTHOR' => $lang['Author'],
'L_MESSAGE' => $lang['Message'],
'L_POSTED' => $lang['Posted'],
'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_PRINTER_TOPIC' => $printer_alt,
'L_BACK_TO_TOP' => $lang['Back_to_top'],
'L_DISPLAY_POSTS' => $lang['Display_posts'],
'L_LOCK_TOPIC' => $lang['Lock_topic'],
'L_UNLOCK_TOPIC' => $lang['Unlock_topic'],
'L_MOVE_TOPIC' => $lang['Move_topic'],
'L_SPLIT_TOPIC' => $lang['Split_topic'],
'L_DELETE_TOPIC' => $lang['Delete_topic'],
'L_GOTO_PAGE' => $lang['Goto_page'],
'L_TELL_FRIEND' => $lang['Tell_Friend'],
'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 . "&start=$start"),
'S_AUTH_LIST' => $s_auth_can,
'S_TOPIC_ADMIN' => $topic_mod,
'S_WATCH_TOPIC' => $s_watching_topic,
'S_WATCH_TOPIC_IMG' => $s_watching_topic_img,
'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=$highlight"),
'U_VIEW_FORUM' => $view_forum_url,
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
'U_POST_NEW_TOPIC' => $new_topic_url,
'U_PRINTER_TOPIC' => $printer_topic_url,
'U_POST_REPLY_TOPIC' => $reply_topic_url)
);
//
// Does this topic contain a poll?
//
if ( !empty($forum_topic_data['topic_vote']) )
{
$s_hidden_fields = '';
$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);
}
if ( $vote_info = $db->sql_fetchrowset($result) )
{
$db->sql_freeresult($result);
$vote_options = count($vote_info);
$vote_id = $vote_info[0]['vote_id'];
$vote_title = $vote_info[0]['vote_text'];
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . intval($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);
}
$user_voted = ( $row = $db->sql_fetchrow($result) ) ? TRUE : 0;
$db->sql_freeresult($result);
if ( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) )
{
$view_result = ( ( ( isset($HTTP_GET_VARS['vote']) ) ? $HTTP_GET_VARS['vote'] : $HTTP_POST_VARS['vote'] ) == 'viewresult' ) ? TRUE : 0;
}
else
{
$view_result = 0;
}
$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_topic_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;
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(
'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_IMG' => $vote_graphic_img,
'POLL_OPTION_IMG_WIDTH' => $vote_graphic_length)
);
}
$template->assign_vars(array(
'L_TOTAL_VOTES' => $lang['Total_votes'],
'TOTAL_VOTES' => $vote_results_sum)
);
}
else
{
$template->set_filenames(array(
'pollbox' => 'viewtopic_poll_ballot.tpl')
);
for($i = 0; $i < $vote_options; $i++)
{
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(
'POLL_OPTION_ID' => $vote_info[$i]['vote_option_id'],
'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'])
);
}
$template->assign_vars(array(
'L_SUBMIT_VOTE' => $lang['Submit_vote'],
'L_VIEW_RESULTS' => $lang['View_results'],
'U_VIEW_RESULTS' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult"))
);
$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '" /><input type="hidden" name="mode" value="vote" />';
}
if ( count($orig_word) )
{
$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
}
$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
$template->assign_vars(array(
'POLL_QUESTION' => $vote_title,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_POLL_ACTION' => append_sid("posting.$phpEx?mode=vote&" . POST_TOPIC_URL . "=$topic_id"))
);
$template->assign_var_from_handle('POLL_DISPLAY', 'pollbox');
}
}
init_display_post_attachments($forum_topic_data['topic_attachment']);
//
// Update the topic view counter
//
if (!($postrow[0]['user_id'] == $userdata['user_id'])) {
$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);
}
// Begin Thanks Mod
//
// Get topic thanks
//
if ($show_thanks == FORUM_THANKABLE)
{
// Select Format for the date
$timeformat = "d-m, G:i";
$sql = "SELECT u.user_id, u.username, t.thanks_time
FROM " . THANKS_TABLE . " t, " . USERS_TABLE . " u
WHERE topic_id = $topic_id
AND t.user_id = u.user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain thanks information", '', __LINE__, __FILE__, $sql);
}
$total_thank = $db->sql_numrows($result);
$thanksrow = array();
$thanksrow = $db->sql_fetchrowset($result);
for($i = 0; $i < $total_thank; $i++)
{
$topic_thanks = $db->sql_fetchrow($result);
$thanker_id[$i] = $thanksrow[$i]['user_id'];
$thanker_name[$i] = $thanksrow[$i]['username'];
$thanks_date[$i] = $thanksrow[$i]['thanks_time'];
// Get thanks date
$thanks_date[$i] = create_date($timeformat, $thanks_date[$i], $board_config['board_timezone']);
// Make thanker profile link
$thanker_profile[$i] = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$thanker_id[$i]");
$thanks .= '<a href="' .$thanker_profile[$i] . '">' . $thanker_name[$i] . '</a>(' . $thanks_date[$i] . '), ';
if ($userdata['user_id'] == $thanksrow[$i]['user_id'])
{
$thanked = TRUE;
}
}
$sql = "SELECT u.topic_poster, t.user_id, t.username
FROM " . TOPICS_TABLE . " u, " . USERS_TABLE . " t
WHERE topic_id = $topic_id
AND u.topic_poster = t.user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain user information", '', __LINE__, __FILE__, $sql);
}
if( !($autor = $db->sql_fetchrowset($result)) )
{
message_die(GENERAL_ERROR, "Could not obtain user information", '', __LINE__, __FILE__, $sql);
}
$autor_name = $autor[0]['username'];
$thanks .= "".$lang['thanks_to']." $autor_name ".$lang['thanks_end']."";
// Create button switch
if ($userdata['user_id'] != $autor['0']['user_id'] && !$thanked)
{
$template->assign_block_vars('thanks_button', array(
'THANK_IMG' => $thank_img,
'U_THANK_TOPIC' => $thank_topic_url,
'L_THANK_TOPIC' => $thank_alt
));
}
}
// End Thanks Mod
}
#==== Get all adr info OUTSIDE the looping array, so it doesn't keep adding up SQL's. We can use the
#==== info from the array later in the loop below. I'm gonna add my name for faster finding later.
$adr_topic_info_char = adr_get_posters_char_info();
$adr_topic_info_race = adr_get_posters_races_info();
$adr_topic_info_elem = adr_get_posters_elements_info();
$adr_topic_info_clas = adr_get_posters_class_info();
$adr_topic_info_alig = adr_get_posters_alignment_info();
$adr_topic_info_pvp = adr_get_posters_pvp_info();
$adr_topic_info_adr = adr_get_posters_adr_info();
#==== Added By aUsTiN
//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
// Start add - Birthday MOD
$this_year = create_date('Y', time(), $board_config['board_timezone']);
$this_date = create_date('md', time(), $board_config['board_timezone']);
// End add - Birthday MOD
for($i = 0; $i < $total_posts; $i++)
{
$poster_id = $postrow[$i]['user_id'];
$poster = ( $poster_id == ANONYMOUS ) ? $lang['Guest'] : $postrow[$i]['username'];
// Start add - Birthday MOD
if ( $postrow[$i]['user_birthday'] != 999999 )
{
$poster_birthdate=realdate('md', $postrow[$i]['user_birthday']);
$poster_age = $this_year - realdate ('Y',$postrow[$i]['user_birthday']);
if ($this_date < $poster_birthdate) $poster_age--;
$poster_age = $lang['Age'] . ': ' . $poster_age;
} else
{
$poster_age = '';
}
// End add - Birthday MOD
$post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']);
$poster_posts = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Posts'] . ': ' . $postrow[$i]['user_posts'] : '';
$poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : '';
$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'] )
{
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" OnError=this.src="'. $images['default_avatar'] .'" />' : '';
break;
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" OnError=this.src="'. $images['default_avatar'] .'" />' : '';
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" />' : '';
break;
}
}
//
// Default Avatar MOD - Begin
//
if ( empty($poster_avatar) && $poster_id != ANONYMOUS)
{
$poster_avatar = '<img src="'. $images['default_avatar'] .'" alt="" border="0" />';
}
if ( $poster_id == ANONYMOUS )
{
$poster_avatar = '<img src="'. $images['guest_avatar'] .'" alt="" border="0" />';
}
//
// Default Avatar MOD - End
//
//
// 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_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 = '';
// Start add - Gender MOD
$gender_image = '';
// End add - Gender MOD
if ( $postrow[$i]['user_id'] == ANONYMOUS )
{
}
else if ( $postrow[$i]['user_rank'] )
{
for($j = 0; $j < count($ranksrow); $j++)
{
if ( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
{
$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 />' : '';
}
}
}
else
{
for($j = 0; $j < count($ranksrow); $j++)
{
if ( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )
{
$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 />' : '';
}
}
}
//
// Handle anon users posting with usernames
//
if ( $poster_id == ANONYMOUS && $postrow[$i]['post_username'] != '' )
{
$poster = $postrow[$i]['post_username'];
$poster_rank = $lang['Guest'];
// Start add - Birthday MOD
$poster_age = '';
// End add - Birthday MOD
}
$temp_url = '';
if ( $poster_id != ANONYMOUS )
{
$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . 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>';
$profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
$temp_url = append_sid("privmsg.$phpEx?mode=post&" . 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>';
// Start add - Gender MOD
switch ($postrow[$i]['user_gender'])
{
case 1 : $gender_image = $lang['Gender'].": <img src=\"" . $images['icon_minigender_male'] . "\" alt=\"" . $lang['Gender']. ":".$lang['Male']."\" title=\"" . $lang['Gender'] . ":".$lang['Male']. "\" border=\"0\" />"; break;
case 2 : $gender_image = $lang['Gender'].": <img src=\"" . $images['icon_minigender_female'] . "\" alt=\"" . $lang['Gender']. ":".$lang['Female']. "\" title=\"" . $lang['Gender'] . ":".$lang['Female']. "\" border=\"0\" />"; break;
default : $gender_image="";
}
// End add - Gender MOD
$pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
if ( !empty($postrow[$i]['user_viewemail']) || $is_auth['auth_mod'] )
{
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $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 = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
}
else
{
$email_img = '';
$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 = ( $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 = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '">' . $lang['ICQ'] . '</a>';
}
else
{
$icq_status_img = '';
$icq_img = '';
$icq = '';
}
$aim_img = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '';
$aim = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';
$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . 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>' : '';
$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'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
$yim = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : '';
}
else
{
$profile_img = '';
$profile = '';
$pm_img = '';
$pm = '';
$email_img = '';
$email = '';
$www_img = '';
$www = '';
$icq_status_img = '';
$icq_img = '';
$icq = '';
$aim_img = '';
$aim = '';
$msn_img = '';
$msn = '';
$yim_img = '';
$yim = '';
}
$temp_url = append_sid("posting.$phpEx?mode=quote&" . 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>';
$quote = '<a href="' . $temp_url . '">' . $lang['Reply_with_quote'] . '</a>';
$temp_url = append_sid("search.$phpEx?search_author=" . urlencode($postrow[$i]['username']) . "&showresults=posts");
$search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $postrow[$i]['username']) . '" title="' . sprintf($lang['Search_user_posts'], $postrow[$i]['username']) . '" border="0" /></a>';
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $postrow[$i]['username']) . '</a>';
$current_time = time();
$difference_sec = $current_time - $postrow[$i]['post_time'] ;
$difference_min = ($current_time - $postrow[$i]['post_time']) / 60;
if ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] && $difference_min <= $board_config['edit_time'] )
{
$temp_url = append_sid("posting.$phpEx?mode=editpost&" . 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>';
$edit = '<a href="' . $temp_url . '">' . $lang['Edit_delete_post'] . '</a>';
}
if ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] && $board_config['edit_time'] == '0' )
{
$temp_url = append_sid("posting.$phpEx?mode=editpost&" . 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>';
$edit = '<a href="' . $temp_url . '">' . $lang['Edit_delete_post'] . '</a>';
}
else if ( $is_auth['auth_mod'] )
{
$temp_url = append_sid("posting.$phpEx?mode=editpost&" . 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>';
$edit = '<a href="' . $temp_url . '">' . $lang['Edit_delete_post'] . '</a>';
}
else
{
$edit_img = '';
$edit = '';
}
if ( $is_auth['auth_mod'] )
{
$temp_url = "modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id . "&sid=" . $userdata['session_id'];
if( $userdata['user_level'] == ADMIN )
{
$ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
}
else
{
$ip_img = '';
}
$ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';
$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_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'] && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] )
{
$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_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($poster_id != ANONYMOUS && $postrow[$i]['user_level'] != ADMIN)
{
$current_user = str_replace("'","\'",$postrow[$i]['username']);
if ($is_auth['auth_greencard'])
{
$g_card_img = ' <input type="image" name="unban" value="unban" onClick="return confirm(\''.sprintf($lang['Green_card_warning'],$current_user).'\')" src="'. $images['icon_g_card'] . '" alt="' . $lang['Give_G_card'] . '" >';
}
else
{
$g_card_img = '';
}
$user_warnings = $postrow[$i]['user_warnings'];
$card_img = ($user_warnings) ? (( $user_warnings < $board_config['max_user_bancard']) ? sprintf($lang['Warnings'], $user_warnings) : $lang['Banned'] ) : '';
// these lines will make a icon apear beside users post, if user have warnings or ar banned
// used instead of the previous line of code, witch shows the status as a text
// ------ From here --- do not include this line
// $card_img = ($user_warnings) ? '<img src="'.(( $user_warnings < $board_config['max_user_bancard']) ?
// $images['icon_y_card'] . '" alt="'. sprintf($lang['Warnings'], $user_warnings) .'">' :
// $images['icon_r_card'] . '" alt="'. $lang['Banned'] .'">') : '';
// ----- To this line --- Do not included this line
//
// You may also included several images, instead of only one yellow, these lines below will produce several yellow images, depending on mumber of yellow cards
// ------ From here --- do not include this line
//$card_img = ($user_warnings >= $board_config['max_user_bancard']) ? '<img src="'.$images['icon_r_card'] . '" alt="'. $lang['Banned'] .'">' : '';
//for ($n=0 ; $n<$user_warnings && $user_warnings < $board_config['max_user_bancard'];$n++)
//{
//$card_img .= ($user_warnings) ? '<img src="'.(( $user_warnings < $board_config['max_user_bancard']) ?
//$images['icon_y_card'] . '" alt="'. sprintf($lang['Warnings'], $user_warnings) .'">' :
//$images['icon_r_card'] . '" alt="'. $lang['Banned'] .'">') : '';
//}
// ----- To this line --- Do not included this line
if ($user_warnings<$board_config['max_user_bancard'] && $is_auth['auth_ban'] )
{
$y_card_img = ' <input type="image" name="warn" value="warn" onClick="return confirm(\''.sprintf($lang['Yellow_card_warning'],$current_user).'\')" src="'. $images['icon_y_card'] . '" alt="' . sprintf($lang['Give_Y_card'],$user_warnings+1) . '" >';
$r_card_img = ' <input type="image" name="ban" value="ban" onClick="return confirm(\''.sprintf($lang['Red_card_warning'],$current_user).'\')" src="'. $images['icon_r_card'] . '" alt="' . $lang['Give_R_card'] . '" >';
}
else
{
$y_card_img = '';
$r_card_img = '';
}
} else
{
$card_img = '';
$g_card_img = '';
$y_card_img = '';
$r_card_img = '';
}
if ($is_auth['auth_bluecard'])
{
if ($is_auth['auth_mod'])
{
$b_card_img = (($postrow[$i]['post_bluecard'])) ? ' <input type="image" name="report_reset" value="report_reset" onClick="return confirm(\''.$lang['Clear_blue_card_warning'].'\')" src="'. $images['icon_bhot_card'] . '" alt="'. sprintf($lang['Clear_b_card'],$postrow[$i]['post_bluecard']) . '">':' <input type="image" name="report" value="report" src="'. $images['icon_b_card'] . '" alt="'. $lang['Give_b_card'] . '" >';
}
else
{
$b_card_img = ' <input type="image" name="report" value="report" src="'. $images['icon_b_card'] . '" alt="'. $lang['Give_b_card'] . '" >';
}
} else $b_card_img = '';
// parse hidden filds if cards visible
$card_hidden = ($g_card_img || $r_card_img || $y_card_img || $b_card_img) ? '<input type="hidden" name="post_id" value="'. $postrow[$i]['post_id'].'">' :'';
$post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : '';
$message = $postrow[$i]['post_text'];
$bbcode_uid = $postrow[$i]['bbcode_uid'];
if ( ((!$is_auth['auth_reply']) or ($forum_topic_data['forum_status'] == FORUM_LOCKED) or ($forum_topic_data['topic_status'] == TOPIC_LOCKED)) and ($userdata['user_level'] != ADMIN) )
{
$quick_quote = '';
}
else
{
$plain_message = $postrow[$i]['post_text'];
$plain_message = preg_replace('/\:(([a-z0-9]:)?)' . $bbcode_uid . '/s', '', $plain_message);
$plain_message = str_replace('<', '<', $plain_message);
$plain_message = str_replace('>', '>', $plain_message);
$plain_message = str_replace('<br />', "\n", $plain_message);
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
if ( !empty($orig_word) )
{
$plain_message = ( !empty($plain_message) ) ? preg_replace($orig_word, $replacement_word, $plain_message) : '';
}
$plain_message = addslashes($plain_message);
$plain_message = str_replace("\n", "\\n", $plain_message);
$plain_message = str_replace(chr(13), '', $plain_message);
$quick_quote = '<input type="button" class="button" name="addquote" value="' . $lang['Quick_quote'] . '" style="width: 100px" onClick="addquote(' . $postrow[$i]['post_id'] . ');" /> ';
}
$user_sig = ( $postrow[$i]['enable_sig'] && $postrow[$i]['user_sig'] != '' && $board_config['allow_sig'] ) ? $postrow[$i]['user_sig'] : '';
$user_sig_bbcode_uid = $postrow[$i]['user_sig_bbcode_uid'];
#==== Removed By aUsTiN
#$adr_topic_box = adr_display_poster_infos($postrow[$i]['user_id'], $userdata['user_id']);
if(($postrow[$i]['user_id'] != ANONYMOUS) && ($postrow[$i]['user_adr_ban'] != '1'))
$adr_topic_box = adr_display_poster_infos($postrow[$i]['user_id'], $adr_topic_info_char, $adr_topic_info_race, $adr_topic_info_elem, $adr_topic_info_clas, $adr_topic_info_alig, $adr_topic_info_pvp, $adr_topic_info_adr, $adr_topic_info_jobs, $postrow[$i]['user_cell_time']);
#==== Added By aUsTiN
if ($poster_id != ANONYMOUS)
{
$user_points = ($userdata['user_level'] == ADMIN || user_is_authed($userdata['user_id'])) ? '<a href="' . append_sid("pointscp.$phpEx?" . POST_USERS_URL . "=" . $postrow[$i]['user_id']) . '" class="gensmall" title="' . sprintf($lang['Points_link_title'], $board_config['points_name']) . '">' . $board_config['points_name'] . '</a>' : $board_config['points_name'];
$user_points = '<br />' . $user_points . ': ' . $postrow[$i]['user_points'];
if ($board_config['points_donate'] && $userdata['user_id'] != ANONYMOUS && $userdata['user_id'] != $poster_id)
{
$donate_points = '<br />' . sprintf($lang['Points_donate'], '<a href="' . append_sid("pointscp.$phpEx?mode=donate&" . POST_USERS_URL . "=" . $postrow[$i]['user_id']) . '" class="gensmall" title="' . sprintf($lang['Points_link_title_2'], $board_config['points_name']) . '">', '</a>');
}
else
{
$donate_points = '';
}
}
else
{
$user_points = '';
$donate_points = '';
}
//
// Note! The order used for parsing the message _is_ important, moving things around could break any
// output
//
//
// 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'] || !$userdata['user_allowhtml'])
{
if ( $user_sig != '' )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig);
}
if ( $postrow[$i]['enable_html'] )
{
$message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $message);
}
}
//
// Parse message and/or sig for BBCode if reqd
//
if ($user_sig != '' && $user_sig_bbcode_uid != '')
{
$user_sig = ($board_config['allow_bbcode']) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace("/\:$user_sig_bbcode_uid/si", '', $user_sig);
}
if ($bbcode_uid != '')
{
$message = ($board_config['allow_bbcode']) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si", '', $message);
}
if ( $user_sig != '' )
{
$user_sig = make_clickable($user_sig);
}
$message = make_clickable($message);
//
// Parse smilies
//
if ( $board_config['allow_smilies'] )
{
if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig);
}
if ( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
}
}
//
// Highlight active words (primarily for search)
//
if ($highlight_match)
{
// This has been back-ported from 3.0 CVS
$message = preg_replace('#(?!<.*)(?<!\w)(' . $highlight_match . ')(?!\w|[^<>]*>)#i', '<b style="color:#'.$theme['fontcolor3'].'">\1</b>', $message);
}
//
// Replace naughty words
//
if (count($orig_word))
{
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
if ($user_sig != '')
{
$user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
}
$message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
}
//
// 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 = str_replace("\n", "\n<br />\n", $message);
//
// Editing information
//
if ( $postrow[$i]['post_edit_count'] )
{
$l_edit_time_total = ( $postrow[$i]['post_edit_count'] == 1 ) ? $lang['Edited_time_total'] : $lang['Edited_times_total'];
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']);
}
else
{
$l_edited_by = '';
}
//
// 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'];
$adr_topic_box = ($postrow[$i]['user_id'] != '-1') ? $adr_topic_box : '';
if ($postrow[$i]['post_id'] == $topic_first_post_id) mycal_append_event($topic_id, $message);
$template->assign_block_vars('postrow', array(
'DOWNLOAD_POST' => append_sid("viewtopic.$phpEx?download=".$postrow[$i]['post_id']."&".POST_TOPIC_URL."=".$topic_id),
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'ADR_TOPIC_BOX' => $adr_topic_box,
'POSTER_NAME' => $poster,
// Start add - Birthday MOD
'POSTER_AGE' => $poster_age,
// End add - Birthday MOD
'POSTER_RANK' => $poster_rank . Amod_Trophy_King_Image($postrow[$i]['user_id']),
// Start add - Gender MOD
'POSTER_GENDER' => $gender_image,
// End add - Gender MOD
'RANK_IMAGE' => $rank_image,
'POSTER_JOINED' => $poster_joined,
'POSTER_POSTS' => $poster_posts,
'POSTER_FROM' => $poster_from,
'POSTER_AVATAR' => $poster_avatar,
#======================================================================= |
#==== Start: == Activity Mod Plus ====================================== |
#==== v1.1.0 =========================================================== |
#====
'POSTER_TROPHY' => Amod_Build_Topics($hof_data, $postrow[$i]['user_id'], $postrow[$i]['user_trophies'], $postrow[$i]['username'], $postrow[$i]['ina_char_name']),
#====
#==== Author: aUsTiN [[email protected]] [http://phpbb-amod.com] === |
#==== End: ==== Activity Mod Plus ====================================== |
#======================================================================= |
'POST_NUMBER' => ($i + $start + 1),
'POST_DATE' => $post_date,
'POST_SUBJECT' => $post_subject,
'MESSAGE' => $message,
'QUICK_QUOTE' => $quick_quote,
'PLAIN_MESSAGE' => str_replace(chr(13), '', $plain_message),
'SIGNATURE' => $user_sig,
'EDITED_MESSAGE' => $l_edited_by,
'MINI_POST_IMG' => $mini_post_img,
'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile,
'SEARCH_IMG' => $search_img,
'SEARCH' => $search,
'PM_IMG' => $pm_img,
'PM' => $pm,
'EMAIL_IMG' => $email_img,
'EMAIL' => $email,
'WWW_IMG' => $www_img,
'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img,
'ICQ' => $icq,
'AIM_IMG' => $aim_img,
'AIM' => $aim,
'MSN_IMG' => $msn_img,
'MSN' => $msn,
'YIM_IMG' => $yim_img,
'YIM' => $yim,
'EDIT_IMG' => $edit_img,
'EDIT' => $edit,
'QUOTE_IMG' => $quote_img,
'QUOTE' => $quote,
'IP_IMG' => $ip_img,
'IP' => $ip,
'DELETE_IMG' => $delpost_img,
'DELETE' => $delpost,
'POINTS' => $user_points,
'DONATE_POINTS' => $donate_points,
'USER_WARNINGS' => $user_warnings,
'CARD_IMG' => $card_img,
'CARD_HIDDEN_FIELDS' => $card_hidden,
'CARD_EXTRA_SPACE' => ($r_card_img || $y_card_img || $g_card_img || $b_card_img) ? ' ' : '',
// Start add - Gender MOD
'L_GENDER' => $lang['Gender'],
// End add - Gender MOD
'L_MINI_POST_ALT' => $mini_post_alt,
'U_MINI_POST' => $mini_post_url,
'U_G_CARD' => $g_card_img,
'U_Y_CARD' => $y_card_img,
'U_R_CARD' => $r_card_img,
'U_B_CARD' => $b_card_img,
'S_CARD' => append_sid("card.".$phpEx),
'U_POST_ID' => $postrow[$i]['post_id'])
);
// Begin Thanks Mod
if( ($show_thanks == FORUM_THANKABLE) && ($i == 0) && ($current_page == 1) && ($total_thank > 0))
{
$template->assign_block_vars('postrow.thanks', array(
'THANKFUL' => $lang['thankful'],
'THANKED' => $lang['thanked'],
'HIDE' => $lang['hide'],
'THANKS_TOTAL' => $total_thank,
'THANKS' => $thanks
)
);
}
// End Thanks Mod
display_post_attachments($postrow[$i]['post_id'], $postrow[$i]['post_attachment']);
}
if ( ((!$is_auth['auth_reply']) or ($forum_topic_data['forum_status'] == FORUM_LOCKED) or ($forum_topic_data['topic_status'] == TOPIC_LOCKED)) and ($userdata['user_level'] != ADMIN) )
{
$quick_reply_form = "";
}
else
{
if ( $can_watch_topic && $is_watching_topic )
{
$notify = 1;
}
else
{
$notify = $userdata['user_notify'];
}
$bbcode_uid = $postrow[$total_posts - 1]['bbcode_uid'];
$last_poster = $postrow[$total_posts - 1]['username'];
$last_msg = $postrow[$total_posts - 1]['post_text'];
$last_msg = str_replace(":1:$bbcode_uid", "", $last_msg);
$last_msg = str_replace(":u:$bbcode_uid", "", $last_msg);
$last_msg = str_replace(":o:$bbcode_uid", "", $last_msg);
$last_msg = str_replace(":$bbcode_uid", "", $last_msg);
$last_msg = str_replace("'", "'", $last_msg);
$last_msg = "[QUOTE=\"$last_poster\"]" . $last_msg . "[/QUOTE]";
$quick_reply_form = "
<script language='JavaScript' type='text/javascript'>
var is_submit = false;
function checkForm() {
formErrors = false;
document.post.message.value = '';
if (document.post.input.value.length < 2) {
formErrors = '" . $lang['Empty_message'] . "';
}
if (is_submit) {
alert('Your reply is already submitted');
return false;
} else {
is_submit = true;
}
if (formErrors) {
alert(formErrors);
return false;
} else {
if (document.post.quick_quote.checked) {
document.post.message.value = document.post.last_msg.value;
}
document.post.message.value += document.post.input.value;
return true;
}
}
</script>
<form action='".append_sid("posting.$phpEx")."' method='post' name='post' onsubmit='return checkForm(this)'>
<span class='genmed'><b>".$lang['Quick_Reply'].":</b><br />";
if (!$userdata['session_logged_in'])
{
$quick_reply_form .= $lang['Username'] . ": <input class='post' type='text' name='username' size='25' maxlength='25' value='' /><br />";
}
$quick_reply_form .= "<textarea name='input' rows='10' cols='50' wrap='virtual' class='post''></textarea><br />
<input type='checkbox' name='quick_quote' />".$lang['Quote_last']."<br />
<input type='checkbox' name='attach_sig' checked='checked' />".$lang["Attach_signature"]."<br />
<input type='hidden' name='mode' value='reply' />
<input type='hidden' name='sid' value='" . $userdata['session_id'] . "' />
<input type='hidden' name='t' value='" . $topic_id . "' />
<input type='hidden' name='message' value='' />
<input type='hidden' name='notify' value=" . $notify . " />
<input type='hidden' name='last_msg' value='" . $last_msg . "' />
<input type='submit' name='preview' class='liteoption' value='".$lang['Preview']."' />
<input type='submit' name='post' class='mainoption' value='".$lang["Submit"]."' />
</form></span>";
}
$template->assign_vars(array(
'QUICK_REPLY_FORM' => $quick_reply_form)
);
$template->assign_vars(array(
"TELL_LINK" => append_sid("http://".$HTTP_SERVER_VARS['HTTP_HOST'].$HTTP_SERVER_VARS['PHP_SELF']."?t=$topic_id", true)));
$template->pparse('body');
if(isset($HTTP_GET_VARS['printertopic']))
{
$gen_simple_header = 1;
}
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Code: Select all
<script language="Javascript" type="text/javascript">
<!--
function open_postreview(ref)
{
height = screen.height / 3;
width = screen.width / 2;
window.open(ref, '_phpbbpostreview', 'HEIGHT=' + height + ',WIDTH=' + width + ',resizable=yes,scrollbars=yes');
return;
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
message = new Array();
<!-- BEGIN postrow -->
message[{postrow.U_POST_ID}] = "[quote=\"{postrow.POSTER_NAME}\";p=\"{postrow.U_POST_ID}\"]\n{postrow.PLAIN_MESSAGE}\n[/quote]";
<!-- END postrow -->
function addquote(post_id) {
window.parent.document.post.input.value += message[post_id];
window.parent.document.post.input.focus();
return;
}
//-->
</script>
<table width="100%" cellspacing="2" cellpadding="2" border="0">
<tr>
<td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><br />
<!-- Start add - Complete banner MOD -->
{BANNER_14_IMG}<br/>
<!-- End add - Complete banner MOD -->
{S_TOPIC_ADMIN}
<span class="gensmall"><br /><a href="tellafriend.php?topic={TOPIC_TITLE}&link={TELL_LINK}">{L_TELL_FRIEND}</a>
<b>{PAGINATION}</b><br /></span></td>
</tr>
</table>
<table width="100%" cellspacing="2" cellpadding="2" border="0">
<tr>
<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" style="filter:alpha(opacity=65)" onMouseOver="this.filters.alpha.opacity=100" onMouseOut="this.filters.alpha.opacity=65" /></a> <a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" style="filter:alpha(opacity=65)" onMouseOver="this.filters.alpha.opacity=100" onMouseOut="this.filters.alpha.opacity=65" /></a> <a href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" style="filter:alpha(opacity=65)" onMouseOver="this.filters.alpha.opacity=100" onMouseOut="this.filters.alpha.opacity=65" /></a>
<!-- BEGIN thanks_button -->
<a href="{thanks_button.U_THANK_TOPIC}"><img src="{thanks_button.THANK_IMG}" border="0" alt="{thanks_button.L_THANK_TOPIC}" align="middle" /></a>
<!-- END thanks_button -->
</span></td>
<td align="left" valign="middle" width="100%"><span class="nav"> <a href="{U_INDEX}" class="nav">{L_INDEX}</a>
-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
</tr>
</table>
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
<tr align="right">
<td class="catHead" colspan="2" height="28"><span class="nav"><a href="{U_VIEW_OLDER_TOPIC}" class="nav">{L_VIEW_PREVIOUS_TOPIC}</a> : <a href="{DOWNLOAD_TOPIC}" class="nav">{L_DOWNLOAD_TOPIC}</a> : <a href="{U_VIEW_NEWER_TOPIC}" class="nav">{L_VIEW_NEXT_TOPIC}</a> </span></td>
</tr>
{POLL_DISPLAY}
<tr>
<th class="thLeft" width="150" height="26" nowrap="nowrap">{L_AUTHOR}</th>
<th class="thRight" nowrap="nowrap">{L_MESSAGE}</th>
</tr>
<!-- BEGIN postrow -->
<tr>
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b><br />{postrow.CARD_IMG}</span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_GENDER}<br />{postrow.POSTER_AGE}<br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS} {postrow.POSTER_TROPHY}<br />{postrow.POSTER_FROM}<br />{postrow.ADR_TOPIC_BOX}{postrow.POINTS}{postrow.DONATE_POINTS}</span><br /></td>
<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- Start add - Yellow card admin MOD -->
<form method="post" action="{postrow.S_CARD}">
<!-- End add - Yellow card admin MOD -->
<td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen"> </span> {L_POST_SUBJECT}: {postrow.POST_SUBJECT} <a href="{postrow.DOWNLOAD_POST}" class="genmed">{L_DOWNLOAD_POST}</a></span></td>
<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}{postrow.U_R_CARD}{postrow.U_Y_CARD}{postrow.U_G_CARD}{postrow.U_B_CARD}{postrow.CARD_EXTRA_SPACE}{postrow.CARD_HIDDEN_FIELDS}</td></tr></table></td>
<!-- Start add - Yellow card admin MOD -->
</form>
<!-- End add - Yellow card admin MOD -->
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td colspan="2"><span class="postbody">{postrow.MESSAGE}</span>{postrow.ATTACHMENTS}<span class="postbody">{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
</tr>
</table></td>
</tr>
<tr>
<td class="{postrow.ROW_CLASS}" width="150" align="left" valign="middle"><span class="nav"><a href="#top" class="nav">{L_BACK_TO_TOP}</a></span><br /><span class="gen">{postrow.QUICK_QUOTE}</span></td>
<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap"><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
<tr>
<td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG}<script language="JavaScript" type="text/javascript"><!--
if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
document.write(' {postrow.ICQ_IMG}');
else
document.write('</td><td> </td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
//--></script><noscript>{postrow.ICQ_IMG}</noscript></td>
</tr>
</table></td>
</tr>
<tr>
<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<!-- BEGIN thanks -->
<tr>
<td colspan="2" class="row2">
<table class="forumline" cellspacing="1" cellpadding="3" border="0" width="100%">
<tr>
<th class="thLeft">{postrow.thanks.THANKFUL}</th>
</tr>
<tr>
<td class="row2" valign="top" align="left">
<span id="hide_thank" style="display: block;" class="gensmall">
<a href="javascript: void(0);" onclick="document.all.show_thank.style.display = 'block';document.all.hide_thank.style.display = 'none'">{postrow.thanks.THANKS_TOTAL}</a> {postrow.thanks.THANKED}
</span>
<span id="show_thank" style="display: none;" class="gensmall">
{postrow.thanks.THANKS}
<br /><br /><div align="right"><a href="javascript: void(0);" onClick="document.all.show_thank.style.display = 'none';document.all.hide_thank.style.display = 'block'">[ {postrow.thanks.HIDE} ]</a></div>
</span>
</td>
</tr>
</table>
</td>
</tr>
<!-- END thanks -->
<!-- END postrow -->
<tr align="center">
<td class="catBottom" colspan="2" height="28"><table cellspacing="0" cellpadding="0" border="0">
<tr><form method="post" action="{S_POST_DAYS_ACTION}">
<td align="center"><span class="gensmall">{L_DISPLAY_POSTS}: {S_SELECT_POST_DAYS} {S_SELECT_POST_ORDER} <input type="submit" value="{L_GO}" class="liteoption" name="submit" /></span></td>
</form></tr>
</table></td>
</tr>
</table>
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" style="filter:alpha(opacity=65)" onMouseOver="this.filters.alpha.opacity=100" onMouseOut="this.filters.alpha.opacity=65" /></a> <a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" style="filter:alpha(opacity=65)" onMouseOver="this.filters.alpha.opacity=100" onMouseOut="this.filters.alpha.opacity=65" /></a> <a href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" style="filter:alpha(opacity=65)" onMouseOver="this.filters.alpha.opacity=100" onMouseOut="this.filters.alpha.opacity=65" /></</a>
<!-- BEGIN thanks_button -->
<a href="{thanks_button.U_THANK_TOPIC}"><img src="{thanks_button.THANK_IMG}" border="0" alt="{thanks_button.L_THANK_TOPIC}" align="middle" /></a>
<!-- END thanks_button -->
</span></td>
<td align="left" valign="middle" width="100%"><span class="nav"> <a href="{U_INDEX}" class="nav">{L_INDEX}</a>
-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
</td>
</tr>
<tr>
<td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
<span class="gensmall">{S_TIMEZONE}<br /><a href="tellafriend.php?topic={TOPIC_TITLE}&link={TELL_LINK}">{L_TELL_FRIEND}</a></span>
<span class="gensmall"><b>{IGNORED_MSG}</b><br /> </span>
<span class="gensmall"><b>{PAGINATION}</b><br />
</tr>
</table>
<table width="100%" cellspacing="2" border="0" align="center">
<tr>
<!-- Start add - Complete banner MOD -->
<td align="left" valign="bottom" colspan="2">{BANNER_15_IMG}</td>
<!-- End add - Complete banner MOD -->
<td width="40%" valign="top" nowrap="nowrap" align="left"><span class="gensmall">{S_WATCH_TOPIC}</span><br />
<span class="gensmall">{IGNORED_MSG}</span><br />
<br />
{S_TOPIC_ADMIN}{QUICK_REPLY_FORM}</td>
<td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span></td>
</tr>
</table>
Code: Select all
if( ($show_thanks == FORUM_THANKABLE) && ($i == 0) && ($current_page == 1) && ($total_thank > 0))
Code: Select all
if( ($show_thanks == FORUM_THANKABLE) && ($postrow[$i]['post_id'] == $topic_first_post_id) && ($total_thank > 0))
no idea ?Is it possible to view in a forum, each topic where a 'thank' had be done with a small gif (hart.gif) : the viewforum_body.tpl (and viewforum.php also ?) must be changed, but how this ?