mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/16015] Add new hook core.ucp_profile_avatar_upload_validation
PHPBB3-16015
This commit is contained in:
@@ -84,6 +84,24 @@ class remote extends \phpbb\avatar\driver\driver
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event to make custom validation of avatar upload
|
||||
*
|
||||
* @event core.ucp_profile_avatar_upload_validation
|
||||
* @var string $url Image url
|
||||
* @var string $width Image width
|
||||
* @var string $height Image height
|
||||
* @var array $error Error message array
|
||||
* @since 3.2.6-RC1
|
||||
*/
|
||||
$vars = array('url', 'width', 'height', 'error');
|
||||
extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_upload_validation', compact($vars)));
|
||||
|
||||
if (!empty($error))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if this url looks alright
|
||||
// Do not allow specifying the port (see RFC 3986) or IP addresses
|
||||
if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.('. implode('|', $this->allowed_extensions) . ')$#i', $url) ||
|
||||
|
Reference in New Issue
Block a user