1.10.x
Yannick Warnier 11 years ago
parent 527a44f025
commit aacfa6643d
  1. 4
      main/auth/profile.php
  2. 3
      main/inc/lib/api.lib.php
  3. 2
      main/inc/lib/usermanager.lib.php

@ -213,10 +213,10 @@ if (is_profile_editable() && api_get_setting('profile', 'picture') == 'true') {
if (!empty($user_data['picture_uri'])) {
$form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage'));
}
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$allowed_picture_types = api_get_supported_image_extensions();
$form->addRule(
'picture',
get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
get_lang('OnlyImagesAllowed').' ('.implode(', ', $allowed_picture_types).')',
'filetype',
$allowed_picture_types
);

@ -7499,7 +7499,8 @@ function api_get_configuration_value($variable)
*/
function api_get_supported_image_extensions()
{
$supportedImageExtensions = array('jpg', 'jpeg', 'png', 'gif', 'svg');
// jpg can also be called jpeg, jpe, jfif and jif. See https://en.wikipedia.org/wiki/JPEG#JPEG_filename_extensions
$supportedImageExtensions = array('jpg', 'jpeg', 'png', 'gif', 'svg', 'jpe', 'jfif', 'jif');
if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
array_push($supportedImageExtensions, 'webp');
}

@ -1581,7 +1581,7 @@ class UserManager
}
// Validation 2.
$allowed_types = array('jpg', 'jpeg', 'png', 'gif');
$allowed_types = api_get_supported_image_extensions();
$file = str_replace('\\', '/', $file);
$filename = (($pos = strrpos($file, '/')) !== false) ? substr($file, $pos + 1) : $file;
$extension = strtolower(substr(strrchr($filename, '.'), 1));

Loading…
Cancel
Save