Completed
Push — 1.10.x ( 986d2b...f19030 )
by Angel Fernando Quiroz
69:29 queued 19:50
created
main/inc/lib/usermanager.lib.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     const USER_FIELD_TYPE_TIMEZONE = 11;
35 35
     const USER_FIELD_TYPE_SOCIAL_PROFILE = 12;
36 36
     const USER_FIELD_TYPE_FILE = 13;
37
-    const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER  = 14;
37
+    const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14;
38 38
 
39 39
     private static $encryptionMethod;
40 40
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         }
281 281
 
282 282
         if (empty($password)) {
283
-            Display::addFlash(Display::return_message(get_lang('ThisFieldIsRequired').': '.get_lang('Password') , 'warning'));
283
+            Display::addFlash(Display::return_message(get_lang('ThisFieldIsRequired').': '.get_lang('Password'), 'warning'));
284 284
 
285 285
             return false;
286 286
         }
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         $res = Database::query($sql);
487 487
         while ($course = Database::fetch_object($res)) {
488 488
             $sql = "SELECT id FROM $table_course_user
489
-                    WHERE status=1 AND c_id = " . intval($course->c_id);
489
+                    WHERE status=1 AND c_id = ".intval($course->c_id);
490 490
             $res2 = Database::query($sql);
491 491
             if (Database::num_rows($res2) == 1) {
492 492
 
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
         $sql = "UPDATE $table_user SET active = 1 WHERE id IN ($ids)";
751 751
         $r = Database::query($sql);
752 752
         if ($r !== false) {
753
-            Event::addEvent(LOG_USER_ENABLE,LOG_USER_ID,$ids);
753
+            Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $ids);
754 754
         }
755 755
         return $r;
756 756
     }
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
             // 1. Conversion of unacceptable letters (latinian letters with accents for example) into ASCII letters in order they not to be totally removed.
1157 1157
             // 2. Applying the strict purifier.
1158 1158
             // 3. Length limitation.
1159
-            $return  = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH);
1159
+            $return = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH);
1160 1160
             $return = URLify::transliterate($return);
1161 1161
             return $return;
1162 1162
         }
@@ -1248,12 +1248,12 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
         if (!is_null($order)) {
1250 1250
             $order = Database::escape_string($order);
1251
-            $sql .= ' ORDER BY ' . $order;
1251
+            $sql .= ' ORDER BY '.$order;
1252 1252
         }
1253 1253
 
1254 1254
         if (!is_null($limit)) {
1255 1255
             $limit = Database::escape_string($limit);
1256
-            $sql .= ' LIMIT ' . $limit;
1256
+            $sql .= ' LIMIT '.$limit;
1257 1257
         }
1258 1258
 
1259 1259
         $rs = Database::query($sql);
@@ -1346,11 +1346,11 @@  discard block
 block discarded – undo
1346 1346
             }
1347 1347
 
1348 1348
             if (api_is_multiple_url_enabled()) {
1349
-                $sql_query .= ' AND auru.access_url_id = ' . api_get_current_access_url_id();
1349
+                $sql_query .= ' AND auru.access_url_id = '.api_get_current_access_url_id();
1350 1350
             }
1351 1351
         } else {
1352 1352
             if (api_is_multiple_url_enabled()) {
1353
-                $sql_query .= ' WHERE auru.access_url_id = ' . api_get_current_access_url_id();
1353
+                $sql_query .= ' WHERE auru.access_url_id = '.api_get_current_access_url_id();
1354 1354
             }
1355 1355
         }
