Vergleich inc/class_parser.php - 1.8.19 - 1.8.22

  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;

Zeile 1259Zeile 1257
	function mycode_parse_img_callback3($matches)
{
return $this->mycode_parse_img($matches[3], array(), $matches[1]);

	function mycode_parse_img_callback3($matches)
{
return $this->mycode_parse_img($matches[3], array(), $matches[1]);

	}


	}


	/**
* Parses IMG MyCode.

	/**
* Parses IMG MyCode.

	 *
* @param array $matches Matches.
* @return string Image code.
*/

	 *
* @param array $matches Matches.
* @return string Image code.
*/

	function mycode_parse_img_callback4($matches)
{
return $this->mycode_parse_img($matches[5], array($matches[1], $matches[2]), $matches[3]);

	function mycode_parse_img_callback4($matches)
{
return $this->mycode_parse_img($matches[5], array($matches[1], $matches[2]), $matches[3]);

	}

/**
* Parses IMG MyCode disabled.
*

	}

/**
* Parses IMG MyCode disabled.
*

	 * @param string $url The URL to the image
* @return string
*/

	 * @param string $url The URL to the image
* @return string
*/

Zeile 1288Zeile 1286

$image = $lang->sprintf($lang->posted_image, $this->mycode_parse_url($url));
return $image;


$image = $lang->sprintf($lang->posted_image, $this->mycode_parse_url($url));
return $image;

	}


	}


	/**
* Parses IMG MyCode disabled.
*

	/**
* Parses IMG MyCode disabled.
*

Zeile 1297Zeile 1295
	 * @return string Image code.
*/
function mycode_parse_img_disabled_callback1($matches)

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

	{

	{

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

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

	}

/**
* Parses IMG MyCode disabled.
*
* @param array $matches Matches.
* @return string Image code.

	}

/**
* Parses IMG MyCode disabled.
*
* @param array $matches Matches.
* @return string Image code.

	 */
function mycode_parse_img_disabled_callback2($matches)
{

	 */
function mycode_parse_img_disabled_callback2($matches)
{

Zeile 1321Zeile 1319
	function mycode_parse_img_disabled_callback3($matches)
{
return $this->mycode_parse_img_disabled($matches[3]);

	function mycode_parse_img_disabled_callback3($matches)
{
return $this->mycode_parse_img_disabled($matches[3]);

	}


	}


	/**
* Parses IMG MyCode disabled.
*

	/**
* Parses IMG MyCode disabled.
*

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.

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

Zeile 1382Zeile 1380
	*
* @param string $video The video provider.
* @param string $url The video to link to.

	*
* @param string $video The video provider.
* @param string $url The video to link to.

	* @return string The built-up video code.
*/

	* @return string The built-up video code.
*/

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

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

Zeile 1538Zeile 1536
			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 1596Zeile 1594

// 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 1618

$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 1631
			}

// 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;
}