aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorDSR! <xchwarze@gmail.com>2019-04-13 21:57:04 -0300
committerDSR! <xchwarze@gmail.com>2019-04-14 19:36:17 -0300
commitb8de0fc47e85fa226dc5723d09a141ef4b1d67f2 (patch)
tree5c4389ead16f88b5a8aea16b63198d3977f229eb /phpBB/phpbb
parent507efee633fee769e7e2af4a2b298c951193f800 (diff)
downloadforums-b8de0fc47e85fa226dc5723d09a141ef4b1d67f2.tar
forums-b8de0fc47e85fa226dc5723d09a141ef4b1d67f2.tar.gz
forums-b8de0fc47e85fa226dc5723d09a141ef4b1d67f2.tar.bz2
forums-b8de0fc47e85fa226dc5723d09a141ef4b1d67f2.tar.xz
forums-b8de0fc47e85fa226dc5723d09a141ef4b1d67f2.zip
[ticket/16015] Add new hook core.ucp_profile_avatar_upload_validation
PHPBB3-16015
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/avatar/driver/remote.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php
index efc4f5ec0f..69402f39b2 100644
--- a/phpBB/phpbb/avatar/driver/remote.php
+++ b/phpBB/phpbb/avatar/driver/remote.php
@@ -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) ||