phpBB

Code Changes

File: includes/message_parser.php

  Unmodified   Added   Modified   Removed
Line 46Line 46
	var $message = '';
var $warn_msg = array();
var $parsed_items = array();

	var $message = '';
var $warn_msg = array();
var $parsed_items = array();

 
	var $mode;


/**
* Parse BBCode


/**
* Parse BBCode

Line 390Line 391
		$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 400
		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 531Line 506
				}

// Because highlight_string is specialcharing the text (but we already did this before), we have to reverse this in order to get correct results

				}

// Because highlight_string is specialcharing the text (but we already did this before), we have to reverse this in order to get correct results

				$code = htmlspecialchars_decode($code);

				$code = html_entity_decode($code, ENT_COMPAT);

				$code = highlight_string($code, true);

$str_from = array('<span style="color: ', '<font color="syntax', '</font>', '<code>', '</code>','[', ']', '.', ':');

				$code = highlight_string($code, true);

$str_from = array('<span style="color: ', '<font color="syntax', '</font>', '<code>', '</code>','[', ']', '.', ':');

Line 1127Line 1102
	var $allow_flash_bbcode = true;
var $allow_quote_bbcode = true;
var $allow_url_bbcode = true;

	var $allow_flash_bbcode = true;
var $allow_quote_bbcode = true;
var $allow_url_bbcode = true;


var $mode;

 

/**
* The plupload object used for dealing with attachments


/**
* The plupload object used for dealing with attachments

Line 1181Line 1154
		}

// Store message length...

		}

// Store message length...

		$message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message));

		$message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(?:=\S+?)?\]#ius', '', $this->message));


// Maximum message length check. 0 disables this check completely.
if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars'])


// Maximum message length check. 0 disables this check completely.
if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars'])

Line 1274Line 1247
		));

// Parse this message

		));

// Parse this message

		$this->message = $parser->parse(htmlspecialchars_decode($this->message, ENT_QUOTES));

		$this->message = $parser->parse(html_entity_decode($this->message, ENT_QUOTES));


// Remove quotes that are nested too deep
if ($config['max_quote_depth'] > 0)


// Remove quotes that are nested too deep
if ($config['max_quote_depth'] > 0)