Vergleich inc/class_parser.php - 1.8.3 - 1.8.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 228Zeile 228
			$message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message);
$message = preg_replace("#(&nbsp;)+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message);
}

			$message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message);
$message = preg_replace("#(&nbsp;)+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message);
}


$message = my_wordwrap($message);

 

$message = $plugins->run_hooks("parse_message_end", $message);



$message = $plugins->run_hooks("parse_message_end", $message);


Zeile 262Zeile 260

$standard_mycode = $callback_mycode = $nestable_mycode = array();
$standard_count = $callback_count = $nestable_count = 0;


$standard_mycode = $callback_mycode = $nestable_mycode = array();
$standard_count = $callback_count = $nestable_count = 0;





		if($mybb->settings['allowbasicmycode'] == 1)
{
$standard_mycode['b']['regex'] = "#\[b\](.*?)\[/b\]#si";

		if($mybb->settings['allowbasicmycode'] == 1)
{
$standard_mycode['b']['regex'] = "#\[b\](.*?)\[/b\]#si";

Zeile 293Zeile 291

$standard_mycode['reg']['regex'] = "#\(r\)#i";
$standard_mycode['reg']['replacement'] = "&reg;";


$standard_mycode['reg']['regex'] = "#\(r\)#i";
$standard_mycode['reg']['replacement'] = "&reg;";





			++$standard_count;
}


			++$standard_count;
}


Zeile 340Zeile 338

$callback_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";
$callback_mycode['size_int']['replacement'] = array($this, 'mycode_handle_size_callback');


$callback_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";
$callback_mycode['size_int']['replacement'] = array($this, 'mycode_handle_size_callback');


++$nestable_count;


++$nestable_count;

			++$callback_count;

			++$callback_count;

		}

		}


if($mybb->settings['allowfontmycode'] == 1)
{
$nestable_mycode['font']['regex'] = "#\[font=([a-z0-9 ,\-_'\"]+)\](.*?)\[/font\]#si";
$nestable_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";


if($mybb->settings['allowfontmycode'] == 1)
{
$nestable_mycode['font']['regex'] = "#\[font=([a-z0-9 ,\-_'\"]+)\](.*?)\[/font\]#si";
$nestable_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";





			++$nestable_count;
}


			++$nestable_count;
}


Zeile 357Zeile 355
		{
$nestable_mycode['align']['regex'] = "#\[align=(left|center|right|justify)\](.*?)\[/align\]#si";
$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\">$2</div>";

		{
$nestable_mycode['align']['regex'] = "#\[align=(left|center|right|justify)\](.*?)\[/align\]#si";
$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\">$2</div>";





			++$nestable_count;
}


			++$nestable_count;
}


Zeile 372Zeile 370
				$custom_mycode[$key]['regex'] = "#".$mycode['regex']."#si";

++$standard_count;

				$custom_mycode[$key]['regex'] = "#".$mycode['regex']."#si";

++$standard_count;

			}

			}

			$mycode = array_merge($standard_mycode, $custom_mycode);
}
else

			$mycode = array_merge($standard_mycode, $custom_mycode);
}
else

Zeile 418Zeile 416
		if(empty($this->options))
{
$this->options = $options;

		if(empty($this->options))
{
$this->options = $options;

		}


		}


		// Cache the MyCode globally if needed.
if($this->mycode_cache == 0)
{
$this->cache_mycode();
}

		// Cache the MyCode globally if needed.
if($this->mycode_cache == 0)
{
$this->cache_mycode();
}





		// Parse quotes first
$message = $this->mycode_parse_quotes($message);


		// Parse quotes first
$message = $this->mycode_parse_quotes($message);


Zeile 435Zeile 433

// Replace the rest
if($this->mycode_cache['standard_count'] > 0)


// Replace the rest
if($this->mycode_cache['standard_count'] > 0)

		{

		{

			$message = preg_replace($this->mycode_cache['standard']['find'], $this->mycode_cache['standard']['replacement'], $message);

			$message = preg_replace($this->mycode_cache['standard']['find'], $this->mycode_cache['standard']['replacement'], $message);

		}


		}


		if($this->mycode_cache['callback_count'] > 0)

		if($this->mycode_cache['callback_count'] > 0)

		{

		{

			foreach($this->mycode_cache['callback'] as $replace)

			foreach($this->mycode_cache['callback'] as $replace)

			{

			{

				$message = preg_replace_callback($replace['find'], $replace['replacement'], $message);
}
}

				$message = preg_replace_callback($replace['find'], $replace['replacement'], $message);
}
}

