Vergleich inc/class_parser.php - 1.8.27 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 119Zeile 119
	 * @access public
* @var self::VALIDATION_*
*/

	 * @access public
* @var self::VALIDATION_*
*/

	public $output_validation_policy = self::VALIDATION_REPORT_ONLY;

	public $output_validation_policy = self::VALIDATION_REQUIRE;


/**
* Parses a message with the specified options.


/**
* Parses a message with the specified options.

Zeile 315Zeile 315
		global $cache, $lang, $mybb;
$this->mycode_cache = array();


		global $cache, $lang, $mybb;
$this->mycode_cache = array();


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

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


if($mybb->settings['allowbasicmycode'] == 1)
{


if($mybb->settings['allowbasicmycode'] == 1)
{

Zeile 398Zeile 398

++$nestable_count;
++$callback_count;


++$nestable_count;
++$callback_count;

		}

if($mybb->settings['allowfontmycode'] == 1)
{
$callback_mycode['font']['regex'] = "#\[font=\\s*(\"?)([a-z0-9 ,\-_'\"]+)\\1\\s*\](.*?)\[/font\]#si";
$callback_mycode['font']['replacement'] = array($this, 'mycode_parse_font_callback');

++$nestable_count;

 
		}

if($mybb->settings['allowalignmycode'] == 1)

		}

if($mybb->settings['allowalignmycode'] == 1)

Zeile 414Zeile 406
			$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\" class=\"mycode_align\">$2</div>";

++$nestable_count;

			$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\" class=\"mycode_align\">$2</div>";

++$nestable_count;

 
		}

if($mybb->settings['allowfontmycode'] == 1)
{
$nestable_callback_mycode['font']['regex'] = "#\[font=\\s*(\"?)([a-z0-9 ,\-_'\"]+)\\1\\s*\](.*?)\[/font\]#si";
$nestable_callback_mycode['font']['replacement'] = array($this, 'mycode_parse_font_callback');

++$nestable_callback_count;

		}

$custom_mycode = $cache->read("mycode");

		}

$custom_mycode = $cache->read("mycode");

Zeile 448Zeile 448
			$this->mycode_cache['nestable'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);
}


			$this->mycode_cache['nestable'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);
}


		// Assign the nestable MyCode to the cache.

		// Assign the callback MyCode to the cache.

		foreach($callback_mycode as $code)
{
$this->mycode_cache['callback'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);

		foreach($callback_mycode as $code)
{
$this->mycode_cache['callback'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);

 
		}

// Assign the nestable callback MyCode to the cache.
foreach($nestable_callback_mycode as $code)
{
$this->mycode_cache['nestable_callback'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);

		}

$this->mycode_cache['standard_count'] = $standard_count;
$this->mycode_cache['callback_count'] = $callback_count;
$this->mycode_cache['nestable_count'] = $nestable_count;

		}

$this->mycode_cache['standard_count'] = $standard_count;
$this->mycode_cache['callback_count'] = $callback_count;
$this->mycode_cache['nestable_count'] = $nestable_count;

 
		$this->mycode_cache['nestable_callback_count'] = $nestable_callback_count;

	}

/**

	}

/**

Zeile 534Zeile 541
				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);

 
				}
}
}

// Replace the nestable callback mycodes
if($this->mycode_cache['nestable_callback_count'] > 0)
{
foreach($this->mycode_cache['nestable_callback'] as $replace)
{
while(preg_match($replace['find'], $message))
{
$message_org = $message;
$message = preg_replace_callback($replace['find'], $replace['replacement'], $message);
if ($message_org == $message)
{
break;
}

				}
}
}

				}
}
}

Zeile 582Zeile 606
			$extra_class = $onclick = '';
foreach($smilies as $sid => $smilie)
{

			$extra_class = $onclick = '';
foreach($smilies as $sid => $smilie)
{

 
				if(isset($theme['imgdir']))
{
$imgdir = $theme['imgdir'];
}
else
{
$imgdir = '';
}


				$smilie['find'] = explode("\n", $smilie['find']);

				$smilie['find'] = explode("\n", $smilie['find']);

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

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

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


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


Zeile 600Zeile 633
							"&lt$s" => "&lt$s",
"&gt$s" => "&gt$s",
);

							"&lt$s" => "&lt$s",
"&gt$s" => "&gt$s",
);

					}
}

					}
}

			}
}
}

			}
}
}

Zeile 646Zeile 679
				$i++;
}
$message = implode("", $message);

				$i++;
}
$message = implode("", $message);

		}

return $message;
}

/**

		}

return $message;
}

/**

	 * Generates a cache of badwords filters.
*
* @access private

	 * Generates a cache of badwords filters.
*
* @access private

	 */

	 */

	function cache_badwords()
{
global $cache;

	function cache_badwords()
{
global $cache;

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

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

		}


		}


		if($this->badwords_cache == 0)
{
$this->cache_badwords();

		if($this->badwords_cache == 0)
{
$this->cache_badwords();

Zeile 700Zeile 733
			}
}
if(!empty($this->options['strip_tags']))

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

		{

		{

			$message = strip_tags($message);
}
return $message;

			$message = strip_tags($message);
}
return $message;

