1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-13 04:13:29 +02:00

Merge branch '3.2.x' into 3.3.x

This commit is contained in:
Marc Alexander 2019-12-25 17:40:59 +01:00
commit 2ebbcbe233
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -49,6 +49,8 @@ class remote extends \phpbb\avatar\driver\driver
*/
public function process_form($request, $template, $user, $row, &$error)
{
global $phpbb_dispatcher;
$url = $request->variable('avatar_remote_url', '');
$width = $request->variable('avatar_remote_width', 0);
$height = $request->variable('avatar_remote_height', 0);
@ -84,6 +86,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.9-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) ||