[ticket/11548] Check upload avatar URL the same way as in phpBB 3.0

The upload avatar URL was checked for its length in phpBB 3.0. Additionally,
starting with the new avatar system in phpBB 3.1, the URL was checked to
prevent improper URLs being submitted. This minor change is needed for proper
testing of the ucp and acp groups pages.

PHPBB3-11548
This commit is contained in:
Marc Alexander 2013-07-12 14:35:17 -04:00
parent 0d0338a55c
commit adff2fb254

View file

@ -77,6 +77,32 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
}
elseif (!empty($this->config['allow_avatar_remote_upload']) && !empty($url))
{
if (!preg_match('#^(http|https|ftp)://#i', $url))
{
$url = 'http://' . $url;
}
if (!function_exists('validate_data'))
{
require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
}
$validate_array = validate_data(
array(
'url' => $url,
),
array(
'url' => array('string', true, 5, 255),
)
);
$error = array_merge($error, $validate_array);
if (!empty($error))
{
return false;
}
$file = $upload->remote_upload($url);
}
else