1356 1356
         if (count($order_by) > 0) {
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
             // In exceptional cases, on some portals, the intermediate base user
1450 1450
             // directory might not have been created. Make sure it is before
1451 1451
             // going further.
1452
-            $rootPath = api_get_path(SYS_UPLOAD_PATH) . 'users/' . substr((string) $id, 0, 1);
1452
+            $rootPath = api_get_path(SYS_UPLOAD_PATH).'users/'.substr((string) $id, 0, 1);
1453 1453
             if (!is_dir($rootPath)) {
1454 1454
                 $perm = api_get_permissions_for_new_directories();
1455 1455
                 try {
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
         $path_info = self::get_user_picture_path_by_id($user_id, 'system');
1702 1702
         $path = $path_info['dir'];
1703 1703
         if (!empty($extra_field)) {
1704
-            $path .= $extra_field . '/';
1704
+            $path .= $extra_field.'/';
1705 1705
         }
1706 1706
         // If this directory does not exist - we create it.
1707 1707
         if (!file_exists($path)) {
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
         }
1710 1710
 
1711 1711
         if (filter_extension($file)) {
1712
-            if (@move_uploaded_file($source_file,$path.$file)) {
1712
+            if (@move_uploaded_file($source_file, $path.$file)) {
1713 1713
                 if ($extra_field) {
1714 1714
                     return $extra_field.'/'.$file;
1715 1715
                 } else {
@@ -1962,10 +1962,10 @@  discard block
 block discarded – undo
1962 1962
         if (count($extra_files) > 0) {
1963 1963
             $extra_file_list = '<div class="files-production"><ul id="productions">';
1964 1964
             foreach ($extra_files as $file) {
1965
-                $filename = substr($file,strlen($extra_field)+1);
1965
+                $filename = substr($file, strlen($extra_field) + 1);
1966 1966
                 $extra_file_list .= '<li>'.Display::return_icon('archive.png').'<a href="'.$path.$extra_field.'/'.urlencode($filename).'" target="_blank">'.htmlentities($filename).'</a> ';
1967 1967
                 if ($showdelete) {
1968
-                    $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_' . $extra_field . '['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>';
1968
+                    $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_'.$extra_field.'['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>';
1969 1969
                 }
1970 1970
             }
1971 1971
             $extra_file_list .= '</ul></div>';
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
 
2562 2562
         if (api_is_allowed_to_create_course()) {
2563 2563
             $sessionListFromCourseCoach = array();
2564
-            $sql =" SELECT DISTINCT session_id
2564
+            $sql = " SELECT DISTINCT session_id
2565 2565
                     FROM $tbl_session_course_user
2566 2566
                     WHERE user_id = $user_id AND status = 2 ";
2567 2567
 
@@ -2569,7 +2569,7 @@  discard block
 block discarded – undo
2569 2569
             if (Database::num_rows($result)) {
2570 2570
                 $result = Database::store_result($result);
2571 2571
                 foreach ($result as $session) {
2572
-                    $sessionListFromCourseCoach[]= $session['session_id'];
2572
+                    $sessionListFromCourseCoach[] = $session['session_id'];
2573 2573
                 }
2574 2574
             }
2575 2575
             if (!empty($sessionListFromCourseCoach)) {
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
                 ORDER BY access_start_date, access_end_date, name";
2593 2593
 
2594 2594
         $result = Database::query($sql);
2595
-        if (Database::num_rows($result)>0) {
2595
+        if (Database::num_rows($result) > 0) {
2596 2596
             while ($row = Database::fetch_assoc($result)) {
2597 2597
                 $sessions[$row['id']] = $row;
2598 2598
             }
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
                 ORDER BY access_start_date, access_end_date, name";
2609 2609
 
2610 2610
         $result = Database::query($sql);
2611
-        if (Database::num_rows($result)>0) {
2611
+        if (Database::num_rows($result) > 0) {
2612 2612
             while ($row = Database::fetch_assoc($result)) {
2613 2613
                 if (empty($sessions[$row['id']])) {
2614 2614
                     $sessions[$row['id']] = $row;
@@ -3600,13 +3600,13 @@  discard block
 block discarded – undo
3600 3600
         $useExtraFields = false;
3601 3601
         $extraFields = UserManager::get_extra_filtrable_fields();
3602 3602
         $extraFieldResult = array();
3603
-        if (is_array($extraFields) && count($extraFields)>0 ) {
3603
+        if (is_array($extraFields) && count($extraFields) > 0) {
3604 3604
             foreach ($extraFields as $extraField) {
3605 3605
                 $varName = 'field_'.$extraField['variable'];
3606 3606
                 if (UserManager::is_extra_field_available($extraField['variable'])) {
3607
-                    if (isset($_GET[$varName]) && $_GET[$varName]!='0') {
3607
+                    if (isset($_GET[$varName]) && $_GET[$varName] != '0') {
3608 3608
                         $useExtraFields = true;
3609
-                        $extraFieldResult[]= UserManager::get_extra_user_data_by_value(
3609
+                        $extraFieldResult[] = UserManager::get_extra_user_data_by_value(
3610 3610
                             $extraField['variable'],
3611 3611
                             $_GET[$varName]
3612 3612
                         );
@@ -3617,17 +3617,17 @@  discard block
 block discarded – undo
3617 3617
 
3618 3618
         if ($useExtraFields) {
3619 3619
             $finalResult = array();
3620
-            if (count($extraFieldResult)>1) {
3621
-                for ($i=0; $i < count($extraFieldResult) -1; $i++) {
3622
-                if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i+1])) {
3623
-                        $finalResult  = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]);
3620
+            if (count($extraFieldResult) > 1) {
3621
+                for ($i = 0; $i < count($extraFieldResult) - 1; $i++) {
3622
+                if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i + 1])) {
3623
+                        $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i + 1]);
3624 3624
                     }
3625 3625
                 }
3626 3626
             } else {
3627 3627
                 $finalResult = $extraFieldResult[0];
3628 3628
             }
3629 3629
 
3630
-            if (is_array($finalResult) && count($finalResult)>0) {
3630
+            if (is_array($finalResult) && count($finalResult) > 0) {
3631 3631
                 $whereFilter = " AND u.id IN  ('".implode("','", $finalResult)."') ";
3632 3632
             } else {
3633 3633
                 //no results
@@ -3804,7 +3804,7 @@  discard block
 block discarded – undo
3804 3804
             $sql = 'DELETE FROM '.$tbl_my_friend.'
3805 3805
                     WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND friend_user_id='.$friend_id.' '.$extra_condition;
3806 3806
             Database::query($sql);
3807
-            $sql= 'DELETE FROM '.$tbl_my_friend.'
3807
+            $sql = 'DELETE FROM '.$tbl_my_friend.'
3808 3808
                    WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND user_id='.$friend_id.' '.$extra_condition;
3809 3809
             Database::query($sql);
3810 3810
         } else {
@@ -4005,7 +4005,7 @@  discard block
 block discarded – undo
4005 4005
 
4006 4006
         if (!empty($lastConnectionDate)) {
4007 4007
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
4008
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
4008
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
4009 4009
         }
4010 4010
 
4011 4011
         $courseConditions = null;
@@ -4074,7 +4074,7 @@  discard block
 block discarded – undo
4074 4074
                 break;
4075 4075
             case STUDENT_BOSS :
4076 4076
                 $drhConditions = " AND friend_user_id = $userId AND "
4077
-                . "relation_type = " . USER_RELATION_TYPE_BOSS;
4077
+                . "relation_type = ".USER_RELATION_TYPE_BOSS;
4078 4078
                 break;
4079 4079
         }
4080 4080
 
@@ -4166,7 +4166,7 @@  discard block
 block discarded – undo
4166 4166
                     WHERE 
4167 4167
                         friend_user_id = $userId AND 
4168 4168
                         relation_type = $relationType AND 
4169
-                        access_url_id = " . api_get_current_access_url_id();
4169
+                        access_url_id = ".api_get_current_access_url_id();
4170 4170
         } else {
4171 4171
             $sql = "SELECT user_id FROM $userRelUserTable 
4172 4172
                     WHERE friend_user_id = $userId 
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
         if (empty($years)) {
4449 4449
             $years = 1;
4450 4450
         }
4451
-        $inactive_time = $years * 31536000;  //1 year
4451
+        $inactive_time = $years * 31536000; //1 year
4452 4452
         $rs = Database::query($sql);
4453 4453
         if (Database::num_rows($rs) > 0) {
4454 4454
             if ($last_login_date = Database::result($rs, 0, 0)) {
@@ -4581,7 +4581,7 @@  discard block
 block discarded – undo
4581 4581
                         'extra_'.$field_details[1],
4582 4582
                         $field_details[3],
4583 4583
                         $options,
4584
-                        array('id' => 'extra_' . $field_details[1])
4584
+                        array('id' => 'extra_'.$field_details[1])
4585 4585
                     );
4586 4586
 
4587 4587
                     if (!$admin_permissions) {
@@ -4735,7 +4735,7 @@  discard block
 block discarded – undo
4735 4735
                     $extra_field = 'extra_'.$field_details[1];
4736 4736
                     $form->addElement('file', $extra_field, $field_details[3], null, '');
4737 4737
                     if ($extra_file_list = UserManager::build_user_extra_file_list($user_id, $field_details[1], '', true)) {
4738
-                        $form->addElement('static', $extra_field . '_list', null, $extra_file_list);
4738
+                        $form->addElement('static', $extra_field.'_list', null, $extra_file_list);
4739 4739
                     }
4740 4740
                     if ($field_details[7] == 0) {
4741 4741
                         $form->freeze($extra_field);
@@ -4903,7 +4903,7 @@  discard block
 block discarded – undo
4903 4903
         $direction = null,
4904 4904
         $active = null,
4905 4905
         $lastConnectionDate = null
4906
-    ){
4906
+    ) {
4907 4907
         return self::getUsersFollowedByUser(
4908 4908
             $userId,
4909 4909
             $userStatus,
@@ -5110,12 +5110,12 @@  discard block
 block discarded – undo
5110 5110
         if (!empty($_SERVER['HTTPS'])) {
5111 5111
             $url = 'https://secure.gravatar.com/avatar/';
5112 5112
         }
5113
-        $url .= md5( strtolower( trim( $email ) ) );
5113
+        $url .= md5(strtolower(trim($email)));
5114 5114
         $url .= "?s=$s&d=$d&r=$r";
5115
-        if ( $img ) {
5116
-            $url = '<img src="' . $url . '"';
5117
-            foreach ( $atts as $key => $val )
5118
-                $url .= ' ' . $key . '="' . $val . '"';
5115
+        if ($img) {
5116
+            $url = '<img src="'.$url.'"';
5117
+            foreach ($atts as $key => $val)
5118
+                $url .= ' '.$key.'="'.$val.'"';
5119 5119
             $url .= ' />';
5120 5120
         }
5121 5121
         return $url;
Please login to merge, or discard this patch.