Vergleich inc/class_parser.php - 1.4.11 - 1.4.15

  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 4538 2009-11-25 08:28:55Z RyanGordon $

 * $Id: class_parser.php 5379 2011-02-21 11:06:42Z Tomm $

 */

/*

 */

/*

Zeile 114Zeile 114
			{
$message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "&lt;script$1&gt;$2&lt;/script$3&gt;", $message);
}

			{
$message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "&lt;script$1&gt;$2&lt;/script$3&gt;", $message);
}

			// Remove these completely
$message = preg_replace("#\s*<base[^>]*>\s*#is", "", $message);
$message = preg_replace("#\s*<meta[^>]*>\s*#is", "", $message);





			$message = str_replace(array('<?php', '<!--', '-->', '?>', "<br />\n", "<br>\n"), array('&lt;?php', '&lt;!--', '--&gt;', '?&gt;', "\n", "\n"), $message);
}

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

			$message = str_replace(array('<?php', '<!--', '-->', '?>', "<br />\n", "<br>\n"), array('&lt;?php', '&lt;!--', '--&gt;', '?&gt;', "\n", "\n"), $message);
}

// If MyCode needs to be replaced, first filter out [code] and [php] tags.
if($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 133Zeile 130
		
// Replace "me" code and slaps if we have a username
if($options['me_username'])

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

		{

		{

			global $lang;

$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} \\2</span>", $message);

			global $lang;

$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} \\2</span>", $message);

Zeile 156Zeile 153
		if($options['highlight'])
{
$message = $this->highlight_message($message, $options['highlight']);

		if($options['highlight'])
{
$message = $this->highlight_message($message, $options['highlight']);

		}


		}


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


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


Zeile 168Zeile 165
			{
foreach($code_matches as $text)
{

			{
foreach($code_matches as $text)
{

					// Fix up HTML inside the code tags so it is clean
if($options['allow_html'] != 0)
{
$text[2] = $this->parse_html($text[2]);
}


 
					if(my_strtolower($text[1]) == "code")
{
$code = $this->mycode_parse_code($text[2]);

					if(my_strtolower($text[1]) == "code")
{
$code = $this->mycode_parse_code($text[2]);

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

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

 
		}

// 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(
'$matches',
'return htmlspecialchars($matches[0]);'
), $message);

		}

if($options['nl2br'] !== 0)

		}

if($options['nl2br'] !== 0)

Zeile 305Zeile 305
		{
$this->mycode_cache['find'][] = $code['regex'];
$this->mycode_cache['replacement'][] = $code['replacement'];

		{
$this->mycode_cache['find'][] = $code['regex'];
$this->mycode_cache['replacement'][] = $code['replacement'];

		}

		}

	}

/**

	}

/**

Zeile 487Zeile 487
				{
$badword['replacement'] = "*****";
}

				{
$badword['replacement'] = "*****";
}

				$badword['badword'] = preg_quote($badword['badword']);

				$badword['badword'] = preg_quote($badword['badword'], "#");

				$message = preg_replace("#(\b|^)".$badword['badword']."(\b|$)#i", "\\1".$badword['replacement']."\\2", $message);
}
}

				$message = preg_replace("#(\b|^)".$badword['badword']."(\b|$)#i", "\\1".$badword['replacement']."\\2", $message);
}
}

Zeile 584Zeile 584
		}

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

		}

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

		{

		{

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


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


Zeile 769Zeile 769
			@highlight_string($str);
$code = ob_get_contents();
ob_end_clean();

			@highlight_string($str);
$code = ob_get_contents();
ob_end_clean();

		}

		}

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

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

Zeile 803Zeile 803
		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_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);

		if($added_end_tag)
{
$code = str_replace("?&gt;</span></code>", "</span></code>", $code);

Zeile 838Zeile 838
		if(!preg_match("#^[a-z0-9]+://#i", $url))
{
$url = "http://".$url;

		if(!preg_match("#^[a-z0-9]+://#i", $url))
{
$url = "http://".$url;

		}

		}

		$fullurl = $url;

		$fullurl = $url;





		$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))
{
$fullurl = "http://".$fullurl;
}

		






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

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

Zeile 866Zeile 861
			}
}


			}
}


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



		// Fix some entities in URLs
$entities = array('$' => '%24', '&#36;' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20');
$fullurl = str_replace(array_keys($entities), array_values($entities), $fullurl);


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

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