Vergleich inc/class_parser.php - 1.8.18 - 1.8.25

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 368Zeile 368

if($mybb->settings['allowfontmycode'] == 1)
{


if($mybb->settings['allowfontmycode'] == 1)
{

			$nestable_mycode['font']['regex'] = "#\[font=([a-z0-9 ,\-_'\"]+)\](.*?)\[/font\]#si";
$nestable_mycode['font']['replacement'] = "<span style=\"font-family: $1;\" class=\"mycode_font\">$2</span>";

			$nestable_mycode['font']['regex'] = "#\[font=(\"?)([a-z0-9 ,\-_']+)\\1\](.*?)\[/font\]#si";
$nestable_mycode['font']['replacement'] = "<span style=\"font-family: $2;\" class=\"mycode_font\">$3</span>";


++$nestable_count;
}


++$nestable_count;
}

Zeile 679Zeile 679
			return;
}


			return;
}


		// Neutralize multiple adjacent wildcards and generate pattern
$ptrn = array('/\*\++/', '/\++\*/', '/\*+/');
$rplc = array('*', '*', '[^\s\n]*');

		// Neutralize escape character, regex operators, multiple adjacent wildcards and generate pattern
$ptrn = array('/\\\\/', '/([\[\^\$\.\|\?\(\)\{\}]{1})/', '/\*\++/', '/\++\*/', '/\*+/');
$rplc = array('\\\\\\\\','\\\\${1}', '*', '*', '[^\s\n]*');

		$bad_word = preg_replace($ptrn, $rplc, $bad_word);

// Count + and generate pattern

		$bad_word = preg_replace($ptrn, $rplc, $bad_word);

// Count + and generate pattern

Zeile 1133Zeile 1133

// Fix some entities in URLs
$url = $this->encode_url($url);


// Fix some entities in URLs
$url = $this->encode_url($url);



$name = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode

		$name = $this->parse_badwords(preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name)); // Fix & but allow unicode, filter bad words




eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\";");
return $mycode_url;


eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\";");
return $mycode_url;

	}

/**
* Parses URL MyCode.
*
* @param array $matches Matches.

	}

/**
* Parses URL MyCode.
*
* @param array $matches Matches.

	* @return string The built-up link.
*/
function mycode_parse_url_callback1($matches)

	* @return string The built-up link.
*/
function mycode_parse_url_callback1($matches)

Zeile 1152Zeile 1150
		if(!isset($matches[3]))
{
$matches[3] = '';

		if(!isset($matches[3]))
{
$matches[3] = '';

		}

		}

		return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
}


		return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
}


Zeile 1167Zeile 1165
		if(!isset($matches[2]))
{
$matches[2] = '';

		if(!isset($matches[2]))
{
$matches[2] = '';

		}

		}

		return $this->mycode_parse_url($matches[1], $matches[2]);
}


		return $this->mycode_parse_url($matches[1], $matches[2]);
}


Zeile 1197Zeile 1195
			$css_align = ' style="float: right;"';
}
else if($align == "left")

			$css_align = ' style="float: right;"';
}
else if($align == "left")

		{

		{

			$css_align = ' style="float: left;"';
}


			$css_align = ' style="float: left;"';
}


Zeile 1319Zeile 1317
	 * @return string Image code.
*/
function mycode_parse_img_disabled_callback3($matches)

	 * @return string Image code.
*/
function mycode_parse_img_disabled_callback3($matches)

	{

	{

		return $this->mycode_parse_img_disabled($matches[3]);
}


		return $this->mycode_parse_img_disabled($matches[3]);
}