Zeile 748Zeile 781
		}

return '\b'.$trap.'\b';

		}

return '\b'.$trap.'\b';

	}

/**

	}

/**

	 * Resolves nested CDATA tags in the specified message.
*
* @param string $message The message to be parsed.

	 * Resolves nested CDATA tags in the specified message.
*
* @param string $message The message to be parsed.

	 * @return string The parsed message.

	 * @return string The parsed message.

	 */
function parse_cdata($message)

	 */
function parse_cdata($message)

	{

	{

		$message = str_replace(']]>', ']]]]><![CDATA[>', $message);

return $message;

		$message = str_replace(']]>', ']]]]><![CDATA[>', $message);

return $message;

Zeile 775Zeile 808
			"#(&\#(0*)106;?|&\#(0*)74;?|&\#x(0*)4a;?|&\#x(0*)6a;?|j)((&\#(0*)97;?|&\#(0*)65;?|a)(&\#(0*)118;?|&\#(0*)86;?|v)(&\#(0*)97;?|&\#(0*)65;?|a)(\s)?(&\#(0*)115;?|&\#(0*)83;?|s)(&\#(0*)99;?|&\#(0*)67;?|c)(&\#(0*)114;?|&\#(0*)82;?|r)(&\#(0*)105;?|&\#(0*)73;?|i)(&\#112;?|&\#(0*)80;?|p)(&\#(0*)116;?|&\#(0*)84;?|t)(&\#(0*)58;?|\:))#i",
"#([\s\"']on)([a-z]+\s*=)#i",
);

			"#(&\#(0*)106;?|&\#(0*)74;?|&\#x(0*)4a;?|&\#x(0*)6a;?|j)((&\#(0*)97;?|&\#(0*)65;?|a)(&\#(0*)118;?|&\#(0*)86;?|v)(&\#(0*)97;?|&\#(0*)65;?|a)(\s)?(&\#(0*)115;?|&\#(0*)83;?|s)(&\#(0*)99;?|&\#(0*)67;?|c)(&\#(0*)114;?|&\#(0*)82;?|r)(&\#(0*)105;?|&\#(0*)73;?|i)(&\#112;?|&\#(0*)80;?|p)(&\#(0*)116;?|&\#(0*)84;?|t)(&\#(0*)58;?|\:))#i",
"#([\s\"']on)([a-z]+\s*=)#i",
);





		// Add invisible white space
$message = preg_replace($js_array, "$1\xE2\x80\x8C$2$6", $message);


		// Add invisible white space
$message = preg_replace($js_array, "$1\xE2\x80\x8C$2$6", $message);


Zeile 792Zeile 825
	function mycode_handle_size($size, $text)
{
global $templates;

	function mycode_handle_size($size, $text)
{
global $templates;





		$size = (int)$size;

if($size < 1)
{
$size = 1;

		$size = (int)$size;

if($size < 1)
{
$size = 1;

		}


		}


		if($size > 50)
{
$size = 50;
}

$text = str_replace("\'", "'", $text);

		if($size > 50)
{
$size = 50;
}

$text = str_replace("\'", "'", $text);





		eval("\$mycode_size = \"".$templates->get("mycode_size_int", 1, 0)."\";");
return $mycode_size;

		eval("\$mycode_size = \"".$templates->get("mycode_size_int", 1, 0)."\";");
return $mycode_size;

	}

	}


