Passed
Push — 1.10.x ( ffa1de...5c22eb )
by Yannick
1010:23 queued 946:48
created
main/inc/lib/usermanager.lib.php 1 patch
Spacing   +37 added lines, -37 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
         }
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
         $res = Database::query($sql);
494 494
         while ($course = Database::fetch_object($res)) {
495 495
             $sql = "SELECT id FROM $table_course_user
496
-                    WHERE status=1 AND c_id = " . Database::escape_string($course->c_id);
496
+                    WHERE status=1 AND c_id = ".Database::escape_string($course->c_id);
497 497
             $res2 = Database::query($sql);
498 498
             if (Database::num_rows($res2) == 1) {
499 499
                 return false;
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         $sql = "UPDATE $table_user SET active = 1 WHERE id IN ($ids)";
759 759
         $r = Database::query($sql);
760 760
         if ($r !== false) {
761
-            Event::addEvent(LOG_USER_ENABLE,LOG_USER_ID,$ids);
761
+            Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $ids);
762 762
         }
763 763
         return $r;
764 764
     }
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
             // 1. Conversion of unacceptable letters (latinian letters with accents for example) into ASCII letters in order they not to be totally removed.
1163 1163
             // 2. Applying the strict purifier.
1164 1164
             // 3. Length limitation.
1165
-            $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);
1165
+            $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);
1166 1166
             $return = URLify::transliterate($return);
1167 1167
             return $return;
1168 1168
         }
@@ -1254,12 +1254,12 @@  discard block
 block discarded – undo
1254 1254
 
1255 1255
         if (!is_null($order)) {
1256 1256
             $order = Database::escape_string($order);
1257
-            $sql .= ' ORDER BY ' . $order;
1257
+            $sql .= ' ORDER BY '.$order;
1258 1258
         }
1259 1259
 
1260 1260
         if (!is_null($limit)) {
1261 1261
             $limit = Database::escape_string($limit);
1262
-            $sql .= ' LIMIT ' . $limit;
1262
+            $sql .= ' LIMIT '.$limit;
1263 1263
         }
1264 1264
 
1265 1265
         $rs = Database::query($sql);
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
             // In exceptional cases, on some portals, the intermediate base user
1433 1433
             // directory might not have been created. Make sure it is before
1434 1434
             // going further.
