@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | //-------------------------------------------------------------------- |
48 | 48 | |
49 | - public function __construct($ci=null) |
|
49 | + public function __construct($ci = null) |
|
50 | 50 | { |
51 | 51 | parent::__construct($ci); |
52 | 52 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | // so request authorization by the client. |
113 | 113 | if (empty($username) || empty($password)) |
114 | 114 | { |
115 | - $this->ci->output->set_header('WWW-Authenticate: Basic realm="'. config_item('api.realm') .'"'); |
|
115 | + $this->ci->output->set_header('WWW-Authenticate: Basic realm="'.config_item('api.realm').'"'); |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | // No digest string? Then you're done. Go home. |
163 | 163 | if (empty($digest_string)) |
164 | 164 | { |
165 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
165 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | |
@@ -172,30 +172,30 @@ discard block |
||
172 | 172 | preg_match_all('@(username|nonce|uri|nc|cnonce|qop|response)=[\'"]?([^\'",]+)@', $digest_string, $matches); |
173 | 173 | $digest = (empty($matches[1]) || empty($matches[2])) ? array() : array_combine($matches[1], $matches[2]); |
174 | 174 | |
175 | - if (! array_key_exists('username', $digest)) |
|
175 | + if ( ! array_key_exists('username', $digest)) |
|
176 | 176 | { |
177 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
177 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
181 | 181 | // Grab the user that corresponds to that "username" |
182 | 182 | // exact field determined in the api config file - api.auth_field setting. |
183 | - $user = $this->user_model->as_array()->find_by( config_item('api.auth_field'), $digest['username'] ); |
|
183 | + $user = $this->user_model->as_array()->find_by(config_item('api.auth_field'), $digest['username']); |
|
184 | 184 | |
185 | 185 | // If the user is throttled due to too many invalid logins |
186 | 186 | // or the system is under attack, kick them back. |
187 | 187 | |
188 | 188 | // If throttling time is above zero, we can't allow |
189 | 189 | // logins now. |
190 | - if ($time = (int)$this->isThrottled($user) > 0) |
|
190 | + if ($time = (int) $this->isThrottled($user) > 0) |
|
191 | 191 | { |
192 | 192 | $this->error = sprintf(lang('api.throttled'), $time); |
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
196 | - if (! $user) |
|
196 | + if ( ! $user) |
|
197 | 197 | { |
198 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
198 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
199 | 199 | $this->ci->login_model->recordLoginAttempt($this->ci->input->ip_address()); |
200 | 200 | return false; |
201 | 201 | } |
@@ -205,16 +205,16 @@ discard block |
||
205 | 205 | |
206 | 206 | if ($digest['qop'] == 'auth') |
207 | 207 | { |
208 | - $A2 = md5( strtoupper( $_SERVER['REQUEST_METHOD'] ) .':'. $digest['uri'] ); |
|
208 | + $A2 = md5(strtoupper($_SERVER['REQUEST_METHOD']).':'.$digest['uri']); |
|
209 | 209 | } else { |
210 | 210 | $body = file_get_contents('php://input'); |
211 | - $A2 = md5( strtoupper( $_SERVER['REQUEST_METHOD'] ) .':'. $digest['uri'] .':'. md5($body) ); |
|
211 | + $A2 = md5(strtoupper($_SERVER['REQUEST_METHOD']).':'.$digest['uri'].':'.md5($body)); |
|
212 | 212 | } |
213 | - $valid_response = md5($A1 .':'. $digest['nonce'].':'. $digest['nc'] .':'. $digest['cnonce'] .':'. $digest['qop'] .':'. $A2); |
|
213 | + $valid_response = md5($A1.':'.$digest['nonce'].':'.$digest['nc'].':'.$digest['cnonce'].':'.$digest['qop'].':'.$A2); |
|
214 | 214 | |
215 | 215 | if ($digest['response'] != $valid_response) |
216 | 216 | { |
217 | - $this->ci->output->set_header( sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque) ); |
|
217 | + $this->ci->output->set_header(sprintf('WWW-Authenticate: Digest realm="%s", nonce="%s", opaque="%s"', config_item('api.realm'), $nonce, $opaque)); |
|
218 | 218 | $this->ci->login_model->recordLoginAttempt($this->ci->input->ip_address(), $user['id']); |
219 | 219 | return false; |
220 | 220 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | break; |
253 | 253 | } |
254 | 254 | |
255 | - if (! $user) |
|
255 | + if ( ! $user) |
|
256 | 256 | { |
257 | 257 | $this->user = null; |
258 | 258 | return $user; |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | { |
281 | 281 | $blacklist = explode(',', config_item('api.ip_blacklist')); |
282 | 282 | |
283 | - array_walk($blacklist, function (&$item, $key) { |
|
283 | + array_walk($blacklist, function(&$item, $key) { |
|
284 | 284 | $item = trim($item); |
285 | 285 | }); |
286 | 286 | |
287 | 287 | if (in_array($this->ci->input->ip_address(), $blacklist)) |
288 | 288 | { |
289 | - throw new \Exception( lang('api.ip_denied'), 401); |
|
289 | + throw new \Exception(lang('api.ip_denied'), 401); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return true; |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | |
306 | 306 | array_push($whitelist, '127.0.0.1', '0.0.0.0'); |
307 | 307 | |
308 | - array_walk($whitelist, function (&$item, $key) { |
|
308 | + array_walk($whitelist, function(&$item, $key) { |
|
309 | 309 | $item = trim($item); |
310 | 310 | }); |
311 | 311 | |
312 | - if (! in_array($this->ci->input->ip_address(), $whitelist)) |
|
312 | + if ( ! in_array($this->ci->input->ip_address(), $whitelist)) |
|
313 | 313 | { |
314 | - throw new \Exception( lang('api.ip_denied'), 401); |
|
314 | + throw new \Exception(lang('api.ip_denied'), 401); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return true; |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return bool|mixed|void |
370 | 370 | */ |
371 | - public function login($credentials, $remember=false) |
|
371 | + public function login($credentials, $remember = false) |
|
372 | 372 | { |
373 | - throw new \BadMethodCallException( lang('api.unused_method') ); |
|
373 | + throw new \BadMethodCallException(lang('api.unused_method')); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | //-------------------------------------------------------------------- |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function logout() |
387 | 387 | { |
388 | - throw new \BadMethodCallException( lang('api.unused_method') ); |
|
388 | + throw new \BadMethodCallException(lang('api.unused_method')); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | //-------------------------------------------------------------------- |
@@ -62,21 +62,21 @@ discard block |
||
62 | 62 | |
63 | 63 | //-------------------------------------------------------------------- |
64 | 64 | |
65 | - public function __construct( $ci=null ) |
|
65 | + public function __construct($ci = null) |
|
66 | 66 | { |
67 | 67 | if ($ci) |
68 | 68 | { |
69 | - $this->ci= $ci; |
|
69 | + $this->ci = $ci; |
|
70 | 70 | } |
71 | 71 | else |
72 | 72 | { |
73 | - $this->ci =& get_instance(); |
|
73 | + $this->ci = & get_instance(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // Get our compatibility password file loaded up. |
77 | - if (! function_exists('password_hash')) |
|
77 | + if ( ! function_exists('password_hash')) |
|
78 | 78 | { |
79 | - require_once dirname(__FILE__) .'password.php'; |
|
79 | + require_once dirname(__FILE__).'password.php'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if (empty($this->ci->session)) |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | * @param bool $remember |
102 | 102 | * @return bool|mixed |
103 | 103 | */ |
104 | - public function login($credentials, $remember=false) |
|
104 | + public function login($credentials, $remember = false) |
|
105 | 105 | { |
106 | 106 | $user = $this->validate($credentials, true); |
107 | 107 | |
108 | - if (! $user) |
|
108 | + if ( ! $user) |
|
109 | 109 | { |
110 | 110 | $this->user = null; |
111 | 111 | return $user; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param bool $return_user |
136 | 136 | * @return mixed |
137 | 137 | */ |
138 | - public function validate($credentials, $return_user=false) |
|
138 | + public function validate($credentials, $return_user = false) |
|
139 | 139 | { |
140 | 140 | // Can't validate without a password. |
141 | 141 | if (empty($credentials['password']) || count($credentials) < 2) |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // Ensure that the fields are allowed validation fields |
158 | - if (! in_array(key($credentials), config_item('auth.valid_fields')) ) |
|
158 | + if ( ! in_array(key($credentials), config_item('auth.valid_fields'))) |
|
159 | 159 | { |
160 | 160 | $this->error = lang('auth.invalid_credentials'); |
161 | 161 | return false; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | // We do not want to force case-sensitivity on things |
165 | 165 | // like username and email for usability sake. |
166 | - if (! empty($credentials['email'])) |
|
166 | + if ( ! empty($credentials['email'])) |
|
167 | 167 | { |
168 | 168 | $credentials['email'] = strtolower($credentials['email']); |
169 | 169 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | // If throttling time is above zero, we can't allow |
180 | 180 | // logins now. |
181 | - $time = (int)$this->isThrottled($user); |
|
181 | + $time = (int) $this->isThrottled($user); |
|
182 | 182 | if ($time > 0) |
183 | 183 | { |
184 | 184 | $this->error = sprintf(lang('auth.throttled'), $time); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // Get ip address |
189 | 189 | $ip_address = $this->ci->input->ip_address(); |
190 | 190 | |
191 | - if (! $user) |
|
191 | + if ( ! $user) |
|
192 | 192 | { |
193 | 193 | $this->error = lang('auth.invalid_user'); |
194 | 194 | $this->ci->login_model->recordLoginAttempt($ip_address); |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | // Now, try matching the passwords. |
199 | - $result = password_verify($password, $user['password_hash']); |
|
199 | + $result = password_verify($password, $user['password_hash']); |
|
200 | 200 | |
201 | - if (! $result) |
|
201 | + if ( ! $result) |
|
202 | 202 | { |
203 | 203 | $this->error = lang('auth.invalid_password'); |
204 | 204 | $this->ci->login_model->recordLoginAttempt($ip_address, $user['id']); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | // This would be due to the hash algorithm or hash |
210 | 210 | // cost changing since the last time that a user |
211 | 211 | // logged in. |
212 | - if (password_needs_rehash($user['password_hash'], PASSWORD_DEFAULT, ['cost' => config_item('auth.hash_cost')] )) |
|
212 | + if (password_needs_rehash($user['password_hash'], PASSWORD_DEFAULT, ['cost' => config_item('auth.hash_cost')])) |
|
213 | 213 | { |
214 | 214 | $new_hash = Password::hashPassword($password); |
215 | 215 | $this->user_model->skip_validation() |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | // Is the user active? |
221 | - if (! $user['active']) |
|
221 | + if ( ! $user['active']) |
|
222 | 222 | { |
223 | 223 | $this->error = lang('auth.inactive_account'); |
224 | 224 | return false; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | $this->ci->load->helper('cookie'); |
240 | 240 | |
241 | - if (! Events::trigger('beforeLogout', [$this->user])) |
|
241 | + if ( ! Events::trigger('beforeLogout', [$this->user])) |
|
242 | 242 | { |
243 | 243 | return false; |
244 | 244 | } |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | // available for flash messages, etc. |
248 | 248 | if (isset($_SESSION)) |
249 | 249 | { |
250 | - foreach ( $_SESSION as $key => $value ) |
|
250 | + foreach ($_SESSION as $key => $value) |
|
251 | 251 | { |
252 | - $_SESSION[ $key ] = NULL; |
|
253 | - unset( $_SESSION[ $key ] ); |
|
252 | + $_SESSION[$key] = NULL; |
|
253 | + unset($_SESSION[$key]); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | // Also, regenerate the session ID for a touch of added safety. |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | { |
277 | 277 | $id = $this->ci->session->userdata('logged_in'); |
278 | 278 | |
279 | - if (! $id) |
|
279 | + if ( ! $id) |
|
280 | 280 | { |
281 | 281 | return false; |
282 | 282 | } |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | // If the user var hasn't been filled in, we need to fill it in, |
285 | 285 | // since this method will typically be used as the only method |
286 | 286 | // to determine whether a user is logged in or not. |
287 | - if (! $this->user) |
|
287 | + if ( ! $this->user) |
|
288 | 288 | { |
289 | 289 | $this->user = $this->user_model->as_array() |
290 | - ->find_by('id', (int)$id); |
|
290 | + ->find_by('id', (int) $id); |
|
291 | 291 | |
292 | 292 | if (empty($this->user)) |
293 | 293 | { |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function viaRemember() |
313 | 313 | { |
314 | - if (! config_item('auth.allow_remembering')) |
|
314 | + if ( ! config_item('auth.allow_remembering')) |
|
315 | 315 | { |
316 | 316 | return false; |
317 | 317 | } |
318 | 318 | |
319 | 319 | $this->ci->load->helper('cookie'); |
320 | 320 | |
321 | - if (! $token = get_cookie('remember')) |
|
321 | + if ( ! $token = get_cookie('remember')) |
|
322 | 322 | { |
323 | 323 | return false; |
324 | 324 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $query = $this->ci->db->where('hash', $this->ci->login_model->hashRememberToken($token)) |
328 | 328 | ->get('auth_tokens'); |
329 | 329 | |
330 | - if (! $query->num_rows()) |
|
330 | + if ( ! $query->num_rows()) |
|
331 | 331 | { |
332 | 332 | return false; |
333 | 333 | } |
@@ -365,16 +365,16 @@ discard block |
||
365 | 365 | // If via email, we need to generate a hash |
366 | 366 | $this->ci->load->helper('string'); |
367 | 367 | $token = random_string('alnum', 24); |
368 | - $user_data['activate_hash'] = hash('sha1', config_item('auth.salt') . $token); |
|
368 | + $user_data['activate_hash'] = hash('sha1', config_item('auth.salt').$token); |
|
369 | 369 | |
370 | 370 | // Email should NOT be case sensitive. |
371 | - if (! empty($user_data['email'])) |
|
371 | + if ( ! empty($user_data['email'])) |
|
372 | 372 | { |
373 | 373 | $user_data['email'] = strtolower($user_data['email']); |
374 | 374 | } |
375 | 375 | |
376 | 376 | // Save the user |
377 | - if (! $id = $this->user_model->insert($user_data)) |
|
377 | + if ( ! $id = $this->user_model->insert($user_data)) |
|
378 | 378 | { |
379 | 379 | $this->error = $this->user_model->error(); |
380 | 380 | return false; |
@@ -405,25 +405,25 @@ discard block |
||
405 | 405 | { |
406 | 406 | $post = [ |
407 | 407 | 'email' => $data['email'], |
408 | - 'activate_hash' => hash('sha1', config_item('auth.salt') . $data['code']) |
|
408 | + 'activate_hash' => hash('sha1', config_item('auth.salt').$data['code']) |
|
409 | 409 | ]; |
410 | 410 | |
411 | 411 | $user = $this->user_model->where($post) |
412 | 412 | ->first(); |
413 | 413 | |
414 | - if (! $user) { |
|
414 | + if ( ! $user) { |
|
415 | 415 | $this->error = $this->user_model->error() ? $this->user_model->error() : lang('auth.activate_no_user'); |
416 | 416 | |
417 | 417 | return false; |
418 | 418 | } |
419 | 419 | |
420 | - if (! $this->user_model->update($user->id, ['active' => 1, 'activate_hash' => null])) |
|
420 | + if ( ! $this->user_model->update($user->id, ['active' => 1, 'activate_hash' => null])) |
|
421 | 421 | { |
422 | 422 | $this->error = $this->user_model->error(); |
423 | 423 | return false; |
424 | 424 | } |
425 | 425 | |
426 | - Events::trigger('didActivate', [(array)$user]); |
|
426 | + Events::trigger('didActivate', [(array) $user]); |
|
427 | 427 | |
428 | 428 | return true; |
429 | 429 | } |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | */ |
439 | 439 | public function activateUserById($id) |
440 | 440 | { |
441 | - if (! $this->user_model->update($id, ['active' => 1, 'activate_hash' => null])) |
|
441 | + if ( ! $this->user_model->update($id, ['active' => 1, 'activate_hash' => null])) |
|
442 | 442 | { |
443 | 443 | $this->error = $this->user_model->error(); |
444 | 444 | return false; |
@@ -470,12 +470,12 @@ discard block |
||
470 | 470 | */ |
471 | 471 | public function id() |
472 | 472 | { |
473 | - if (! is_array($this->user) || empty($this->user['id'])) |
|
473 | + if ( ! is_array($this->user) || empty($this->user['id'])) |
|
474 | 474 | { |
475 | 475 | return null; |
476 | 476 | } |
477 | 477 | |
478 | - return (int)$this->user['id']; |
|
478 | + return (int) $this->user['id']; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | //-------------------------------------------------------------------- |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | public function isThrottled($user) |
493 | 493 | { |
494 | 494 | // Not throttling? Get outta here! |
495 | - if (! config_item('auth.allow_throttling')) |
|
495 | + if ( ! config_item('auth.allow_throttling')) |
|
496 | 496 | { |
497 | 497 | return false; |
498 | 498 | } |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | { |
561 | 561 | $this->error = lang('auth.bruteBan_notice'); |
562 | 562 | |
563 | - $ban_time = 60 * 15; // 15 minutes |
|
563 | + $ban_time = 60 * 15; // 15 minutes |
|
564 | 564 | $_SESSION['bruteBan'] = time() + $ban_time; |
565 | 565 | return $ban_time; |
566 | 566 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | // Is it a valid user? |
609 | 609 | $user = $this->user_model->find_by('email', $email); |
610 | 610 | |
611 | - if (! $user) |
|
611 | + if ( ! $user) |
|
612 | 612 | { |
613 | 613 | $this->error = lang('auth.invalid_email'); |
614 | 614 | return false; |
@@ -617,17 +617,17 @@ discard block |
||
617 | 617 | // Generate/store our codes |
618 | 618 | $this->ci->load->helper('string'); |
619 | 619 | $token = random_string('alnum', 24); |
620 | - $hash = hash('sha1', config_item('auth.salt') .$token); |
|
620 | + $hash = hash('sha1', config_item('auth.salt').$token); |
|
621 | 621 | |
622 | 622 | $result = $this->user_model->update($user->id, ['reset_hash' => $hash]); |
623 | 623 | |
624 | - if (! $result) |
|
624 | + if ( ! $result) |
|
625 | 625 | { |
626 | 626 | $this->error = $this->user_model->error(); |
627 | 627 | return false; |
628 | 628 | } |
629 | 629 | |
630 | - Events::trigger('didRemindUser', [(array)$user, $token]); |
|
630 | + Events::trigger('didRemindUser', [(array) $user, $token]); |
|
631 | 631 | |
632 | 632 | return true; |
633 | 633 | } |
@@ -654,10 +654,10 @@ discard block |
||
654 | 654 | } |
655 | 655 | |
656 | 656 | // Generate a hash to match against the table. |
657 | - $reset_hash = hash('sha1', config_item('auth.salt') .$credentials['code']); |
|
657 | + $reset_hash = hash('sha1', config_item('auth.salt').$credentials['code']); |
|
658 | 658 | unset($credentials['code']); |
659 | 659 | |
660 | - if (! empty($credentials['email'])) |
|
660 | + if ( ! empty($credentials['email'])) |
|
661 | 661 | { |
662 | 662 | $credentials['email'] = strtolower($credentials['email']); |
663 | 663 | } |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | |
670 | 670 | // If throttling time is above zero, we can't allow |
671 | 671 | // logins now. |
672 | - $time = (int)$this->isThrottled($user); |
|
672 | + $time = (int) $this->isThrottled($user); |
|
673 | 673 | if ($time > 0) |
674 | 674 | { |
675 | 675 | $this->error = sprintf(lang('auth.throttled'), $time); |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | // Get ip address |
680 | 680 | $ip_address = $this->ci->input->ip_address(); |
681 | 681 | |
682 | - if (! $user) |
|
682 | + if ( ! $user) |
|
683 | 683 | { |
684 | 684 | $this->error = lang('auth.reset_no_user'); |
685 | 685 | $this->ci->login_model->recordLoginAttempt($ip_address); |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | 'reset_hash' => null |
702 | 702 | ]; |
703 | 703 | |
704 | - if (! $this->user_model->update($user['id'], $data)) |
|
704 | + if ( ! $this->user_model->update($user['id'], $data)) |
|
705 | 705 | { |
706 | 706 | $this->error = $this->user_model->error(); |
707 | 707 | return false; |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | * @param null $message |
727 | 727 | * @return mixed |
728 | 728 | */ |
729 | - public function changeStatus($newStatus, $message=null) |
|
729 | + public function changeStatus($newStatus, $message = null) |
|
730 | 730 | { |
731 | 731 | // todo actually record new users status! |
732 | 732 | } |
@@ -743,14 +743,14 @@ discard block |
||
743 | 743 | * @param bool $allow_any_parent |
744 | 744 | * @return mixed |
745 | 745 | */ |
746 | - public function useModel($model, $allow_any_parent=false) |
|
746 | + public function useModel($model, $allow_any_parent = false) |
|
747 | 747 | { |
748 | - if (! $allow_any_parent && get_parent_class($model) != 'Myth\Models\CIDbModel') |
|
748 | + if ( ! $allow_any_parent && get_parent_class($model) != 'Myth\Models\CIDbModel') |
|
749 | 749 | { |
750 | 750 | throw new \RuntimeException('Models passed into LocalAuthenticate MUST extend Myth\Models\CIDbModel'); |
751 | 751 | } |
752 | 752 | |
753 | - $this->user_model =& $model; |
|
753 | + $this->user_model = & $model; |
|
754 | 754 | |
755 | 755 | return $this; |
756 | 756 | } |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | */ |
821 | 821 | protected function rememberUser($user) |
822 | 822 | { |
823 | - if (! config_item('auth.allow_remembering')) |
|
823 | + if ( ! config_item('auth.allow_remembering')) |
|
824 | 824 | { |
825 | 825 | log_message('debug', 'Auth library set to refuse "Remember Me" functionality.'); |
826 | 826 | return false; |
@@ -839,13 +839,13 @@ discard block |
||
839 | 839 | * @param null $token |
840 | 840 | * @return mixed |
841 | 841 | */ |
842 | - protected function refreshRememberCookie($user, $token=null) |
|
842 | + protected function refreshRememberCookie($user, $token = null) |
|
843 | 843 | { |
844 | 844 | $this->ci->load->helper('cookie'); |
845 | 845 | |
846 | 846 | // If a token is passed in, we know we're removing the |
847 | 847 | // old one. |
848 | - if (! empty($token)) |
|
848 | + if ( ! empty($token)) |
|
849 | 849 | { |
850 | 850 | $this->invalidateRememberCookie($user['email'], $token); |
851 | 851 | } |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | // Save the token to the database. |
856 | 856 | $data = [ |
857 | 857 | 'email' => $user['email'], |
858 | - 'hash' => sha1(config_item('auth.salt') . $new_token), |
|
858 | + 'hash' => sha1(config_item('auth.salt').$new_token), |
|
859 | 859 | 'created' => date('Y-m-d H:i:s') |
860 | 860 | ]; |
861 | 861 | |
@@ -863,13 +863,13 @@ discard block |
||
863 | 863 | |
864 | 864 | // Create the cookie |
865 | 865 | set_cookie( |
866 | - 'remember', // Cookie Name |
|
867 | - $new_token, // Value |
|
868 | - config_item('auth.remember_length'), // # Seconds until it expires |
|
866 | + 'remember', // Cookie Name |
|
867 | + $new_token, // Value |
|
868 | + config_item('auth.remember_length'), // # Seconds until it expires |
|
869 | 869 | config_item('cookie_domain'), |
870 | 870 | config_item('cookie_path'), |
871 | 871 | config_item('cookie_prefix'), |
872 | - false, // Only send over HTTPS? |
|
872 | + false, // Only send over HTTPS? |
|
873 | 873 | true // Hide from Javascript? |
874 | 874 | ); |
875 | 875 |