phpBB

Code Changes

File: includes/message_parser.php

  Unmodified   Added   Modified   Removed
Line 390Line 390
		$in = str_replace(' ', '%20', $in);

// Checking urls

		$in = str_replace(' ', '%20', $in);

// Checking urls

		if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in))

		if (!preg_match('#^' . get_preg_expression('url_http') . '$#iu', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in))

		{
return '[img]' . $in . '[/img]';
}

		{
return '[img]' . $in . '[/img]';
}

Line 399Line 399
		if (!preg_match('#^[a-z0-9]+://#i', $in))
{
$in = 'http://' . $in;

		if (!preg_match('#^[a-z0-9]+://#i', $in))
{
$in = 'http://' . $in;

		}

if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
$imagesize = new \FastImageSize\FastImageSize();
$size_info = $imagesize->getImageSize(htmlspecialchars_decode($in));

if ($size_info === false)
{
$error = true;
$this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE'];
}
else
{
if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $size_info['height'])
{
$error = true;
$this->warn_msg[] = $user->lang('MAX_IMG_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']);
}

if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $size_info['width'])
{
$error = true;
$this->warn_msg[] = $user->lang('MAX_IMG_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']);
}
}

 
		}

if ($error || $this->path_in_domain($in))

		}

if ($error || $this->path_in_domain($in))

Line 1139Line 1113
	/**
* Init - give message here or manually
*/

	/**
* Init - give message here or manually
*/

	function parse_message($message = '')

	function __construct($message = '')

	{
// Init BBCode UID
$this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN);

	{
// Init BBCode UID
$this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN);

Line 1522Line 1496

$this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#u' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#u'), $replace, $this->message));
}


$this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#u' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#u'), $replace, $this->message));
}

 
	}

/**
* Check attachment form token depending on submit type
*
* @param \phpbb\language\language $language Language
* @param \phpbb\request\request_interface $request Request
* @param string $form_name Form name for checking form key
*
* @return bool True if form token is not needed or valid, false if needed and invalid
*/
function check_attachment_form_token(\phpbb\language\language $language, \phpbb\request\request_interface $request, $form_name)
{
$add_file = $request->is_set_post('add_file');
$delete_file = $request->is_set_post('delete_file');

if (($add_file || $delete_file) && !check_form_key($form_name))
{
$this->warn_msg[] = $language->lang('FORM_INVALID');

if ($request->is_ajax() && $this->plupload)
{
$this->plupload->emit_error(-400, 'FORM_INVALID');
}

return false;
}

return true;

	}

/**

	}

/**

Line 1586Line 1589
						'in_message'		=> ($is_message) ? 1 : 0,
'poster_id' => $user->data['user_id'],
);

						'in_message'		=> ($is_message) ? 1 : 0,
'poster_id' => $user->data['user_id'],
);

 

/**
* Modify attachment sql array on submit
*
* @event core.modify_attachment_sql_ary_on_submit
* @var array sql_ary Array containing SQL data
* @since 3.2.6-RC1
*/
$vars = array('sql_ary');
extract($phpbb_dispatcher->trigger_event('core.modify_attachment_sql_ary_on_submit', compact($vars)));


$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));



$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));


Line 1721Line 1734
							'in_message'		=> ($is_message) ? 1 : 0,
'poster_id' => $user->data['user_id'],
);

							'in_message'		=> ($is_message) ? 1 : 0,
'poster_id' => $user->data['user_id'],
);

 

/**
* Modify attachment sql array on upload
*
* @event core.modify_attachment_sql_ary_on_upload
* @var array sql_ary Array containing SQL data
* @since 3.2.6-RC1
*/
$vars = array('sql_ary');
extract($phpbb_dispatcher->trigger_event('core.modify_attachment_sql_ary_on_upload', compact($vars)));


$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));



$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));