/**
* Handles fontsize.


/**
* Handles fontsize.

Zeile 824Zeile 857

/**
* Parses quote MyCode.


/**
* Parses quote MyCode.

	*

	*

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

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

Zeile 849Zeile 882
		}

do

		}

do

		{

		{

			// preg_replace has erased the message? Restore it...
$previous_message = $message;
$message = preg_replace($pattern, $replace, $message, -1, $count);

			// preg_replace has erased the message? Restore it...
$previous_message = $message;
$message = preg_replace($pattern, $replace, $message, -1, $count);

Zeile 897Zeile 930
		if(!$message)
{
return '';

		if(!$message)
{
return '';

		}


		}


		$username .= "'";
$delete_quote = true;


		$username .= "'";
$delete_quote = true;


Zeile 908Zeile 941
			$pid = (int)$match[1];
$url = $mybb->settings['bburl']."/".get_post_link($pid)."#pid$pid";
if(defined("IN_ARCHIVE"))

			$pid = (int)$match[1];
$url = $mybb->settings['bburl']."/".get_post_link($pid)."#pid$pid";
if(defined("IN_ARCHIVE"))

			{

			{

				$linkback = " <a href=\"{$url}\">[ -> ]</a>";
}
else

				$linkback = " <a href=\"{$url}\">[ -> ]</a>";
}
else

Zeile 923Zeile 956
		unset($match);
preg_match("#dateline=(?:&quot;|\"|')?([0-9]+)(?:&quot;|\"|')?#i", $username, $match);
if(isset($match[1]) && (int)$match[1])

		unset($match);
preg_match("#dateline=(?:&quot;|\"|')?([0-9]+)(?:&quot;|\"|')?#i", $username, $match);
if(isset($match[1]) && (int)$match[1])

		{

		{

			if($match[1] < TIME_NOW)
{
if($text_only)

			if($match[1] < TIME_NOW)
{
if($text_only)

				{

				{

					$postdate = my_date('normal', (int)$match[1]);
}
else

					$postdate = my_date('normal', (int)$match[1]);
}
else

Zeile 938Zeile 971
			}
$username = preg_replace("#(?:&quot;|\"|')? dateline=(?:&quot;|\"|')?[0-9]+(?:&quot;|\"|')?#i", '', $username);
$delete_quote = false;

			}
$username = preg_replace("#(?:&quot;|\"|')? dateline=(?:&quot;|\"|')?[0-9]+(?:&quot;|\"|')?#i", '', $username);
$delete_quote = false;

		}


		}


		if($delete_quote)
{
$username = my_substr($username, 0, my_strlen($username)-1, true);

		if($delete_quote)
{
$username = my_substr($username, 0, my_strlen($username)-1, true);

Zeile 948Zeile 981
		if(!empty($this->options['allow_html']))
{
$username = htmlspecialchars_uni($username);

		if(!empty($this->options['allow_html']))
{
$username = htmlspecialchars_uni($username);

		}

		}


if($text_only)
{


if($text_only)
{

Zeile 997Zeile 1030
	* @return string The parsed message.
*/
function mycode_parse_code($code, $text_only=false)

	* @return string The parsed message.
*/
function mycode_parse_code($code, $text_only=false)

	{

	{

		global $lang, $templates;

if($text_only == true)

		global $lang, $templates;

if($text_only == true)

Zeile 1070Zeile 1103
		{
$added_open_tag = true;
$str = "<?php \n".$str;

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

		}

		}


$added_end_tag = false;
if(!preg_match("#\?>\s*$#si", $str))
{
$added_end_tag = true;
$str = $str." \n?>";


$added_end_tag = false;
if(!preg_match("#\?>\s*$#si", $str))
{
$added_end_tag = true;
$str = $str." \n?>";

		}

$code = @highlight_string($str, true);

		}

$code = @highlight_string($str, true);


// Do the actual replacing.
$code = preg_replace('#<code>\s*<span style="color: \#000000">\s*#i', "<code>", $code);


// Do the actual replacing.
$code = preg_replace('#<code>\s*<span style="color: \#000000">\s*#i', "<code>", $code);

Zeile 1088Zeile 1121
		$code = str_replace("\\", '&#092;', $code);
$code = str_replace('$', '&#36;', $code);
$code = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $code);

		$code = str_replace("\\", '&#092;', $code);
