@@ -32,104 +32,104 @@ |
||
| 32 | 32 | class GraphUser extends GraphObject |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Returns the ID for the user as a string if present. |
|
| 37 | - * |
|
| 38 | - * @return string|null |
|
| 39 | - */ |
|
| 40 | - public function getId() |
|
| 41 | - { |
|
| 35 | + /** |
|
| 36 | + * Returns the ID for the user as a string if present. |
|
| 37 | + * |
|
| 38 | + * @return string|null |
|
| 39 | + */ |
|
| 40 | + public function getId() |
|
| 41 | + { |
|
| 42 | 42 | return $this->getProperty('id'); |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Returns the name for the user as a string if present. |
|
| 47 | - * |
|
| 48 | - * @return string|null |
|
| 49 | - */ |
|
| 50 | - public function getName() |
|
| 51 | - { |
|
| 45 | + /** |
|
| 46 | + * Returns the name for the user as a string if present. |
|
| 47 | + * |
|
| 48 | + * @return string|null |
|
| 49 | + */ |
|
| 50 | + public function getName() |
|
| 51 | + { |
|
| 52 | 52 | return $this->getProperty('name'); |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function getEmail() |
|
| 56 | - { |
|
| 55 | + public function getEmail() |
|
| 56 | + { |
|
| 57 | 57 | return $this->getProperty('email'); |
| 58 | - } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Returns the first name for the user as a string if present. |
|
| 62 | - * |
|
| 63 | - * @return string|null |
|
| 64 | - */ |
|
| 65 | - public function getFirstName() |
|
| 66 | - { |
|
| 60 | + /** |
|
| 61 | + * Returns the first name for the user as a string if present. |
|
| 62 | + * |
|
| 63 | + * @return string|null |
|
| 64 | + */ |
|
| 65 | + public function getFirstName() |
|
| 66 | + { |
|
| 67 | 67 | return $this->getProperty('first_name'); |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Returns the middle name for the user as a string if present. |
|
| 72 | - * |
|
| 73 | - * @return string|null |
|
| 74 | - */ |
|
| 75 | - public function getMiddleName() |
|
| 76 | - { |
|
| 70 | + /** |
|
| 71 | + * Returns the middle name for the user as a string if present. |
|
| 72 | + * |
|
| 73 | + * @return string|null |
|
| 74 | + */ |
|
| 75 | + public function getMiddleName() |
|
| 76 | + { |
|
| 77 | 77 | return $this->getProperty('middle_name'); |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Returns the last name for the user as a string if present. |
|
| 82 | - * |
|
| 83 | - * @return string|null |
|
| 84 | - */ |
|
| 85 | - public function getLastName() |
|
| 86 | - { |
|
| 80 | + /** |
|
| 81 | + * Returns the last name for the user as a string if present. |
|
| 82 | + * |
|
| 83 | + * @return string|null |
|
| 84 | + */ |
|
| 85 | + public function getLastName() |
|
| 86 | + { |
|
| 87 | 87 | return $this->getProperty('last_name'); |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Returns the gender for the user as a string if present. |
|
| 92 | - * |
|
| 93 | - * @return string|null |
|
| 94 | - */ |
|
| 95 | - public function getGender() |
|
| 96 | - { |
|
| 90 | + /** |
|
| 91 | + * Returns the gender for the user as a string if present. |
|
| 92 | + * |
|
| 93 | + * @return string|null |
|
| 94 | + */ |
|
| 95 | + public function getGender() |
|
| 96 | + { |
|
| 97 | 97 | return $this->getProperty('gender'); |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Returns the Facebook URL for the user as a string if available. |
|
| 102 | - * |
|
| 103 | - * @return string|null |
|
| 104 | - */ |
|
| 105 | - public function getLink() |
|
| 106 | - { |
|
| 100 | + /** |
|
| 101 | + * Returns the Facebook URL for the user as a string if available. |
|
| 102 | + * |
|
| 103 | + * @return string|null |
|
| 104 | + */ |
|
| 105 | + public function getLink() |
|
| 106 | + { |
|
| 107 | 107 | return $this->getProperty('link'); |
| 108 | - } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Returns the users birthday, if available. |
|
| 112 | - * |
|
| 113 | - * @return \DateTime|null |
|
| 114 | - */ |
|
| 115 | - public function getBirthday() |
|
| 116 | - { |
|
| 110 | + /** |
|
| 111 | + * Returns the users birthday, if available. |
|
| 112 | + * |
|
| 113 | + * @return \DateTime|null |
|
| 114 | + */ |
|
| 115 | + public function getBirthday() |
|
| 116 | + { |
|
| 117 | 117 | $value = $this->getProperty('birthday'); |
| 118 | 118 | if ($value) { |
| 119 | - return new \DateTime($value); |
|
| 119 | + return new \DateTime($value); |
|
| 120 | 120 | } |
| 121 | 121 | return null; |
| 122 | - } |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Returns the current location of the user as a FacebookGraphLocation |
|
| 126 | - * if available. |
|
| 127 | - * |
|
| 128 | - * @return GraphLocation|null |
|
| 129 | - */ |
|
| 130 | - public function getLocation() |
|
| 131 | - { |
|
| 124 | + /** |
|
| 125 | + * Returns the current location of the user as a FacebookGraphLocation |
|
| 126 | + * if available. |
|
| 127 | + * |
|
| 128 | + * @return GraphLocation|null |
|
| 129 | + */ |
|
| 130 | + public function getLocation() |
|
| 131 | + { |
|
| 132 | 132 | return $this->getProperty('location', GraphLocation::className()); |
| 133 | - } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 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 |
||
| 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 |
@@ -40,13 +40,13 @@ discard block |
||
| 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 |
||
| 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)) { |
@@ -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; |