Completed
Push — 1.10.x ( b2efe1...50e584 )
by Angel Fernando Quiroz
46:24
created
main/inc/local.inc.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     $_user['status']  = $uData['status'];
131 131
     Session::write('_user', $_user);
132 132
     Session::erase('conditional_login');
133
-    $uidReset=true;
133
+    $uidReset = true;
134 134
     Event::event_login($_user['user_id']);
135 135
 }
136 136
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
             //is necessary verify check
214 214
             if ($legal_type == 1) {
215
-                if ((isset($_POST['legal_accept']) && $_POST['legal_accept']=='1')) {
215
+                if ((isset($_POST['legal_accept']) && $_POST['legal_accept'] == '1')) {
216 216
                     $legal_option = true;
217 217
                 } else {
218 218
                     $legal_option = false;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
             //no is check option
223 223
             if ($legal_type == 0) {
224
-                $legal_option=true;
224
+                $legal_option = true;
225 225
             }
226 226
 
227 227
             if (isset($_POST['legal_accept_type']) && $legal_option === true) {
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
                  * Process external authentication
515 515
                  * on the basis of the given login name
516 516
                  */
517
-                $loginFailed = true;  // Default initialisation. It could
517
+                $loginFailed = true; // Default initialisation. It could
518 518
                 // change after the external authentication
519 519
                 $key = $uData['auth_source']; //'ldap','shibboleth'...
520 520
                 /* >>>>>>>> External authentication modules <<<<<<<<< */
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
             }
534 534
         } else {
535 535
             // login failed, Database::num_rows($result) <= 0
536
-            $loginFailed = true;  // Default initialisation. It could
536
+            $loginFailed = true; // Default initialisation. It could
537 537
             // change after the external authentication
538 538
 
539 539
             /*
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
                         include_once($thisAuthSource['newUser']);
560 560
                     } else {
561 561
                         error_log(
562
-                            'Chamilo Authentication external file' .
562
+                            'Chamilo Authentication external file'.
563 563
                             ' could not be found - this might prevent your system from using'.
564 564
                             ' the authentication process in the user creation process',
565 565
                             0
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
             online_logout(null, false);
669 669
             $osso->logout(); //redirects and exits
670 670
         }
671
-    } elseif (api_get_setting('openid_authentication')=='true') {
671
+    } elseif (api_get_setting('openid_authentication') == 'true') {
672 672
         if (!empty($_POST['openid_url'])) {
673 673
             include api_get_path(SYS_CODE_PATH).'auth/openid/login.php';
674 674
             openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php');
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             if ($res['status'] == 'success') {
682 682
                 $id1 = Database::escape_string($res['openid.identity']);
683 683
                 //have another id with or without the final '/'
684
-                $id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/');
684
+                $id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/');
685 685
                 //lookup the user in the main database
686 686
                 $user_table = Database::get_main_table(TABLE_MAIN_USER);
687 687
                 $sql = "SELECT user_id, username, password, auth_source, active, expiration_date
@@ -690,14 +690,14 @@  discard block
 block discarded – undo
690 690
                         OR openid = '$id2' ";
691 691
                 $result = Database::query($sql);
692 692
                 if ($result !== false) {
693
-                    if (Database::num_rows($result)>0) {
693
+                    if (Database::num_rows($result) > 0) {
694 694
                         $uData = Database::fetch_array($result);
695 695
 
696 696
                         if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
697 697
                             //the authentification of this user is managed by Chamilo itself
698 698
 
699 699
                             // check if the account is active (not locked)
700
-                            if ($uData['active']=='1') {
700
+                            if ($uData['active'] == '1') {
701 701
                                 // check if the expiration date has not been reached
702 702
                                 if ($uData['expiration_date'] > date('Y-m-d H:i:s')
703 703
                                     || empty($uData['expiration_date'])
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
     (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid']))
776 776
 ) {
777 777
     $cidReset = true;
778
-    $gidReset = true;    // As groups depend from courses, group id is reset
778
+    $gidReset = true; // As groups depend from courses, group id is reset
779 779
 }
780 780
 
781 781
 /* USER INIT */
@@ -925,8 +925,8 @@  discard block
 block discarded – undo
925 925
             $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
926 926
 
927 927
             if (!empty($_GET['id_session'])) {
928
-                $sql = 'SELECT name FROM '.$tbl_session . '
929
-                        WHERE id="'.intval($_GET['id_session']) . '"';
928
+                $sql = 'SELECT name FROM '.$tbl_session.'
929
+                        WHERE id="'.intval($_GET['id_session']).'"';
930 930
                 $rs = Database::query($sql);
931 931
                 if (Database::num_rows($rs)) {
932 932
                     list($_SESSION['session_name']) = Database::fetch_array(
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
         // Moreover, if we want to track a course with another session it can be usefull
1017 1017
         if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) {
1018 1018
             $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
1019
-            $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"';
1019
+            $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"';
1020 1020
             $rs = Database::query($sql);
1021 1021
             if (Database::num_rows($rs)) {
1022 1022
                 list($_SESSION['session_name']) = Database::fetch_array($rs);
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
         if (Database::num_rows($result) > 0) { // this  user have a recorded state for this course
1098 1098
             $cuData = Database::fetch_array($result, 'ASSOC');
1099 1099
 
1100
-            $is_courseAdmin = (bool)($cuData['status'] == 1);
1101
-            $is_courseTutor = (bool)($cuData['is_tutor'] == 1);
1100
+            $is_courseAdmin = (bool) ($cuData['status'] == 1);
1101
+            $is_courseTutor = (bool) ($cuData['is_tutor'] == 1);
1102 1102
             $is_courseMember = true;
1103 1103
         }
1104 1104
 
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
                 // This user has no status related to this course
1110 1110
                 // The user is subscribed in a session? The user is a Session coach a Session admin ?
1111 1111
 
1112
-                $tbl_session  = Database :: get_main_table(TABLE_MAIN_SESSION);
1112
+                $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
1113 1113
                 $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
1114 1114
                 $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1115 1115
 
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 
1223 1223
             //If I'm the admin platform i'm a teacher of the course
1224 1224
             if ($is_platformAdmin) {
1225
-                $is_courseAdmin     = true;
1225
+                $is_courseAdmin = true;
1226 1226
             }
1227 1227
         }
1228 1228
     } else { // keys missing => not anymore in the course - user relation
@@ -1380,12 +1380,12 @@  discard block
 block discarded – undo
1380 1380
     ($logging_in && exist_firstpage_parameter())
1381 1381
 ) {
1382 1382
     $redirectCourseDir = api_get_firstpage_parameter();
1383
-    api_delete_firstpage_parameter();    // delete the cookie
1383
+    api_delete_firstpage_parameter(); // delete the cookie
1384 1384
 
1385 1385
     if (!isset($_SESSION['request_uri'])) {
1386 1386
         if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1387 1387
             $_SESSION['noredirection'] = false;
1388
-            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1388
+            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1389 1389
         }
1390 1390
     }
1391 1391
 } elseif (api_user_is_login() && exist_firstpage_parameter()) {
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
     api_delete_firstpage_parameter(); // delete the cookie
1394 1394
     if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1395 1395
         $_SESSION['noredirection'] = false;
1396
-        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1396
+        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1397 1397
     }
1398 1398
 }
1399 1399
 
Please login to merge, or discard this patch.