phpBB

Code Changes

File: posting.php

  Unmodified   Added   Modified   Removed
Line 29Line 29


// Grab only parameters needed here



// Grab only parameters needed here

$post_id	= request_var('p', 0);
$topic_id = request_var('t', 0);
$forum_id = request_var('f', 0);
$draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0);

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





$submit		= (isset($_POST['post'])) ? true : false;

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

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

Line 43Line 42
$cancel		= (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;

$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview);

$cancel		= (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;

$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview);

$mode		= request_var('mode', '');


$submit = $request->is_set_post('post') && !$refresh && !$preview;
$mode = $request->variable('mode', '');


// If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here.
if ($mode == 'delete' && (($confirm && !$request->is_set_post('delete_permanent')) || !$auth->acl_gets('f_delete', 'm_delete', $forum_id)))


// If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here.
if ($mode == 'delete' && (($confirm && !$request->is_set_post('delete_permanent')) || !$auth->acl_gets('f_delete', 'm_delete', $forum_id)))

Line 73Line 73
* @var	bool	preview		Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved
* @var bool load Whether or not a draft is being loaded

* @var	bool	preview		Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved
* @var bool load Whether or not a draft is being loaded

* @var	bool	delete		Whether or not the post is being deleted

 
* @var	bool	cancel		Whether or not to cancel the form (returns to
* viewtopic or viewforum depending on if the user
* is posting a new topic or editing a post)

* @var	bool	cancel		Whether or not to cancel the form (returns to
* viewtopic or viewforum depending on if the user
* is posting a new topic or editing a post)

Line 85Line 84
*							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

*/
$vars = array(
'post_id',

*/
$vars = array(
'post_id',

Line 96Line 96
	'preview',
'save',
'load',

	'preview',
'save',
'load',

	'delete',

 
	'cancel',
'refresh',
'mode',

	'cancel',
'refresh',
'mode',

Line 105Line 104
extract($phpbb_dispatcher->trigger_event('core.modify_posting_parameters', compact($vars)));

// Was cancel pressed? If so then redirect to the appropriate page

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

// Was cancel pressed? If so then redirect to the appropriate page

if ($cancel || ($current_time - $lastclick < 2 && $submit))

if ($cancel)

{
$f = ($forum_id) ? 'f=' . $forum_id . '&amp;' : '';
$redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx")));

{
$f = ($forum_id) ? 'f=' . $forum_id . '&amp;' : '';
$redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx")));

Line 117Line 116
	trigger_error('NO_FORUM');
}


	trigger_error('NO_FORUM');
}


 
/* @var $phpbb_content_visibility \phpbb\content_visibility */

$phpbb_content_visibility = $phpbb_container->get('content.visibility');

// We need to know some basic information in all cases before we do anything.

$phpbb_content_visibility = $phpbb_container->get('content.visibility');

// We need to know some basic information in all cases before we do anything.

Line 331Line 331
		{
$is_authed = true;
}

		{
$is_authed = true;
}

	break;



// no break;


case 'soft_delete':


case 'soft_delete':

		if ($user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))

		if (!$is_authed && $user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))

		{

		{

 
			// Fall back to soft_delete if we have no permissions to delete posts but to soft delete them

			$is_authed = true;

			$is_authed = true;

 
			$mode = 'soft_delete';

		}

		}

		else

		else if (!$is_authed)

		{
// Display the same error message for softdelete we use for delete
$mode = 'delete';
}
break;
}

		{
// Display the same error message for softdelete we use for delete
$mode = 'delete';
}
break;
}

 
/**
* This event allows you to do extra auth checks and verify if the user
* has the required permissions
*
* Extensions should only change the error and is_authed variables.
*
* @event core.modify_posting_auth
* @var int post_id ID of the post
* @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 load Whether or not a draft is being loaded
* @var bool refresh Whether or not to retain previously submitted data
* @var string mode What action to take if the form has been submitted
* post|reply|quote|edit|delete|bump|smilies|popup
* @var array error Any error strings; a non-empty array aborts
* form submission.
* NOTE: Should be actual language strings, NOT
* language keys.
* @var bool is_authed Does the user have the required permissions?
* @var array post_data All post data from database
* @since 3.1.3-RC1
* @changed 3.1.10-RC1 Added post_data
*/
$vars = array(
'post_id',
'topic_id',
'forum_id',
'draft_id',
'lastclick',
'submit',
'preview',
'save',
'load',
'refresh',
'mode',
'error',
'is_authed',
'post_data',
);
extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars)));


