phpBB

Code Changes

File: phpbb/avatar/driver/remote.php

  Unmodified   Added   Modified   Removed
Line 36Line 36
	public function prepare_form($request, $template, $user, $row, &$error)
{
$template->assign_vars(array(

	public function prepare_form($request, $template, $user, $row, &$error)
{
$template->assign_vars(array(

			'AVATAR_REMOTE_WIDTH' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_width']) ? $row['avatar_width'] : $request->variable('avatar_remote_width', 0),
'AVATAR_REMOTE_HEIGHT' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_height']) ? $row['avatar_height'] : $request->variable('avatar_remote_width', 0),

			'AVATAR_REMOTE_WIDTH' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_width']) ? $row['avatar_width'] : $request->variable('avatar_remote_width', ''),
'AVATAR_REMOTE_HEIGHT' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_height']) ? $row['avatar_height'] : $request->variable('avatar_remote_width', ''),

			'AVATAR_REMOTE_URL' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar']) ? $row['avatar'] : '',
));


			'AVATAR_REMOTE_URL' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar']) ? $row['avatar'] : '',
));


Line 92Line 92
			return false;
}


			return false;
}


		// Make sure getimagesize works...
if (function_exists('getimagesize'))
{
if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false))

		// Get image dimensions
if (($width <= 0 || $height <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false))



			{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
return false;
}


			{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
return false;
}


			if (!empty($image_data) && ($image_data[0] <= 0 || $image_data[1] <= 0))

		if (!empty($image_data) && ($image_data['width'] <= 0 || $image_data['height'] <= 0))

			{
$error[] = 'AVATAR_NO_SIZE';
return false;
}


			{
$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['width'];
$height = ($width && $height) ? $height : $image_data['height'];



if ($width <= 0 || $height <= 0)
{


if ($width <= 0 || $height <= 0)
{

Line 117Line 114
			return false;
}


			return false;
}


		if (!class_exists('fileupload'))
{
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
}

$types = \fileupload::image_types();
$extension = strtolower(\filespec::get_extension($url));

		$types = \phpbb\files\upload::image_types();
$extension = strtolower(\phpbb\files\filespec::get_extension($url));







// Check if this is actually an image
if ($file_stream = @fopen($url, 'r'))


// Check if this is actually an image
if ($file_stream = @fopen($url, 'r'))

Line 172Line 164
			return false;
}


			return false;
}


		if (!empty($image_data) && (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]])))

		if (!empty($image_data) && (!isset($types[$image_data['type']]) || !in_array($extension, $types[$image_data['type']])))

		{

		{

			if (!isset($types[$image_data[2]]))

			if (!isset($types[$image_data['type']]))

			{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
}
else
{

			{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
}
else
{

				$error[] = array('IMAGE_FILETYPE_MISMATCH', $types[$image_data[2]][0], $extension);

				$error[] = array('IMAGE_FILETYPE_MISMATCH', $types[$image_data['type']][0], $extension);

			}

return false;

			}

return false;