Vergleich inc/class_parser.php - 1.8.0 - 1.8.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 228Zeile 228
			$message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message);
$message = preg_replace("#(&nbsp;)+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message);
}

			$message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message);
$message = preg_replace("#(&nbsp;)+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message);
}


$message = my_wordwrap($message);

 

$message = $plugins->run_hooks("parse_message_end", $message);



$message = $plugins->run_hooks("parse_message_end", $message);


Zeile 523Zeile 521
			{
$smilie['find'] = explode("\n", $smilie['find']);
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);

			{
$smilie['find'] = explode("\n", $smilie['find']);
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);

				$smilie['image'] = $mybb->get_asset_url($smilie['image']);



				$smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image']));
$smilie['name'] = htmlspecialchars_uni($smilie['name']);


				foreach($smilie['find'] as $s)
{
$s = $this->parse_html($s);

				foreach($smilie['find'] as $s)
{
$s = $this->parse_html($s);

Zeile 692Zeile 691
			"#(o)(nabort\s?=)#i"
);


			"#(o)(nabort\s?=)#i"
);


		$message = preg_replace($js_array, "$1<strong></strong>$2$4", $message);

		$message = preg_replace($js_array, "$1<strong></strong>$2$6", $message);


return $message;
}


return $message;
}

Zeile 843Zeile 842
		if($delete_quote)
{
$username = my_substr($username, 0, my_strlen($username)-1);

		if($delete_quote)
{
$username = my_substr($username, 0, my_strlen($username)-1);

 
		}

if(!empty($this->options['allow_html']))
{
$username = htmlspecialchars_uni($username);

		}

if($text_only)
{

		}

if($text_only)
{

			return "\n".htmlspecialchars_uni($username)." $lang->wrote{$date}\n--\n{$message}\n--\n";

			return "\n{$username} {$lang->wrote}{$date}\n--\n{$message}\n--\n";

		}
else
{

		}
else
{

Zeile 857Zeile 861
				$span = "<span>{$date}</span>";
}


				$span = "<span>{$date}</span>";
}


			return "<blockquote><cite>{$span}".htmlspecialchars_uni($username)." $lang->wrote{$linkback}</cite>{$message}</blockquote>\n";

			return "<blockquote><cite>{$span}{$username} {$lang->wrote}{$linkback}</cite>{$message}</blockquote>\n";

		}
}


		}
}


Zeile 1036Zeile 1040
		{
$url = "http://".$url;
}

		{
$url = "http://".$url;
}

		$fullurl = $url;

 




		$url = str_replace('&amp;', '&', $url);
$name = str_replace('&amp;', '&', $name);



		if(!empty($this->options['allow_html']))
{
$url = $this->parse_html($url);
}


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



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


		if($name == $url && !empty($this->options['shorten_urls']))

		if($name == $url && (!isset($this->options['shorten_urls']) || !empty($this->options['shorten_urls'])))

		{

		{

			if(my_strlen($url) > 55)


			$name = htmlspecialchars_decode($name);
if(my_strlen($name) > 55)

			{

			{

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

				$name = my_substr($name , 0, 40).'...'.my_substr($name , -10);

			}

			}

 
			$name = htmlspecialchars_uni($name);

		}

$nofollow = '';
if(!empty($this->options['nofollow_on']))
{
$nofollow = " rel=\"nofollow\"";

		}

$nofollow = '';
if(!empty($this->options['nofollow_on']))
{
$nofollow = " rel=\"nofollow\"";

		}


		}


		// Fix some entities in URLs
$entities = array('$' => '%24', '&#36;' => '%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);

		$url = str_replace(array_keys($entities), array_values($entities), $url);


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


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

		$link = "<a href=\"$fullurl\" target=\"_blank\"{$nofollow}>$name</a>";

		$link = "<a href=\"$url\" target=\"_blank\"{$nofollow}>$name</a>";

		return $link;

		return $link;

	}

	}