if (!$is_authed)
{


if (!$is_authed)
{

Line 437Line 485
	}

$delete_reason = $request->variable('delete_reason', '', true);

	}

$delete_reason = $request->variable('delete_reason', '', true);

	phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $delete_reason);

	phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete' && !$request->is_set_post('delete_permanent')), $delete_reason);

	return;
}


	return;
}


Line 445Line 493
if ($mode == 'bump')
{
if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id'])

if ($mode == 'bump')
{
if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id'])

		&& check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}"))

		&& check_link_hash($request->variable('hash', ''), "topic_{$post_data['topic_id']}"))

	{
$meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time);
meta_refresh(3, $meta_url);

	{
$meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time);
meta_refresh(3, $meta_url);

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

$message_parser = new parse_message();

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

$message_parser = new parse_message();

 
/* @var $plupload \phpbb\plupload\plupload */

$plupload = $phpbb_container->get('plupload');

$plupload = $phpbb_container->get('plupload');

 

/* @var $mimetype_guesser \phpbb\mimetype\guesser */

$mimetype_guesser = $phpbb_container->get('mimetype.guesser');
$message_parser->set_plupload($plupload);

$mimetype_guesser = $phpbb_container->get('mimetype.guesser');
$message_parser->set_plupload($plupload);

$message_parser->set_mimetype_guesser($mimetype_guesser);

 

if (isset($post_data['post_text']))
{


if (isset($post_data['post_text']))
{

Line 555Line 605
		WHERE post_msg_id = $post_id
AND in_message = 0
AND is_orphan = 0

		WHERE post_msg_id = $post_id
AND in_message = 0
AND is_orphan = 0

		ORDER BY filetime DESC";

		ORDER BY attach_id DESC";

	$result = $db->sql_query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);

	$result = $db->sql_query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);

Line 578Line 628
	$post_data['enable_smilies']	= ($config['allow_smilies'] && $user->optionget('smilies')) ? true : false;
$post_data['enable_bbcode'] = ($config['allow_bbcode'] && $user->optionget('bbcode')) ? true : false;
$post_data['enable_urls'] = true;

	$post_data['enable_smilies']	= ($config['allow_smilies'] && $user->optionget('smilies')) ? true : false;
$post_data['enable_bbcode'] = ($config['allow_bbcode'] && $user->optionget('bbcode')) ? true : false;
$post_data['enable_urls'] = true;

 
}

if ($mode == 'post')
{
$post_data['topic_status'] = ($request->is_set_post('lock_topic') && $auth->acl_gets('m_lock', 'f_user_lock', $forum_id)) ? ITEM_LOCKED : ITEM_UNLOCKED;

}

$post_data['enable_magic_url'] = $post_data['drafts'] = false;

}

$post_data['enable_magic_url'] = $post_data['drafts'] = false;

