phpBB

Code Changes

File: includes/message_parser.php

  Unmodified   Added   Modified   Removed
Line 705Line 705
			if ($tok == ']')
{
// if $tok is ']' the buffer holds a tag

			if ($tok == ']')
{
// if $tok is ']' the buffer holds a tag

				if (strtolower($buffer) == '/list' && sizeof($list_end_tags))

				if (strtolower($buffer) == '/list' && count($list_end_tags))

				{
// valid [/list] tag, check nesting so that we don't hit false positives

				{
// valid [/list] tag, check nesting so that we don't hit false positives

					if (sizeof($item_end_tags) && sizeof($item_end_tags) >= sizeof($list_end_tags))

					if (count($item_end_tags) && count($item_end_tags) >= count($list_end_tags))

					{
// current li tag has not been closed
$out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . '][';

					{
// current li tag has not been closed
$out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . '][';

Line 733Line 733
				}
else
{

				}
else
{

					if (($buffer == '*' || substr($buffer, -2) == '[*') && sizeof($list_end_tags))

					if (($buffer == '*' || substr($buffer, -2) == '[*') && count($list_end_tags))

					{
// the buffer holds a bullet tag and we have a [list] tag open

					{
// the buffer holds a bullet tag and we have a [list] tag open

						if (sizeof($item_end_tags) >= sizeof($list_end_tags))

						if (count($item_end_tags) >= count($list_end_tags))

						{
if (substr($buffer, -2) == '[*')
{

						{
if (substr($buffer, -2) == '[*')
{

Line 780Line 780
		while ($in);

// do we have some tags open? close them now

		while ($in);

// do we have some tags open? close them now

		if (sizeof($item_end_tags))

		if (count($item_end_tags))

		{
$out .= '[' . implode('][', $item_end_tags) . ']';
}

		{
$out .= '[' . implode('][', $item_end_tags) . ']';
}

		if (sizeof($list_end_tags))

		if (count($list_end_tags))

		{
$out .= '[' . implode('][', $list_end_tags) . ']';
}

		{
$out .= '[' . implode('][', $list_end_tags) . ']';
}

Line 835Line 835

if ($tok == ']')
{


if ($tok == ']')
{

				if (strtolower($buffer) == '/quote' && sizeof($close_tags) && substr($out, -1, 1) == '[')

				if (strtolower($buffer) == '/quote' && count($close_tags) && substr($out, -1, 1) == '[')

				{
// we have found a closing tag
$out .= array_pop($close_tags) . ']';

				{
// we have found a closing tag
$out .= array_pop($close_tags) . ']';

Line 949Line 949

$out .= $buffer;



$out .= $buffer;


		if (sizeof($close_tags))

		if (count($close_tags))

		{
$out .= '[' . implode('][', $close_tags) . ']';
}

		{
$out .= '[' . implode('][', $close_tags) . ']';
}

Line 1072Line 1072

if ($config['force_server_vars'])
{


if ($config['force_server_vars'])
{

			$check_path = $config['script_path'];

			$check_path = !empty($config['script_path']) ? $config['script_path'] : '/';

		}
else
{

		}
else
{

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


			$db->sql_freeresult($result);
}


		if (sizeof($match))

		if (count($match))

		{
if ($max_smilies)
{

		{
if ($max_smilies)
{

Line 1530Line 1530
	function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false)
{
global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request;

	function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false)
{
global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request;

		global $phpbb_container;

		global $phpbb_container, $phpbb_dispatcher;


$error = array();



$error = array();


		$num_attachments = sizeof($this->attachment_data);

		$num_attachments = count($this->attachment_data);

		$this->filename_data['filecomment'] = $request->variable('filecomment', '', true);
$upload = $request->file($form_name);
$upload_file = (!empty($upload) && $upload['name'] !== 'none' && trim($upload['name']));

		$this->filename_data['filecomment'] = $request->variable('filecomment', '', true);
$upload = $request->file($form_name);
$upload_file = (!empty($upload) && $upload['name'] !== 'none' && trim($upload['name']));

Line 1571Line 1571
				$filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message);
$error = $filedata['error'];


				$filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message);
$error = $filedata['error'];


				if ($filedata['post_attach'] && !sizeof($error))

				if ($filedata['post_attach'] && !count($error))

				{
$sql_ary = array(
'physical_filename' => $filedata['physical_filename'],

				{
$sql_ary = array(
'physical_filename' => $filedata['physical_filename'],

Line 1598Line 1598
					);

$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);

					);

$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);

 

/**
* Modify attachment data on submit
*
* @event core.modify_attachment_data_on_submit
* @var array attachment_data Array containing attachment data
* @since 3.2.2-RC1
*/
$attachment_data = $this->attachment_data;
$vars = array('attachment_data');
extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_submit', compact($vars)));
$this->attachment_data = $attachment_data;
unset($attachment_data);


					$this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) {
return '[attachment='.($match[1] + 1).']' . $match[2] . '[/attachment]';
}, $this->message);

					$this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) {
return '[attachment='.($match[1] + 1).']' . $match[2] . '[/attachment]';
}, $this->message);

Line 1621Line 1635
			}
}


			}
}


		if ($preview || $refresh || sizeof($error))

		if ($preview || $refresh || count($error))

		{
if (isset($this->plupload) && $this->plupload->is_active())
{

		{
if (isset($this->plupload) && $this->plupload->is_active())
{

Line 1692Line 1706
					$filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message);
$error = array_merge($error, $filedata['error']);


					$filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message);
$error = array_merge($error, $filedata['error']);


					if (!sizeof($error))

					if (!count($error))

					{
$sql_ary = array(
'physical_filename' => $filedata['physical_filename'],

					{
$sql_ary = array(
'physical_filename' => $filedata['physical_filename'],

Line 1719Line 1733
						);

$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);

						);

$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);

 

/**
* Modify attachment data on upload
*
* @event core.modify_attachment_data_on_upload
* @var array attachment_data Array containing attachment data
* @since 3.2.2-RC1
*/
$attachment_data = $this->attachment_data;
$vars = array('attachment_data');
extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_upload', compact($vars)));
$this->attachment_data = $attachment_data;
unset($attachment_data);


						$this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) {
return '[attachment=' . ($match[1] + 1) . ']' . $match[2] . '[/attachment]';
}, $this->message);

						$this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) {
return '[attachment=' . ($match[1] + 1) . ']' . $match[2] . '[/attachment]';
}, $this->message);

Line 1774Line 1802

$check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id;



$check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id;


		if (!sizeof($attachment_data))

		if (!count($attachment_data))

		{
return;
}

		{
return;
}

Line 1794Line 1822
		}

// Regenerate already posted attachments

		}

// Regenerate already posted attachments

		if (sizeof($not_orphan))

		if (count($not_orphan))

		{
// Get the attachment data, based on the poster id...
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize

		{
// Get the attachment data, based on the poster id...
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize

Line 1814Line 1842
			$db->sql_freeresult($result);
}


			$db->sql_freeresult($result);
}


		if (sizeof($not_orphan))

		if (count($not_orphan))

		{
trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR);
}

// Regenerate newly uploaded attachments

		{
trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR);
}

// Regenerate newly uploaded attachments

		if (sizeof($orphan))

		if (count($orphan))

		{
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize
FROM ' . ATTACHMENTS_TABLE . '

		{
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize
FROM ' . ATTACHMENTS_TABLE . '

Line 1840Line 1868
			$db->sql_freeresult($result);
}


			$db->sql_freeresult($result);
}


		if (sizeof($orphan))

		if (count($orphan))

		{
trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR);
}

		{
trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR);
}

Line 1861Line 1889
		$tmp_message = $this->message;

$poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text']));

		$tmp_message = $this->message;

$poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text']));

		$poll['poll_options_size'] = sizeof($poll['poll_options']);

		$poll['poll_options_size'] = count($poll['poll_options']);


foreach ($poll['poll_options'] as &$poll_option)
{


foreach ($poll['poll_options'] as &$poll_option)
{

Line 1890Line 1918
			}
}


			}
}


		if (sizeof($poll['poll_options']) == 1)

		if (count($poll['poll_options']) == 1)

		{
$this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS'];
}

		{
$this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS'];
}