@@ -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)) { |
@@ -22,5 +22,5 @@ |
||
22 | 22 | * See facebook section of the auth.conf.php file |
23 | 23 | */ |
24 | 24 | |
25 | -require_once dirname(__FILE__) . '/../../../app/config/auth.conf.php'; |
|
25 | +require_once dirname(__FILE__).'/../../../app/config/auth.conf.php'; |
|
26 | 26 |
@@ -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 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * This script executes the importation of all users in the LDAP repository |
|
5 | - * into Chamilo |
|
6 | - * @package chamilo.auth.ldap |
|
7 | - */ |
|
4 | + * This script executes the importation of all users in the LDAP repository |
|
5 | + * into Chamilo |
|
6 | + * @package chamilo.auth.ldap |
|
7 | + */ |
|
8 | 8 | /** |
9 | - * Init |
|
10 | - */ |
|
9 | + * Init |
|
10 | + */ |
|
11 | 11 | if (PHP_SAPI != 'cli') { |
12 | 12 | die ('For security reasons, this script can only be launched from cron or from the command line'); |
13 | 13 | } |
@@ -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) { |
@@ -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 { |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | * @package chamilo.auth.ldap |
8 | 8 | */ |
9 | 9 | /** |
10 | - * An external authentification module needs to set |
|
11 | - * - $loginFailed |
|
12 | - * - $uidReset |
|
13 | - * - $_user['user_id'] |
|
14 | - * - register the $_user['user_id'] in the session |
|
15 | - * |
|
16 | - * As the LDAP code shows, this is not as difficult as you might think. |
|
17 | - * LDAP authentification module |
|
18 | - * this calls the loginWithLdap function |
|
19 | - * from the LDAP library, and sets a few |
|
20 | - * variables based on the result. |
|
21 | - */ |
|
10 | + * An external authentification module needs to set |
|
11 | + * - $loginFailed |
|
12 | + * - $uidReset |
|
13 | + * - $_user['user_id'] |
|
14 | + * - register the $_user['user_id'] in the session |
|
15 | + * |
|
16 | + * As the LDAP code shows, this is not as difficult as you might think. |
|
17 | + * LDAP authentification module |
|
18 | + * this calls the loginWithLdap function |
|
19 | + * from the LDAP library, and sets a few |
|
20 | + * variables based on the result. |
|
21 | + */ |
|
22 | 22 | //require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded |
23 | 23 | |
24 | 24 | use ChamiloSession as Session; |
@@ -28,14 +28,14 @@ discard block |
||
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 | } |