Vergleich inc/class_parser.php - 1.8.27 - 1.8.33

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 119Zeile 119
	 * @access public
* @var self::VALIDATION_*
*/

	 * @access public
* @var self::VALIDATION_*
*/

	public $output_validation_policy = self::VALIDATION_REPORT_ONLY;

	public $output_validation_policy = self::VALIDATION_REQUIRE;


/**
* Parses a message with the specified options.


/**
* Parses a message with the specified options.

Zeile 315Zeile 315
		global $cache, $lang, $mybb;
$this->mycode_cache = array();


		global $cache, $lang, $mybb;
$this->mycode_cache = array();


		$standard_mycode = $callback_mycode = $nestable_mycode = array();
$standard_count = $callback_count = $nestable_count = 0;

		$standard_mycode = $callback_mycode = $nestable_mycode = $nestable_callback_mycode = array();
$standard_count = $callback_count = $nestable_count = $nestable_callback_count = 0;


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


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

Zeile 398Zeile 398

++$nestable_count;
++$callback_count;


++$nestable_count;
++$callback_count;

		}

if($mybb->settings['allowfontmycode'] == 1)
{
$callback_mycode['font']['regex'] = "#\[font=\\s*(\"?)([a-z0-9 ,\-_'\"]+)\\1\\s*\](.*?)\[/font\]#si";
$callback_mycode['font']['replacement'] = array($this, 'mycode_parse_font_callback');

++$nestable_count;

 
		}

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

		}

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

Zeile 414Zeile 406
			$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\" class=\"mycode_align\">$2</div>";

++$nestable_count;

			$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\" class=\"mycode_align\">$2</div>";

++$nestable_count;

 
		}

if($mybb->settings['allowfontmycode'] == 1)
{
$nestable_callback_mycode['font']['regex'] = "#\[font=\\s*(\"?)([a-z0-9 ,\-_'\"]+)\\1\\s*\](.*?)\[/font\]#si";
$nestable_callback_mycode['font']['replacement'] = array($this, 'mycode_parse_font_callback');

++$nestable_callback_count;

		}

$custom_mycode = $cache->read("mycode");

		}

$custom_mycode = $cache->read("mycode");

Zeile 427Zeile 427
				$custom_mycode[$key]['regex'] = "#".$mycode['regex']."#si";

++$standard_count;

				$custom_mycode[$key]['regex'] = "#".$mycode['regex']."#si";

++$standard_count;

			}

			}

			$mycode = array_merge($standard_mycode, $custom_mycode);

			$mycode = array_merge($standard_mycode, $custom_mycode);

		}

		}

		else
{
$mycode = $standard_mycode;

		else
{
$mycode = $standard_mycode;

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

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

		}


		}


		// Assign the nestable MyCode to the cache.
foreach($nestable_mycode as $code)

		// Assign the nestable MyCode to the cache.
foreach($nestable_mycode as $code)

		{

		{

			$this->mycode_cache['nestable'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);
}


			$this->mycode_cache['nestable'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);
}


		// Assign the nestable MyCode to the cache.

		// Assign the callback MyCode to the cache.

		foreach($callback_mycode as $code)
{
$this->mycode_cache['callback'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);

		foreach($callback_mycode as $code)
{
$this->mycode_cache['callback'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);

		}







		}

// Assign the nestable callback MyCode to the cache.
foreach($nestable_callback_mycode as $code)
{
$this->mycode_cache['nestable_callback'][] = array('find' => $code['regex'], 'replacement' => $code['replacement']);
}


$this->mycode_cache['standard_count'] = $standard_count;
$this->mycode_cache['callback_count'] = $callback_count;
$this->mycode_cache['nestable_count'] = $nestable_count;


$this->mycode_cache['standard_count'] = $standard_count;
$this->mycode_cache['callback_count'] = $callback_count;
$this->mycode_cache['nestable_count'] = $nestable_count;

 
		$this->mycode_cache['nestable_callback_count'] = $nestable_callback_count;

	}

/**

	}

/**

Zeile 477Zeile 484

// Cache the MyCode globally if needed.
if($this->mycode_cache == 0)


// Cache the MyCode globally if needed.
if($this->mycode_cache == 0)

		{

		{

			$this->cache_mycode();
}


			$this->cache_mycode();
}


Zeile 502Zeile 509

// Convert videos when allow.
if(!empty($this->options['allow_videocode']))


// Convert videos when allow.
if(!empty($this->options['allow_videocode']))

		{

		{

			$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_callback'), $message);
}
else

			$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_callback'), $message);
}
else

		{

		{

			$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_disabled_callback'), $message);

			$message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_disabled_callback'), $message);

		}


		}


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

// Replace the rest

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

// Replace the rest

Zeile 528Zeile 535

// Replace the nestable mycode's
if($this->mycode_cache['nestable_count'] > 0)


// Replace the nestable mycode's
if($this->mycode_cache['nestable_count'] > 0)

		{

		{

			foreach($this->mycode_cache['nestable'] as $mycode)
{
while(preg_match($mycode['find'], $message))

			foreach($this->mycode_cache['nestable'] as $mycode)
{
while(preg_match($mycode['find'], $message))

				{

				{

					$message = preg_replace($mycode['find'], $mycode['replacement'], $message);

					$message = preg_replace($mycode['find'], $mycode['replacement'], $message);

				}


















				}
}
}

// Replace the nestable callback mycodes
if($this->mycode_cache['nestable_callback_count'] > 0)
{
foreach($this->mycode_cache['nestable_callback'] as $replace)
{
while(preg_match($replace['find'], $message))
{
$message_org = $message;
$message = preg_replace_callback($replace['find'], $replace['replacement'], $message);
if ($message_org == $message)
{
break;
}
}

			}
}


			}
}


Zeile 553Zeile 577
				// Ignores missing end tags
$message = preg_replace_callback("#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si", array($this, 'mycode_parse_list_callback'), $message, 1);
}

				// Ignores missing end tags
$message = preg_replace_callback("#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si", array($this, 'mycode_parse_list_callback'), $message, 1);
}

		}

		}


if(
(!isset($this->options['allow_auto_url']) || $this->options['allow_auto_url'] == 1) &&


if(
(!isset($this->options['allow_auto_url']) || $this->options['allow_auto_url'] == 1) &&

Zeile 582Zeile 606
			$extra_class = $onclick = '';
foreach($smilies as $sid => $smilie)
{

			$extra_class = $onclick = '';
foreach($smilies as $sid => $smilie)
{

 
				if(isset($theme['imgdir']))
{
$imgdir = $theme['imgdir'];
}
else
{
$imgdir = '';
}


				$smilie['find'] = explode("\n", $smilie['find']);

				$smilie['find'] = explode("\n", $smilie['find']);

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

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

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


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


Zeile 601Zeile 634
							"&gt$s" => "&gt$s",
);
}

							"&gt$s" => "&gt$s",
);
}

				}
}
}
}

				}
}
}
}


/**
* Parses smilie code in the specified message.


/**
* Parses smilie code in the specified message.

Zeile 1436Zeile 1469
	*/