Line 631Line 686
// Save Draft
if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote'))
{

// Save Draft
if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote'))
{

	$subject = utf8_normalize_nfc(request_var('subject', '', true));

	$subject = $request->variable('subject', '', true);

	$subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject;

	$subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject;

	$message = utf8_normalize_nfc(request_var('message', '', true));

	$message = $request->variable('message', '', true);


if ($subject && $message)
{


if ($subject && $message)
{

Line 703Line 758
				if (is_bool($default))
{
// Use the string representation

				if (is_bool($default))
{
// Use the string representation

					$hidden_fields[$name] = request_var($name, '');

					$hidden_fields[$name] = $request->variable($name, '');

				}
else
{

				}
else
{

					$hidden_fields[$name] = request_var($name, $default);

					$hidden_fields[$name] = $request->variable($name, $default);

				}
}


				}
}


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


	load_drafts($topic_id, $forum_id);
}


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


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


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

	$post_data['topic_cur_post_id']	= request_var('topic_cur_post_id', 0);
$post_data['post_subject'] = utf8_normalize_nfc(request_var('subject', '', true));
$message_parser->message = utf8_normalize_nfc(request_var('message', '', true));

	$post_data['topic_cur_post_id']	= $request->variable('topic_cur_post_id', 0);
$post_data['post_subject'] = $request->variable('subject', '', true);
$message_parser->message = $request->variable('message', '', true);





	$post_data['username']			= utf8_normalize_nfc(request_var('username', $post_data['username'], true));
$post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : '';

	$post_data['username']			= $request->variable('username', $post_data['username'], true);
$post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? $request->variable('edit_reason', '', true) : '';


$post_data['orig_topic_type'] = $post_data['topic_type'];


$post_data['orig_topic_type'] = $post_data['topic_type'];

	$post_data['topic_type']		= request_var('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL));
$post_data['topic_time_limit'] = request_var('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0));

	$post_data['topic_type']		= $request->variable('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL));
$post_data['topic_time_limit'] = $request->variable('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0));


if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id))
{


if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id))
{

		$post_data['icon_id'] = request_var('icon', (int) $post_data['icon_id']);

		$post_data['icon_id'] = $request->variable('icon', (int) $post_data['icon_id']);

	}

$post_data['enable_bbcode'] = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true;

	}

$post_data['enable_bbcode'] = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true;

Line 842Line 898
	}
else
{

	}
else
{

		$post_data['poll_title']		= utf8_normalize_nfc(request_var('poll_title', '', true));
$post_data['poll_length'] = request_var('poll_length', 0);
$post_data['poll_option_text'] = utf8_normalize_nfc(request_var('poll_option_text', '', true));
$post_data['poll_max_options'] = request_var('poll_max_options', 1);

		$post_data['poll_title']		= $request->variable('poll_title', '', true);
$post_data['poll_length'] = $request->variable('poll_length', 0);
$post_data['poll_option_text'] = $request->variable('poll_option_text', '', true);
$post_data['poll_max_options'] = $request->variable('poll_max_options', 1);

		$post_data['poll_vote_change']	= ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
}


		$post_data['poll_vote_change']	= ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
}


Line 869Line 925

// Parse Attachments - before checksum is calculated
$message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh);


// Parse Attachments - before checksum is calculated
$message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh);

 

/**
* This event allows you to modify message text before parsing
*
* @event core.posting_modify_message_text
* @var array post_data Array with post data
* @var string mode What action to take if the form is submitted
* post|reply|quote|edit|delete|bump|smilies|popup
* @var int post_id ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum
* @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 load Whether or not a draft is being loaded
* @var bool cancel Whether or not to cancel the form (returns to
* viewtopic or viewforum depending on if the user
* 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
* @since 3.1.2-RC1
*/
$vars = array(
'post_data',
'mode',
'post_id',
'topic_id',
'forum_id',
'submit',
'preview',
'save',
'load',
'cancel',
'refresh',
'message_parser',
);
extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars)));


// Grab md5 'checksum' of new message
$message_md5 = md5($message_parser->message);


// Grab md5 'checksum' of new message
$message_md5 = md5($message_parser->message);

Line 877Line 970
	// Notify and show user the changed post
