phpBB

Code Changes

File: posting.php

  Unmodified   Added   Modified   Removed
Line 33Line 33
$topic_id	= $request->variable('t', 0);
$forum_id = $request->variable('f', 0);
$draft_id = $request->variable('d', 0);

$topic_id	= $request->variable('t', 0);
$forum_id = $request->variable('f', 0);
$draft_id = $request->variable('d', 0);

$lastclick	= $request->variable('lastclick', 0);

 

$preview = (isset($_POST['preview'])) ? true : false;
$save = (isset($_POST['save'])) ? true : false;


$preview = (isset($_POST['preview'])) ? true : false;
$save = (isset($_POST['save'])) ? true : false;

Line 68Line 67
* @var	int		topic_id	ID of the topic
* @var int forum_id ID of the forum
* @var int draft_id ID of the draft

* @var	int		topic_id	ID of the topic
* @var int forum_id ID of the forum
* @var int draft_id ID of the draft

* @var	int		lastclick	Timestamp of when the form was last loaded

 
* @var	bool	submit		Whether or not the form has been submitted
* @var bool preview Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved

* @var	bool	submit		Whether or not the form has been submitted
* @var bool preview Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved

Line 84Line 82
*							NOTE: Should be actual language strings, NOT
* language keys.
* @since 3.1.0-a1

*							NOTE: Should be actual language strings, NOT
* language keys.
* @since 3.1.0-a1

* @change 3.1.2-RC1			Removed 'delete' var as it does not exist


* @changed 3.1.2-RC1			Removed 'delete' var as it does not exist
* @changed 3.2.4-RC1 Remove unused 'lastclick' var

*/
$vars = array(
'post_id',
'topic_id',
'forum_id',
'draft_id',

*/
$vars = array(
'post_id',
'topic_id',
'forum_id',
'draft_id',

	'lastclick',

 
	'submit',
'preview',
'save',

	'submit',
'preview',
'save',

Line 223Line 221
	}
trigger_error(($mode == 'post' || $mode == 'bump' || $mode == 'reply') ? 'NO_TOPIC' : 'NO_POST');
}

	}
trigger_error(($mode == 'post' || $mode == 'bump' || $mode == 'reply') ? 'NO_TOPIC' : 'NO_POST');
}

 

/**
* This event allows you to bypass reply/quote test of an unapproved post.
*
* @event core.posting_modify_row_data
* @var array post_data All post data from database
* @var string mode What action to take if the form has been submitted
* post|reply|quote|edit|delete|bump|smilies|popup
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum
* @since 3.2.8-RC1
*/
$vars = array(
'post_data',
'mode',
'topic_id',
'forum_id',
);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_row_data', compact($vars)));


// Not able to reply to unapproved posts/topics
// TODO: add more descriptive language key


// Not able to reply to unapproved posts/topics
// TODO: add more descriptive language key

Line 238Line 255
}

$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']);

}

$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']);


if ($config['enable_post_confirm'] && !$user->data['is_registered'])
{
$captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
}

 

// Use post_row values in favor of submitted ones...
$forum_id = (!empty($post_data['forum_id'])) ? (int) $post_data['forum_id'] : (int) $forum_id;


// Use post_row values in favor of submitted ones...
$forum_id = (!empty($post_data['forum_id'])) ? (int) $post_data['forum_id'] : (int) $forum_id;

Line 340Line 351
			// Fall back to soft_delete if we have no permissions to delete posts but to soft delete them
$is_authed = true;
$mode = 'soft_delete';

			// Fall back to soft_delete if we have no permissions to delete posts but to soft delete them
$is_authed = true;
$mode = 'soft_delete';

		}
else if (!$is_authed)
{
// Display the same error message for softdelete we use for delete
$mode = 'delete';

 
		}
break;
}

		}
break;
}

Line 359Line 365
* @var	int		topic_id	ID of the topic
* @var int forum_id ID of the forum
* @var int draft_id ID of the draft

* @var	int		topic_id	ID of the topic
* @var int forum_id ID of the forum
* @var int draft_id ID of the draft

* @var	int		lastclick	Timestamp of when the form was last loaded

 
* @var	bool	submit		Whether or not the form has been submitted
* @var bool preview Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved

* @var	bool	submit		Whether or not the form has been submitted
* @var bool preview Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved

Line 375Line 380
* @var	array	post_data	All post data from database
* @since 3.1.3-RC1
* @changed 3.1.10-RC1 Added post_data

* @var	array	post_data	All post data from database
* @since 3.1.3-RC1
* @changed 3.1.10-RC1 Added post_data

 
* @changed 3.2.4-RC1 		Remove unused 'lastclick' var

