Vergleich inc/class_parser.php - 1.2.7 - 1.2.12

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

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * $Id: class_parser.php 3030 2007-04-26 00:19:47Z Tikitiki $

 * $Id: class_parser.php 3531 2007-12-02 01:21:43Z chris $

 */

/*

 */

/*

Zeile 68Zeile 68
	 */
function parse_message($message, $options=array())
{

	 */
function parse_message($message, $options=array())
{

		global $plugins, $mybb;

		global $plugins, $mybb, $lang;


// Set base URL for parsing smilies
$this->base_url = $mybb->settings['bburl'];


// Set base URL for parsing smilies
$this->base_url = $mybb->settings['bburl'];

Zeile 119Zeile 119
		{
// 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);

		{
// 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);

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

		}

// Always fix bad Javascript in the message.

		}

// Always fix bad Javascript in the message.

Zeile 168Zeile 168
					{
$code = $this->mycode_parse_php($text[2]);
}

					{
$code = $this->mycode_parse_php($text[2]);
}

					$message = preg_replace("#\{\{mybb-code\}\}\n?#", $code, $message, 1);

					$message = preg_replace("#\<mybb-code>\n?#", $code, $message, 1);

				}
}
}

				}
}
}

Zeile 338Zeile 338
			$message = preg_replace("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$2')\n", $message);
$message = preg_replace("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$4', array('$1', '$2'));", $message);
$message = preg_replace("#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$3', array(), '$1');", $message);

			$message = preg_replace("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$2')\n", $message);
$message = preg_replace("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$4', array('$1', '$2'));", $message);
$message = preg_replace("#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$3', array(), '$1');", $message);

			$message = preg_replace("#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$5', array('$1', '$2', '$3'));", $message);

			$message = preg_replace("#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$5', array('$1', '$2'), '$3');", $message);

		}

return $message;

		}

return $message;

Zeile 378Zeile 378
		{
$this->cache_smilies();
}

		{
$this->cache_smilies();
}

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

// First we take out any of the tags we don't want parsed between (url= etc)
preg_match_all("#\[(url=([^\]]*])|url\].*\[\/url\])#i", $message, $bad_matches, PREG_PATTERN_ORDER);
$message = preg_replace("#\[(url=([^\]]*])|url\].*\[\/url\])#si", "<mybb-bad-sm>", $message);

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

		if(is_array($this->smilies_cache))

		if(is_array($this->smilies_cache))

		{
reset($this->smilies_cache);

		{


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

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

			{
if($allow_html != "yes")







			{
if(version_compare(PHP_VERSION, "5.1.0", ">="))
{
$message = preg_replace('#([^<])(?<!"|&amp|&quot|&lt|&gt|&\#[0-9]{1}|&\#[0-9]{2}|&\#[0-9]{3}|&\#[0-9]{4})'.preg_quote($find, "#")."#is", "$1".$replace, $message, $remaining, $replacements);
$remaining -= $replacements;
if($remaining <= 0) break; // Reached the limit
}
else

				{

				{

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

					$message = preg_replace('#([^<])(?<!"|&amp|&quot|&lt|&gt|&\#[0-9]{1}|&\#[0-9]{2}|&\#[0-9]{3}|&\#[0-9]{4})'.preg_quote($find, "#")."#is", "$1".$replace, $message,	$remaining);

				}

				}

				$message = str_replace($find, $replace, $message);

 
			}
}

			}
}

		return $message;












// If we matched any tags previously, swap them back in
if(count($bad_matches[0]) > 0)
{
foreach($bad_matches[0] as $match)
{
$message = preg_replace("#<mybb-bad-sm>#", $match, $message, 1);
}
}

return trim($message);

	}

/**

	}

/**