Zeile 1332Zeile 1330
	function mycode_parse_img_disabled_callback4($matches)
{
return $this->mycode_parse_img_disabled($matches[5]);

	function mycode_parse_img_disabled_callback4($matches)
{
return $this->mycode_parse_img_disabled($matches[5]);

	}

/**
* Parses email MyCode.

	}

/**
* Parses email MyCode.

	*
* @param string $email The email address to link to.
* @param string $name The name for the link.
* @return string The built-up email link.
*/
function mycode_parse_email($email, $name="")

	*
* @param string $email The email address to link to.
* @param string $name The name for the link.
* @return string The built-up email link.
*/
function mycode_parse_email($email, $name="")

	{

	{

		global $templates;

		global $templates;





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

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

		}
if(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+$/si", $email))
{
$email = $email;
}
elseif(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+\?(.*?)$/si", $email))
{
$email = htmlspecialchars_uni($email);
}


		}

$email = $this->encode_url($email);








		eval("\$mycode_email = \"".$templates->get("mycode_email", 1, 0)."\";");
return $mycode_email;
}

		eval("\$mycode_email = \"".$templates->get("mycode_email", 1, 0)."\";");
return $mycode_email;
}

Zeile 1387Zeile 1379
	function mycode_parse_video($video, $url)
{
global $templates;

	function mycode_parse_video($video, $url)
{
global $templates;





		if(empty($video) || empty($url))
{
return "[video={$video}]{$url}[/video]";

		if(empty($video) || empty($url))
{
return "[video={$video}]{$url}[/video]";

Zeile 1538Zeile 1530
			return "[video={$video}]{$url}[/video]";
}


			return "[video={$video}]{$url}[/video]";
}


		$id = htmlspecialchars_uni($id);

		$id = $this->encode_url($id);


eval("\$video_code = \"".$templates->get("video_{$video}_embed", 1, 0)."\";");
return $video_code;


eval("\$video_code = \"".$templates->get("video_{$video}_embed", 1, 0)."\";");
return $video_code;

Zeile 1571Zeile 1563

$video = $lang->sprintf($lang->posted_video, $this->mycode_parse_url($url));
return $video;


$video = $lang->sprintf($lang->posted_video, $this->mycode_parse_url($url));
return $video;

	}

	}


/**
* Parses video MyCode disabled.


/**
* Parses video MyCode disabled.

Zeile 1582Zeile 1574
	function mycode_parse_video_disabled_callback($matches)
{
return $this->mycode_parse_video_disabled($matches[2]);

	function mycode_parse_video_disabled_callback($matches)
{
return $this->mycode_parse_video_disabled($matches[2]);

	}

/**
* Parses URLs automatically.
*

	}

/**
* Parses URLs automatically.
*

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

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

Zeile 1596Zeile 1588

// Links should end with slashes, numbers, characters and braces but not with dots, commas or question marks
// Don't create links within existing links (handled up-front in the callback function).


// Links should end with slashes, numbers, characters and braces but not with dots, commas or question marks
// Don't create links within existing links (handled up-front in the callback function).

		$message = preg_replace_callback("#<a\\s[^>]*>.*?</a>|([\s\(\)\[\>])(http|https|ftp|news|irc|ircs|irc6){1}://([^\/\"\s\<\[\.]+\.([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#ius", array($this, 'mycode_auto_url_callback'), $message);
$message = preg_replace_callback("#<a\\s[^>]*>.*?</a>|([\s\(\)\[\>])(www|ftp)\.(([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#ius", array($this, 'mycode_auto_url_callback'), $message);

		$message = preg_replace_callback("#<a\\s[^>]*>.*?</a>|([\s\(\)\[\>])(http|https|ftp|news|irc|ircs|irc6){1}(://)([^\/\"\s\<\[\.]+\.([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#ius", array($this, 'mycode_auto_url_callback'), $message);
$message = preg_replace_callback("#<a\\s[^>]*>.*?</a>|([\s\(\)\[\>])(www|ftp)(\.)(([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#ius", array($this, 'mycode_auto_url_callback'), $message);

		$message = my_substr($message, 1);

return $message;

		$message = my_substr($message, 1);

return $message;

Zeile 1620Zeile 1612

$external = '';
// Allow links like http://en.wikipedia.org/wiki/PHP_(disambiguation) but detect mismatching braces


$external = '';
// Allow links like http://en.wikipedia.org/wiki/PHP_(disambiguation) but detect mismatching braces

		while(my_substr($matches[3], -1) == ')')

		while(my_substr($matches[4], -1) == ')')

		{

		{

			if(substr_count($matches[3], ')') > substr_count($matches[3], '('))

			if(substr_count($matches[4], ')') > substr_count($matches[4], '('))

			{

			{

				$matches[3] = my_substr($matches[3], 0, -1);

				$matches[4] = my_substr($matches[4], 0, -1);

				$external = ')'.$external;
}
else

				$external = ')'.$external;
}
else

Zeile 1633Zeile 1625
			}

// Example: ([...] http://en.wikipedia.org/Example_(disambiguation).)

			}

// Example: ([...] http://en.wikipedia.org/Example_(disambiguation).)

			$last_char = my_substr($matches[3], -1);

			$last_char = my_substr($matches[4], -1);

			while($last_char == '.' || $last_char == ',' || $last_char == '?' || $last_char == '!')
{

			while($last_char == '.' || $last_char == ',' || $last_char == '?' || $last_char == '!')
{

				$matches[3] = my_substr($matches[3], 0, -1);

				$matches[4] = my_substr($matches[4], 0, -1);

				$external = $last_char.$external;

				$external = $last_char.$external;

				$last_char = my_substr($matches[3], -1);

				$last_char = my_substr($matches[4], -1);

			}
}

			}
}

		if(in_array(strtolower($matches[2]), array('www', 'ftp')))
{
$url = "{$matches[2]}.{$matches[3]}";
}
else
{
$url = "{$matches[2]}://{$matches[3]}";
}

		$url = "{$matches[2]}{$matches[3]}{$matches[4]}";









return $matches[1].$this->mycode_parse_url($url, $url).$external;
}


return $matches[1].$this->mycode_parse_url($url, $url).$external;
}

Zeile 1817Zeile 1802
			"#\[img=([1-9][0-9]*)x([1-9][0-9]*)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is",
"#\[url=((?!javascript)[a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si",
"#\[url=((?!javascript:)[^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#si",

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

 
			"#\[attachment=([0-9]+?)\]#i",

		);

$replace = array(

		);

$replace = array(

Zeile 1825Zeile 1811
			"$4",
"$3 ($1$2)",
"$2 ($1)",

			"$4",
"$3 ($1$2)",
"$2 ($1)",

 
			"",

		);

$messageBefore = "";

		);

$messageBefore = "";