*/
$vars = array(
'post_id',
'topic_id',
'forum_id',
'draft_id',

*/
$vars = array(
'post_id',
'topic_id',
'forum_id',
'draft_id',

	'lastclick',

 
	'submit',
'preview',
'save',

	'submit',
'preview',
'save',

Line 394Line 399
);
extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars)));


);
extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars)));


if (!$is_authed)

if (!$is_authed || !empty($error))

{

{

	$check_auth = ($mode == 'quote') ? 'reply' : $mode;

	$check_auth = ($mode == 'quote') ? 'reply' : (($mode == 'soft_delete') ? 'delete' : $mode);


if ($user->data['is_registered'])
{


if ($user->data['is_registered'])
{

		trigger_error('USER_CANNOT_' . strtoupper($check_auth));

		trigger_error(empty($error) ? 'USER_CANNOT_' . strtoupper($check_auth) : implode('<br/>', $error));

	}
$message = $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)];


	}
$message = $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)];


Line 414Line 419
	}

login_box('', $message);

	}

login_box('', $message);

 
}

if ($config['enable_post_confirm'] && !$user->data['is_registered'])
{
$captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_POST);

}

// Is the user able to post within this forum?

}

// Is the user able to post within this forum?

Line 551Line 562
	}
$db->sql_freeresult($result);
}

	}
$db->sql_freeresult($result);
}

 

/**
* This event allows you to modify the post data before parsing
*
* @event core.posting_modify_post_data
* @var int forum_id ID of the forum
* @var string mode What action to take if the form has been submitted
* post|reply|quote|edit|delete|bump|smilies|popup
* @var array post_data Array with post data
* @var int post_id ID of the post
* @var int topic_id ID of the topic
* @since 3.2.2-RC1
*/
$vars = array(
'forum_id',
'mode',
'post_data',
'post_id',
'topic_id',
);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_post_data', compact($vars)));


if ($mode == 'edit')
{


if ($mode == 'edit')
{

Line 565Line 597
	);
}


	);
}


$orig_poll_options_size = sizeof($post_data['poll_options']);

$orig_poll_options_size = count($post_data['poll_options']);


$message_parser = new parse_message();
/* @var $plupload \phpbb\plupload\plupload */


$message_parser = new parse_message();
/* @var $plupload \phpbb\plupload\plupload */

Line 583Line 615

// Set some default variables
$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0);


// Set some default variables
$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0);

 

/**
* This event allows you to modify the default variables for post_data, and unset them in post_data if needed
*
* @event core.posting_modify_default_variables
* @var array post_data Array with post data
* @var array uninit Array with default vars to put into post_data, if they aren't there
* @since 3.2.5-RC1
*/
$vars = array(
'post_data',
'uninit',
);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_default_variables', compact($vars)));


foreach ($uninit as $var_name => $default_value)
{


foreach ($uninit as $var_name => $default_value)
{

Line 694Line 740
	{
if (confirm_box(true))
{

	{
if (confirm_box(true))
{

 
			$message_parser->message = $message;
$message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);


			$sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => (int) $user->data['user_id'],
'topic_id' => (int) $topic_id,
'forum_id' => (int) $forum_id,
'save_time' => (int) $current_time,
'draft_subject' => (string) $subject,

			$sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => (int) $user->data['user_id'],
'topic_id' => (int) $topic_id,
'forum_id' => (int) $forum_id,
'save_time' => (int) $current_time,
'draft_subject' => (string) $subject,

				'draft_message'	=> (string) $message)

				'draft_message'	=> (string) $message_parser->message)

			);
$db->sql_query($sql);


			);
$db->sql_query($sql);


Line 816Line 865
	load_drafts($topic_id, $forum_id);
}


	load_drafts($topic_id, $forum_id);
}


 
/** @var \phpbb\textformatter\utils_interface $bbcode_utils */

$bbcode_utils = $phpbb_container->get('text_formatter.utils');

if ($submit || $preview || $refresh)

$bbcode_utils = $phpbb_container->get('text_formatter.utils');

if ($submit || $preview || $refresh)

Line 865Line 915
	}

// Delete Poll

	}

