Vergleich inc/class_parser.php - 1.2.1 - 1.2.2

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

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

 * $Id: class_parser.php 2271 2006-09-27 02:45:07Z Tikitiki $

 * $Id: class_parser.php 2447 2006-11-27 04:18:13Z CraKteR $

 */

/*

 */

/*

Zeile 75Zeile 75

if($this->base_url != "")
{


if($this->base_url != "")
{

			if(my_substr($this->base_url, strlen($this->base_url) -1) != "/")

			if(my_substr($this->base_url, my_strlen($this->base_url) -1) != "/")

			{
$this->base_url = $this->base_url."/";
}

			{
$this->base_url = $this->base_url."/";
}

Zeile 86Zeile 86

// Get rid of cartridge returns for they are the workings of the devil
$message = str_replace("\r", "", $message);


// Get rid of cartridge returns for they are the workings of the devil
$message = str_replace("\r", "", $message);

		$message = $this->strip_rtl($message);


 
		
// Filter bad words if requested.
if($options['filter_badwords'] != "no")

		
// Filter bad words if requested.
if($options['filter_badwords'] != "no")

		{

		{

			$message = $this->parse_badwords($message);
}

if($options['allow_html'] != "yes")
{
$message = $this->parse_html($message);

			$message = $this->parse_badwords($message);
}

if($options['allow_html'] != "yes")
{
$message = $this->parse_html($message);

		}

		}

		else
{
// Strip out any script tags if HTML is enabled

		else
{
// Strip out any script tags if HTML is enabled

Zeile 110Zeile 108
				}
$message = preg_replace("#<base(.*)>#is", "&lt;base$1&gt;", $message);
$message = preg_replace("#<meta(.*)>#is", "&lt;meta$1&gt;", $message);

				}
$message = preg_replace("#<base(.*)>#is", "&lt;base$1&gt;", $message);
$message = preg_replace("#<meta(.*)>#is", "&lt;meta$1&gt;", $message);

 
				$message = str_replace(array('<?php', '<!--', '-->', '?>'), array('&lt;?php', '&lt;!--', '--&gt;', '?&gt;'), $message);

			}
}


			}
}


Zeile 166Zeile 165
		}

if($options['nl2br'] != "no")

		}

if($options['nl2br'] != "no")

		{

		{

			$message = nl2br($message);
$message = str_replace("</div><br />", "</div>", $message);
$message = preg_replace("#<(/?)p>\s*(<br />?)#", "<$1p>", $message);

			$message = nl2br($message);
$message = str_replace("</div><br />", "</div>", $message);
$message = preg_replace("#<(/?)p>\s*(<br />?)#", "<$1p>", $message);

Zeile 251Zeile 250
		$standard_mycode['size']['replacement'] = "<span style=\"font-size: $1;\">$2</span>";

$standard_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";

		$standard_mycode['size']['replacement'] = "<span style=\"font-size: $1;\">$2</span>";

$standard_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";

		$standard_mycode['size_int']['replacement'] = "<font size=\"$1\">$2</font>";

		$standard_mycode['size_int']['replacement'] = "<span style=\"font-size: $1em;\">$2</span>";


$standard_mycode['font']['regex'] = "#\[font=([a-z ]+?)\](.+?)\[/font\]#si";
$standard_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";


$standard_mycode['font']['regex'] = "#\[font=([a-z ]+?)\](.+?)\[/font\]#si";
$standard_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";

Zeile 306Zeile 305
		// Parse quotes first
$message = $this->mycode_parse_quotes($message);


		// Parse quotes first
$message = $this->mycode_parse_quotes($message);


		$message = $this->mycode_auto_url($message);		

		$message = $this->mycode_auto_url($message);





 
		$message = str_replace('$', '&#36;', $message);


		// Replace the rest
$message = preg_replace($this->mycode_cache['find'], $this->mycode_cache['replacement'], $message);


		// Replace the rest
$message = preg_replace($this->mycode_cache['find'], $this->mycode_cache['replacement'], $message);


Zeile 421Zeile 422
			{
if(!$badword['replacement']) $badword['replacement'] = "*****";
$badword['badword'] = preg_quote($badword['badword']);

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

				$message = preg_replace("#\b".$badword['badword']."\b#i", $badword['replacement'], $message);

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

			}
}
if($options['strip_tags'] == "yes")

			}
}
if($options['strip_tags'] == "yes")

Zeile 440Zeile 441
	function fix_javascript($message)
{
$js_array = array(

	function fix_javascript($message)
{
$js_array = array(

			"#(j)(avascript)#i",
"#(a)(lert)#i",
"#(o)(nmouseover)#i",
"#(o)(nmouseout)#i",
"#(o)(nmousedown)#i",
"#(o)(nmousemove)#i",
"#(o)(nmouseup)#i",
"#(o)(nclick)#i",
"#(o)(ndblclick)#i",
"#(o)(nload)#i",
"#(o)(nsubmit)#i",
"#(o)(nblur)#i",
"#(o)(nchange)#i",
"#(o)(nfocus)#i",
"#(o)(nselect)#i",
"#(o)(nunload)#i",
"#(o)(nkeypress)#i"

			"#(j)(avascript\:)#i",
"#(o)(nmouseover\s?=)#i",
"#(o)(nmouseout\s?=)#i",
"#(o)(nmousedown\s?=)#i",
"#(o)(nmousemove\s?=)#i",
"#(o)(nmouseup\s?=)#i",
"#(o)(nclick\s?=)#i",
"#(o)(ndblclick\s?=)#i",
"#(o)(nload\s?=)#i",
"#(o)(nsubmit\s?=)#i",
"#(o)(nblur\s?=)#i",
"#(o)(nchange\s?=)#i",
"#(o)(nfocus\s?=)#i",
"#(o)(nselect\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", $message);

 


		return $message;
}


		return $message;
}


Zeile 475Zeile 476
		// Assign pattern and replace values.
$pattern = array("#\[quote=(?:&quot;|\"|')?(.*?)[\"']?(?:&quot;|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si",
"#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");

		// Assign pattern and replace values.
$pattern = array("#\[quote=(?:&quot;|\"|')?(.*?)[\"']?(?:&quot;|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si",
"#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");

 
						 


$replace = array("</p>\n<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n<p>\n",
"</p>\n<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\n<p>\n");


$replace = array("</p>\n<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n<p>\n",
"</p>\n<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\n<p>\n");

Zeile 494Zeile 496
		);
$message = preg_replace($find, $replace, $message);
return $message;

		);
$message = preg_replace($find, $replace, $message);
return $message;





	}

/**
* Parses code MyCode.

	}

/**
* Parses code 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 527Zeile 529
		{
return;
}

		{
return;
}

 
		$str = str_replace('&amp;', '&', $str);

		$str = str_replace('&lt;', '<', $str);
$str = str_replace('&gt;', '>', $str);

		$str = str_replace('&lt;', '<', $str);
$str = str_replace('&gt;', '>', $str);

		$str = str_replace('&amp;', '&', $str);

 
		$original = $str;

		$original = $str;

 


		// See if open and close tags are provided.

		// See if open and close tags are provided.

		$added_open_close = false;

		$added_open_tag = false;

		if(!preg_match("#^\s*<\?#si", $str))
{

		if(!preg_match("#^\s*<\?#si", $str))
{

			$added_open_close = true;
$str = "<?php \n".$str." \n?>";








			$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?>";

		}
// If the PHP version < 4.2, catch highlight_string() output.
if(version_compare(PHP_VERSION, "4.2.0", "<"))

		}
// If the PHP version < 4.2, catch highlight_string() output.
if(version_compare(PHP_VERSION, "4.2.0", "<"))

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

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

		}

		}

		// If < PHP 5, make XHTML compatible.
if(version_compare(PHP_VERSION, "5", "<"))
{

		// If < PHP 5, make XHTML compatible.
if(version_compare(PHP_VERSION, "5", "<"))
{

Zeile 557Zeile 567
				"<font",
"color=\"",
"</font>"

				"<font",
"color=\"",
"</font>"

			);


			);


			$replace = array(
"<span",
"style=\"color: ",

			$replace = array(
"<span",
"style=\"color: ",

Zeile 575Zeile 585
		$code = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $code);



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



		if($added_open_close == true)

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

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


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


Zeile 622Zeile 636
		$fullurl = stripslashes($fullurl);
if($name == $url && $this->options['shorten_urls'] != "no")
{

		$fullurl = stripslashes($fullurl);
if($name == $url && $this->options['shorten_urls'] != "no")
{

			if(strlen($url) > 55)

			if(my_strlen($url) > 55)

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

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

Zeile 660Zeile 674
	* @param string The email address to link to.
* @param string The name for the link.
* @return string The built-up email link.

	* @param string The email address to link to.
* @param string The name for the link.
* @return string The built-up email link.

	*/

	*/

	function mycode_parse_email($email, $name="")
{
if(!$name)

	function mycode_parse_email($email, $name="")
{
if(!$name)

Zeile 734Zeile 748
		}
return $message;
}

		}
return $message;
}

	
/**
* Strip RTL Unicude
*
*/
function strip_rtl($message)
{
//$message = htmlentities($message);
//$message = preg_replace('/[^\x09\x0A\x0D\x20-\x7F]/e', '"&#".ord($0).";"', $message);
//$message = str_replace('&#226;&#128;&#174;', '', $message);
//$message = str_replace('&#8238;', '', $message);
//$message = str_replace('&#x202E', '', $message);
//$message = html_entity_decode($message);
return $message;
}

 

/**
* Strips MyCode.


/**
* Strips MyCode.