if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW)
{

	// Notify and show user the changed post
if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW)
{

		$edit_post_message_checksum = request_var('edit_post_message_checksum', '');
$edit_post_subject_checksum = request_var('edit_post_subject_checksum', '');

		$edit_post_message_checksum = $request->variable('edit_post_message_checksum', '');
$edit_post_subject_checksum = $request->variable('edit_post_subject_checksum', '');


// $post_data['post_checksum'] is the checksum of the post submitted in the meantime
// $message_md5 is the checksum of the post we're about to submit


// $post_data['post_checksum'] is the checksum of the post submitted in the meantime
// $message_md5 is the checksum of the post we're about to submit

Line 941Line 1034
		$message_parser->bbcode_bitfield = $post_data['bbcode_bitfield'];
}


		$message_parser->bbcode_bitfield = $post_data['bbcode_bitfield'];
}


	if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('f_ignoreflood', $forum_id))


	$ignore_flood = $auth->acl_get('u_ignoreflood') ? true : $auth->acl_get('f_ignoreflood', $forum_id);
if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$ignore_flood)

	{
// Flood check
$last_post_time = 0;

	{
// Flood check
$last_post_time = 0;

Line 992Line 1086
	if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply')))
{
$captcha_data = array(

	if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply')))
{
$captcha_data = array(

			'message'	=> utf8_normalize_nfc(request_var('message', '', true)),
'subject' => utf8_normalize_nfc(request_var('subject', '', true)),
'username' => utf8_normalize_nfc(request_var('username', '', true)),

			'message'	=> $request->variable('message', '', true),
'subject' => $request->variable('subject', '', true),
'username' => $request->variable('username', '', true),

		);
$vc_response = $captcha->validate($captcha_data);
if ($vc_response)

		);
$vc_response = $captcha->validate($captcha_data);
if ($vc_response)

Line 1085Line 1179
		$post_data['poll_title'] = '';
$post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0;
}

		$post_data['poll_title'] = '';
$post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0;
}

	else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != ''))

	else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && !$bbcode_utils->is_empty($original_poll_data['poll_title']))

	{
// 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.

Line 1112Line 1206
		switch ($post_data['topic_type'])
{
case POST_GLOBAL:

		switch ($post_data['topic_type'])
{
case POST_GLOBAL:

 
				$auth_option = 'f_announce_global';
break;


			case POST_ANNOUNCE:
$auth_option = 'f_announce';
break;

			case POST_ANNOUNCE:
$auth_option = 'f_announce';
break;

Line 1125Line 1222
			break;
}


			break;
}


		if (!$auth->acl_get($auth_option, $forum_id))

		if ($auth_option != '' && !$auth->acl_get($auth_option, $forum_id))

		{
// There is a special case where a user edits his post whereby the topic type got changed by an admin/mod.
// Another case would be a mod not having sticky permissions for example but edit permissions.

		{
// There is a special case where a user edits his post whereby the topic type got changed by an admin/mod.
// Another case would be a mod not having sticky permissions for example but edit permissions.

Line 1160Line 1257
	*
* @event core.posting_modify_submission_errors
* @var array post_data Array with post data

	*
* @event core.posting_modify_submission_errors
* @var array post_data Array with post data

 
	* @var	array	poll		Array with poll data from post (must be used instead of the post_data equivalent)

	* @var	string	mode		What action to take if the form is submitted
* post|reply|quote|edit|delete|bump|smilies|popup

	* @var	string	mode		What action to take if the form is submitted
* post|reply|quote|edit|delete|bump|smilies|popup

	* @var	string	page_title	Title of the mode page

 
	* @var	int	post_id		ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum

	* @var	int	post_id		ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum

Line 1170Line 1267
	* @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

	*/
$vars = array(
'post_data',

	*/
$vars = array(
'post_data',

 
		'poll',

		'mode',

		'mode',

		'page_title',

 
		'post_id',
'topic_id',
'forum_id',

		'post_id',
'topic_id',
'forum_id',

Line 1211Line 1310

$user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : '';



$user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : '';


				add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), $post_data['topic_title']);





				$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), false, array(
'forum_id' => $forum_id,
'topic_id' => $topic_id,
$post_data['topic_title']
));

			}

// Lock/Unlock Post Edit

			}

// Lock/Unlock Post Edit

