@@ -13,9 +13,9 @@ |
||
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 | */ |
@@ -39,8 +39,8 @@ |
||
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) { |
@@ -303,7 +303,7 @@ |
||
303 | 303 | |
304 | 304 | // TODO the password, if encrypted at the source, will be encrypted twice, which makes it useless. Try to fix that. |
305 | 305 | $passwordKey = isset($extldap_user_correspondance['password']) ? $extldap_user_correspondance['password'] : 'userPassword'; |
306 | - $password = $data[$passwordKey][0]; |
|
306 | + $password = $data[$passwordKey][0]; |
|
307 | 307 | |
308 | 308 | // To ease management, we add the step-year (etape-annee) code |
309 | 309 | //$official_code = $etape."-".$annee; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | //Those are the mandatory fields for user creation. |
21 | 21 | //See external_add_user function for all the fields you can have. |
22 | 22 | $table = USERINFO_TABLE; |
23 | - $sql = "SELECT * from $table where username='" . Database::escape_string($login) . "'"; |
|
23 | + $sql = "SELECT * from $table where username='".Database::escape_string($login)."'"; |
|
24 | 24 | $result = Database::query($sql); |
25 | 25 | |
26 | 26 | if (Database::num_rows($result) == 0) { //false password |
@@ -31,7 +31,7 @@ |
||
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 { |
@@ -34,7 +34,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class ssoDrupal |
24 | 24 | { |
25 | - public $protocol; // 'http://', |
|
26 | - public $domain; // 'localhost/project/drupal', |
|
27 | - public $auth_uri; // '/?q=user', |
|
25 | + public $protocol; // 'http://', |
|
26 | + public $domain; // 'localhost/project/drupal', |
|
27 | + public $auth_uri; // '/?q=user', |
|
28 | 28 | public $deauth_uri; // '/?q=logout', |
29 | - public $referer; // http://my.chamilo.com/main/auth/profile.php |
|
29 | + public $referer; // http://my.chamilo.com/main/auth/profile.php |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Instanciates the object, initializing all relevant URL strings |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | && ($sso['username'] == $uData['username'])) { |
124 | 124 | |
125 | 125 | //Check if the account is active (not locked) |
126 | - if ($uData['active']=='1') { |
|
126 | + if ($uData['active'] == '1') { |
|
127 | 127 | // check if the expiration date has not been reached |
128 | - if (empty($uData['expiration_date']) OR $uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date']=='0000-00-00 00:00:00') { |
|
128 | + if (empty($uData['expiration_date']) OR $uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date'] == '0000-00-00 00:00:00') { |
|
129 | 129 | |
130 | 130 | //If Multiple URL is enabled |
131 | 131 | if (api_get_multiple_access_url()) { |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | // the user credentials are OK, which |
159 | 159 | // should be protection enough |
160 | 160 | // against evil URL spoofing... |
161 | - $sso_target = api_get_path(WEB_PATH) . base64_decode($sso['ruri']); |
|
161 | + $sso_target = api_get_path(WEB_PATH).base64_decode($sso['ruri']); |
|
162 | 162 | } else { |
163 | - $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) . 'index.php'; |
|
163 | + $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH).'index.php'; |
|
164 | 164 | } |
165 | - header('Location: '. $sso_target); |
|
165 | + header('Location: '.$sso_target); |
|
166 | 166 | exit; |
167 | 167 | } else { |
168 | 168 | // user does not have permission for this site |
@@ -279,12 +279,12 @@ discard block |
||
279 | 279 | // If this is an administrator, allow him to make some changes in |
280 | 280 | // the Chamilo profile |
281 | 281 | if ($asAdmin && api_is_platform_admin(true)) { |
282 | - return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId"; |
|
282 | + return api_get_path(WEB_CODE_PATH)."admin/user_edit.php?user_id=$userId"; |
|
283 | 283 | } |
284 | 284 | // If the user doesn't match a Drupal user, give the normal profile |
285 | 285 | // link |
286 | 286 | if ($drupalUserIdData === false) { |
287 | - return api_get_path(WEB_CODE_PATH) . 'auth/profile.php'; |
|
287 | + return api_get_path(WEB_CODE_PATH).'auth/profile.php'; |
|
288 | 288 | } |
289 | 289 | // In all other cases, generate a link to the Drupal profile edition |
290 | 290 | $drupalUserId = $drupalUserIdData['value']; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | /* 2.Get the chamilo username and password from your system or from webservices */ |
50 | 50 | |
51 | - $account['username'] = 'jbrion525'; //username in Chamilo |
|
51 | + $account['username'] = 'jbrion525'; //username in Chamilo |
|
52 | 52 | $account['password'] = sha1(sha1('jbrion525')); //encrypted password with assuming that the first encrypted method is sha1 in chamilo |
53 | 53 | |
54 | 54 | $master_auth_uri = $my_chamilo_server.'/?q=user'; |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | $cookie = base64_encode(serialize($sso)); |
67 | - $url = chamilo_sso_protocol() . $master_auth_uri; |
|
68 | - $params = 'sso_referer='. urlencode($url) .'&sso_cookie='. urlencode($cookie); |
|
69 | - $final_url = filter_xss($_GET['sso_referer']) .'?'. $params; |
|
67 | + $url = chamilo_sso_protocol().$master_auth_uri; |
|
68 | + $params = 'sso_referer='.urlencode($url).'&sso_cookie='.urlencode($cookie); |
|
69 | + $final_url = filter_xss($_GET['sso_referer']).'?'.$params; |
|
70 | 70 | |
71 | 71 | //If your user exists redirect to chamilo and set the account in a session to check it later |
72 | 72 | $_SESSION['my_server_user_session'] = $account; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @license see /license.txt |
16 | 16 | * @author Laurent Opprecht <[email protected]>, Nicolas Rod for the University of Geneva |
17 | 17 | */ |
18 | -include_once(dirname(__FILE__) . '/init.php'); |
|
18 | +include_once(dirname(__FILE__).'/init.php'); |
|
19 | 19 | |
20 | 20 | /* |
21 | 21 | ============================================================================== |