1435
-            $rootPath = api_get_path(SYS_UPLOAD_PATH) . 'users/' . substr((string) $id, 0, 1);
1435
+            $rootPath = api_get_path(SYS_UPLOAD_PATH).'users/'.substr((string) $id, 0, 1);
1436 1436
             if (!is_dir($rootPath)) {
1437 1437
                 $perm = api_get_permissions_for_new_directories();
1438 1438
                 try {
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
         $path_info = self::get_user_picture_path_by_id($user_id, 'system');
1686 1686
         $path = $path_info['dir'];
1687 1687
         if (!empty($extra_field)) {
1688
-            $path .= $extra_field . '/';
1688
+            $path .= $extra_field.'/';
1689 1689
         }
1690 1690
         // If this directory does not exist - we create it.
1691 1691
         if (!file_exists($path)) {
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
         }
1694 1694
 
1695 1695
         if (filter_extension($file)) {
1696
-            if (@move_uploaded_file($source_file,$path.$file)) {
1696
+            if (@move_uploaded_file($source_file, $path.$file)) {
1697 1697
                 if ($extra_field) {
1698 1698
                     return $extra_field.'/'.$file;
1699 1699
                 } else {
@@ -1946,10 +1946,10 @@  discard block
 block discarded – undo
1946 1946
         if (count($extra_files) > 0) {
1947 1947
             $extra_file_list = '<div class="files-production"><ul id="productions">';
1948 1948
             foreach ($extra_files as $file) {
1949
-                $filename = substr($file,strlen($extra_field)+1);
1949
+                $filename = substr($file, strlen($extra_field) + 1);
1950 1950
                 $extra_file_list .= '<li>'.Display::return_icon('archive.png').'<a href="'.$path.$extra_field.'/'.urlencode($filename).'" target="_blank">'.htmlentities($filename).'</a> ';
1951 1951
                 if ($showdelete) {
1952
-                    $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>';
1952
+                    $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>';
1953 1953
                 }
1954 1954
             }
1955 1955
             $extra_file_list .= '</ul></div>';
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
 
2536 2536
         if (api_is_allowed_to_create_course()) {
2537 2537
             $sessionListFromCourseCoach = array();
2538
-            $sql =" SELECT DISTINCT session_id
2538
+            $sql = " SELECT DISTINCT session_id
2539 2539
                     FROM $tbl_session_course_user
2540 2540
                     WHERE user_id = $user_id AND status = 2 ";
2541 2541
 
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
             if (Database::num_rows($result)) {
2544 2544
                 $result = Database::store_result($result);
2545 2545
                 foreach ($result as $session) {
2546
-                    $sessionListFromCourseCoach[]= $session['session_id'];
2546
+                    $sessionListFromCourseCoach[] = $session['session_id'];
2547 2547
                 }
2548 2548
             }
2549 2549
             if (!empty($sessionListFromCourseCoach)) {
@@ -2566,7 +2566,7 @@  discard block
 block discarded – undo
2566 2566
                 ORDER BY access_start_date, access_end_date, name";
2567 2567
 
2568 2568
         $result = Database::query($sql);
2569
-        if (Database::num_rows($result)>0) {
2569
+        if (Database::num_rows($result) > 0) {
2570 2570
             while ($row = Database::fetch_assoc($result)) {
2571 2571
                 $sessions[$row['id']] = $row;
2572 2572
             }
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
                 ORDER BY access_start_date, access_end_date, name";
2583 2583
 
2584 2584
         $result = Database::query($sql);
2585
-        if (Database::num_rows($result)>0) {
2585
+        if (Database::num_rows($result) > 0) {
2586 2586
             while ($row = Database::fetch_assoc($result)) {
2587 2587
                 if (empty($sessions[$row['id']])) {
2588 2588
                     $sessions[$row['id']] = $row;
@@ -3571,13 +3571,13 @@  discard block
 block discarded – undo
3571 3571
         $useExtraFields = false;
3572 3572
         $extraFields = UserManager::get_extra_filtrable_fields();
3573 3573
         $extraFieldResult = array();
3574
-        if (is_array($extraFields) && count($extraFields)>0 ) {
3574
+        if (is_array($extraFields) && count($extraFields) > 0) {
3575 3575
             foreach ($extraFields as $extraField) {
3576 3576
                 $varName = 'field_'.$extraField['variable'];
3577 3577
                 if (UserManager::is_extra_field_available($extraField['variable'])) {
3578
-                    if (isset($_GET[$varName]) && $_GET[$varName]!='0') {
3578
+                    if (isset($_GET[$varName]) && $_GET[$varName] != '0') {
3579 3579
                         $useExtraFields = true;
3580
-                        $extraFieldResult[]= UserManager::get_extra_user_data_by_value(
3580
+                        $extraFieldResult[] = UserManager::get_extra_user_data_by_value(
3581 3581
                             $extraField['variable'],
3582 3582
                             $_GET[$varName]
3583 3583
                         );
@@ -3588,17 +3588,17 @@  discard block
 block discarded – undo
3588 3588
 
3589 3589
         if ($useExtraFields) {
3590 3590
             $finalResult = array();
3591
-            if (count($extraFieldResult)>1) {
3592
-                for ($i=0; $i < count($extraFieldResult) -1; $i++) {
3593
-                    if (is_array($extraFieldResult[$i+1])) {
3594
-                        $finalResult  = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]);
3591
+            if (count($extraFieldResult) > 1) {
3592
+                for ($i = 0; $i < count($extraFieldResult) - 1; $i++) {
3593
+                    if (is_array($extraFieldResult[$i + 1])) {
3594
+                        $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i + 1]);
3595 3595
                     }
3596 3596
                 }
3597 3597
             } else {
3598 3598
                 $finalResult = $extraFieldResult[0];
3599 3599
             }
3600 3600
 
3601
-            if (is_array($finalResult) && count($finalResult)>0) {
3601
+            if (is_array($finalResult) && count($finalResult) > 0) {
3602 3602
                 $whereFilter = " AND u.id IN  ('".implode("','", $finalResult)."') ";
3603 3603
             } else {
3604 3604
                 //no results
@@ -3771,7 +3771,7 @@  discard block
 block discarded – undo
3771 3771
             $sql = 'DELETE FROM '.$tbl_my_friend.'
3772 3772
                     WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND friend_user_id='.$friend_id.' '.$extra_condition;
3773 3773
             Database::query($sql);
3774
-            $sql= 'DELETE FROM '.$tbl_my_friend.'
3774
+            $sql = 'DELETE FROM '.$tbl_my_friend.'
3775 3775
                    WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND user_id='.$friend_id.' '.$extra_condition;
3776 3776
             Database::query($sql);
3777 3777
         } else {
@@ -3972,7 +3972,7 @@  discard block
 block discarded – undo
3972 3972
 
3973 3973
         if (!empty($lastConnectionDate)) {
3974 3974
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
3975
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
3975
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
3976 3976
         }
3977 3977
 
3978 3978
         $courseConditions = null;
@@ -4039,7 +4039,7 @@  discard block
 block discarded – undo
4039 4039
                 break;
4040 4040
             case STUDENT_BOSS :
4041 4041
                 $drhConditions = " AND friend_user_id = $userId AND "
4042
-                . "relation_type = " . USER_RELATION_TYPE_BOSS;
4042
+                . "relation_type = ".USER_RELATION_TYPE_BOSS;
4043 4043
                 break;
4044 4044
         }
4045 4045
 
@@ -4129,7 +4129,7 @@  discard block
 block discarded – undo
4129 4129
                 . "INNER JOIN $userRelAccessUrlTable a ON (a.user_id = s.user_id) "
4130 4130
                 . "WHERE friend_user_id = $userId "
4131 4131
                 . "AND relation_type = $relationType "
4132
-                . "AND access_url_id = " . api_get_current_access_url_id() . "";
4132
+                . "AND access_url_id = ".api_get_current_access_url_id()."";
4133 4133
         } else {
4134 4134
             $sql = "SELECT user_id FROM $userRelUserTable "
4135 4135
                 . "WHERE friend_user_id = $userId "
@@ -4404,7 +4404,7 @@  discard block
 block discarded – undo
4404 4404
         if (empty($years)) {
4405 4405
             $years = 1;
4406 4406
         }
4407
-        $inactive_time = $years * 31536000;  //1 year
4407
+        $inactive_time = $years * 31536000; //1 year
4408 4408
         $rs = Database::query($sql);
4409 4409
         if (Database::num_rows($rs) > 0) {
4410 4410
             if ($last_login_date = Database::result($rs, 0, 0)) {
@@ -4537,7 +4537,7 @@  discard block
 block discarded – undo
4537 4537
                         'extra_'.$field_details[1],
4538 4538
                         $field_details[3],
4539 4539
                         $options,
4540
-                        array('id' => 'extra_' . $field_details[1])
4540
+                        array('id' => 'extra_'.$field_details[1])
4541 4541
                     );
4542 4542
 
4543 4543
                     if (!$admin_permissions) {
@@ -4691,7 +4691,7 @@  discard block
 block discarded – undo
4691 4691
                     $extra_field = 'extra_'.$field_details[1];
4692 4692
                     $form->addElement('file', $extra_field, $field_details[3], null, '');
4693 4693
                     if ($extra_file_list = UserManager::build_user_extra_file_list($user_id, $field_details[1], '', true)) {
4694
-                        $form->addElement('static', $extra_field . '_list', null, $extra_file_list);
4694
+                        $form->addElement('static', $extra_field.'_list', null, $extra_file_list);
4695 4695
                     }
4696 4696
                     if ($field_details[7] == 0) {
4697 4697
                         $form->freeze($extra_field);
@@ -4831,7 +4831,7 @@  discard block
 block discarded – undo
4831 4831
         $direction = null,
4832 4832
         $active = null,
4833 4833
         $lastConnectionDate = null
4834
-    ){
4834
+    ) {
4835 4835
         return self::getUsersFollowedByUser(
4836 4836
                 $userId, $userStatus, $getOnlyUserId, $getSql, $getCount, $from, $numberItems, $column, $direction,
4837 4837
                 $active, $lastConnectionDate, STUDENT_BOSS
@@ -4998,12 +4998,12 @@  discard block
 block discarded – undo
4998 4998
         if (!empty($_SERVER['HTTPS'])) {
4999 4999
             $url = 'https://secure.gravatar.com/avatar/';
5000 5000
         }
5001
-        $url .= md5( strtolower( trim( $email ) ) );
5001
+        $url .= md5(strtolower(trim($email)));
5002 5002
         $url .= "?s=$s&d=$d&r=$r";
5003
-        if ( $img ) {
5004
-            $url = '<img src="' . $url . '"';
5005
-            foreach ( $atts as $key => $val )
5006
-                $url .= ' ' . $key . '="' . $val . '"';
5003
+        if ($img) {
5004
+            $url = '<img src="'.$url.'"';
5005
+            foreach ($atts as $key => $val)
5006
+                $url .= ' '.$key.'="'.$val.'"';
5007 5007
             $url .= ' />';
5008 5008
         }
5009 5009
         return $url;
Please login to merge, or discard this patch.