Line 1241Line 1344
				'enable_urls'			=> (bool) $post_data['enable_urls'],
'enable_indexing' => (bool) $post_data['enable_indexing'],
'message_md5' => (string) $message_md5,

				'enable_urls'			=> (bool) $post_data['enable_urls'],
'enable_indexing' => (bool) $post_data['enable_indexing'],
'message_md5' => (string) $message_md5,

				'post_time'				=> (isset($post_data['post_time'])) ? (int) $post_data['post_time'] : $current_time,

 
				'post_checksum'			=> (isset($post_data['post_checksum'])) ? (string) $post_data['post_checksum'] : '',
'post_edit_reason' => $post_data['post_edit_reason'],
'post_edit_user' => ($mode == 'edit') ? $user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0),

				'post_checksum'			=> (isset($post_data['post_checksum'])) ? (string) $post_data['post_checksum'] : '',
'post_edit_reason' => $post_data['post_edit_reason'],
'post_edit_user' => ($mode == 'edit') ? $user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0),

Line 1256Line 1358
				'message'				=> $message_parser->message,
'attachment_data' => $message_parser->attachment_data,
'filename_data' => $message_parser->filename_data,

				'message'				=> $message_parser->message,
'attachment_data' => $message_parser->attachment_data,
'filename_data' => $message_parser->filename_data,

 
				'topic_status'			=> $post_data['topic_status'],


'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false,
'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false,


'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false,
'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false,

Line 1283Line 1386
			* @var	array	data		Array with post data going to be stored in the database
* @var string mode What action to take if the form is submitted
* post|reply|quote|edit|delete

			* @var	array	data		Array with post data going to be stored in the database
* @var string mode What action to take if the form is submitted
* post|reply|quote|edit|delete

			* @var	string	page_title	Title of the mode page

 
			* @var	int	post_id		ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum
* @var string post_author_name Author name for guest posts
* @var bool update_message Boolean if the post message was changed
* @var bool update_subject Boolean if the post subject was changed

			* @var	int	post_id		ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum
* @var string post_author_name Author name for guest posts
* @var bool update_message Boolean if the post message was changed
* @var bool update_subject Boolean if the post subject was changed

			* @var	bool	submit		Whether or not the form has been submitted
* @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

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

 
			* @changed 3.1.6-RC1 remove submit and error from event  Submit and Error are checked previously prior to running event
* @change 3.2.0-a1 Removed undefined page_title

			*/
$vars = array(
'post_data',
'poll',
'data',
'mode',

			*/
$vars = array(
'post_data',
'poll',
'data',
'mode',

				'page_title',

 
				'post_id',
'topic_id',
'forum_id',
'post_author_name',
'update_message',
'update_subject',

				'post_id',
'topic_id',
'forum_id',
'post_author_name',
'update_message',
'update_subject',

				'submit',
'error',

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


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


Line 1324Line 1423
			* @var	array	data		Array with post data going to be stored in the database
* @var string mode What action to take if the form is submitted
* post|reply|quote|edit|delete

			* @var	array	data		Array with post data going to be stored in the database
* @var string mode What action to take if the form is submitted
* post|reply|quote|edit|delete

			* @var	string	page_title	Title of the mode page

 
			* @var	int	post_id		ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum

			* @var	int	post_id		ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum

Line 1332Line 1430
			* @var	bool	update_message		Boolean if the post message was changed
* @var bool update_subject Boolean if the post subject was changed
* @var string redirect_url URL the user is going to be redirected to

			* @var	bool	update_message		Boolean if the post message was changed
* @var bool update_subject Boolean if the post subject was changed
* @var string redirect_url URL the user is going to be redirected to

			* @var	bool	submit		Whether or not the form has been submitted
* @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

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

 
			* @changed 3.1.6-RC1 remove submit and error from event  Submit and Error are checked previously prior to running event
* @change 3.2.0-a1 Removed undefined page_title

			*/
$vars = array(
'post_data',
'poll',
'data',
'mode',

			*/
$vars = array(
'post_data',
'poll',
'data',
'mode',

				'page_title',

 
				'post_id',
'topic_id',
'forum_id',

				'post_id',
'topic_id',
'forum_id',

Line 1350Line 1447
				'update_message',
'update_subject',
'redirect_url',

				'update_message',
'update_subject',
'redirect_url',

				'submit',
'error',

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


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


Line 1398Line 1493
	// Signature
if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id))
{

	// Signature
if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id))
{

		$parse_sig = new parse_message($preview_signature);
$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;

		$flags = ($config['allow_sig_bbcode']) ? OPTION_FLAG_BBCODE : 0;
$flags |= ($config['allow_sig_links']) ? OPTION_FLAG_LINKS : 0;
$flags |= ($config['allow_sig_smilies']) ? OPTION_FLAG_SMILIES : 0;





		// Not sure about parameters for bbcode/smilies/urls... in signatures
$parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']);
$preview_signature = $parse_sig->message;
unset($parse_sig);

		$preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $flags, false);




	}
