phpBB

Code Changes

File: posting.php

  Unmodified   Added   Modified   Removed
Line 546Line 546
	}
$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 560Line 581
	);
}


	);
}


$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 863Line 884
	}

// 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 1013Line 1034
	// 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 1025Line 1046
		}

// 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 1247Line 1268
		}
}


		}
}


	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 1292Line 1313
	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 1489Line 1510
}

// 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 1531Line 1552
		}

$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 1560Line 1581
	}

// 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 1578Line 1599
		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 1601Line 1622
}

// 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 1649Line 1670
$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']) || (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 1774Line 1795
	'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 1786Line 1807
	'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 1846Line 1867
	$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']),