// Delete Poll

	if ($poll_delete && $mode == 'edit' && sizeof($post_data['poll_options']) &&

	if ($poll_delete && $mode == 'edit' && count($post_data['poll_options']) &&

		((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
{
if ($submit && check_form_key('posting'))

		((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
{
if ($submit && check_form_key('posting'))

Line 924Line 974
	}

// Parse Attachments - before checksum is calculated

	}

// Parse Attachments - before checksum is calculated

 
	if ($message_parser->check_attachment_form_token($language, $request, 'posting'))
{

	$message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh);

	$message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh);

 
	}


/**
* This event allows you to modify message text before parsing


/**
* This event allows you to modify message text before parsing

Line 945Line 998
	*				is posting a new topic or editing a post)
* @var bool refresh Whether or not to retain previously submitted data
* @var object message_parser The message parser object

	*				is posting a new topic or editing a post)
* @var bool refresh Whether or not to retain previously submitted data
* @var object message_parser The message parser object

 
	* @var	array	error		Array of errors

	* @since 3.1.2-RC1

	* @since 3.1.2-RC1

 
	* @changed 3.1.11-RC1 Added error

	*/
$vars = array(
'post_data',

	*/
$vars = array(
'post_data',

Line 960Line 1015
		'cancel',
'refresh',
'message_parser',

		'cancel',
'refresh',
'message_parser',

 
		'error',

	);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars)));


	);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars)));


Line 1012Line 1068
	// Parse message
if ($update_message)
{

	// Parse message
if ($update_message)
{

		if (sizeof($message_parser->warn_msg))

		if (count($message_parser->warn_msg))

		{
$error[] = implode('<br />', $message_parser->warn_msg);
$message_parser->warn_msg = array();

		{
$error[] = implode('<br />', $message_parser->warn_msg);
$message_parser->warn_msg = array();

Line 1024Line 1080
		}

// On a refresh we do not care about message parsing errors

		}

// On a refresh we do not care about message parsing errors

		if (sizeof($message_parser->warn_msg) && $refresh && !$preview)

		if (count($message_parser->warn_msg) && $refresh && !$preview)

		{
$message_parser->warn_msg = array();
}

		{
$message_parser->warn_msg = array();
}

Line 1066Line 1122

// Validate username
if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username']))


// Validate username
if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username']))

 
	{
if (!function_exists('validate_username'))

	{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

	{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

 
		}


$user->add_lang('ucp');



$user->add_lang('ucp');


Line 1122Line 1181
		$error[] = $user->lang['EMPTY_SUBJECT'];
}


		$error[] = $user->lang['EMPTY_SUBJECT'];
}


	// Check for out-of-bounds characters that are currently
// not supported by utf8_bin in MySQL














	/**
* Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR.
* Using their Numeric Character Reference's Hexadecimal notation.
* Check the permissions for posting Emojis first.
*/
if ($auth->acl_get('u_emoji'))
{
$post_data['post_subject'] = utf8_encode_ucr($post_data['post_subject']);
}
else
{
/**
* Check for out-of-bounds characters that are currently
* not supported by utf8_bin in MySQL
*/

	if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches))
{

	if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches))
{

		$character_list = implode('<br />', $matches[0]);


			$character_list = implode('<br>', $matches[0]);


		$error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list);

		$error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list);

 
		}

	}

$post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0;

	}

$post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0;

Line 1183Line 1257
	{
// We have a poll but the editing user is not permitted to create/edit it.
// So we just keep the original poll-data.

	{
// We have a poll but the editing user is not permitted to create/edit it.
// So we just keep the original poll-data.

 
		// Decode the poll title and options text fisrt.
$original_poll_data['poll_title'] = $bbcode_utils->unparse($original_poll_data['poll_title']);
$original_poll_data['poll_option_text'] = $bbcode_utils->unparse($original_poll_data['poll_option_text']);
$original_poll_data['poll_options'] = explode("\n", $original_poll_data['poll_option_text']);


		$poll = array_merge($original_poll_data, array(
'enable_bbcode' => $post_data['enable_bbcode'],
'enable_urls' => $post_data['enable_urls'],

		$poll = array_merge($original_poll_data, array(
'enable_bbcode' => $post_data['enable_bbcode'],
'enable_urls' => $post_data['enable_urls'],

Line 1238Line 1317
		}
}


		}
}


	if (sizeof($message_parser->warn_msg))

	if (count($message_parser->warn_msg))

	{
$error[] = implode('<br />', $message_parser->warn_msg);
}

	{
$error[] = implode('<br />', $message_parser->warn_msg);
}

Line 1267Line 1346
	* @var	array	error		Any error strings; a non-empty array aborts form submission.
* NOTE: Should be actual language strings, NOT language keys.
* @since 3.1.0-RC5

	* @var	array	error		Any error strings; a non-empty array aborts form submission.
* NOTE: Should be actual language strings, NOT language keys.
* @since 3.1.0-RC5

	* @change 3.1.5-RC1 Added poll array to the event
* @change 3.2.0-a1 Removed undefined page_title

	* @changed 3.1.5-RC1 Added poll array to the event
* @changed 3.2.0-a1 Removed undefined page_title

	*/
$vars = array(
'post_data',

	*/
$vars = array(
'post_data',

Line 1283Line 1362
	extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars)));

// Store message, sync counters

	extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars)));

