@@ -66,7 +66,7 @@ |
||
66 | 66 | $ret = $auth->activatePendingUser($user); |
67 | 67 | if($ret === false) |
68 | 68 | { |
69 | - throw new \Exception('Unable to create user! '.$res); |
|
69 | + throw new \Exception('Unable to create user! '.$res); |
|
70 | 70 | } |
71 | 71 | return self::SUCCESS; |
72 | 72 | } |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | namespace Auth; |
3 | 3 | require_once('/var/www/common/libs/google/src/Google/autoload.php'); |
4 | 4 | |
5 | -class GoogleAuthenticator extends Authenticator |
|
6 | -{ |
|
5 | +class GoogleAuthenticator extends Authenticator |
|
6 | +{ |
|
7 | 7 | protected $client; |
8 | 8 | protected $token = null; |
9 | 9 | |
10 | - public function __construct($params) |
|
11 | - { |
|
10 | + public function __construct($params) |
|
11 | + { |
|
12 | 12 | parent::__construct($params); |
13 | - if(!isset($params['client_secrets_path'])) |
|
14 | - { |
|
13 | + if(!isset($params['client_secrets_path'])) |
|
14 | + { |
|
15 | 15 | throw new \Exception('Missing required parameter client_secrets_path!'); |
16 | 16 | } |
17 | - if(!isset($params['redirect_url'])) |
|
18 | - { |
|
17 | + if(!isset($params['redirect_url'])) |
|
18 | + { |
|
19 | 19 | $params['redirect_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/oauth2callback.php?src=google'; |
20 | 20 | } |
21 | 21 | $this->token = \FlipSession::getVar('GoogleToken', null); |
@@ -25,60 +25,64 @@ discard block |
||
25 | 25 | $this->client->setRedirectUri($params['redirect_url']); |
26 | 26 | } |
27 | 27 | |
28 | - public function getSupplementLink() |
|
29 | - { |
|
28 | + public function getSupplementLink() |
|
29 | + { |
|
30 | 30 | $authUrl = $this->client->createAuthUrl(); |
31 | 31 | return '<a href="'.filter_var($authUrl, FILTER_SANITIZE_URL).'"><img src="/img/common/google_sign_in.png" style="width: 2em;"/></a>'; |
32 | 32 | } |
33 | 33 | |
34 | - public function authenticate($code, &$currentUser = false) |
|
35 | - { |
|
34 | + public function authenticate($code, &$currentUser = false) |
|
35 | + { |
|
36 | 36 | $googleUser = false; |
37 | - try{ |
|
37 | + try |
|
38 | + { |
|
38 | 39 | $this->client->authenticate($code); |
39 | 40 | $this->token = $this->client->getAccessToken(); |
40 | 41 | \FlipSession::setVar('GoogleToken', $this->token); |
41 | 42 | $oauth2Service = new \Google_Service_Oauth2($this->client); |
42 | 43 | $googleUser = $oauth2Service->userinfo->get(); |
43 | - } catch(\Exception $ex) { |
|
44 | + } |
|
45 | + catch(\Exception $ex) |
|
46 | + { |
|
44 | 47 | return self::LOGIN_FAILED; |
45 | 48 | } |
46 | 49 | |
47 | 50 | $auth = \AuthProvider::getInstance(); |
48 | 51 | $localUsers = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$googleUser->email)); |
49 | - if($localUsers !== false && isset($localUsers[0])) |
|
50 | - { |
|
51 | - if($localUsers[0]->canLoginWith('google.com')) |
|
52 | - { |
|
52 | + if($localUsers !== false && isset($localUsers[0])) |
|
53 | + { |
|
54 | + if($localUsers[0]->canLoginWith('google.com')) |
|
55 | + { |
|
53 | 56 | $auth->impersonateUser($localUsers[0]); |
54 | 57 | return self::SUCCESS; |
55 | 58 | } |
56 | 59 | $currentUser = $localUsers[0]; |
57 | 60 | return self::ALREADY_PRESENT; |
58 | - } |
|
59 | - else |
|
60 | - { |
|
61 | + } |
|
62 | + else |
|
63 | + { |
|
61 | 64 | $user = new PendingUser(); |
62 | 65 | $user->setEmail($googleUser->email); |
63 | 66 | $user->setGivenName($googleUser->givenName); |
64 | 67 | $user->setLastName($googleUser->familyName); |
65 | 68 | $user->addLoginProvider('google.com'); |
66 | 69 | $ret = $auth->activatePendingUser($user); |
67 | - if($ret === false) |
|
68 | - { |
|
70 | + if($ret === false) |
|
71 | + { |
|
69 | 72 | throw new \Exception('Unable to create user! '.$res); |
70 | 73 | } |
71 | 74 | return self::SUCCESS; |
72 | 75 | } |
73 | 76 | } |
74 | 77 | |
75 | - public function getUser($data = false) |
|
76 | - { |
|
77 | - if($data === false) |
|
78 | - { |
|
78 | + public function getUser($data = false) |
|
79 | + { |
|
80 | + if($data === false) |
|
81 | + { |
|
79 | 82 | $data = $this->token; |
80 | 83 | } |
81 | - try { |
|
84 | + try |
|
85 | + { |
|
82 | 86 | $this->client->setAccessToken($data); |
83 | 87 | $oauth2Service = new \Google_Service_Oauth2($this->client); |
84 | 88 | $googleUser = $oauth2Service->userinfo->get(); |
@@ -89,8 +93,9 @@ discard block |
||
89 | 93 | $profileUser['displayName'] = $googleUser->name; |
90 | 94 | $profileUser['jpegPhoto'] = base64_encode(file_get_contents($googleUser->picture)); |
91 | 95 | return $profileUser; |
92 | - } catch(\Exception $e) |
|
93 | - { |
|
96 | + } |
|
97 | + catch(\Exception $e) |
|
98 | + { |
|
94 | 99 | return false; |
95 | 100 | } |
96 | 101 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Auth; |
3 | -require dirname(__FILE__) . '/../libs/google/src/Google/autoload.php'; |
|
3 | +require dirname(__FILE__).'/../libs/google/src/Google/autoload.php'; |
|
4 | 4 | |
5 | 5 | class GoogleAuthenticator extends Authenticator |
6 | 6 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function authenticate($code, &$currentUser = false) |
35 | 35 | { |
36 | 36 | $googleUser = false; |
37 | - try{ |
|
37 | + try { |
|
38 | 38 | $this->client->authenticate($code); |
39 | 39 | $this->token = $this->client->getAccessToken(); |
40 | 40 | \FlipSession::setVar('GoogleToken', $this->token); |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $collections = $this->db->getCollectionNames(); |
66 | 66 | if(in_array($name, $collections)) |
67 | 67 | { |
68 | - return true; |
|
68 | + return true; |
|
69 | 69 | } |
70 | 70 | return false; |
71 | 71 | } |
@@ -7,15 +7,15 @@ |
||
7 | 7 | $classname = ltrim($classname, '\\'); |
8 | 8 | $filename = ''; |
9 | 9 | $namespace = ''; |
10 | - if ($lastNsPos = strrpos($classname, '\\')) |
|
10 | + if($lastNsPos = strrpos($classname, '\\')) |
|
11 | 11 | { |
12 | 12 | $namespace = substr($classname, 0, $lastNsPos); |
13 | 13 | $classname = substr($classname, $lastNsPos + 1); |
14 | - $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
14 | + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
15 | 15 | } |
16 | 16 | if(strlen($namespace)) |
17 | 17 | { |
18 | - $namespace.=DIRECTORY_SEPARATOR; |
|
18 | + $namespace .= DIRECTORY_SEPARATOR; |
|
19 | 19 | } |
20 | 20 | $filename = __DIR__.'/../libs/mongofill/src/'.$namespace.$classname.'.php'; |
21 | 21 | if(is_readable($filename)) |
@@ -247,15 +247,15 @@ |
||
247 | 247 | */ |
248 | 248 | protected function printIeCompatability($prefix='') |
249 | 249 | { |
250 | - //IE 8 doesn't support HTML 5. Install the shim... |
|
251 | - if($this->getBrowserMajorVer() < 9) |
|
252 | - { |
|
253 | - echo $prefix.'<script src="js/html5.js"></script>'; |
|
254 | - echo "\n"; |
|
255 | - } |
|
256 | - //Tell the browser not to use compatability mode... |
|
257 | - echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
258 | - echo "\n"; |
|
250 | + //IE 8 doesn't support HTML 5. Install the shim... |
|
251 | + if($this->getBrowserMajorVer() < 9) |
|
252 | + { |
|
253 | + echo $prefix.'<script src="js/html5.js"></script>'; |
|
254 | + echo "\n"; |
|
255 | + } |
|
256 | + //Tell the browser not to use compatability mode... |
|
257 | + echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
258 | + echo "\n"; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $browserName = $this->getBrowserName(); |
61 | 61 | if($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
62 | 62 | { |
63 | - header( 'Location: /badbrowser.php' ) ; |
|
63 | + header('Location: /badbrowser.php'); |
|
64 | 64 | } |
65 | 65 | else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
66 | 66 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function getBrowser() |
91 | 91 | { |
92 | - static $browser;//No accident can arise from depending on an unset variable. |
|
92 | + static $browser; //No accident can arise from depending on an unset variable. |
|
93 | 93 | if(!isset($browser)) |
94 | 94 | { |
95 | 95 | $browser = $this->browscap->getBrowser(); |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return string The tag as a string |
192 | 192 | */ |
193 | - protected function createOpenTag($tagName, $attribs=array(), $selfClose=false) |
|
193 | + protected function createOpenTag($tagName, $attribs = array(), $selfClose = false) |
|
194 | 194 | { |
195 | 195 | $tag = '<'.$tagName; |
196 | 196 | $attribNames = array_keys($attribs); |
197 | 197 | foreach($attribNames as $attribName) |
198 | 198 | { |
199 | - $tag.=' '.$attribName; |
|
199 | + $tag .= ' '.$attribName; |
|
200 | 200 | if($attribs[$attribName]) |
201 | 201 | { |
202 | - $tag.='="'.$attribs[$attribName].'"'; |
|
202 | + $tag .= '="'.$attribs[$attribName].'"'; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | if($selfClose) |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string The link |
231 | 231 | */ |
232 | - public function createLink($linkName, $linkTarget='#') |
|
232 | + public function createLink($linkName, $linkTarget = '#') |
|
233 | 233 | { |
234 | 234 | $startTag = $this->createOpenTag('a', array('href'=>$linkTarget)); |
235 | 235 | $endTag = $this->createCloseTag('a'); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @param string $prefix The prefix to append to each line |
247 | 247 | */ |
248 | - protected function printIeCompatability($prefix='') |
|
248 | + protected function printIeCompatability($prefix = '') |
|
249 | 249 | { |
250 | 250 | //IE 8 doesn't support HTML 5. Install the shim... |
251 | 251 | if($this->getBrowserMajorVer() < 9) |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @param string $prefix The prefix to append to each line |
265 | 265 | */ |
266 | - protected function printHead($prefix='') |
|
266 | + protected function printHead($prefix = '') |
|
267 | 267 | { |
268 | 268 | echo $prefix.'<HEAD>'; |
269 | 269 | if($this->getBrowserName() === 'IE') |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @param string $prefix The prefix to append to each line |
286 | 286 | */ |
287 | - protected function printBody($prefix='') |
|
287 | + protected function printBody($prefix = '') |
|
288 | 288 | { |
289 | 289 | echo $prefix.'<BODY '.$this->body_tags.'>'; |
290 | 290 | echo $prefix.$prefix.$this->body."\n"; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | { |
322 | 322 | $requestURI = substr($requestURI, 1); |
323 | 323 | } |
324 | - return 'http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
324 | + return 'http'.(isset($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -14,7 +14,7 @@ |
||
14 | 14 | 'version' => 'latest', |
15 | 15 | 'region' => 'us-west-2', |
16 | 16 | 'credentials' => $credentials |
17 | - ]); |
|
17 | + ]); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function canSend() |
@@ -3,19 +3,19 @@ discard block |
||
3 | 3 | |
4 | 4 | class LDAPObject extends \SerializableObject |
5 | 5 | { |
6 | - public $server; |
|
6 | + public $server; |
|
7 | 7 | |
8 | - function __construct($array=false, $server=false) |
|
9 | - { |
|
10 | - parent::__construct($array); |
|
11 | - $this->server = $server; |
|
12 | - } |
|
8 | + function __construct($array=false, $server=false) |
|
9 | + { |
|
10 | + parent::__construct($array); |
|
11 | + $this->server = $server; |
|
12 | + } |
|
13 | 13 | |
14 | - public function jsonSerialize() |
|
15 | - { |
|
16 | - $ret = array(); |
|
17 | - foreach ($this as $key => $value) |
|
18 | - { |
|
14 | + public function jsonSerialize() |
|
15 | + { |
|
16 | + $ret = array(); |
|
17 | + foreach ($this as $key => $value) |
|
18 | + { |
|
19 | 19 | if($key === 'server' || $key === 'count') continue; |
20 | 20 | if(is_numeric($key)) continue; |
21 | 21 | if($key === 'jpegphoto') |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | { |
32 | 32 | $ret[$key] = $value; |
33 | 33 | } |
34 | - } |
|
35 | - return $ret; |
|
36 | - } |
|
34 | + } |
|
35 | + return $ret; |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | ?> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | { |
6 | 6 | public $server; |
7 | 7 | |
8 | - function __construct($array=false, $server=false) |
|
8 | + function __construct($array = false, $server = false) |
|
9 | 9 | { |
10 | 10 | parent::__construct($array); |
11 | 11 | $this->server = $server; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function jsonSerialize() |
15 | 15 | { |
16 | 16 | $ret = array(); |
17 | - foreach ($this as $key => $value) |
|
17 | + foreach($this as $key => $value) |
|
18 | 18 | { |
19 | 19 | if($key === 'server' || $key === 'count') continue; |
20 | 20 | if(is_numeric($key)) continue; |
@@ -16,8 +16,14 @@ |
||
16 | 16 | $ret = array(); |
17 | 17 | foreach ($this as $key => $value) |
18 | 18 | { |
19 | - if($key === 'server' || $key === 'count') continue; |
|
20 | - if(is_numeric($key)) continue; |
|
19 | + if($key === 'server' || $key === 'count') |
|
20 | + { |
|
21 | + continue; |
|
22 | + } |
|
23 | + if(is_numeric($key)) |
|
24 | + { |
|
25 | + continue; |
|
26 | + } |
|
21 | 27 | if($key === 'jpegphoto') |
22 | 28 | { |
23 | 29 | $ret[$key] = base64_encode($value[0]); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param string $name The name of the group to check if the user is in |
33 | 33 | * |
34 | - * @return true|false True if the user is in the group, false otherwise |
|
34 | + * @return boolean True if the user is in the group, false otherwise |
|
35 | 35 | */ |
36 | 36 | function isInGroupNamed($name) |
37 | 37 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * The name the user should be displayed as |
43 | 43 | * |
44 | - * @return string The name the user should be displayed as |
|
44 | + * @return boolean The name the user should be displayed as |
|
45 | 45 | */ |
46 | 46 | function getDisplayName() |
47 | 47 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * The given (or first) name for the user |
53 | 53 | * |
54 | - * @return string The user's first name |
|
54 | + * @return boolean The user's first name |
|
55 | 55 | */ |
56 | 56 | function getGivenName() |
57 | 57 | { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * The email address for the user |
63 | 63 | * |
64 | - * @return string The user's email address |
|
64 | + * @return boolean The user's email address |
|
65 | 65 | */ |
66 | 66 | function getEmail() |
67 | 67 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | /** |
72 | 72 | * The user ID for the user |
73 | 73 | * |
74 | - * @return string The user's ID or username |
|
74 | + * @return boolean The user's ID or username |
|
75 | 75 | */ |
76 | 76 | function getUid() |
77 | 77 | { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * The photo for the user |
83 | 83 | * |
84 | - * @return string The user's photo as a binary string |
|
84 | + * @return boolean The user's photo as a binary string |
|
85 | 85 | */ |
86 | 86 | function getPhoto() |
87 | 87 | { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * The phone number for the user |
93 | 93 | * |
94 | - * @return false|string The user's phone number |
|
94 | + * @return boolean The user's phone number |
|
95 | 95 | */ |
96 | 96 | function getPhoneNumber() |
97 | 97 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * The organziation for the user |
103 | 103 | * |
104 | - * @return false|string The user's organization |
|
104 | + * @return boolean The user's organization |
|
105 | 105 | */ |
106 | 106 | function getOrganization() |
107 | 107 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * The list of titles for the user |
113 | 113 | * |
114 | - * @return array The user's title(s) in short format |
|
114 | + * @return boolean The user's title(s) in short format |
|
115 | 115 | */ |
116 | 116 | function getTitles() |
117 | 117 | { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * The list of titles for the user |
123 | 123 | * |
124 | - * @return array The user's title(s) in user friendly strings |
|
124 | + * @return boolean The user's title(s) in user friendly strings |
|
125 | 125 | * |
126 | 126 | * @SuppressWarnings("StaticAccess") |
127 | 127 | */ |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * The state the user's mailing address is in |
161 | 161 | * |
162 | - * @return string The user's state from their mailing address |
|
162 | + * @return boolean The user's state from their mailing address |
|
163 | 163 | */ |
164 | 164 | function getState() |
165 | 165 | { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | /** |
170 | 170 | * The city the user's mailing address is in |
171 | 171 | * |
172 | - * @return string The user's city from their mailing address |
|
172 | + * @return boolean The user's city from their mailing address |
|
173 | 173 | */ |
174 | 174 | function getCity() |
175 | 175 | { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * The last name for the user |
181 | 181 | * |
182 | - * @return string The user's last name |
|
182 | + * @return boolean The user's last name |
|
183 | 183 | */ |
184 | 184 | function getLastName() |
185 | 185 | { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | /** |
190 | 190 | * The nick name for the user |
191 | 191 | * |
192 | - * @return string The user's nick name |
|
192 | + * @return boolean The user's nick name |
|
193 | 193 | */ |
194 | 194 | function getNickName() |
195 | 195 | { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | /** |
200 | 200 | * The street address for the user |
201 | 201 | * |
202 | - * @return string The user's street address |
|
202 | + * @return boolean The user's street address |
|
203 | 203 | */ |
204 | 204 | function getAddress() |
205 | 205 | { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * The postal (zip) code for the user's mailing address |
211 | 211 | * |
212 | - * @return string The user's postal code |
|
212 | + * @return boolean The user's postal code |
|
213 | 213 | */ |
214 | 214 | function getPostalCode() |
215 | 215 | { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | /** |
220 | 220 | * The country the user's mailing address is in |
221 | 221 | * |
222 | - * @return string The user's country from their mailing address |
|
222 | + * @return boolean The user's country from their mailing address |
|
223 | 223 | */ |
224 | 224 | function getCountry() |
225 | 225 | { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * |
232 | 232 | * This is the same as Areas in Flipside speak. |
233 | 233 | * |
234 | - * @return array The user's orgnaiational units |
|
234 | + * @return boolean The user's orgnaiational units |
|
235 | 235 | */ |
236 | 236 | function getOrganizationUnits() |
237 | 237 | { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | /** |
242 | 242 | * The supplemental login types that the user can use to login |
243 | 243 | * |
244 | - * @return array The user's login providers |
|
244 | + * @return boolean The user's login providers |
|
245 | 245 | */ |
246 | 246 | function getLoginProviders() |
247 | 247 | { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * The groups the user is a part of |
253 | 253 | * |
254 | - * @return false|array The user's Auth\Group structures |
|
254 | + * @return boolean The user's Auth\Group structures |
|
255 | 255 | */ |
256 | 256 | function getGroups() |
257 | 257 | { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @param string $provider The hostname for the provider |
277 | 277 | * |
278 | - * @return true|false true if they can login with the provider, false otherwise |
|
278 | + * @return boolean true if they can login with the provider, false otherwise |
|
279 | 279 | */ |
280 | 280 | function canLoginWith($provider) |
281 | 281 | { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param string $password The new user password |
296 | 296 | * |
297 | - * @return true|false true if the user's password was changed, false otherwise |
|
297 | + * @return boolean true if the user's password was changed, false otherwise |
|
298 | 298 | */ |
299 | 299 | protected function setPass($password) |
300 | 300 | { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * Has the user completely filled out their user profile? |
306 | 306 | * |
307 | - * @return true|false true if the user's profile is complete, false otherwise |
|
307 | + * @return boolean true if the user's profile is complete, false otherwise |
|
308 | 308 | */ |
309 | 309 | function isProfileComplete() |
310 | 310 | { |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @param string $password The user's current password |
324 | 324 | * |
325 | - * @return true|false true if the user's password is correct, false otherwise |
|
325 | + * @return boolean true if the user's password is correct, false otherwise |
|
326 | 326 | * |
327 | 327 | * @SuppressWarnings("UnusedFormalParameter") |
328 | 328 | */ |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @param string $hash The user's reset hash |
338 | 338 | * |
339 | - * @return true|false true if the user's hash is correct, false otherwise |
|
339 | + * @return boolean true if the user's hash is correct, false otherwise |
|
340 | 340 | * |
341 | 341 | * @SuppressWarnings("UnusedFormalParameter") |
342 | 342 | */ |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * @param string $newpass The user's new password |
353 | 353 | * @param boolean $isHash Is $old_pass a password or a hash |
354 | 354 | * |
355 | - * @return true|false true if the user's password was changed, false otherwise |
|
355 | + * @return boolean true if the user's password was changed, false otherwise |
|
356 | 356 | */ |
357 | 357 | function change_pass($oldpass, $newpass, $isHash=false) |
358 | 358 | { |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param string $name The user's new display name |
378 | 378 | * |
379 | - * @return true|false true if the user's display name was changed, false otherwise |
|
379 | + * @return boolean true if the user's display name was changed, false otherwise |
|
380 | 380 | */ |
381 | 381 | function setDisplayName($name) |
382 | 382 | { |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @param string $name The user's new given name |
390 | 390 | * |
391 | - * @return true|false true if the user's given name was changed, false otherwise |
|
391 | + * @return boolean true if the user's given name was changed, false otherwise |
|
392 | 392 | */ |
393 | 393 | function setGivenName($name) |
394 | 394 | { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @param string $email The user's new email address |
402 | 402 | * |
403 | - * @return true|false true if the user's email address was changed, false otherwise |
|
403 | + * @return boolean true if the user's email address was changed, false otherwise |
|
404 | 404 | * |
405 | 405 | * @SuppressWarnings("UnusedFormalParameter") |
406 | 406 | */ |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @param string $uid The user's new user ID |
416 | 416 | * |
417 | - * @return true|false true if the user's ID was changed, false otherwise |
|
417 | + * @return boolean true if the user's ID was changed, false otherwise |
|
418 | 418 | * |
419 | 419 | * @SuppressWarnings("UnusedFormalParameter") |
420 | 420 | */ |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * |
429 | 429 | * @param string $photo The user's new photo as a binary string |
430 | 430 | * |
431 | - * @return true|false true if the user's photo was changed, false otherwise |
|
431 | + * @return boolean true if the user's photo was changed, false otherwise |
|
432 | 432 | * |
433 | 433 | * @SuppressWarnings("UnusedFormalParameter") |
434 | 434 | */ |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @param string $phone The user's new phonew number |
444 | 444 | * |
445 | - * @return true|false true if the user's phone number was changed, false otherwise |
|
445 | + * @return boolean true if the user's phone number was changed, false otherwise |
|
446 | 446 | * |
447 | 447 | * @SuppressWarnings("UnusedFormalParameter") |
448 | 448 | */ |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @param string $org The user's new organization |
458 | 458 | * |
459 | - * @return true|false true if the user's organization was changed, false otherwise |
|
459 | + * @return boolean true if the user's organization was changed, false otherwise |
|
460 | 460 | * |
461 | 461 | * @SuppressWarnings("UnusedFormalParameter") |
462 | 462 | */ |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * |
471 | 471 | * @param string $titles The user's new titles |
472 | 472 | * |
473 | - * @return true|false true if the user's titles were changed, false otherwise |
|
473 | + * @return boolean true if the user's titles were changed, false otherwise |
|
474 | 474 | * |
475 | 475 | * @SuppressWarnings("UnusedFormalParameter") |
476 | 476 | */ |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * |
485 | 485 | * @param string $state The user's new state |
486 | 486 | * |
487 | - * @return true|false true if the user's state was changed, false otherwise |
|
487 | + * @return boolean true if the user's state was changed, false otherwise |
|
488 | 488 | * |
489 | 489 | * @SuppressWarnings("UnusedFormalParameter") |
490 | 490 | */ |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | * |
499 | 499 | * @param string $city The user's new city |
500 | 500 | * |
501 | - * @return true|false true if the user's city was changed, false otherwise |
|
501 | + * @return boolean true if the user's city was changed, false otherwise |
|
502 | 502 | * |
503 | 503 | * @SuppressWarnings("UnusedFormalParameter") |
504 | 504 | */ |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @param string $sn The user's new last name |
514 | 514 | * |
515 | - * @return true|false true if the user's last name was changed, false otherwise |
|
515 | + * @return boolean true if the user's last name was changed, false otherwise |
|
516 | 516 | * |
517 | 517 | * @SuppressWarnings("UnusedFormalParameter") |
518 | 518 | */ |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @param string $displayName The user's new nick name |
528 | 528 | * |
529 | - * @return true|false true if the user's nick name was changed, false otherwise |
|
529 | + * @return boolean true if the user's nick name was changed, false otherwise |
|
530 | 530 | */ |
531 | 531 | function setNickName($displayName) |
532 | 532 | { |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * |
539 | 539 | * @param string $address The user's new mailing address |
540 | 540 | * |
541 | - * @return true|false true if the user's mailing address was changed, false otherwise |
|
541 | + * @return boolean true if the user's mailing address was changed, false otherwise |
|
542 | 542 | * |
543 | 543 | * @SuppressWarnings("UnusedFormalParameter") |
544 | 544 | */ |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @param string $postalcode The user's new postal code |
554 | 554 | * |
555 | - * @return true|false true if the user's postal code was changed, false otherwise |
|
555 | + * @return boolean true if the user's postal code was changed, false otherwise |
|
556 | 556 | * |
557 | 557 | * @SuppressWarnings("UnusedFormalParameter") |
558 | 558 | */ |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * |
567 | 567 | * @param string $country The user's new country |
568 | 568 | * |
569 | - * @return true|false true if the user's country was changed, false otherwise |
|
569 | + * @return boolean true if the user's country was changed, false otherwise |
|
570 | 570 | * |
571 | 571 | * @SuppressWarnings("UnusedFormalParameter") |
572 | 572 | */ |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @param string $ous The user's new organizations |
582 | 582 | * |
583 | - * @return true|false true if the user's organizations was changed, false otherwise |
|
583 | + * @return boolean true if the user's organizations was changed, false otherwise |
|
584 | 584 | * |
585 | 585 | * @SuppressWarnings("UnusedFormalParameter") |
586 | 586 | */ |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | /** |
705 | 705 | * Obtain the user's password reset hash |
706 | 706 | * |
707 | - * @return string|false A hash if available, false otherwise |
|
707 | + * @return boolean A hash if available, false otherwise |
|
708 | 708 | */ |
709 | 709 | public function getPasswordResetHash() |
710 | 710 | { |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function isProfileComplete() |
310 | 310 | { |
311 | - if($this->getCountry() === false || $this->getAddress() === false || |
|
311 | + if($this->getCountry() === false || $this->getAddress() === false || |
|
312 | 312 | $this->getPostalCode() === false || $this->getCity() === false || |
313 | - $this->getState() === false || $this->getPhoneNumber() === false) |
|
313 | + $this->getState() === false || $this->getPhoneNumber() === false) |
|
314 | 314 | { |
315 | 315 | return false; |
316 | 316 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return true|false true if the user's password was changed, false otherwise |
356 | 356 | */ |
357 | - public function change_pass($oldpass, $newpass, $isHash=false) |
|
357 | + public function change_pass($oldpass, $newpass, $isHash = false) |
|
358 | 358 | { |
359 | 359 | if($isHash === false && $this->validate_password($oldpass) === false) |
360 | 360 | { |
@@ -793,17 +793,17 @@ discard block |
||
793 | 793 | public function getVcard() |
794 | 794 | { |
795 | 795 | $ret = "BEGIN:VCARD\nVERSION:2.1\n"; |
796 | - $ret.= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
797 | - $ret.= 'FN:'.$this->getGivenName()."\n"; |
|
796 | + $ret .= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
797 | + $ret .= 'FN:'.$this->getGivenName()."\n"; |
|
798 | 798 | $titles = $this->getTitles(); |
799 | 799 | if($titles !== false) |
800 | 800 | { |
801 | - $ret.= 'TITLE:'.implode(',', $titles)."\n"; |
|
801 | + $ret .= 'TITLE:'.implode(',', $titles)."\n"; |
|
802 | 802 | } |
803 | - $ret.= "ORG: Austin Artistic Reconstruction\n"; |
|
804 | - $ret.= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
805 | - $ret.= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
806 | - $ret.= "END:VCARD\n"; |
|
803 | + $ret .= "ORG: Austin Artistic Reconstruction\n"; |
|
804 | + $ret .= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
805 | + $ret .= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
806 | + $ret .= "END:VCARD\n"; |
|
807 | 807 | return $ret; |
808 | 808 | } |
809 | 809 | } |
@@ -280,11 +280,17 @@ |
||
280 | 280 | public function canLoginWith($provider) |
281 | 281 | { |
282 | 282 | $hosts = $this->getLoginProviders(); |
283 | - if($hosts === false) return false; |
|
283 | + if($hosts === false) |
|
284 | + { |
|
285 | + return false; |
|
286 | + } |
|
284 | 287 | $count = count($hosts); |
285 | 288 | for($i = 0; $i < $count; $i++) |
286 | 289 | { |
287 | - if(strcasecmp($hosts[$i], $provider) === 0) return true; |
|
290 | + if(strcasecmp($hosts[$i], $provider) === 0) |
|
291 | + { |
|
292 | + return true; |
|
293 | + } |
|
288 | 294 | } |
289 | 295 | return false; |
290 | 296 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | if(isset($this->data['mail'])) |
39 | 39 | { |
40 | - return $this->data['mail']; |
|
40 | + return $this->data['mail']; |
|
41 | 41 | } |
42 | 42 | return $this->getUid(); |
43 | 43 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | private $data; |
7 | 7 | private $auth; |
8 | 8 | |
9 | - function __construct($data=false, $auth=false) |
|
9 | + function __construct($data = false, $auth = false) |
|
10 | 10 | { |
11 | 11 | $this->data = array(); |
12 | 12 | $this->auth = $auth; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | private function createCSV(&$array) |
118 | 118 | { |
119 | - if (count($array) == 0) |
|
119 | + if(count($array) == 0) |
|
120 | 120 | { |
121 | 121 | return null; |
122 | 122 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $keys = array_keys(get_object_vars($first)); |
136 | 136 | } |
137 | 137 | fputcsv($df, $keys); |
138 | - foreach ($array as $row) |
|
138 | + foreach($array as $row) |
|
139 | 139 | { |
140 | 140 | if(is_array($row)) |
141 | 141 | { |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | $this->error($errorHandler); |
288 | 288 | } |
289 | 289 | |
290 | - function get_json_body($array=false) |
|
290 | + function get_json_body($array = false) |
|
291 | 291 | { |
292 | 292 | return $this->getJsonBody($array); |
293 | 293 | } |
294 | 294 | |
295 | - function getJsonBody($array=false) |
|
295 | + function getJsonBody($array = false) |
|
296 | 296 | { |
297 | 297 | $body = $this->request->getBody(); |
298 | 298 | return json_decode($body, $array); |
@@ -75,8 +75,8 @@ |
||
75 | 75 | if(!isset($this->headers['Authorization'])) |
76 | 76 | { |
77 | 77 | $this->app->user = $this->getUserFromSession(); |
78 | - } |
|
79 | - else |
|
78 | + } |
|
79 | + else |
|
80 | 80 | { |
81 | 81 | $header = $this->headers['Authorization']; |
82 | 82 | $this->app->user = $this->getUserFromHeader($header); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | if(isset($params['$expand'])) |
68 | 68 | { |
69 | - $this->expand = explode(',',$params['$expand']); |
|
69 | + $this->expand = explode(',', $params['$expand']); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | { |
75 | 75 | if(isset($params['select'])) |
76 | 76 | { |
77 | - $this->select = explode(',',$params['select']); |
|
77 | + $this->select = explode(',', $params['select']); |
|
78 | 78 | } |
79 | 79 | else if(isset($params['$select'])) |
80 | 80 | { |
81 | - $this->select = explode(',',$params['$select']); |
|
81 | + $this->select = explode(',', $params['$select']); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | if(isset($params['$orderby'])) |
88 | 88 | { |
89 | 89 | $this->orderby = array(); |
90 | - $orderby = explode(',',$params['$orderby']); |
|
90 | + $orderby = explode(',', $params['$orderby']); |
|
91 | 91 | $count = count($orderby); |
92 | 92 | for($i = 0; $i < $count; $i++) |
93 | 93 | { |
94 | - $exp = explode(' ',$orderby[$i]); |
|
94 | + $exp = explode(' ', $orderby[$i]); |
|
95 | 95 | if(count($exp) === 1) |
96 | 96 | { |
97 | 97 | //Default to assending |