$code = str_replace('$', '&#36;', $code);
$code = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $code);





		if($added_open_tag)
{
$code = preg_replace("#<code><span style=\"color: \#([A-Z0-9]{6})\">&lt;\?php( |&nbsp;)(<br />?)#", "<code><span style=\"color: #$1\">", $code);
}

if($added_end_tag)

		if($added_open_tag)
{
$code = preg_replace("#<code><span style=\"color: \#([A-Z0-9]{6})\">&lt;\?php( |&nbsp;)(<br />?)#", "<code><span style=\"color: #$1\">", $code);
}

if($added_end_tag)

		{

		{

			$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);

Zeile 1194Zeile 1227
		$fonts = str_replace('"', "'", $matches[2]);

return "<span style=\"font-family: {$fonts};\" class=\"mycode_font\">{$matches[3]}</span>";

		$fonts = str_replace('"', "'", $matches[2]);

return "<span style=\"font-family: {$fonts};\" class=\"mycode_font\">{$matches[3]}</span>";

	}


	}


	/**
* Parses URL MyCode.
*

	/**
* Parses URL MyCode.
*

Zeile 1436Zeile 1469
	*/
function mycode_parse_video($video, $url)
{

	*/
function mycode_parse_video($video, $url)
{

		global $templates;

		global $mybb, $templates;


if(empty($video) || empty($url))


if(empty($video) || empty($url))

		{
return "[video={$video}]{$url}[/video]";
}


		{
return "[video={$video}]{$url}[/video]";
}


		// Check URL is a valid URL first, as `parse_url` doesn't check validity.
if(false === filter_var($url, FILTER_VALIDATE_URL))

		// Check URL is a valid URL first, as `parse_url` doesn't check validity.
if(false === filter_var($url, FILTER_VALIDATE_URL))

		{
return "[video={$video}]{$url}[/video]";
}

$parsed_url = @parse_url(urldecode($url));
if($parsed_url === false)
{

		{







			return "[video={$video}]{$url}[/video]";
}


			return "[video={$video}]{$url}[/video]";
}


		$fragments = array();
if($parsed_url['fragment'])
{
$fragments = explode("&", $parsed_url['fragment']);
}

if($video == "liveleak")





		$parsed_url = @parse_url(urldecode($url));
if($parsed_url === false)
{
return "[video={$video}]{$url}[/video]";
}

$bbdomain = parse_url($mybb->settings['bburl'], PHP_URL_HOST);

$fragments = empty($parsed_url['fragment']) ? array() : explode("&", $parsed_url['fragment']);

if($video == "liveleak" && !empty($parsed_url['query']))

		{
// The query part can start with any alphabet, but set only 'i' to catch in index key later
$parsed_url['query'] = "i".substr($parsed_url['query'], 1);

		{
// The query part can start with any alphabet, but set only 'i' to catch in index key later
$parsed_url['query'] = "i".substr($parsed_url['query'], 1);

		}

$queries = explode("&", $parsed_url['query']);


		}

$queries = empty($parsed_url['query']) ? array() : explode("&", $parsed_url['query']);


		$input = array();
foreach($queries as $query)
{

		$input = array();
foreach($queries as $query)
{

			list($key, $value) = explode("=", $query);
$key = str_replace("amp;", "", $key);
$input[$key] = $value;





			$query_array = explode("=", $query);
if(count($query_array) == 2)
{
list($key, $value) = $query_array;
$key = str_replace("amp;", "", $key);
$input[$key] = $value;
}

		}


		}


		$path = explode('/', $parsed_url['path']);

		$path = empty($parsed_url['path']) ? array() : explode('/', $parsed_url['path']);


switch($video)
{
case "dailymotion":


switch($video)
{
case "dailymotion":

				if(isset($path[2]))

				if(!empty($path[2]))

				{
list($id) = explode('_', $path[2], 2); // http://www.dailymotion.com/video/fds123_title-goes-here

				{
list($id) = explode('_', $path[2], 2); // http://www.dailymotion.com/video/fds123_title-goes-here

				}
else

				}
elseif(!empty($path[1]))

				{
$id = $path[1]; // http://dai.ly/fds123

				{
$id = $path[1]; // http://dai.ly/fds123

				}

				}

				break;
case "metacafe":

				break;
case "metacafe":

				$id = $path[2]; // http://www.metacafe.com/watch/fds123/title_goes_here/
$title = htmlspecialchars_uni($path[3]);



				if(!empty($path[2]))
{
$id = $path[2]; // http://www.metacafe.com/watch/fds123/title_goes_here/
}

				break;
case "myspacetv":

				break;
case "myspacetv":

				$id = $path[4]; // http://www.myspace.com/video/fds/fds/123




				if(!empty($path[4]))
{
$id = $path[4]; // http://www.myspace.com/video/fds/fds/123
}

				break;
case "facebook":

				break;
case "facebook":

				if(isset($input['v']))
{

				if(!empty($input['v']))
{

					$id = $input['v']; // http://www.facebook.com/video/video.php?v=123

					$id = $input['v']; // http://www.facebook.com/video/video.php?v=123

				}
elseif(substr($path[3], 0, 3) == 'vb.')
{

				}
elseif(!empty($path[3]) && substr($path[3], 0, 3) == 'vb.' && !empty($path[4]))
{

					$id = $path[4]; // https://www.facebook.com/fds/videos/vb.123/123/
}

					$id = $path[4]; // https://www.facebook.com/fds/videos/vb.123/123/
}

				else

				elseif(!empty($path[3]))

				{
$id = $path[3]; // https://www.facebook.com/fds/videos/123/

				{
$id = $path[3]; // https://www.facebook.com/fds/videos/123/

				}
break;

				}
break;

			case "mixer":

			case "mixer":

				$id = $path[1]; // https://mixer.com/streamer




				if(!empty($path[1]))
{
$id = $path[1]; // https://mixer.com/streamer
}

				break;
case "liveleak":

				break;
case "liveleak":

				$id = $input['i']; // http://www.liveleak.com/view?i=123




				if(!empty($input['i']))
{
$id = $input['i']; // http://www.liveleak.com/view?i=123
}

				break;
case "yahoo":

				break;
case "yahoo":

				if(isset($path[2]))
{

				if(!empty($path[2]))
{

					$id = $path[2]; // http://xy.screen.yahoo.com/fds/fds-123.html

					$id = $path[2]; // http://xy.screen.yahoo.com/fds/fds-123.html

				}
else

				}
elseif(!empty($path[1]))

				{
$id = $path[1]; // http://xy.screen.yahoo.com/fds-123.html
}
// Support for localized portals

				{
$id = $path[1]; // http://xy.screen.yahoo.com/fds-123.html
}
// Support for localized portals

				$domain = explode('.', $parsed_url['host']);
if($domain[0] != 'screen' && preg_match('#^([a-z-]+)$#', $domain[0]))
{
$local = "{$domain[0]}.";
}
else
{
$local = '';
}
break;




				if(!empty($parsed_url['host']))
{
$domain = explode('.', $parsed_url['host']);
if($domain[0] != 'screen' && preg_match('#^([a-z-]+)$#', $domain[0]))
{
$local = "{$domain[0]}.";
}
else
{
$local = '';
}
}
break;

			case "vimeo":

			case "vimeo":

				if(isset($path[3]))

				if(!empty($path[3]))

				{
$id = $path[3]; // http://vimeo.com/fds/fds/fds123

				{
$id = $path[3]; // http://vimeo.com/fds/fds/fds123

				}
else

				}
elseif(!empty($path[1]))

				{
$id = $path[1]; // http://vimeo.com/fds123

				{
$id = $path[1]; // http://vimeo.com/fds123

				}

				}

				break;
case "youtube":

				break;
case "youtube":

				if($fragments[0])

				if(!empty($fragments[0]))

				{
$id = str_replace('!v=', '', $fragments[0]); // http://www.youtube.com/watch#!v=fds123

				{
$id = str_replace('!v=', '', $fragments[0]); // http://www.youtube.com/watch#!v=fds123

				}
elseif($input['v'])

				}
elseif(!empty($input['v']))

				{
$id = $input['v']; // http://www.youtube.com/watch?v=fds123
}

				{
$id = $input['v']; // http://www.youtube.com/watch?v=fds123
}

				else

				elseif(!empty($path[1]))

				{
$id = $path[1]; // http://www.youtu.be/fds123

				{
$id = $path[1]; // http://www.youtu.be/fds123

				}

				}

				break;
case "twitch":
if(count($path) >= 3 && $path[1] == 'videos')

				break;
case "twitch":
if(count($path) >= 3 && $path[1] == 'videos')

Zeile 1618Zeile 1667
		$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);
$url = str_replace("\'", "'", $url);

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





		$video = $lang->sprintf($lang->posted_video, $this->mycode_parse_url($url));
return $video;
}

		$video = $lang->sprintf($lang->posted_video, $this->mycode_parse_url($url));
return $video;
}

Zeile 1700Zeile 1749
			$last_char = my_substr($matches['link'], -1);
while($last_char == '.' || $last_char == ',' || $last_char == '?' || $last_char == '!')
{

			$last_char = my_substr($matches['link'], -1);
while($last_char == '.' || $last_char == ',' || $last_char == '?' || $last_char == '!')
{

				$matches[4] = my_substr($matches['link'], 0, -1);

				$matches['link'] = my_substr($matches['link'], 0, -1);

				$external = $last_char.$external;
$last_char = my_substr($matches['link'], -1);
}

				$external = $last_char.$external;
$last_char = my_substr($matches['link'], -1);
}

Zeile 1718Zeile 1767
	* @return string The parsed message.
*/
function mycode_parse_list($message, $type="")

	* @return string The parsed message.
*/
function mycode_parse_list($message, $type="")

	{

	{

		// No list elements? That's invalid HTML
if(strpos($message, '[*]') === false)
{
$message = "[*]{$message}";

		// No list elements? That's invalid HTML
if(strpos($message, '[*]') === false)
{
$message = "[*]{$message}";

		}

		}


$message = preg_split("#[^\S\n\r]*\[\*\]\s*#", $message);
if(isset($message[0]) && trim($message[0]) == '')
{
array_shift($message);


$message = preg_split("#[^\S\n\r]*\[\*\]\s*#", $message);
if(isset($message[0]) && trim($message[0]) == '')
{
array_shift($message);

		}

		}

		$message = '<li>'.implode("</li>\n<li>", $message)."</li>\n";

if($type)
{
$list = "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";

		$message = '<li>'.implode("</li>\n<li>", $message)."</li>\n";

if($type)
{
$list = "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";

		}

		}

		else
{
$list = "<ul class=\"mycode_list\">$message</ul>\n";
}
$list = preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#", "<$1>", $list);
return $list;

		else
{
$list = "<ul class=\"mycode_list\">$message</ul>\n";
}
$list = preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#", "<$1>", $list);
return $list;

	}


	}


	/**
* Parses list MyCode.

	/**
* Parses list MyCode.

	*
* @param array $matches Matches

	*
* @param array $matches Matches

	* @return string The parsed message.
*/
function mycode_parse_list_callback($matches)

	* @return string The parsed message.
*/
function mycode_parse_list_callback($matches)

Zeile 1768Zeile 1817
		{
$count = array_pop($this->list_elements);
if($count !== NULL)

		{
$count = array_pop($this->list_elements);
if($count !== NULL)

			{

			{

				return "[/list&{$count}]";
}
else

				return "[/list&{$count}]";
}
else

Zeile 1817Zeile 1866
	 * @param string $message The message to be highligted
* @param string $highlight The highlight keywords
* @return string The message with highlight bbcodes

	 * @param string $message The message to be highligted
* @param string $highlight The highlight keywords
* @return string The message with highlight bbcodes

	 */

	 */

	function highlight_message($message, $highlight)
{
if(empty($this->highlight_cache))

	function highlight_message($message, $highlight)
{
if(empty($this->highlight_cache))

Zeile 1867Zeile 1916

$message = preg_replace_callback("#\[php\](.*?)\[/php\](\r\n?|\n?)#is", array($this, 'mycode_parse_php_callback'), $message);
$message = preg_replace_callback("#\[code\](.*?)\[/code\](\r\n?|\n?)#is", array($this, 'mycode_parse_code_callback'), $message);


$message = preg_replace_callback("#\[php\](.*?)\[/php\](\r\n?|\n?)#is", array($this, 'mycode_parse_php_callback'), $message);
$message = preg_replace_callback("#\[code\](.*?)\[/code\](\r\n?|\n?)#is", array($this, 'mycode_parse_code_callback'), $message);





		$find = array(
"#\[(b|u|i|s|url|email|color|img)\](.*?)\[/\\1\]#is",
"#\[(email|color|size|font|align|video)=[^]]*\](.*?)\[/\\1\]#is",

		$find = array(
"#\[(b|u|i|s|url|email|color|img)\](.*?)\[/\\1\]#is",
"#\[(email|color|size|font|align|video)=[^]]*\](.*?)\[/\\1\]#is",

Zeile 1892Zeile 1941
		{
$messageBefore = $message;
$message = preg_replace($find, $replace, $messageBefore);

		{
$messageBefore = $message;
$message = preg_replace($find, $replace, $messageBefore);

		}

		}


// Replace "me" code and slaps if we have a username
if(!empty($this->options['me_username']))


// Replace "me" code and slaps if we have a username
if(!empty($this->options['me_username']))

Zeile 1906Zeile 1955
		// Reset list cache
$this->list_elements = array();
$this->list_count = 0;

		// Reset list cache
$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--)
{
// Ignores missing end tags
$message = preg_replace_callback("#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si", array($this, 'mycode_parse_list_callback'), $message, 1);

		// Replace all lists
for($i = $this->list_count; $i > 0; $i--)
{
// Ignores missing end tags
$message = preg_replace_callback("#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si", array($this, 'mycode_parse_list_callback'), $message, 1);

		}


		}


		// Run plugin hooks
$message = $plugins->run_hooks("text_parse_message", $message);

return $message;

		// Run plugin hooks
$message = $plugins->run_hooks("text_parse_message", $message);

return $message;

	}

/**

	}

/**

	 * Replaces certain characters with their entities in a URL.
*
* @param string $url The URL to be escaped.

	 * Replaces certain characters with their entities in a URL.
*
* @param string $url The URL to be escaped.

Zeile 1932Zeile 1981
	function encode_url($url)
{
$entities = array('$' => '%24', '&#36;' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20');

	function encode_url($url)
{
$entities = array('$' => '%24', '&#36;' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20');





		$url = str_replace(array_keys($entities), array_values($entities), $url);

return $url;

		$url = str_replace(array_keys($entities), array_values($entities), $url);

return $url;

Zeile 1941Zeile 1990
	/**
* Determines whether the resulting HTML syntax is acceptable for output,
* according to the parser's validation policy and HTML support.

	/**
* Determines whether the resulting HTML syntax is acceptable for output,
* according to the parser's validation policy and HTML support.

	 *

	 *

	 * @param string $source The original MyCode.
* @param string $output The output HTML code.
* @return bool

	 * @param string $source The original MyCode.
* @param string $output The output HTML code.
* @return bool

Zeile 1951Zeile 2000
		if($this->output_validation_policy === self::VALIDATION_DISABLE || !empty($this->options['allow_html']))
{
return true;

		if($this->output_validation_policy === self::VALIDATION_DISABLE || !empty($this->options['allow_html']))
{
return true;

		}

		}

		else
{
$output_valid = $this->validate_output($source, $output);

if($this->output_validation_policy === self::VALIDATION_REPORT_ONLY)

		else
{
$output_valid = $this->validate_output($source, $output);

if($this->output_validation_policy === self::VALIDATION_REPORT_ONLY)

			{

			{

				return true;
}
else

				return true;
}
else

Zeile 1966Zeile 2015
			}
}
}

			}
}
}





	/**
* Validate HTML syntax and pass errors to the error handler.
*

	/**
* Validate HTML syntax and pass errors to the error handler.
*

Zeile 2014Zeile 2063
			$error_message .= var_export($data, true);

$error_handler->error(E_USER_WARNING, $error_message, __FILE__, __LINE__, false);

			$error_message .= var_export($data, true);

$error_handler->error(E_USER_WARNING, $error_message, __FILE__, __LINE__, false);

		}

 




		return empty($errors);




			return false;
} else {
return true;
}

	}
}

	}
}