Vergleich inc/class_parser.php - 1.6.3 - 1.6.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: class_parser.php 5380 2011-02-21 12:04:43Z Tomm $

 * $Id: class_parser.php 5520 2011-07-28 08:56:12Z Tomm $

 */

/*

 */

/*

Zeile 125Zeile 125
		// If MyCode needs to be replaced, first filter out [code] and [php] tags.
if($this->options['allow_mycode'])
{

		// If MyCode needs to be replaced, first filter out [code] and [php] tags.
if($this->options['allow_mycode'])
{

			// First we split up the contents of code and php tags to ensure they're not parsed.

 
			preg_match_all("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", $message, $code_matches, PREG_SET_ORDER);
$message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "<mybb-code>\n", $message);
}

			preg_match_all("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", $message, $code_matches, PREG_SET_ORDER);
$message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "<mybb-code>\n", $message);
}

Zeile 183Zeile 182
			}
}


			}
}


 
		// Replace meta and base tags in our post - these are > dangerous <

		if($this->options['allow_html'])
{
$message = preg_replace_callback("#<((m[^a])|(b[^diloru>])|(s[^aemptu>]))(\s*[^>]*)>#si", create_function(

		if($this->options['allow_html'])
{
$message = preg_replace_callback("#<((m[^a])|(b[^diloru>])|(s[^aemptu>]))(\s*[^>]*)>#si", create_function(

Zeile 391Zeile 391
	 */
private function cache_smilies()
{

	 */
private function cache_smilies()
{

		global $cache;

		global $cache, $mybb;

		$this->smilies_cache = array();

$smilies = $cache->read("smilies");

		$this->smilies_cache = array();

$smilies = $cache->read("smilies");

Zeile 399Zeile 399
		{
foreach($smilies as $sid => $smilie)
{

		{
foreach($smilies as $sid => $smilie)
{

 
				if(defined("IN_ARCHIVE") && substr($smilie['image'], 0, 4) != "http")
{
// We're in the archive and not using an outside image, add in our address
$smilie['image'] = $mybb->settings['bburl']."/".$smilie['image'];
}


				$this->smilies_cache[$smilie['find']] = "<img src=\"{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

				$this->smilies_cache[$smilie['find']] = "<img src=\"{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

			}
}
}

			}
}
}