/**
* Parses URL MyCode.


/**
* Parses URL MyCode.

Zeile 1082Zeile 1089
			$matches[3] = '';
}
return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);

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

	}


	}


	/**
* Parses URL MyCode.
*

	/**
* Parses URL MyCode.
*

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

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





	/**
* Parses IMG MyCode.
*

	/**
* Parses IMG MyCode.
*

Zeile 1106Zeile 1113
	 * @param array Optional array of dimensions
*/
function mycode_parse_img($url, $dimensions=array(), $align='')

	 * @param array Optional array of dimensions
*/
function mycode_parse_img($url, $dimensions=array(), $align='')

	{
global $lang;
$url = trim($url);
$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);
if($align == "right")
{
$css_align = " style=\"float: right;\"";








	{
global $lang;
$url = trim($url);
$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);

if(!empty($this->options['allow_html']))
{
$url = $this->parse_html($url);
}

$css_align = '';
if($align == "right")
{
$css_align = " style=\"float: right;\"";

		}
else if($align == "left")

		}
else if($align == "left")

		{

		{

			$css_align = " style=\"float: left;\"";

			$css_align = " style=\"float: left;\"";

		}
$alt = htmlspecialchars_uni(basename($url));



		}
$alt = basename($url);

$alt = htmlspecialchars_decode($alt);

		if(my_strlen($alt) > 55)

		if(my_strlen($alt) > 55)

		{
$alt = my_substr($alt, 0, 40)."...".my_substr($alt, -10);
}
$alt = $lang->sprintf($lang->posted_image, $alt);
if($dimensions[0] > 0 && $dimensions[1] > 0)



		{
$alt = my_substr($alt, 0, 40).'...'.my_substr($alt, -10);
}
$alt = htmlspecialchars_uni($alt);

$alt = $lang->sprintf($lang->posted_image, $alt);
if(isset($dimensions[0]) && $dimensions[0] > 0 && isset($dimensions[1]) && $dimensions[1] > 0)

		{
return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
}
else
{
return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";

		{
return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
}
else
{
return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";

		}
}

/**
* Parses IMG MyCode.
*
* @param array Matches.
* @return string Image code.
*/
function mycode_parse_img_callback1($matches)
{
return $this->mycode_parse_img($matches[2]);

		}
}

/**
* Parses IMG MyCode.
*
* @param array Matches.
* @return string Image code.
*/
function mycode_parse_img_callback1($matches)
{
return $this->mycode_parse_img($matches[2]);

	}

