Completed
Push — 1.10.x ( f2aaaf...ef00db )
by Yannick
241:15 queued 197:35
created
main/auth/external_login/facebook-php-sdk/autoload.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 
31 31
 if (version_compare(PHP_VERSION, '5.4.0', '<')) {
32
-  throw new Exception('The Facebook SDK v4 requires PHP version 5.4 or higher.');
32
+    throw new Exception('The Facebook SDK v4 requires PHP version 5.4 or higher.');
33 33
 }
34 34
 
35 35
 /**
@@ -42,29 +42,29 @@  discard block
 block discarded – undo
42 42
  */
43 43
 spl_autoload_register(function ($class)
44 44
 {
45
-  // project-specific namespace prefix
46
-  $prefix = 'Facebook\\';
45
+    // project-specific namespace prefix
46
+    $prefix = 'Facebook\\';
47 47
 
48
-  // base directory for the namespace prefix
49
-  $base_dir = defined('FACEBOOK_SDK_V4_SRC_DIR') ? FACEBOOK_SDK_V4_SRC_DIR : __DIR__ . '/src/Facebook/';
48
+    // base directory for the namespace prefix
49
+    $base_dir = defined('FACEBOOK_SDK_V4_SRC_DIR') ? FACEBOOK_SDK_V4_SRC_DIR : __DIR__ . '/src/Facebook/';
50 50
 
51
-  // does the class use the namespace prefix?
52
-  $len = strlen($prefix);
53
-  if (strncmp($prefix, $class, $len) !== 0) {
51
+    // does the class use the namespace prefix?
52
+    $len = strlen($prefix);
53
+    if (strncmp($prefix, $class, $len) !== 0) {
54 54
     // no, move to the next registered autoloader
55 55
     return;
56
-  }
56
+    }
57 57
 
58
-  // get the relative class name
59
-  $relative_class = substr($class, $len);
58
+    // get the relative class name
59
+    $relative_class = substr($class, $len);
60 60
 
61
-  // replace the namespace prefix with the base directory, replace namespace
62
-  // separators with directory separators in the relative class name, append
63
-  // with .php
64
-  $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
61
+    // replace the namespace prefix with the base directory, replace namespace
62
+    // separators with directory separators in the relative class name, append
63
+    // with .php
64
+    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
65 65
 
66
-  // if the file exists, require it
67
-  if (file_exists($file)) {
66
+    // if the file exists, require it
67
+    if (file_exists($file)) {
68 68
     require $file;
69
-  }
69
+    }
70 70
 });
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
  * @param string $class The fully-qualified class name.
41 41
  * @return void
42 42
  */
