@@ -11,9 +11,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -14,7 +14,7 @@ discard block |
||
| 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 |
||
| 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); |
@@ -7,7 +7,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -10,7 +10,7 @@ |
||
| 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 |
@@ -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 |
@@ -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; |
@@ -28,14 +28,14 @@ |
||
| 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 | } |
@@ -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 { |