mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/8672] Updated the text_formatter.s9e service
PHPBB3-8672
This commit is contained in:
parent
2fa99602c6
commit
245d042e43
2 changed files with 9 additions and 9 deletions
|
@ -367,7 +367,6 @@ class parser implements \phpbb\textformatter\parser_interface
|
||||||
{
|
{
|
||||||
// Validate the URL
|
// Validate the URL
|
||||||
$url = BuiltInFilters::filterUrl($url, $url_config, $logger);
|
$url = BuiltInFilters::filterUrl($url, $url_config, $logger);
|
||||||
|
|
||||||
if ($url === false)
|
if ($url === false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -375,26 +374,23 @@ class parser implements \phpbb\textformatter\parser_interface
|
||||||
|
|
||||||
if ($max_height || $max_width)
|
if ($max_height || $max_width)
|
||||||
{
|
{
|
||||||
$stats = @getimagesize($url);
|
$imagesize = new \phpbb\upload\imagesize();
|
||||||
|
$size_info = $imagesize->get_imagesize($url);
|
||||||
if ($stats === false)
|
if ($size_info === false)
|
||||||
{
|
{
|
||||||
$logger->err('UNABLE_GET_IMAGE_SIZE');
|
$logger->err('UNABLE_GET_IMAGE_SIZE');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max_height && $max_height < $stats[1])
|
if ($max_height && $max_height < $size_info['height'])
|
||||||
{
|
{
|
||||||
$logger->err('MAX_IMG_HEIGHT_EXCEEDED', array('max_height' => $max_height));
|
$logger->err('MAX_IMG_HEIGHT_EXCEEDED', array('max_height' => $max_height));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max_width && $max_width < $stats[0])
|
if ($max_width && $max_width < $size_info['width'])
|
||||||
{
|
{
|
||||||
$logger->err('MAX_IMG_WIDTH_EXCEEDED', array('max_width' => $max_width));
|
$logger->err('MAX_IMG_WIDTH_EXCEEDED', array('max_width' => $max_width));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,6 +458,10 @@ class phpbb_test_case_helpers
|
||||||
{
|
{
|
||||||
$dispatcher = new phpbb_mock_event_dispatcher;
|
$dispatcher = new phpbb_mock_event_dispatcher;
|
||||||
}
|
}
|
||||||
|
if (!isset($phpbb_dispatcher))
|
||||||
|
{
|
||||||
|
$phpbb_dispatcher = $dispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
// Create and register the text_formatter.s9e.factory service
|
// Create and register the text_formatter.s9e.factory service
|
||||||
$factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $cache_dir, $cache_key_parser, $cache_key_renderer);
|
$factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $cache_dir, $cache_key_parser, $cache_key_renderer);
|
||||||
|
|
Loading…
Add table
Reference in a new issue