Zeile 451Zeile 449
		if($this->mycode_cache['nestable_count'] > 0)
{
foreach($this->mycode_cache['nestable'] as $mycode)

		if($this->mycode_cache['nestable_count'] > 0)
{
foreach($this->mycode_cache['nestable'] as $mycode)

			{

			{

				while(preg_match($mycode['find'], $message))
{
$message = preg_replace($mycode['find'], $mycode['replacement'], $message);
}
}
}

				while(preg_match($mycode['find'], $message))
{
$message = preg_replace($mycode['find'], $mycode['replacement'], $message);
}
}
}





		// Reset list cache
if($mybb->settings['allowlistmycode'] == 1)
{
$this->list_elements = array();
$this->list_count = 0;

		// Reset list cache
if($mybb->settings['allowlistmycode'] == 1)
{
$this->list_elements = array();
$this->list_count = 0;





			// Find all lists
$message = preg_replace_callback("#(\[list(=(a|A|i|I|1))?\]|\[/list\])#si", array($this, 'mycode_prepare_list'), $message);

			// Find all lists
$message = preg_replace_callback("#(\[list(=(a|A|i|I|1))?\]|\[/list\])#si", array($this, 'mycode_prepare_list'), $message);





			// Replace all lists
for($i = $this->list_count; $i > 0; $i--)
{

			// Replace all lists
for($i = $this->list_count; $i > 0; $i--)
{

Zeile 483Zeile 481
			$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback2'), $message);
$message = preg_replace_callback("#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback3'), $message);
$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback4'), $message);

			$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback2'), $message);
$message = preg_replace_callback("#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback3'), $message);
$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback4'), $message);

		}
else

		}
else

		{
$message = preg_replace_callback("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback1'), $message);
$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback2'), $message);
$message = preg_replace_callback("#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback3'), $message);
$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback4'), $message);

		{
$message = preg_replace_callback("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback1'), $message);
$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback2'), $message);
$message = preg_replace_callback("#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback3'), $message);
$message = preg_replace_callback("#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback4'), $message);

		}

		}


// Convert videos when allow.
if(!empty($this->options['allow_videocode']))


// Convert videos when allow.
if(!empty($this->options['allow_videocode']))

		{

		{

			$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_callback'), $message);
}
else
{
$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_disabled_callback'), $message);

			$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_callback'), $message);
}
else
{
$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_disabled_callback'), $message);

		}

		}


return $message;
}


return $message;
}

Zeile 523Zeile 521
			{
$smilie['find'] = explode("\n", $smilie['find']);
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);

			{
$smilie['find'] = explode("\n", $smilie['find']);
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);

				$smilie['image'] = $mybb->get_asset_url($smilie['image']);


				$smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image']));
$smilie['name'] = htmlspecialchars_uni($smilie['name']);


foreach($smilie['find'] as $s)
{


foreach($smilie['find'] as $s)
{

Zeile 612Zeile 611
	function parse_badwords($message, $options=array())
{
if(empty($this->options))

	function parse_badwords($message, $options=array())
{
if(empty($this->options))

		{

		{

			$this->options = $options;
}


			$this->options = $options;
}


Zeile 692Zeile 691
			"#(o)(nabort\s?=)#i"
);


			"#(o)(nabort\s?=)#i"
);


		$message = preg_replace($js_array, "$1<strong></strong>$2$4", $message);

		$message = preg_replace($js_array, "$1<strong></strong>$2$6", $message);


return $message;
}


return $message;
}

Zeile 844Zeile 843
		{
$username = my_substr($username, 0, my_strlen($username)-1);
}

		{
$username = my_substr($username, 0, my_strlen($username)-1);
}


if($text_only)

		
if(!empty($this->options['allow_html']))

		{

		{

			return "\n".htmlspecialchars_uni($username)." $lang->wrote{$date}\n--\n{$message}\n--\n";






			$username = htmlspecialchars_uni($username);
}

if($text_only)
{
return "\n{$username} {$lang->wrote}{$date}\n--\n{$message}\n--\n";

		}
else
{

		}
else
{

Zeile 857Zeile 861
				$span = "<span>{$date}</span>";
}


				$span = "<span>{$date}</span>";
}


			return "<blockquote><cite>{$span}".htmlspecialchars_uni($username)." $lang->wrote{$linkback}</cite>{$message}</blockquote>\n";

			return "<blockquote><cite>{$span}{$username} {$lang->wrote}{$linkback}</cite>{$message}</blockquote>\n";

		}
}


		}
}


Zeile 870Zeile 874
	function mycode_parse_post_quotes_callback1($matches)
{
return $this->mycode_parse_post_quotes($matches[4],$matches[2].$matches[3]);

	function mycode_parse_post_quotes_callback1($matches)
{
return $this->mycode_parse_post_quotes($matches[4],$matches[2].$matches[3]);

	}

/**

	}

/**

	* Parses quotes with post id and/or dateline.

	* Parses quotes with post id and/or dateline.

	*

	*

	* @param array Matches.
* @return string The parsed message.
*/
function mycode_parse_post_quotes_callback2($matches)
{
return $this->mycode_parse_post_quotes($matches[4],$matches[2].$matches[3], true);

	* @param array Matches.
* @return string The parsed message.
*/
function mycode_parse_post_quotes_callback2($matches)
{
return $this->mycode_parse_post_quotes($matches[4],$matches[2].$matches[3], true);

	}

/**
* Parses code MyCode.
*

	}

/**
* Parses code MyCode.
*

	* @param string The message to be parsed
* @param boolean Are we formatting as text?
* @return string The parsed message.

	* @param string The message to be parsed
* @param boolean Are we formatting as text?
* @return string The parsed message.

Zeile 916Zeile 920
		$code = str_replace("  ", '&nbsp;&nbsp;', $code);

return "<div class=\"codeblock\">\n<div class=\"title\">".$lang->code."\n</div><div class=\"body\" dir=\"ltr\"><code>".$code."</code></div></div>\n";

		$code = str_replace("  ", '&nbsp;&nbsp;', $code);

return "<div class=\"codeblock\">\n<div class=\"title\">".$lang->code."\n</div><div class=\"body\" dir=\"ltr\"><code>".$code."</code></div></div>\n";

	}


	}


	/**
* Parses code MyCode.
*

	/**
* Parses code MyCode.
*

Zeile 964Zeile 968
		// See if open and close tags are provided.
$added_open_tag = false;
if(!preg_match("#^\s*<\?#si", $str))

		// See if open and close tags are provided.
$added_open_tag = false;
if(!preg_match("#^\s*<\?#si", $str))

		{

		{

			$added_open_tag = true;
$str = "<?php \n".$str;
}

			$added_open_tag = true;
$str = "<?php \n".$str;
}

Zeile 996Zeile 1000
			$code = str_replace("?&gt;</span></code>", "</span></code>", $code);
// Wait a minute. It fails highlighting? Stupid highlighter.
$code = str_replace("?&gt;</code>", "</code>", $code);

			$code = str_replace("?&gt;</span></code>", "</span></code>", $code);
// Wait a minute. It fails highlighting? Stupid highlighter.
$code = str_replace("?&gt;</code>", "</code>", $code);

		}


		}


		$code = preg_replace("#<span style=\"color: \#([A-Z0-9]{6})\"></span>#", "", $code);
$code = str_replace("<code>", "<div dir=\"ltr\"><code>", $code);
$code = str_replace("</code>", "</code></div>", $code);

		$code = preg_replace("#<span style=\"color: \#([A-Z0-9]{6})\"></span>#", "", $code);
$code = str_replace("<code>", "<div dir=\"ltr\"><code>", $code);
$code = str_replace("</code>", "</code></div>", $code);

Zeile 1028Zeile 1032
	*
* @param string The URL to link to.
* @param string The name of the link.

	*
* @param string The URL to link to.
* @param string The name of the link.

	* @return string The built-up link.
*/

	* @return string The built-up link.
*/

	function mycode_parse_url($url, $name="")
{
if(!preg_match("#^[a-z0-9]+://#i", $url))

	function mycode_parse_url($url, $name="")
{
if(!preg_match("#^[a-z0-9]+://#i", $url))

		{

		{

			$url = "http://".$url;
}

			$url = "http://".$url;
}

 

if(!empty($this->options['allow_html']))
{
$url = $this->parse_html($url);
}


		$fullurl = $url;

if(!$name)

		$fullurl = $url;

if(!$name)

Zeile 1047Zeile 1057
		{
if(my_strlen($url) > 55)
{

		{
if(my_strlen($url) > 55)
{

 
				$name = htmlspecialchars_decode($name);

				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);

				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);

 
				$name = htmlspecialchars_uni($name);

			}
}


			}
}


Zeile 1077Zeile 1089
		if(!isset($matches[3]))
{
$matches[3] = '';

		if(!isset($matches[3]))
{
$matches[3] = '';

		}

		}

		return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
}


		return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
}


Zeile 1108Zeile 1120
		$url = trim($url);
$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);

		$url = trim($url);
$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);

		if($align == "right")








if(!empty($this->options['allow_html']))
{
$url = $this->parse_html($url);
}

if($align == "right")

		{
$css_align = " style=\"float: right;\"";

		{
$css_align = " style=\"float: right;\"";

		}

		}

		else if($align == "left")

		else if($align == "left")

		{

		{

			$css_align = " style=\"float: left;\"";

			$css_align = " style=\"float: left;\"";

		}
$alt = htmlspecialchars_uni(basename($url));

		}
$alt = basename($url);

		if(my_strlen($alt) > 55)

		if(my_strlen($alt) > 55)

		{


		{
$alt = htmlspecialchars_decode($alt);

			$alt = my_substr($alt, 0, 40)."...".my_substr($alt, -10);

			$alt = my_substr($alt, 0, 40)."...".my_substr($alt, -10);

 
			$alt = htmlspecialchars_uni($alt);

		}
$alt = $lang->sprintf($lang->posted_image, $alt);
if($dimensions[0] > 0 && $dimensions[1] > 0)
{
return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";

		}
$alt = $lang->sprintf($lang->posted_image, $alt);
if($dimensions[0] > 0 && $dimensions[1] > 0)
{
return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";

		}

		}

		else
{
return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";

		else
{
return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";

Zeile 1147Zeile 1167
	 * Parses IMG MyCode.
*
* @param array Matches.

	 * Parses IMG MyCode.
*
* @param array Matches.

	 * @return string Image code.
*/
function mycode_parse_img_callback2($matches)
{
return $this->mycode_parse_img($matches[4], array($matches[1], $matches[2]));
}

/**
* Parses IMG MyCode.
*
* @param array Matches.

	 * @return string Image code.
*/
function mycode_parse_img_callback2($matches)
{
return $this->mycode_parse_img($matches[4], array($matches[1], $matches[2]));
}

/**
* Parses IMG MyCode.
*
* @param array Matches.

	 * @return string Image code.
*/
function mycode_parse_img_callback3($matches)

	 * @return string Image code.
*/
function mycode_parse_img_callback3($matches)

Zeile 1202Zeile 1222
	function mycode_parse_img_disabled_callback1($matches)
{
return $this->mycode_parse_img_disabled($matches[2]);

	function mycode_parse_img_disabled_callback1($matches)
{
return $this->mycode_parse_img_disabled($matches[2]);

	}

/**
* Parses IMG MyCode disabled.

	}

/**
* Parses IMG MyCode disabled.

	 *
* @param array Matches.
* @return string Image code.

	 *
* @param array Matches.
* @return string Image code.

Zeile 1253Zeile 1273
		if(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+$/si", $email))
{
return "<a href=\"mailto:$email\">".$name."</a>";

		if(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+$/si", $email))
{
return "<a href=\"mailto:$email\">".$name."</a>";

 
		}
elseif(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+\?(.*?)$/si", $email))
{
return "<a href=\"mailto:".htmlspecialchars_uni($email)."\">".$name."</a>";

		}
else
{

		}
else
{