Vergleich inc/class_parser.php - 1.4.4 - 1.4.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: class_parser.php 4052 2008-07-29 15:45:49Z Tikitiki $

 * $Id: class_parser.php 4322 2009-02-21 23:00:49Z Tikitiki $

 */

/*

 */

/*

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


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


		$standard_mycode['url_simple']['regex'] = "#\[url\]([a-z]+?://)([^\r\n\"\[<]+?)\[/url\]#sei";

		$standard_mycode['url_simple']['regex'] = "#\[url\]([a-z]+?://)([^\r\n\"<]+?)\[/url\]#sei";

		$standard_mycode['url_simple']['replacement'] = "\$this->mycode_parse_url(\"$1$2\")";


		$standard_mycode['url_simple']['replacement'] = "\$this->mycode_parse_url(\"$1$2\")";


		$standard_mycode['url_simple2']['regex'] = "#\[url\]([^\r\n\"\[<]+?)\[/url\]#ei";

		$standard_mycode['url_simple2']['regex'] = "#\[url\]([^\r\n\"<]+?)\[/url\]#ei";

		$standard_mycode['url_simple2']['replacement'] = "\$this->mycode_parse_url(\"$1\")";


		$standard_mycode['url_simple2']['replacement'] = "\$this->mycode_parse_url(\"$1\")";


		$standard_mycode['url_complex']['regex'] = "#\[url=([a-z]+?://)([^\r\n\"\[<]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex']['regex'] = "#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex']['replacement'] = "\$this->mycode_parse_url(\"$1$2\", \"$3\")";


		$standard_mycode['url_complex']['replacement'] = "\$this->mycode_parse_url(\"$1$2\", \"$3\")";


		$standard_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"\[<&\(\)]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex2']['replacement'] = "\$this->mycode_parse_url(\"$1\", \"$2\")";

$standard_mycode['email_simple']['regex'] = "#\[email\](.*?)\[/email\]#ei";

		$standard_mycode['url_complex2']['replacement'] = "\$this->mycode_parse_url(\"$1\", \"$2\")";

$standard_mycode['email_simple']['regex'] = "#\[email\](.*?)\[/email\]#ei";

Zeile 392Zeile 392
		{
foreach($this->smilies_cache as $find => $replace)
{

		{
foreach($this->smilies_cache as $find => $replace)
{

				$find = $this->parse_html($find);

				$find = $this->parse_html($find);				

				$find = preg_quote($find, "#");

if(version_compare(PHP_VERSION, "5.1.0", ">="))
{

				$find = preg_quote($find, "#");

if(version_compare(PHP_VERSION, "5.1.0", ">="))
{

 
					$orig_message = $message;
$orig_find = $find;

					// Fix issues for smileys starting with a ";"
if($find{0} == ";")
{
$find = "(?<!&gt|&lt|&amp)".$find;
}


					// Fix issues for smileys starting with a ";"
if($find{0} == ";")
{
$find = "(?<!&gt|&lt|&amp)".$find;
}


					$message = preg_replace("#(?<=[^\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining, $replacements);







					$message = @preg_replace("#(?<=[^\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining, $replacements);

if($message == null)
{
$message = preg_replace("#(?<=[^&;\"])".$orig_find."(?=.\W|\"|\W.|\W$)#si", $replace, $orig_message, $remaining);
}


					$remaining -= $replacements;
if($remaining <= 0)
{

					$remaining -= $replacements;
if($remaining <= 0)
{

Zeile 415Zeile 423
					$message = preg_replace("#(?<=[^&;\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining);
}
}

					$message = preg_replace("#(?<=[^&;\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining);
}
}

 
			unset($orig_message, $orig_find);

		}

// If we matched any tags previously, swap them back in

		}

// If we matched any tags previously, swap them back in

Zeile 424Zeile 433
			{
$message = preg_replace("#<mybb-bad-sm>#", $match, $message, 1);
}

			{
$message = preg_replace("#<mybb-bad-sm>#", $match, $message, 1);
}

		}


		}


		return trim($message);
}

/**
* Generates a cache of badwords filters.

		return trim($message);
}

/**
* Generates a cache of badwords filters.

	 *

	 *

	 * @access private
*/
function cache_badwords()

	 * @access private
*/
function cache_badwords()