43
-spl_autoload_register(function ($class)
43
+spl_autoload_register(function($class)
44 44
 {
45 45
   // project-specific namespace prefix
46 46
   $prefix = 'Facebook\\';
47 47
 
48 48
   // base directory for the namespace prefix
49
-  $base_dir = defined('FACEBOOK_SDK_V4_SRC_DIR') ? FACEBOOK_SDK_V4_SRC_DIR : __DIR__ . '/src/Facebook/';
49
+  $base_dir = defined('FACEBOOK_SDK_V4_SRC_DIR') ? FACEBOOK_SDK_V4_SRC_DIR : __DIR__.'/src/Facebook/';
50 50
 
51 51
   // does the class use the namespace prefix?
52 52
   $len = strlen($prefix);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
   // replace the namespace prefix with the base directory, replace namespace
62 62
   // separators with directory separators in the relative class name, append
63 63
   // with .php
64
-  $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
64
+  $file = $base_dir.str_replace('\\', '/', $relative_class).'.php';
65 65
 
66 66
   // if the file exists, require it
67 67
   if (file_exists($file)) {
Please login to merge, or discard this patch.
main/auth/external_login/facebook.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
  * Please edit the facebook.conf.php file to adapt it to your fb application parameter
12 12
  */
13 13
 
14
-require_once dirname(__FILE__) . '/../../inc/global.inc.php';
15
-require_once dirname(__FILE__) . '/facebook.init.php';
16
-require_once dirname(__FILE__) . '/facebook-php-sdk/autoload.php';
14
+require_once dirname(__FILE__).'/../../inc/global.inc.php';
15
+require_once dirname(__FILE__).'/facebook.init.php';
16
+require_once dirname(__FILE__).'/facebook-php-sdk/autoload.php';
17 17
 
18 18
 use Facebook\FacebookSession;
19 19
 use Facebook\FacebookRedirectLoginHelper;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 use Facebook\HttpClients\FacebookCurlHttpClient;
28 28
 use Facebook\HttpClients\FacebookHttpable;
29 29
 
30
-require_once dirname(__FILE__) . '/functions.inc.php';
30
+require_once dirname(__FILE__).'/functions.inc.php';
31 31
 
32 32
 // dont rename $facebook_config to $facebookConfig otherwise get a "Facebook\\FacebookSDKException"
33 33
 FacebookSession::setDefaultApplication($facebook_config['appId'], $facebook_config['secret']);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $locale = $graphObject->getProperty('locale');
58 58
             $language = facebookPluginGetLanguage($locale);
59 59
             if (!$language) {
60
-                $language='en_US';
60
+                $language = 'en_US';
61 61
             }
62 62
 
63 63
             //Checks if user already exists in chamilo
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                     $_user['user_id'] = $chamilo_uid;
86 86
                     $_user['uidReset'] = true;
87 87
                     $_SESSION['_user'] = $_user;
88
-                    header('Location:' . api_get_path(WEB_PATH));
88
+                    header('Location:'.api_get_path(WEB_PATH));
89 89
                     exit();
90 90
                 } else {
91 91
                     return false;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 $_user['user_id'] = $chamilo_uid;
99 99
                 $_user['uidReset'] = true;
100 100
                 $_SESSION['_user'] = $_user;
101
-                header('Location:' . api_get_path(WEB_PATH));
101
+                header('Location:'.api_get_path(WEB_PATH));
102 102
                 exit();
103 103
             }
104 104
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 {
118 118
     global $facebook_config;
119 119
     $helper = new FacebookRedirectLoginHelper($facebook_config['return_url']);
120
-    $loginUrl =   $helper->getLoginUrl(
120
+    $loginUrl = $helper->getLoginUrl(
121 121
         array('scope' => 'email')
122 122
     );
123 123
 
Please login to merge, or discard this patch.
main/auth/external_login/login.ws.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $wsUrl = '';
15 15
 
16 16
 // include common authentication functions
17
-require_once dirname(__FILE__) . '/functions.inc.php';
17
+require_once dirname(__FILE__).'/functions.inc.php';
18 18
 // call the login checker (defined below)
19 19
 $isValid = loginWSAuthenticate($login, $password, $wsUrl);
20 20
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
     $key = '-+*%$({[]})$%*+-';
62 62
     // Complete password con PKCS7-specific padding
63 63
     $blockSize = 16;
64
-    $padding = $blockSize - (strlen($password)%$blockSize);
65
-    $password .= str_repeat(chr($padding),$padding);
64
+    $padding = $blockSize - (strlen($password) % $blockSize);
65
+    $password .= str_repeat(chr($padding), $padding);
66 66
     $cipher = new Crypt_AES(CRYPT_AES_MODE_CFB);
67 67
     $cipher->setKeyLength(128);
68 68
     $cipher->setKey($key);
Please login to merge, or discard this patch.
main/auth/external_login/updateUser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 use ChamiloSession as Session;
9 9
 
10
-require_once(dirname(__FILE__) . '/functions.inc.php');
10
+require_once(dirname(__FILE__).'/functions.inc.php');
11 11
 
12 12
 //MAIN CODE
13 13
 //$uData variable is set in local.inc.php
@@ -36,6 +36,6 @@  discard block
 block discarded – undo
36 36
     //User cannot login
37 37
     $loginFailed = true;
38 38
     Session::erase('_uid');
39
-    header('Location: ' . api_get_path(WEB_PATH) . 'index.php?loginFailed=1&error=user_password_incorrect');
39
+    header('Location: '.api_get_path(WEB_PATH).'index.php?loginFailed=1&error=user_password_incorrect');
40 40
     exit;
41 41
 }
Please login to merge, or discard this patch.
main/auth/external_login/newUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
 use ChamiloSession as Session;
12 12
 
13
-require_once(dirname(__FILE__) . '/functions.inc.php');
13
+require_once(dirname(__FILE__).'/functions.inc.php');
14 14
 
15 15
 //MAIN CODE
16 16
 //$login and $password variables are setted in main/inc/local.inc.php
Please login to merge, or discard this patch.
main/auth/external_login/ldap_import_all_users.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
 }
14 14
 use \ChamiloSession as Session;
15 15
 
16
-require dirname(__FILE__) . '/../../inc/global.inc.php';
17
-require dirname(__FILE__) . '/ldap.inc.php';
18
-require dirname(__FILE__) . '/../../inc/conf/auth.conf.php';
16
+require dirname(__FILE__).'/../../inc/global.inc.php';
17
+require dirname(__FILE__).'/ldap.inc.php';
18
+require dirname(__FILE__).'/../../inc/conf/auth.conf.php';
19 19
 /**
20 20
  * Code execution
21 21
  */
Please login to merge, or discard this patch.
main/auth/external_login/newUser.ldap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
 
40 40
 use ChamiloSession as Session;
41 41
 
42
-require_once dirname(__FILE__) . '/ldap.inc.php';
43
-require_once dirname(__FILE__) . '/functions.inc.php';
42
+require_once dirname(__FILE__).'/ldap.inc.php';
43
+require_once dirname(__FILE__).'/functions.inc.php';
44 44
 
45 45
 $ldap_user = extldap_authenticate($login, $password);
46 46
 if ($ldap_user !== false) {
Please login to merge, or discard this patch.
main/auth/ldap/login.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@
 block discarded – undo
28 28
 $loginLdapSucces = ldap_login($login, $password);
29 29
 
30 30
 if ($loginLdapSucces) {
31
-	$loginFailed = false;
32
-	$uidReset = true;
33
-	$_user['user_id'] = $uData['user_id'];
34
-	Session::write('_uid',$_uid);
31
+    $loginFailed = false;
32
+    $uidReset = true;
33
+    $_user['user_id'] = $uData['user_id'];
34
+    Session::write('_uid',$_uid);
35 35
     // Jand: copied from event_login in events.lib.php to enable login statistics:
36
-	Event::event_login($uData['user_id']);
36
+    Event::event_login($uData['user_id']);
37 37
 } else {
38
-	$loginFailed = true;
39
-	unset($_user['user_id']);
40
-	$uidReset = false;
38
+    $loginFailed = true;
39
+    unset($_user['user_id']);
40
+    $uidReset = false;
41 41
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	$loginFailed = false;
32 32
 	$uidReset = true;
33 33
 	$_user['user_id'] = $uData['user_id'];
34
-	Session::write('_uid',$_uid);
34
+	Session::write('_uid', $_uid);
35 35
     // Jand: copied from event_login in events.lib.php to enable login statistics:
36 36
 	Event::event_login($uData['user_id']);
37 37
 } else {
Please login to merge, or discard this patch.
main/auth/sso/sso.class.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct()
36 36
     {
37
-        $this->protocol   = api_get_setting('sso_authentication_protocol');
37
+        $this->protocol = api_get_setting('sso_authentication_protocol');
38 38
         // There can be multiple domains, so make sure to take only the first
39 39
         // This might be later extended with a decision process
40 40
         $domains = explode(',', api_get_setting('sso_authentication_domain'));
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $this->auth_uri = api_get_setting('sso_authentication_auth_uri');
43 43
         $this->deauth_uri = api_get_setting('sso_authentication_unauth_uri');
44 44
         //cut the string to avoid recursive URL construction in case of failure
45
-        $this->referer = $this->protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'sso'));
45
+        $this->referer = $this->protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'sso'));
46 46
         $this->deauth_url = $this->protocol.$this->domain.$this->deauth_uri;
47 47
         $this->master_url = $this->protocol.$this->domain.$this->auth_uri;
48 48
         $this->referrer_uri = base64_encode($_SERVER['REQUEST_URI']);
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
                 ) {
131 131
                     //error_log('user n password are ok');
132 132
                     //Check if the account is active (not locked)
133
-                    if ($uData['active']=='1') {
133
+                    if ($uData['active'] == '1') {
134 134
                         // check if the expiration date has not been reached
135 135
                         if (empty($uData['expiration_date'])
136 136
                             or $uData['expiration_date'] > date('Y-m-d H:i:s')
137
-                            or $uData['expiration_date']=='0000-00-00 00:00:00') {
137
+                            or $uData['expiration_date'] == '0000-00-00 00:00:00') {
138 138
 
139 139
                             //If Multiple URL is enabled
140 140
                             if (api_get_multiple_access_url()) {
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
                                             // the user credentials are OK, which
169 169
                                             // should be protection enough
170 170
                                             // against evil URL spoofing...
171
-                                            $sso_target = api_get_path(WEB_PATH) . base64_decode($sso['ruri']);
171
+                                            $sso_target = api_get_path(WEB_PATH).base64_decode($sso['ruri']);
172 172
                                         } else {
173
-                                            $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) . 'index.php';
173
+                                            $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH).'index.php';
174 174
                                         }
175
-                                        header('Location: '. $sso_target);
175
+                                        header('Location: '.$sso_target);
176 176
                                         exit;
177 177
                                     } else {
178 178
                                         // user does not have permission for this site
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
         $userId = intval($userId);
287 287
 
288 288
         if ($asAdmin && api_is_platform_admin(true)) {
289
-            return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId";
289
+            return api_get_path(WEB_CODE_PATH)."admin/user_edit.php?user_id=$userId";
290 290
         }
291 291
 
292
-        return api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
292
+        return api_get_path(WEB_CODE_PATH).'auth/profile.php';
293 293
     }
294 294
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 
91 91
     /**
92 92
      * Validates the received active connection data with the database
93
-     * @return	bool	Return the loginFailed variable value to local.inc.php
93
+     * @return	null|false	Return the loginFailed variable value to local.inc.php
94 94
      */
95 95
     public function check_user()
96 96
     {
Please login to merge, or discard this patch.