else
{

	}
else
{

Line 1439Line 1531
			'L_MAX_VOTES'		=> $user->lang('MAX_OPTIONS_SELECT', (int) $post_data['poll_max_options']),
));


			'L_MAX_VOTES'		=> $user->lang('MAX_OPTIONS_SELECT', (int) $post_data['poll_max_options']),
));


		$parse_poll->message = implode("\n", $post_data['poll_options']);




		$preview_poll_options = array();
foreach ($post_data['poll_options'] as $poll_option)
{
$parse_poll->message = $poll_option;

		$parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']);

		$parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']);

		$preview_poll_options = explode('<br />', $parse_poll->message);


			$preview_poll_options[] = $parse_poll->message;
}

		unset($parse_poll);

foreach ($preview_poll_options as $key => $option)

		unset($parse_poll);

foreach ($preview_poll_options as $key => $option)

Line 1483Line 1579
			'S_DISPLAY_PREVIEW'		=> !empty($preview_message),
));
}

			'S_DISPLAY_PREVIEW'		=> !empty($preview_message),
));
}

 
}

// Remove quotes that would become nested too deep before decoding the text
$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh);
if ($generate_quote && $config['max_quote_depth'] > 0)
{
$tmp_bbcode_uid = $message_parser->bbcode_uid;
$message_parser->bbcode_uid = $post_data['bbcode_uid'];
$message_parser->remove_nested_quotes($config['max_quote_depth'] - 1);
$message_parser->bbcode_uid = $tmp_bbcode_uid;

}

// Decode text for message display
$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
$message_parser->decode_message($post_data['bbcode_uid']);


}

// Decode text for message display
$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
$message_parser->decode_message($post_data['bbcode_uid']);


if ($mode == 'quote' && !$submit && !$preview && !$refresh)

if ($generate_quote)

{

{

 
	// 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'])
{

	if ($config['allow_bbcode'])
{

		$message_parser->message = '[quote=&quot;' . $post_data['quote_username'] . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";










		$message_parser->message = $bbcode_utils->generate_quote(
censor_text($message_parser->message),
array(
'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
{

	}
else
{

Line 1522Line 1640
$filename_data = $message_parser->filename_data;
$post_data['post_text'] = $message_parser->message;


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


if (sizeof($post_data['poll_options']) || !empty($post_data['poll_title']))

if (sizeof($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 1615Line 1733

$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 = ($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_var('draft_loaded', $draft_id) . '" />' : '';

$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')
{


if ($mode == 'edit')
{

Line 1634Line 1752
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"';
add_form_key('posting');


$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"';
add_form_key('posting');


 
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');


// Build array of variables for main posting page
$page_data = array(
'L_POST_A' => $page_title,
'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'],
'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']),


// Build array of variables for main posting page
$page_data = array(
'L_POST_A' => $page_title,
'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'],
'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']),

 
	'L_DELETE_POST_PERMANENTLY'	=> $user->lang('DELETE_POST_PERMANENTLY', 1),


'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']) : '',


'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']) : '',

Line 1648Line 1769
	'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'],

	'BBCODE_STATUS'			=> ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),

	'BBCODE_STATUS'			=> $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'),

	'IMG_STATUS'			=> ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],

	'IMG_STATUS'			=> ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],