// Store message, sync counters

	if (!sizeof($error) && $submit)

	if (!count($error) && $submit)

	{
if ($submit)
{

	{
if ($submit)
{

Line 1480Line 1559
}

// Preview

}

// Preview

if (!sizeof($error) && $preview)

if (!count($error) && $preview)

{
$post_data['post_time'] = ($mode == 'edit') ? $post_data['post_time'] : $current_time;


{
$post_data['post_time'] = ($mode == 'edit') ? $post_data['post_time'] : $current_time;


Line 1522Line 1601
		}

$template->assign_vars(array(

		}

$template->assign_vars(array(

			'S_HAS_POLL_OPTIONS'	=> (sizeof($post_data['poll_options'])),

			'S_HAS_POLL_OPTIONS'	=> (count($post_data['poll_options'])),

			'S_IS_MULTI_CHOICE'		=> ($post_data['poll_max_options'] > 1) ? true : false,

'POLL_QUESTION' => $parse_poll->message,

			'S_IS_MULTI_CHOICE'		=> ($post_data['poll_max_options'] > 1) ? true : false,

'POLL_QUESTION' => $parse_poll->message,

Line 1551Line 1630
	}

// Attachment Preview

	}

// Attachment Preview

	if (sizeof($message_parser->attachment_data))

	if (count($message_parser->attachment_data))

	{
$template->assign_var('S_HAS_ATTACHMENTS', true);


	{
$template->assign_var('S_HAS_ATTACHMENTS', true);


Line 1569Line 1648
		unset($attachment_data);
}


		unset($attachment_data);
}


	if (!sizeof($error))

	if (!count($error))

	{
$template->assign_vars(array(
'PREVIEW_SUBJECT' => $preview_subject,

	{
$template->assign_vars(array(
'PREVIEW_SUBJECT' => $preview_subject,

Line 1592Line 1671
}

// Decode text for message display

}

// Decode text for message display

$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;

$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !count($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;

$message_parser->decode_message($post_data['bbcode_uid']);

if ($generate_quote)

$message_parser->decode_message($post_data['bbcode_uid']);

if ($generate_quote)

Line 1600Line 1679
	// Remove attachment bbcode tags from the quoted message to avoid mixing with the new post attachments if any
$message_parser->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#uis', '\\2', $message_parser->message);


	// Remove attachment bbcode tags from the quoted message to avoid mixing with the new post attachments if any
$message_parser->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#uis', '\\2', $message_parser->message);


	if ($config['allow_bbcode'])
{
$message_parser->message = $bbcode_utils->generate_quote(
censor_text($message_parser->message),
array(

	$quote_attributes = array(





				'author'  => $post_data['quote_username'],
'post_id' => $post_data['post_id'],
'time' => $post_data['post_time'],
'user_id' => $post_data['poster_id'],

				'author'  => $post_data['quote_username'],
'post_id' => $post_data['post_id'],
'time' => $post_data['post_time'],
'user_id' => $post_data['poster_id'],

			)

 
		);

		);

		$message_parser->message .= "\n\n";
}
else
{
$offset = 0;
$quote_string = "&gt; ";
$message = censor_text(trim($message_parser->message));
// see if we are nesting. It's easily tricked but should work for one level of nesting
if (strpos($message, "&gt;") !== false)
{
$offset = 10;
}
$message = utf8_wordwrap($message, 75 + $offset, "\n");

 




		$message = $quote_string . $message;
$message = str_replace("\n", "\n" . $quote_string, $message);
$message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n";
}














	/**
* This event allows you to modify the quote attributes of the post being quoted
*
* @event core.posting_modify_quote_attributes
* @var array quote_attributes Array with quote attributes
* @var array post_data Array with post data
* @since 3.2.6-RC1
*/
$vars = array(
'quote_attributes',
'post_data',
);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_quote_attributes', compact($vars)));

/** @var \phpbb\language\language $language */
$language = $phpbb_container->get('language');
phpbb_format_quote($language, $message_parser, $bbcode_utils, $bbcode_status, $quote_attributes);

}

if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh)
{
$post_data['post_subject'] = ((strpos($post_data['post_subject'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($post_data['post_subject']);

}

if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh)
{
$post_data['post_subject'] = ((strpos($post_data['post_subject'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($post_data['post_subject']);

 

$post_subject = $post_data['post_subject'];

/**
* This event allows you to modify the post subject of the post being quoted
*
* @event core.posting_modify_post_subject
* @var string post_subject String with the post subject already censored.
* @since 3.2.8-RC1
*/
$vars = array('post_subject');
extract($phpbb_dispatcher->trigger_event('core.posting_modify_post_subject', compact($vars)));

$post_data['post_subject'] = $post_subject;

}

$attachment_data = $message_parser->attachment_data;
$filename_data = $message_parser->filename_data;
$post_data['post_text'] = $message_parser->message;


}

$attachment_data = $message_parser->attachment_data;
$filename_data = $message_parser->filename_data;
$post_data['post_text'] = $message_parser->message;


if (sizeof($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title'])))

if (count($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title'])))

{
$message_parser->message = $post_data['poll_title'];
$message_parser->bbcode_uid = $post_data['bbcode_uid'];

{
$message_parser->message = $post_data['poll_title'];
$message_parser->bbcode_uid = $post_data['bbcode_uid'];

Line 1732Line 1820
}

$s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : '';

}

$s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : '';

$s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_time . '" />';

 
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . $request->variable('draft_loaded', $draft_id) . '" />' : '';

if ($mode == 'edit')

$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . $request->variable('draft_loaded', $draft_id) . '" />' : '';

if ($mode == 'edit')

Line 1765Line 1852
	'FORUM_NAME'			=> $post_data['forum_name'],
'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '',
'TOPIC_TITLE' => censor_text($post_data['topic_title']),

	'FORUM_NAME'			=> $post_data['forum_name'],
'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '',
'TOPIC_TITLE' => censor_text($post_data['topic_title']),

	'MODERATORS'			=> (sizeof($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '',

	'MODERATORS'			=> (count($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '',

	'USERNAME'				=> ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '',
'SUBJECT' => $post_data['post_subject'],
'MESSAGE' => $post_data['post_text'],

	'USERNAME'				=> ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '',
'SUBJECT' => $post_data['post_subject'],
'MESSAGE' => $post_data['post_text'],

Line 1777Line 1864
	'MAX_FONT_SIZE'			=> (int) $config['max_post_font_size'],
'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']),
'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '',

	'MAX_FONT_SIZE'			=> (int) $config['max_post_font_size'],
'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']),
'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '',

	'ERROR'					=> (sizeof($error)) ? implode('<br />', $error) : '',

	'ERROR'					=> (count($error)) ? implode('<br />', $error) : '',

	'TOPIC_TIME_LIMIT'		=> (int) $post_data['topic_time_limit'],
'EDIT_REASON' => $request->variable('edit_reason', '', true),
'SHOW_PANEL' => $request->variable('show_panel', ''),

	'TOPIC_TIME_LIMIT'		=> (int) $post_data['topic_time_limit'],
'EDIT_REASON' => $request->variable('edit_reason', '', true),
'SHOW_PANEL' => $request->variable('show_panel', ''),

Line 1837Line 1924
	$page_data = array_merge($page_data, array(
'S_SHOW_POLL_BOX' => true,
'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),

	$page_data = array_merge($page_data, array(
'S_SHOW_POLL_BOX' => true,
'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),

		'S_POLL_DELETE'			=> ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),

		'S_POLL_DELETE'			=> ($mode == 'edit' && count($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),

		'S_POLL_DELETE_CHECKED'	=> (!empty($poll_delete)) ? true : false,

'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']),

		'S_POLL_DELETE_CHECKED'	=> (!empty($poll_delete)) ? true : false,

'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']),

Line 1885Line 1972
*				posting page via $template->assign_vars()
* @var object message_parser The message parser object
* @since 3.1.0-a1

*				posting page via $template->assign_vars()
* @var object message_parser The message parser object
* @since 3.1.0-a1

* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title,

* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title,

*		s_topic_icons, form_enctype, s_action, s_hidden_fields,
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser

*		s_topic_icons, form_enctype, s_action, s_hidden_fields,
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser

* @change 3.1.2-RC1 Removed 'delete' var as it does not exist
* @change 3.1.5-RC1 Added poll variables to the page_data array
* @change 3.1.6-RC1 Added 'draft_id' var

* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist
* @changed 3.1.5-RC1 Added poll variables to the page_data array
* @changed 3.1.6-RC1 Added 'draft_id' var

*/
$vars = array(
'post_data',

*/
$vars = array(
'post_data',