/**

	}

/**

Zeile 1155Zeile 1173
	function mycode_parse_img_callback2($matches)
{
return $this->mycode_parse_img($matches[4], array($matches[1], $matches[2]));

	function mycode_parse_img_callback2($matches)
{
return $this->mycode_parse_img($matches[4], array($matches[1], $matches[2]));

	}


	}


	/**
* Parses IMG MyCode.
*

	/**
* Parses IMG MyCode.
*

Zeile 1170Zeile 1188

/**
* Parses IMG MyCode.


/**
* Parses IMG MyCode.

	 *

	 *

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

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

Zeile 1192Zeile 1210
		$url = str_replace("\r", "", $url);
$url = str_replace("\'", "'", $url);


		$url = str_replace("\r", "", $url);
$url = str_replace("\'", "'", $url);


		if(!empty($this->options['shorten_urls']))
{
if(my_strlen($url) > 55)
{
$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
}
}
else
{
$name = $url;
}

$link = "<a href=\"{$url}\" target=\"_blank\">{$name}</a>";
$image = $lang->sprintf($lang->posted_image, $link);

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














		return $image;
}


		return $image;
}


Zeile 1218Zeile 1223
	function mycode_parse_img_disabled_callback1($matches)
{
return $this->mycode_parse_img_disabled($matches[2]);

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

	}

/**

	}

/**

	 * Parses IMG MyCode disabled.
*
* @param array Matches.

	 * Parses IMG MyCode disabled.
*
* @param array Matches.

Zeile 1269Zeile 1274
		if(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+$/si", $email))
{
return "<a href=\"mailto:$email\">".$name."</a>";

		if(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+$/si", $email))
{
return "<a href=\"mailto:$email\">".$name."</a>";

 
		}
elseif(preg_match("/^([a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+\?(.*?)$/si", $email))
{
return "<a href=\"mailto:".htmlspecialchars_uni($email)."\">".$name."</a>";

		}
else
{
return $email;

		}
else
{
return $email;

		}
}

/**

		}
}

/**

	* Parses email MyCode.
*
* @param array Matches

	* Parses email MyCode.
*
* @param array Matches

Zeile 1289Zeile 1298
			$matches[2] = '';
}
return $this->mycode_parse_email($matches[1], $matches[2]);

			$matches[2] = '';
}
return $this->mycode_parse_email($matches[1], $matches[2]);

	}

/**
* Parses video MyCode.

	}

/**
* Parses video MyCode.

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

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

Zeile 1301Zeile 1310
	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 1309Zeile 1318

$parsed_url = @parse_url(urldecode($url));
if($parsed_url == false)


$parsed_url = @parse_url(urldecode($url));
if($parsed_url == false)

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

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


$fragments = array();
if($parsed_url['fragment'])


$fragments = array();
if($parsed_url['fragment'])

		{

		{

			$fragments = explode("&", $parsed_url['fragment']);

			$fragments = explode("&", $parsed_url['fragment']);

		}

		}


$queries = explode("&", $parsed_url['query']);



$queries = explode("&", $parsed_url['query']);


Zeile 1327Zeile 1336
			list($key, $value) = explode("=", $query);
$key = str_replace("amp;", "", $key);
$input[$key] = $value;

			list($key, $value) = explode("=", $query);
$key = str_replace("amp;", "", $key);
$input[$key] = $value;

		}


		}


		$path = explode('/', $parsed_url['path']);

switch($video)
{
case "dailymotion":

		$path = explode('/', $parsed_url['path']);

switch($video)
{
case "dailymotion":

				list($id, ) = split("_", $path[2], 1); // http://www.dailymotion.com/video/fds123_title-goes-here

				list($id) = explode('_', $path[2], 2); // http://www.dailymotion.com/video/fds123_title-goes-here

				break;
case "metacafe":
$id = $path[2]; // http://www.metacafe.com/watch/fds123/title_goes_here/

				break;
case "metacafe":
$id = $path[2]; // http://www.metacafe.com/watch/fds123/title_goes_here/

Zeile 1366Zeile 1375
				}
break;
case "vimeo":

				}
break;
case "vimeo":

				$id = $path[1]; // http://vimeo.com/fds123

				$id = $path[1]; // http://vimeo.com/fds123

				break;
case "youtube":
if($fragments[0])

				break;
case "youtube":
if($fragments[0])

				{

				{

					$id = str_replace('!v=', '', $fragments[0]); // http://www.youtube.com/watch#!v=fds123

					$id = str_replace('!v=', '', $fragments[0]); // http://www.youtube.com/watch#!v=fds123

				}

				}

				elseif($input['v'])

				elseif($input['v'])

				{

				{

					$id = $input['v']; // http://www.youtube.com/watch?v=fds123
}
else

					$id = $input['v']; // http://www.youtube.com/watch?v=fds123
}
else

Zeile 1384Zeile 1393
				break;
default:
return "[video={$video}]{$url}[/video]";

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

		}

		}


if(empty($id))
{


if(empty($id))
{

Zeile 1422Zeile 1431
		$url = str_replace("\r", "", $url);
$url = str_replace("\'", "'", $url);


		$url = str_replace("\r", "", $url);
$url = str_replace("\'", "'", $url);


		if(!empty($this->options['shorten_urls']))
{
if(my_strlen($url) > 55)
{
$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
}
}
else
{
$name = $url;
}

$link = "<a href=\"{$url}\" target=\"_blank\">{$name}</a>";
$video = $lang->sprintf($lang->posted_video, $link);

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














		return $video;
}


		return $video;
}


Zeile 1558Zeile 1554
	function mycode_prepare_list($matches)
{
// Append number to identify matching list tags

	function mycode_prepare_list($matches)
{
// Append number to identify matching list tags

		if($matches[1] == '[/list]')

		if(strcasecmp($matches[1], '[/list]') == 0)

		{
$count = array_pop($this->list_elements);
if($count !== NULL)

		{
$count = array_pop($this->list_elements);
if($count !== NULL)