Line 1658Line 1779
	'POST_DATE'				=> ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '',
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'],

	'POST_DATE'				=> ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '',
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'],

	'EDIT_REASON'			=> $request->variable('edit_reason', ''),

	'EDIT_REASON'			=> $request->variable('edit_reason', '', true),

	'SHOW_PANEL'			=> $request->variable('show_panel', ''),
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"),
'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id") : '',

	'SHOW_PANEL'			=> $request->variable('show_panel', ''),
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"),
'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id") : '',

Line 1680Line 1801
	'S_SIGNATURE_CHECKED'		=> ($sig_checked) ? ' checked="checked"' : '',
'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true,
'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '',

	'S_SIGNATURE_CHECKED'		=> ($sig_checked) ? ' checked="checked"' : '',
'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true,
'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '',

	'S_LOCK_TOPIC_ALLOWED'		=> (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false,

	'S_LOCK_TOPIC_ALLOWED'		=> (($mode == 'edit' || $mode == 'reply' || $mode == 'quote' || $mode == 'post') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false,

	'S_LOCK_TOPIC_CHECKED'		=> ($lock_topic_checked) ? ' checked="checked"' : '',
'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false,
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',

	'S_LOCK_TOPIC_CHECKED'		=> ($lock_topic_checked) ? ' checked="checked"' : '',
'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false,
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',

Line 1705Line 1826
	'S_ATTACH_DATA'			=> json_encode($message_parser->attachment_data),
'S_IN_POSTING' => true,
);

	'S_ATTACH_DATA'			=> json_encode($message_parser->attachment_data),
'S_IN_POSTING' => true,
);

 

// Build custom bbcodes array
display_custom_bbcodes();

// Poll entry
if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/))
&& $auth->acl_get('f_poll', $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_CHECKED' => (!empty($poll_delete)) ? true : false,

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

'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '',
'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '',
'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '',
'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1,
'POLL_LENGTH' => $post_data['poll_length'],
)
);
}


/**
* This event allows you to modify template variables for the posting screen


/**
* This event allows you to modify template variables for the posting screen

Line 1723Line 1868
* @var	int	post_id		ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum

* @var	int	post_id		ID of the post
* @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	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 load Whether or not a draft is being 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 load Whether or not a draft is being loaded

* @var	bool	delete		Whether or not the post is being deleted

 
* @var	bool	cancel		Whether or not to cancel the form (returns to
* viewtopic or viewforum depending on if the user
* is posting a new topic or editing a post)

* @var	bool	cancel		Whether or not to cancel the form (returns to
* viewtopic or viewforum depending on if the user
* is posting a new topic or editing a post)

Line 1744Line 1889
*		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

*/
$vars = array(
'post_data',

*/
$vars = array(
'post_data',

Line 1757Line 1905
	'post_id',
'topic_id',
'forum_id',

	'post_id',
'topic_id',
'forum_id',

 
	'draft_id',

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

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

	'delete',

 
	'cancel',
'refresh',
'error',

	'cancel',
'refresh',
'error',

Line 1772Line 1920

// Start assigning vars for main posting page ...
$template->assign_vars($page_data);


// Start assigning vars for main posting page ...
$template->assign_vars($page_data);


// Build custom bbcodes array
display_custom_bbcodes();

// Poll entry
if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/))
&& $auth->acl_get('f_poll', $forum_id))
{
$template->assign_vars(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_CHECKED' => (!empty($poll_delete)) ? true : false,

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

'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '',
'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '',
'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '',
'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1,
'POLL_LENGTH' => $post_data['poll_length'])
);
}

 

// Show attachment box for adding attachments if true
$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype);


// Show attachment box for adding attachments if true
$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype);