@@ -45,8 +45,7 @@ |
||
| 45 | 45 | if (in_array(OPENID_NS_2_0 .'/signon', $xrds_current_service['types']) || |
| 46 | 46 | in_array(OPENID_NS_2_0 .'/server', $xrds_current_service['types'])) { |
| 47 | 47 | $xrds_current_service['version'] = 2; |
| 48 | - } |
|
| 49 | - elseif (in_array(OPENID_NS_1_1, $xrds_current_service['types']) || |
|
| 48 | + } elseif (in_array(OPENID_NS_1_1, $xrds_current_service['types']) || |
|
| 50 | 49 | in_array(OPENID_NS_1_0, $xrds_current_service['types'])) { |
| 51 | 50 | $xrds_current_service['version'] = 1; |
| 52 | 51 | } |
@@ -61,8 +61,9 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | function _openid_is_xri($identifier) { |
| 63 | 63 | $firstchar = substr($identifier, 0, 1); |
| 64 | - if ($firstchar == "@" || $firstchar == "=") |
|
| 65 | - return TRUE; |
|
| 64 | + if ($firstchar == "@" || $firstchar == "=") { |
|
| 65 | + return TRUE; |
|
| 66 | + } |
|
| 66 | 67 | |
| 67 | 68 | if (stristr($identifier, 'xri://') !== FALSE) { |
| 68 | 69 | return TRUE; |
@@ -137,8 +137,12 @@ discard block |
||
| 137 | 137 | // call the ancestor's constructor |
| 138 | 138 | $this->PGTStorage($cas_parent); |
| 139 | 139 | |
| 140 | - if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT; |
|
| 141 | - if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; |
|
| 140 | + if (empty($format) ) { |
|
| 141 | + $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT; |
|
| 142 | + } |
|
| 143 | + if (empty($path) ) { |
|
| 144 | + $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; |
|
| 145 | + } |
|
| 142 | 146 | |
| 143 | 147 | // check that the path is an absolute path |
| 144 | 148 | if (getenv("OS")=="Windows_NT"){
|
@@ -147,8 +151,7 @@ discard block |
||
| 147 | 151 | phpCAS::error('an absolute path is needed for PGT storage to file');
|
| 148 | 152 | } |
| 149 | 153 | |
| 150 | - } |
|
| 151 | - else |
|
| 154 | + } else |
|
| 152 | 155 | {
|
| 153 | 156 | |
| 154 | 157 | if ( $path[0] != '/' ) {
|
@@ -186,8 +189,9 @@ discard block |
||
| 186 | 189 | {
|
| 187 | 190 | phpCAS::traceBegin(); |
| 188 | 191 | // if the storage has already been initialized, return immediatly |
| 189 | - if ( $this->isInitialized() ) |
|
| 190 | - return; |
|
| 192 | + if ( $this->isInitialized() ) { |
|
| 193 | + return; |
|
| 194 | + } |
|
| 191 | 195 | // call the ancestor's method (mark as initialized) |
| 192 | 196 | parent::init(); |
| 193 | 197 | phpCAS::traceEnd(); |
@@ -166,11 +166,21 @@ discard block |
||
| 166 | 166 | // call the ancestor's constructor |
| 167 | 167 | $this->PGTStorage($cas_parent); |
| 168 | 168 | |
| 169 | - if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE; |
|
| 170 | - if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME; |
|
| 171 | - if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT; |
|
| 172 | - if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE; |
|
| 173 | - if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE; |
|
| 169 | + if ( empty($database_type) ) { |
|
| 170 | + $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE; |
|
| 171 | + } |
|
| 172 | + if ( empty($hostname) ) { |
|
| 173 | + $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME; |
|
| 174 | + } |
|
| 175 | + if ( $port==0 ) { |
|
| 176 | + $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT; |
|
| 177 | + } |
|
| 178 | + if ( empty($database) ) { |
|
| 179 | + $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE; |
|
| 180 | + } |
|
| 181 | + if ( empty($table) ) { |
|
| 182 | + $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE; |
|
| 183 | + } |
|
| 174 | 184 | |
| 175 | 185 | // build and store the PEAR DB URL |
| 176 | 186 | $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database; |
@@ -192,8 +202,9 @@ discard block |
||
| 192 | 202 | {
|
| 193 | 203 | phpCAS::traceBegin(); |
| 194 | 204 | // if the storage has already been initialized, return immediatly |
| 195 | - if ( $this->isInitialized() ) |
|
| 196 | - return; |
|
| 205 | + if ( $this->isInitialized() ) { |
|
| 206 | + return; |
|
| 207 | + } |
|
| 197 | 208 | // call the ancestor's method (mark as initialized) |
| 198 | 209 | parent::init(); |
| 199 | 210 | |
@@ -4,8 +4,9 @@ |
||
| 4 | 4 | require_once dirname(__FILE__).'/../../inc/global.inc.php'; |
| 5 | 5 | $url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
| 6 | 6 | |
| 7 | -if (! isset($_SESSION['conditional_login']['uid'])) |
|
| 7 | +if (! isset($_SESSION['conditional_login']['uid'])) { |
|
| 8 | 8 | die("Not Authorised"); |
| 9 | +} |
|
| 9 | 10 | ?> |
| 10 | 11 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 11 | 12 | <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"> |
@@ -95,30 +95,43 @@ |
||
| 95 | 95 | * */ |
| 96 | 96 | function external_add_user($u) { |
| 97 | 97 | //Setting default |
| 98 | - if (empty($u['password'])) |
|
| 99 | - $u['password'] = null; |
|
| 100 | - if (empty($u['status'])) |
|
| 101 | - $u['status'] = 5; |
|
| 102 | - if (!isset($u['official_code'])) |
|
| 103 | - $u['official_code'] = ''; |
|
| 104 | - if (!isset($u['language'])) |
|
| 105 | - $u['language'] = ''; |
|
| 106 | - if (!isset($u['phone'])) |
|
| 107 | - $u['phone'] = ''; |
|
| 108 | - if (!isset($u['picture_uri'])) |
|
| 109 | - $u['picture_uri'] = ''; |
|
| 110 | - if (!isset($u['auth_source'])) |
|
| 111 | - $u['auth_source'] = PLATFORM_AUTH_SOURCE; |
|
| 112 | - if (!isset($u['expiration_date'])) |
|
| 113 | - $u['expiration_date'] = '0000-00-00 00:00:00'; |
|
| 114 | - if (!isset($u['active'])) |
|
| 115 | - $u['active'] = 1; |
|
| 116 | - if (!isset($u['hr_dept_id'])) |
|
| 117 | - $u['hr_dept_id'] = 0; //id of responsible HR |
|
| 118 | - if (!isset($u['extra'])) |
|
| 119 | - $u['extra'] = null; |
|
| 120 | - if (!isset($u['encrypt_method'])) |
|
| 121 | - $u['encrypt_method'] = ''; |
|
| 98 | + if (empty($u['password'])) { |
|
| 99 | + $u['password'] = null; |
|
| 100 | + } |
|
| 101 | + if (empty($u['status'])) { |
|
| 102 | + $u['status'] = 5; |
|
| 103 | + } |
|
| 104 | + if (!isset($u['official_code'])) { |
|
| 105 | + $u['official_code'] = ''; |
|
| 106 | + } |
|
| 107 | + if (!isset($u['language'])) { |
|
| 108 | + $u['language'] = ''; |
|
| 109 | + } |
|
| 110 | + if (!isset($u['phone'])) { |
|
| 111 | + $u['phone'] = ''; |
|
| 112 | + } |
|
| 113 | + if (!isset($u['picture_uri'])) { |
|
| 114 | + $u['picture_uri'] = ''; |
|
| 115 | + } |
|
| 116 | + if (!isset($u['auth_source'])) { |
|
| 117 | + $u['auth_source'] = PLATFORM_AUTH_SOURCE; |
|
| 118 | + } |
|
| 119 | + if (!isset($u['expiration_date'])) { |
|
| 120 | + $u['expiration_date'] = '0000-00-00 00:00:00'; |
|
| 121 | + } |
|
| 122 | + if (!isset($u['active'])) { |
|
| 123 | + $u['active'] = 1; |
|
| 124 | + } |
|
| 125 | + if (!isset($u['hr_dept_id'])) { |
|
| 126 | + $u['hr_dept_id'] = 0; |
|
| 127 | + } |
|
| 128 | + //id of responsible HR |
|
| 129 | + if (!isset($u['extra'])) { |
|
| 130 | + $u['extra'] = null; |
|
| 131 | + } |
|
| 132 | + if (!isset($u['encrypt_method'])) { |
|
| 133 | + $u['encrypt_method'] = ''; |
|
| 134 | + } |
|
| 122 | 135 | |
| 123 | 136 | $chamilo_uid = UserManager::create_user($u['firstname'], $u['lastname'], $u['status'], $u['email'], $u['username'], $u['password'], $u['official_code'], $u['language'], $u['phone'], $u['picture_uri'], $u['auth_source'], $u['expiration_date'], $u['active'], $u['hr_dept_id'], $u['extra'], $u['encrypt_method']); |
| 124 | 137 | return $chamilo_uid; |
@@ -80,7 +80,12 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if ($res==1) { //WRONG PASSWORD |
| 82 | 82 | //$errorMessage = "LDAP User or password incorrect, try again.<br />"; |
| 83 | - if (isset($log)) unset($log); if (isset($uid)) unset($uid); |
|
| 83 | + if (isset($log)) { |
|
| 84 | + unset($log); |
|
| 85 | + } |
|
| 86 | + if (isset($uid)) { |
|
| 87 | + unset($uid); |
|
| 88 | + } |
|
| 84 | 89 | $loginLdapSucces = false; |
| 85 | 90 | } |
| 86 | 91 | if ($res==-1) { //WRONG USERNAME |
@@ -401,8 +406,9 @@ discard block |
||
| 401 | 406 | return $info; |
| 402 | 407 | |
| 403 | 408 | } else { |
| 404 | - if (count($ldap_query)!=0) |
|
| 405 | - Display :: display_error_message(get_lang('LDAPConnectionError')); |
|
| 409 | + if (count($ldap_query)!=0) { |
|
| 410 | + Display :: display_error_message(get_lang('LDAPConnectionError')); |
|
| 411 | + } |
|
| 406 | 412 | return array(); |
| 407 | 413 | } |
| 408 | 414 | } |
@@ -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; |
@@ -168,12 +168,10 @@ |
||
| 168 | 168 | if (empty($result)) |
| 169 | 169 | { |
| 170 | 170 | $result = $default; |
| 171 | - } |
|
| 172 | - else if (count($result) == 1) |
|
| 171 | + } else if (count($result) == 1) |
|
| 173 | 172 | { |
| 174 | 173 | $result = reset($result); |
| 175 | - } |
|
| 176 | - else |
|
| 174 | + } else |
|
| 177 | 175 | { |
| 178 | 176 | $result = $result; |
| 179 | 177 | } |