@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | * @package chamilo.auth.ldap |
9 | 9 | */ |
10 | 10 | /** |
11 | - * when a user does not exist yet in dokeos, |
|
12 | - * but he or she does exist in the LDAP, |
|
13 | - * we add him to the dokeos database |
|
11 | + * when a user does not exist yet in dokeos, |
|
12 | + * but he or she does exist in the LDAP, |
|
13 | + * we add him to the dokeos database |
|
14 | 14 | */ |
15 | 15 | //require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded |
16 | 16 | require_once('authldap.php'); |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | |
22 | 22 | if ($ldap_login_success) |
23 | 23 | { |
24 | - //error_log('Found user '.$login.' on LDAP server',0); |
|
25 | - /* |
|
24 | + //error_log('Found user '.$login.' on LDAP server',0); |
|
25 | + /* |
|
26 | 26 | In here, we know that |
27 | 27 | - the user does not exist in dokeos |
28 | 28 | - the users login and password are correct |
29 | 29 | */ |
30 | - $info_array = ldap_find_user_info($login); |
|
31 | - ldap_put_user_info_locally($login, $info_array); |
|
30 | + $info_array = ldap_find_user_info($login); |
|
31 | + ldap_put_user_info_locally($login, $info_array); |
|
32 | 32 | } else { |
33 | 33 | //error_log('Could not find '.$login.' on LDAP server',0); |
34 | - $loginFailed = true; |
|
35 | - unset($_user['user_id']); |
|
36 | - $uidReset = false; |
|
34 | + $loginFailed = true; |
|
35 | + unset($_user['user_id']); |
|
36 | + $uidReset = false; |
|
37 | 37 | } |
@@ -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 | } |
@@ -90,7 +90,7 @@ |
||
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 | { |
@@ -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 | ============================================================================== |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @license see /license.txt |
9 | 9 | * @author Laurent Opprecht <[email protected]>, Nicolas Rod for the University of Geneva |
10 | 10 | */ |
11 | -include_once(dirname(__FILE__) . '/../init.php'); |
|
11 | +include_once(dirname(__FILE__).'/../init.php'); |
|
12 | 12 | |
13 | 13 | if (!ShibbolethTest::is_enabled()) |
14 | 14 | { |
@@ -59,75 +59,75 @@ |
||
59 | 59 | public function setup_new_student() |
60 | 60 | { |
61 | 61 | $id = uniqid(); |
62 | - $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_' . $id; |
|
62 | + $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_'.$id; |
|
63 | 63 | $_SERVER['Shib-EP-Affiliation'] = 'member'; |
64 | 64 | $_SERVER['Shib-InetOrgPerson-givenName'] = 'John'; |
65 | - $_SERVER['Shib-Person-surname'] = 'Doe' . $id; |
|
66 | - $_SERVER['Shib-InetOrgPerson-mail'] = 'john.' . $id . '[email protected]'; |
|
67 | - $_SERVER['persistent-id'] = 'idp!viewer!' . md5($id); |
|
65 | + $_SERVER['Shib-Person-surname'] = 'Doe'.$id; |
|
66 | + $_SERVER['Shib-InetOrgPerson-mail'] = 'john.'.$id.'[email protected]'; |
|
67 | + $_SERVER['persistent-id'] = 'idp!viewer!'.md5($id); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public function setup_new_student_no_email() |
71 | 71 | { |
72 | 72 | $id = uniqid(); |
73 | - $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_' . $id; |
|
73 | + $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_'.$id; |
|
74 | 74 | $_SERVER['Shib-EP-Affiliation'] = 'member'; |
75 | 75 | $_SERVER['Shib-InetOrgPerson-givenName'] = 'John'; |
76 | - $_SERVER['Shib-Person-surname'] = 'Doe' . $id; |
|
76 | + $_SERVER['Shib-Person-surname'] = 'Doe'.$id; |
|
77 | 77 | $_SERVER['Shib-InetOrgPerson-mail'] = ''; |
78 | - $_SERVER['persistent-id'] = 'idp!viewer!' . md5($id); |
|
78 | + $_SERVER['persistent-id'] = 'idp!viewer!'.md5($id); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function setup_new_student_multiple_givenname() |
82 | 82 | { |
83 | 83 | $id = uniqid(); |
84 | - $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_' . $id; |
|
84 | + $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_'.$id; |
|
85 | 85 | $_SERVER['Shib-EP-Affiliation'] = 'member'; |
86 | 86 | $_SERVER['Shib-InetOrgPerson-givenName'] = 'John;Alex;John Alex'; |
87 | - $_SERVER['Shib-Person-surname'] = 'Doe' . $id; |
|
88 | - $_SERVER['Shib-InetOrgPerson-mail'] = 'john.' . $id . '[email protected]'; |
|
89 | - $_SERVER['persistent-id'] = 'idp!viewer!' . md5($id); |
|
87 | + $_SERVER['Shib-Person-surname'] = 'Doe'.$id; |
|
88 | + $_SERVER['Shib-InetOrgPerson-mail'] = 'john.'.$id.'[email protected]'; |
|
89 | + $_SERVER['persistent-id'] = 'idp!viewer!'.md5($id); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | public function setup_new_teacher() |
93 | 93 | { |
94 | 94 | $id = uniqid(); |
95 | - $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_' . $id; |
|
95 | + $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_'.$id; |
|
96 | 96 | $_SERVER['Shib-EP-Affiliation'] = 'member;staff;faculty'; |
97 | 97 | $_SERVER['Shib-InetOrgPerson-givenName'] = 'John'; |
98 | - $_SERVER['Shib-Person-surname'] = 'Doe' . $id; |
|
99 | - $_SERVER['Shib-InetOrgPerson-mail'] = 'john.' . $id . '[email protected]'; |
|
100 | - $_SERVER['persistent-id'] = 'idp!viewer!' . md5($id); |
|
98 | + $_SERVER['Shib-Person-surname'] = 'Doe'.$id; |
|
99 | + $_SERVER['Shib-InetOrgPerson-mail'] = 'john.'.$id.'[email protected]'; |
|
100 | + $_SERVER['persistent-id'] = 'idp!viewer!'.md5($id); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | public function setup_new_staff() |
104 | 104 | { |
105 | 105 | $id = uniqid(); |
106 | - $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_' . $id; |
|
106 | + $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_'.$id; |
|
107 | 107 | $_SERVER['Shib-EP-Affiliation'] = 'member;staff'; |
108 | 108 | $_SERVER['Shib-InetOrgPerson-givenName'] = 'John'; |
109 | - $_SERVER['Shib-Person-surname'] = 'Doe' . $id; |
|
110 | - $_SERVER['Shib-InetOrgPerson-mail'] = 'john.' . $id . '[email protected]'; |
|
111 | - $_SERVER['persistent-id'] = 'idp!viewer!' . md5($id); |
|
109 | + $_SERVER['Shib-Person-surname'] = 'Doe'.$id; |
|
110 | + $_SERVER['Shib-InetOrgPerson-mail'] = 'john.'.$id.'[email protected]'; |
|
111 | + $_SERVER['persistent-id'] = 'idp!viewer!'.md5($id); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function setup_new_no_affiliation() |
115 | 115 | { |
116 | 116 | $id = uniqid(); |
117 | - $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_' . $id; |
|
117 | + $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_'.$id; |
|
118 | 118 | $_SERVER['Shib-EP-Affiliation'] = ''; |
119 | 119 | $_SERVER['Shib-InetOrgPerson-givenName'] = 'John'; |
120 | - $_SERVER['Shib-Person-surname'] = 'Doe' . $id; |
|
121 | - $_SERVER['Shib-InetOrgPerson-mail'] = 'john.' . $id . '[email protected]'; |
|
122 | - $_SERVER['persistent-id'] = 'idp!viewer!' . md5($id); |
|
120 | + $_SERVER['Shib-Person-surname'] = 'Doe'.$id; |
|
121 | + $_SERVER['Shib-InetOrgPerson-mail'] = 'john.'.$id.'[email protected]'; |
|
122 | + $_SERVER['persistent-id'] = 'idp!viewer!'.md5($id); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | public function setup_new_minimal_data() |
126 | 126 | { |
127 | 127 | $id = uniqid(); |
128 | - $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_' . $id; |
|
128 | + $_SERVER['Shib-SwissEP-UniqueID'] = 'usr_'.$id; |
|
129 | 129 | $_SERVER['Shib-InetOrgPerson-givenName'] = 'John'; |
130 | - $_SERVER['Shib-Person-surname'] = 'Doe' . $id; |
|
130 | + $_SERVER['Shib-Person-surname'] = 'Doe'.$id; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
134 | 134 | \ No newline at end of file |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @license see /license.txt |
7 | 7 | * @author Laurent Opprecht <[email protected]>, Nicolas Rod for the University of Geneva |
8 | 8 | */ |
9 | -include_once(dirname(__FILE__) . '/../init.php'); |
|
9 | +include_once(dirname(__FILE__).'/../init.php'); |
|
10 | 10 | |
11 | 11 | if (!ShibbolethTest::is_enabled()) |
12 | 12 | { |
@@ -17,4 +17,4 @@ discard block |
||
17 | 17 | Shibboleth::session()->logout(); |
18 | 18 | ShibbolethTest::helper()->setup_new_student_no_email(); |
19 | 19 | |
20 | -require_once dirname(__FILE__) . '/../login.php'; |
|
21 | 20 | \ No newline at end of file |
21 | +require_once dirname(__FILE__).'/../login.php'; |
|
22 | 22 | \ No newline at end of file |
@@ -206,8 +206,7 @@ |
||
206 | 206 | echo $message; |
207 | 207 | var_dump(debug_backtrace()); |
208 | 208 | die; |
209 | - } |
|
210 | - else |
|
209 | + } else |
|
211 | 210 | { |
212 | 211 | $message = "Assert successful $message <br/>"; |
213 | 212 | echo $message; |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Shibboleth; |
4 | 4 | |
5 | -require_once dirname(__FILE__) . '/scaffold/admin.class.php'; |
|
5 | +require_once dirname(__FILE__).'/scaffold/admin.class.php'; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * A Chamilo admin. Model for the Admin table. |