Zeile 458Zeile 467
		{
reset($this->badwords_cache);
foreach($this->badwords_cache as $bid => $badword)

		{
reset($this->badwords_cache);
foreach($this->badwords_cache as $bid => $badword)

			{

			{

				if(!$badword['replacement'])
{
$badword['replacement'] = "*****";

				if(!$badword['replacement'])
{
$badword['replacement'] = "*****";

Zeile 471Zeile 480
		{
$message = strip_tags($message);
}

		{
$message = strip_tags($message);
}

		return $message;
}

		return $message;
}


/**
* Attempts to move any javascript references in the specified message.


/**
* Attempts to move any javascript references in the specified message.

Zeile 500Zeile 509
			"#(o)(nunload\s?=)#i",
"#(o)(nkeypress\s?=)#i"
);

			"#(o)(nunload\s?=)#i",
"#(o)(nkeypress\s?=)#i"
);

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


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


return $message;
}


return $message;
}

Zeile 513Zeile 523
	* @return string The parsed text.
*/
function mycode_handle_size($size, $text)

	* @return string The parsed text.
*/
function mycode_handle_size($size, $text)

	{

	{

		$size = intval($size)+10;

if($size > 50)

		$size = intval($size)+10;

if($size > 50)

Zeile 675Zeile 685
		$code = preg_replace('#^(\t*)(\n|\r|\0|\x0B| )*#', '\\1', $code);
$code = rtrim($code);
$original = preg_replace('#^\t*#', '', $code);

		$code = preg_replace('#^(\t*)(\n|\r|\0|\x0B| )*#', '\\1', $code);
$code = rtrim($code);
$original = preg_replace('#^\t*#', '', $code);


if(empty($original))


if(empty($original))

		{
return;
}

		{
return;
}

Zeile 818Zeile 828

$url = str_replace('&amp;', '&', $url);
$name = str_replace('&amp;', '&', $name);


$url = str_replace('&amp;', '&', $url);
$name = str_replace('&amp;', '&', $name);

 



if(!preg_match("#[a-z0-9]+://#i", $fullurl))
{


if(!preg_match("#[a-z0-9]+://#i", $fullurl))
{

Zeile 826Zeile 837
		if(!$name)
{
$name = $url;

		if(!$name)
{
$name = $url;

		}

		}

		
$name = str_replace("\'", "'", $name);
$url = str_replace("\'", "'", $url);
$fullurl = str_replace("\'", "'", $fullurl);

		
$name = str_replace("\'", "'", $name);
$url = str_replace("\'", "'", $url);
$fullurl = str_replace("\'", "'", $fullurl);

		

		

		if($name == $url && (!isset($this->options['shorten_urls']) || $this->options['shorten_urls'] != 0))
{
if(my_strlen($url) > 55)

		if($name == $url && (!isset($this->options['shorten_urls']) || $this->options['shorten_urls'] != 0))
{
if(my_strlen($url) > 55)

Zeile 839Zeile 850
				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
}
}

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

 
		
// fix some entities in URLs
$fullurl = strtr($fullurl, array('$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'));


$name = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";


$name = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";

Zeile 890Zeile 904
	*/
function mycode_parse_email($email, $name="")
{

	*/
function mycode_parse_email($email, $name="")
{

 
		$name = str_replace("\\'", "'", $name);
$email = str_replace("\\'", "'", $email);

		if(!$name)
{
$name = $email;

		if(!$name)
{
$name = $email;

Zeile 912Zeile 928
	*/
function mycode_auto_url($message)
{

	*/
function mycode_auto_url($message)
{

		$message = " ".$message;
$message = preg_replace("#([\>\s\(\)])(https?|ftp|news){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i", "$1[url]$2://$3[/url]", $message);
$message = preg_replace("#([\>\s\(\)])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i", "$1[url]$2.$3[/url]", $message);
















		static $utf8_pcre_supported;
if(!isset($utf8_pcre_supported))
{
$utf8_pcre_supported = @preg_match('#^.#u', 'a');
}

if($utf8_pcre_supported)
{
$utf8_regex_chr = "u";
}
else
{
$utf8_regex_chr = "";
}

$message = " ".$message;
$message = preg_replace("#([\>\s\(\)])(https?|ftp|news){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i".$utf8_regex_chr, "$1[url]$2://$3[/url]", $message);
$message = preg_replace("#([\>\s\(\)])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i".$utf8_regex_chr, "$1[url]$2.$3[/url]", $message);

		$message = my_substr($message, 1);
return $message;
}

		$message = my_substr($message, 1);
return $message;
}