function mycode_parse_video($video, $url)
{

	*/
function mycode_parse_video($video, $url)
{

		global $templates;


		global $mybb, $templates;


		if(empty($video) || empty($url))

		if(empty($video) || empty($url))

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

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


// Check URL is a valid URL first, as `parse_url` doesn't check validity.
if(false === filter_var($url, FILTER_VALIDATE_URL))


// Check URL is a valid URL first, as `parse_url` doesn't check validity.
if(false === filter_var($url, FILTER_VALIDATE_URL))

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

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


$parsed_url = @parse_url(urldecode($url));
if($parsed_url === false)
{
return "[video={$video}]{$url}[/video]";
}


$parsed_url = @parse_url(urldecode($url));
if($parsed_url === false)
{
return "[video={$video}]{$url}[/video]";
}

 

$bbdomain = parse_url($mybb->settings['bburl'], PHP_URL_HOST);


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


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

Zeile 2014Zeile 2049
			$error_message .= var_export($data, true);

$error_handler->error(E_USER_WARNING, $error_message, __FILE__, __LINE__, false);

			$error_message .= var_export($data, true);

$error_handler->error(E_USER_WARNING, $error_message, __FILE__, __LINE__, false);

		}

 




		return empty($errors);




			return false;
} else {
return true;
}

	}
}

	}
}