mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[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:
@@ -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
|
||||
|
Reference in New Issue
Block a user