aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorCullen Walsh <ckwalsh@phpbb.com>2011-04-18 23:34:56 -0700
committerCullen Walsh <ckwalsh@cullenwalsh.com>2012-03-18 22:20:45 +0000
commitf02f6216867db63f6ad2659b0b702b81b07a875c (patch)
treeed568e31461d475a80d1b21681288bd510e7232a /phpBB/includes
parent00d4b9d431d6772889291f2f4c857a144bce93fb (diff)
downloadforums-f02f6216867db63f6ad2659b0b702b81b07a875c.tar
forums-f02f6216867db63f6ad2659b0b702b81b07a875c.tar.gz
forums-f02f6216867db63f6ad2659b0b702b81b07a875c.tar.bz2
forums-f02f6216867db63f6ad2659b0b702b81b07a875c.tar.xz
forums-f02f6216867db63f6ad2659b0b702b81b07a875c.zip
[feature/avatars] Fixing remote avatars size checks
Remote avatars size checks were broken. It assumed getimagesize() was available and used the wrong template values. PHPBB3-10018
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/avatar/driver/local.php9
-rw-r--r--phpBB/includes/avatar/driver/remote.php27
2 files changed, 23 insertions, 13 deletions
diff --git a/phpBB/includes/avatar/driver/local.php b/phpBB/includes/avatar/driver/local.php
index c00f65a81d..4c15b5de2e 100644
--- a/phpBB/includes/avatar/driver/local.php
+++ b/phpBB/includes/avatar/driver/local.php
@@ -73,7 +73,14 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
// Match all images in the gallery folder
if (preg_match('#^[^&\'"<>]+\.(?:gif|png|jpe?g)$#i', $image))
{
- $dims = getimagesize($this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $cat . '/' . $image);
+ if (function_exists('getimagesize'))
+ {
+ $dims = getimagesize($this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $cat . '/' . $image);
+ }
+ else
+ {
+ $dims = array(0, 0);
+ }
$avatar_list[$cat][$image] = array(
'file' => rawurlencode($cat) . '/' . rawurlencode($image),
'filename' => rawurlencode($image),
diff --git a/phpBB/includes/avatar/driver/remote.php b/phpBB/includes/avatar/driver/remote.php
index ebaf3cf5c4..48f86cac3f 100644
--- a/phpBB/includes/avatar/driver/remote.php
+++ b/phpBB/includes/avatar/driver/remote.php
@@ -80,22 +80,25 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
}
// Make sure getimagesize works...
- if (($image_data = getimagesize($url)) === false && ($width <= 0 || $height <= 0))
+ if (function_exists('getimagesize'))
{
- $error[] = 'UNABLE_GET_IMAGE_SIZE';
- return false;
- }
+ if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false))
+ {
+ $error[] = 'UNABLE_GET_IMAGE_SIZE';
+ return false;
+ }
- if (!empty($image_data) && ($image_data[0] < 2 || $image_data[1] < 2))
- {
- $error[] = 'AVATAR_NO_SIZE';
- return false;
- }
+ if (!empty($image_data) && ($image_data[0] <= 0 || $image_data[1] <= 0))
+ {
+ $error[] = 'AVATAR_NO_SIZE';
+ return false;
+ }
- $width = ($width && $height) ? $width : $image_data[0];
- $height = ($width && $height) ? $height : $image_data[1];
+ $width = ($width && $height) ? $width : $image_data[0];
+ $height = ($width && $height) ? $height : $image_data[1];
+ }
- if ($width < 2 || $height < 2)
+ if ($width <= 0 || $height <= 0)
{
$error[] = 'AVATAR_NO_SIZE';
return false;