Explorar el Código

Update methods in UserManager to add better filtering

Yannick Warnier hace 11 años
padre
commit
8b9110539f
Se han modificado 1 ficheros con 9 adiciones y 0 borrados
  1. 9 0
      main/inc/lib/usermanager.lib.php

+ 9 - 0
main/inc/lib/usermanager.lib.php

@@ -715,6 +715,9 @@ class UserManager
      */
      */
     public static function disable($user_id)
     public static function disable($user_id)
     {
     {
+        if (empty($user_id)) {
+            return false;
+        }
         self::change_active_state($user_id, 0);
         self::change_active_state($user_id, 0);
     }
     }
 
 
@@ -726,6 +729,9 @@ class UserManager
      */
      */
     public static function enable($user_id)
     public static function enable($user_id)
     {
     {
+        if (empty($user_id)) {
+            return false;
+        }
         self::change_active_state($user_id, 1);
         self::change_active_state($user_id, 1);
     }
     }
 
 
@@ -797,6 +803,9 @@ class UserManager
         if (is_null($language)) {
         if (is_null($language)) {
             $language = api_get_interface_language();
             $language = api_get_interface_language();
         }
         }
+        if (empty($firstname) && empty($lastname)) {
+            return false;
+        }
         $firstname = api_substr(preg_replace(USERNAME_PURIFIER, '', api_transliterate($firstname, '', $encoding)), 0, 1); // The first letter only.
         $firstname = api_substr(preg_replace(USERNAME_PURIFIER, '', api_transliterate($firstname, '', $encoding)), 0, 1); // The first letter only.
         //Looking for a space in the lastname
         //Looking for a space in the lastname
         $pos = api_strpos($lastname, ' ');
         $pos = api_strpos($lastname, ' ');