/**
* Parses smilie code in the specified message.


/**
* Parses smilie code in the specified message.

Zeile 422Zeile 428
		$message = ' ' . $message . ' ';

// First we take out any of the tags we don't want parsed between (url= etc)

		$message = ' ' . $message . ' ';

// First we take out any of the tags we don't want parsed between (url= etc)

		preg_match_all("#\[(url(=[^\]]*])?\](.*?)\[\/url\]|quote=([^\]]*)?\])#i", $message, $bad_matches, PREG_PATTERN_ORDER);
$message = preg_replace("#\[(url(=[^\]]*])?\](.*?)\[\/url\]|quote=([^\]]*)?\])#si", "<mybb-bad-sm>", $message);

		preg_match_all("#\[(url(=[^\]]*)?\](.*?)\[\/url\]|quote=([^\]]*)?\])#i", $message, $bad_matches, PREG_PATTERN_ORDER);
$message = preg_replace("#\[(url(=[^\]]*)?\](.*?)\[\/url\]|quote=([^\]]*)?\])#si", "<mybb-bad-sm>", $message);

		
// Impose a hard limit of 500 smilies per message as to not overload the parser
$remaining = 500;

		
// Impose a hard limit of 500 smilies per message as to not overload the parser
$remaining = 500;

Zeile 435Zeile 441
				$orig_message = $message;
$find = $this->parse_html($find);
$find = preg_quote($find, "#");

				$orig_message = $message;
$find = $this->parse_html($find);
$find = preg_quote($find, "#");

 

$replace = strip_tags($replace, "<img>");

				
// Fix issues for smileys starting with a ";"
$orig_find = $find;
if(substr($find, 0, 1) == ";")

				
// Fix issues for smileys starting with a ";"
$orig_find = $find;
if(substr($find, 0, 1) == ";")

				{

				{

					$find = "(?<!&gt|&lt|&amp)".$find;
}


					$find = "(?<!&gt|&lt|&amp)".$find;
}


Zeile 486Zeile 494

/**
* Parses a list of filtered/badwords in the specified message.


/**
* Parses a list of filtered/badwords in the specified message.

	 *

	 *

	 * @param string The message to be parsed.
* @param array Array of parser options in yes/no format.
* @return string The parsed message.

	 * @param string The message to be parsed.
* @param array Array of parser options in yes/no format.
* @return string The parsed message.

Zeile 592Zeile 600

// Assign pattern and replace values.
$pattern = array(


// Assign pattern and replace values.
$pattern = array(

			"#\[quote=(?:&quot;|\"|')?(.*?)[\"']?(?:&quot;|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#esi",

			"#\[quote=([\"']|&quot;|)(.*?)(?:\\1)(.*?)(?:[\"']|&quot;)?\](.*?)\[/quote\](\r\n?|\n?)#esi",

			"#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si"
);

if($text_only == false)
{
$replace = array(

			"#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si"
);

if($text_only == false)
{
$replace = array(

				"\$this->mycode_parse_post_quotes('$2','$1')",

				"\$this->mycode_parse_post_quotes('$4','$2$3')",

				"<blockquote><cite>$lang->quote</cite>$1</blockquote>\n"
);
}
else
{
$replace = array(

				"<blockquote><cite>$lang->quote</cite>$1</blockquote>\n"
);
}
else
{
$replace = array(

				"\$this->mycode_parse_post_quotes('$2', '$1', true)",

				"\$this->mycode_parse_post_quotes('$4','$2$3', true)",

				"\n{$lang->quote}\n--\n$1\n--\n"
);
}


				"\n{$lang->quote}\n--\n$1\n--\n"
);
}


		while(preg_match($pattern[0], $message) || preg_match($pattern[1], $message))

		do

		{

		{

			$message = preg_replace($pattern, $replace, $message);
}

			$message = preg_replace($pattern, $replace, $message, -1, $count);
} while($count);


if($text_only == false)
{


if($text_only == false)
{

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

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

		}

		}

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


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


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

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

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

				}
else
{

				}
else
{

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

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

				}
break;
default:

				}
break;
default:

Zeile 1043Zeile 1055
		$message .= "</li>";

if($type)

		$message .= "</li>";

if($type)

		{

		{

			$list = "\n<ol type=\"$type\">$message</ol>\n";

			$list = "\n<ol type=\"$type\">$message</ol>\n";

		}

		}

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

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

	}

/**

	}

/**

	 * Strips smilies from a string
*
* @param string The message for smilies to be stripped from

	 * Strips smilies from a string
*
* @param string The message for smilies to be stripped from

Zeile 1096Zeile 1108
	}

/**

	}

/**

	 * Parses message to plain text equivilents of MyCode.

	 * Parses message to plain text equivalents of MyCode.

	 *
* @param string The message to be parsed
* @return string The parsed message.

	 *
* @param string The message to be parsed
* @return string The parsed message.

Zeile 1116Zeile 1128

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


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

			"#\[code\](.*?)\[/code\](\r\n?|\n?)#ise",

 
			"#\[php\](.*?)\[/php\](\r\n?|\n?)#ise",

			"#\[php\](.*?)\[/php\](\r\n?|\n?)#ise",

 
			"#\[code\](.*?)\[/code\](\r\n?|\n?)#ise",

			"#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
"#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si",
"#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#si",

			"#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
"#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si",
"#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#si",

Zeile 1143Zeile 1155
		}

// Special code requiring special attention

		}

// Special code requiring special attention

		while(preg_match("#\[list\](.*?)\[/list\]#si", $message))
{
$message = preg_replace("#\[list\](.*?)\[/list\](\r\n?|\n?)#esi", "\$this->mycode_parse_list('$1', '', true)\n", $message);

		while(preg_match("#\[list\](.*?)\[/list\]#esi", $message))
{
$message = preg_replace("#\s?\[list\](.*?)\[/list\](\r\n?|\n?)#esi", "\$this->mycode_parse_list('$1')\n", $message);

		}

// Replace lists.
while(preg_match("#\[list=(a|A|i|I|1)\](.*?)\[/list\](\r\n?|\n?)#esi", $message))
{

		}

// Replace lists.
while(preg_match("#\[list=(a|A|i|I|1)\](.*?)\[/list\](\r\n?|\n?)#esi", $message))
{

			$message = preg_replace("#\[list=(a|A|i|I|1)\](.*?)\[/list\]#esi", "\$this->mycode_parse_list('$2', '$1', true)\n", $message);

			$message = preg_replace("#\s?\[list=(a|A|i|I|1)\](.*?)\[/list\]#esi", "\$this->mycode_parse_list('$2', '$1')\n", $message);

		}

// Run plugin hooks

		}

// Run plugin hooks