Yannick Warnier 9 years ago
parent
commit
aacfa6643d
3 changed files with 5 additions and 4 deletions
  1. 2 2
      main/auth/profile.php
  2. 2 1
      main/inc/lib/api.lib.php
  3. 1 1
      main/inc/lib/usermanager.lib.php

+ 2 - 2
main/auth/profile.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
     );

+ 2 - 1
main/inc/lib/api.lib.php

@@ -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');
     }

+ 1 - 1
main/inc/lib/usermanager.lib.php

@@ -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));