aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/avatar
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-12-25 17:40:54 +0100
committerMarc Alexander <admin@m-a-styles.de>2019-12-25 17:40:54 +0100
commit4e2e36df60e3d283d1c6a6e2300db4d5a0045163 (patch)
treef1c3b6bb644437fcd0393313f1d02ad7dc8373b5 /phpBB/phpbb/avatar
parente880d2c12a9b3921177106463e786e18e186430a (diff)
parent4bee15d0fad107f0425c249757945e93009f0459 (diff)
downloadforums-4e2e36df60e3d283d1c6a6e2300db4d5a0045163.tar
forums-4e2e36df60e3d283d1c6a6e2300db4d5a0045163.tar.gz
forums-4e2e36df60e3d283d1c6a6e2300db4d5a0045163.tar.bz2
forums-4e2e36df60e3d283d1c6a6e2300db4d5a0045163.tar.xz
forums-4e2e36df60e3d283d1c6a6e2300db4d5a0045163.zip
Merge pull request #5564 from xchwarze/PHPBB3-16015
[ticket/16015] Add new hook core.ucp_profile_avatar_upload_validation
Diffstat (limited to 'phpBB/phpbb/avatar')
-rw-r--r--phpBB/phpbb/avatar/driver/remote.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php
index efc4f5ec0f..b16549ffb7 100644
--- a/phpBB/phpbb/avatar/driver/remote.php
+++ b/phpBB/phpbb/avatar/driver/remote.php
@@ -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) ||