@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * Name: Ion Auth Lang - Italian |
4 | 4 | * |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | // Account Creation |
18 | -$lang['account_creation_successful'] = 'Account creato con successo.'; |
|
19 | -$lang['account_creation_unsuccessful'] = 'Impossibile creare l\'account.'; |
|
20 | -$lang['account_creation_duplicate_email'] = 'Email già in uso o non valida.'; |
|
21 | -$lang['account_creation_duplicate_identity'] = 'Nome utente già in uso o non valido.'; |
|
18 | +$lang['account_creation_successful'] = 'Account creato con successo.'; |
|
19 | +$lang['account_creation_unsuccessful'] = 'Impossibile creare l\'account.'; |
|
20 | +$lang['account_creation_duplicate_email'] = 'Email già in uso o non valida.'; |
|
21 | +$lang['account_creation_duplicate_identity'] = 'Nome utente già in uso o non valido.'; |
|
22 | 22 | |
23 | 23 | // TODO Please Translate |
24 | 24 | $lang['account_creation_missing_default_group'] = 'Default group is not set'; |
@@ -27,24 +27,24 @@ discard block |
||
27 | 27 | |
28 | 28 | // Password |
29 | 29 | $lang['password_change_successful'] = 'Password modificata con successo.'; |
30 | -$lang['password_change_unsuccessful'] = 'Impossibile modificare la password.'; |
|
30 | +$lang['password_change_unsuccessful'] = 'Impossibile modificare la password.'; |
|
31 | 31 | $lang['forgot_password_successful'] = 'Email di reset della password inviata.'; |
32 | -$lang['forgot_password_unsuccessful'] = 'Impossibile resettare la password.'; |
|
32 | +$lang['forgot_password_unsuccessful'] = 'Impossibile resettare la password.'; |
|
33 | 33 | |
34 | 34 | // Activation |
35 | -$lang['activate_successful'] = 'Account attivato.'; |
|
36 | -$lang['activate_unsuccessful'] = 'Impossibile attivare l\'account.'; |
|
37 | -$lang['deactivate_successful'] = 'Account disattivato.'; |
|
38 | -$lang['deactivate_unsuccessful'] = 'Impossibile disattivare l\'account.'; |
|
39 | -$lang['activation_email_successful'] = 'Email di attivazione inviata.'; |
|
40 | -$lang['activation_email_unsuccessful'] = 'Impossibile inviare l\'email di attivazione.'; |
|
41 | -$lang['deactivate_current_user_unsuccessful']= 'You cannot De-Activate your self.'; |
|
35 | +$lang['activate_successful'] = 'Account attivato.'; |
|
36 | +$lang['activate_unsuccessful'] = 'Impossibile attivare l\'account.'; |
|
37 | +$lang['deactivate_successful'] = 'Account disattivato.'; |
|
38 | +$lang['deactivate_unsuccessful'] = 'Impossibile disattivare l\'account.'; |
|
39 | +$lang['activation_email_successful'] = 'Email di attivazione inviata.'; |
|
40 | +$lang['activation_email_unsuccessful'] = 'Impossibile inviare l\'email di attivazione.'; |
|
41 | +$lang['deactivate_current_user_unsuccessful'] = 'You cannot De-Activate your self.'; |
|
42 | 42 | |
43 | 43 | // Login / Logout |
44 | -$lang['login_successful'] = 'Login effettuato con successo.'; |
|
45 | -$lang['login_unsuccessful'] = 'Login non corretto.'; |
|
46 | -$lang['login_unsuccessful_not_active'] = 'Account is inactive'; |
|
47 | -$lang['login_timeout'] = 'Temporarily Locked Out. Try again later.'; |
|
44 | +$lang['login_successful'] = 'Login effettuato con successo.'; |
|
45 | +$lang['login_unsuccessful'] = 'Login non corretto.'; |
|
46 | +$lang['login_unsuccessful_not_active'] = 'Account is inactive'; |
|
47 | +$lang['login_timeout'] = 'Temporarily Locked Out. Try again later.'; |
|
48 | 48 | $lang['logout_successful'] = 'Logout effettuato con successo.'; |
49 | 49 | |
50 | 50 | // Account Changes |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | $lang['group_delete_successful'] = 'Group deleted'; |
61 | 61 | $lang['group_delete_unsuccessful'] = 'Unable to delete group'; |
62 | 62 | $lang['group_delete_notallowed'] = 'Can\'t delete the administrators\' group'; |
63 | -$lang['group_name_required'] = 'Group name is a required field'; |
|
63 | +$lang['group_name_required'] = 'Group name is a required field'; |
|
64 | 64 | $lang['group_name_admin_not_alter'] = 'Admin group name can not be changed'; |
65 | 65 | |
66 | 66 | // Activation Email |
67 | -$lang['email_activation_subject'] = 'Attivazione Account'; |
|
67 | +$lang['email_activation_subject'] = 'Attivazione Account'; |
|
68 | 68 | $lang['email_activate_heading'] = 'Activate account for %s'; |
69 | 69 | $lang['email_activate_subheading'] = 'Please click this link to %s.'; |
70 | 70 | $lang['email_activate_link'] = 'Activate Your Account'; |
71 | 71 | // Forgot Password Email |
72 | -$lang['email_forgotten_password_subject'] = 'Verifica il cambio password dimenticata'; |
|
72 | +$lang['email_forgotten_password_subject'] = 'Verifica il cambio password dimenticata'; |
|
73 | 73 | $lang['email_forgot_password_heading'] = 'Reset Password for %s'; |
74 | 74 | $lang['email_forgot_password_subheading'] = 'Please click this link to %s.'; |
75 | 75 | $lang['email_forgot_password_link'] = 'Reset Your Password'; |
76 | 76 | // New Password Email |
77 | -$lang['email_new_password_subject'] = 'Nuova Password'; |
|
77 | +$lang['email_new_password_subject'] = 'Nuova Password'; |
|
78 | 78 | $lang['email_new_password_heading'] = 'New Password for %s'; |
79 | 79 | $lang['email_new_password_subheading'] = 'Your password has been reset to: %s'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * Name: Auth Lang - Italian |
4 | 4 | * |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $lang['forgot_password_username_identity_label'] = 'Username'; |
139 | 139 | $lang['forgot_password_email_identity_label'] = 'Email'; |
140 | 140 | $lang['forgot_password_email_not_found'] = 'Indirizzo email non presente nel database.'; |
141 | -$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
141 | +$lang['forgot_password_identity_not_found'] = 'No record of that username address.'; |
|
142 | 142 | |
143 | 143 | // Reset Password |
144 | 144 | $lang['reset_password_heading'] = 'Cambia Password'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * Name: Ion Auth Model |
4 | 4 | * |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | $this->lang->load('ion_auth'); |
172 | 172 | |
173 | 173 | // initialize db tables data |
174 | - $this->tables = $this->config->item('tables', 'ion_auth'); |
|
174 | + $this->tables = $this->config->item('tables', 'ion_auth'); |
|
175 | 175 | |
176 | 176 | //initialize data |
177 | 177 | $this->identity_column = $this->config->item('identity', 'ion_auth'); |
178 | 178 | $this->store_salt = $this->config->item('store_salt', 'ion_auth'); |
179 | 179 | $this->salt_length = $this->config->item('salt_length', 'ion_auth'); |
180 | - $this->join = $this->config->item('join', 'ion_auth'); |
|
180 | + $this->join = $this->config->item('join', 'ion_auth'); |
|
181 | 181 | |
182 | 182 | |
183 | 183 | // initialize hash method options (Bcrypt) |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $delimiters_source = $this->config->item('delimiters_source', 'ion_auth'); |
195 | 195 | |
196 | 196 | // load the error delimeters either from the config file or use what's been supplied to form validation |
197 | - if ($delimiters_source === 'form_validation') |
|
197 | + if($delimiters_source === 'form_validation') |
|
198 | 198 | { |
199 | 199 | // load in delimiters from form_validation |
200 | 200 | // to keep this simple we'll load the value using reflection since these properties are protected |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | $this->_ion_hooks = new stdClass; |
226 | 226 | |
227 | 227 | // load the bcrypt class if needed |
228 | - if ($this->hash_method == 'bcrypt') { |
|
229 | - if ($this->random_rounds) |
|
228 | + if($this->hash_method == 'bcrypt') { |
|
229 | + if($this->random_rounds) |
|
230 | 230 | { |
231 | - $rand = rand($this->min_rounds,$this->max_rounds); |
|
231 | + $rand = rand($this->min_rounds, $this->max_rounds); |
|
232 | 232 | $params = array('rounds' => $rand); |
233 | 233 | } |
234 | 234 | else |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | $params['salt_prefix'] = $this->config->item('salt_prefix', 'ion_auth'); |
240 | - $this->load->library('bcrypt',$params); |
|
240 | + $this->load->library('bcrypt', $params); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $this->trigger_events('model_constructor'); |
@@ -260,28 +260,28 @@ discard block |
||
260 | 260 | * @return void |
261 | 261 | * @author Mathew |
262 | 262 | **/ |
263 | - public function hash_password($password, $salt=false, $use_sha1_override=FALSE) |
|
263 | + public function hash_password($password, $salt = false, $use_sha1_override = FALSE) |
|
264 | 264 | { |
265 | - if (empty($password)) |
|
265 | + if(empty($password)) |
|
266 | 266 | { |
267 | 267 | return FALSE; |
268 | 268 | } |
269 | 269 | |
270 | 270 | // bcrypt |
271 | - if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
271 | + if($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
272 | 272 | { |
273 | 273 | return $this->bcrypt->hash($password); |
274 | 274 | } |
275 | 275 | |
276 | 276 | |
277 | - if ($this->store_salt && $salt) |
|
277 | + if($this->store_salt && $salt) |
|
278 | 278 | { |
279 | - return sha1($password . $salt); |
|
279 | + return sha1($password.$salt); |
|
280 | 280 | } |
281 | 281 | else |
282 | 282 | { |
283 | 283 | $salt = $this->salt(); |
284 | - return $salt . substr(sha1($salt . $password), 0, -$this->salt_length); |
|
284 | + return $salt.substr(sha1($salt.$password), 0, -$this->salt_length); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | * @return void |
293 | 293 | * @author Mathew |
294 | 294 | **/ |
295 | - public function hash_password_db($id, $password, $use_sha1_override=FALSE) |
|
295 | + public function hash_password_db($id, $password, $use_sha1_override = FALSE) |
|
296 | 296 | { |
297 | - if (empty($id) || empty($password)) |
|
297 | + if(empty($id) || empty($password)) |
|
298 | 298 | { |
299 | 299 | return FALSE; |
300 | 300 | } |
@@ -309,15 +309,15 @@ discard block |
||
309 | 309 | |
310 | 310 | $hash_password_db = $query->row(); |
311 | 311 | |
312 | - if ($query->num_rows() !== 1) |
|
312 | + if($query->num_rows() !== 1) |
|
313 | 313 | { |
314 | 314 | return FALSE; |
315 | 315 | } |
316 | 316 | |
317 | 317 | // bcrypt |
318 | - if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
318 | + if($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') |
|
319 | 319 | { |
320 | - if ($this->bcrypt->verify($password,$hash_password_db->password)) |
|
320 | + if($this->bcrypt->verify($password, $hash_password_db->password)) |
|
321 | 321 | { |
322 | 322 | return TRUE; |
323 | 323 | } |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | } |
327 | 327 | |
328 | 328 | // sha1 |
329 | - if ($this->store_salt) |
|
329 | + if($this->store_salt) |
|
330 | 330 | { |
331 | - $db_password = sha1($password . $hash_password_db->salt); |
|
331 | + $db_password = sha1($password.$hash_password_db->salt); |
|
332 | 332 | } |
333 | 333 | else |
334 | 334 | { |
335 | 335 | $salt = substr($hash_password_db->password, 0, $this->salt_length); |
336 | 336 | |
337 | - $db_password = $salt . substr(sha1($salt . $password), 0, -$this->salt_length); |
|
337 | + $db_password = $salt.substr(sha1($salt.$password), 0, -$this->salt_length); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | if($db_password == $hash_password_db->password) |
@@ -374,44 +374,44 @@ discard block |
||
374 | 374 | $buffer = ''; |
375 | 375 | $buffer_valid = false; |
376 | 376 | |
377 | - if (function_exists('random_bytes')) { |
|
377 | + if(function_exists('random_bytes')) { |
|
378 | 378 | $buffer = random_bytes($raw_salt_len); |
379 | - if ($buffer) { |
|
379 | + if($buffer) { |
|
380 | 380 | $buffer_valid = true; |
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - if (!$buffer_valid && function_exists('mcrypt_create_iv') && !defined('PHALANGER')) { |
|
384 | + if(!$buffer_valid && function_exists('mcrypt_create_iv') && !defined('PHALANGER')) { |
|
385 | 385 | $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM); |
386 | - if ($buffer) { |
|
386 | + if($buffer) { |
|
387 | 387 | $buffer_valid = true; |
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | - if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) { |
|
391 | + if(!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) { |
|
392 | 392 | $buffer = openssl_random_pseudo_bytes($raw_salt_len); |
393 | - if ($buffer) { |
|
393 | + if($buffer) { |
|
394 | 394 | $buffer_valid = true; |
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
398 | - if (!$buffer_valid && @is_readable('/dev/urandom')) { |
|
398 | + if(!$buffer_valid && @is_readable('/dev/urandom')) { |
|
399 | 399 | $f = fopen('/dev/urandom', 'r'); |
400 | 400 | $read = strlen($buffer); |
401 | - while ($read < $raw_salt_len) { |
|
401 | + while($read < $raw_salt_len) { |
|
402 | 402 | $buffer .= fread($f, $raw_salt_len - $read); |
403 | 403 | $read = strlen($buffer); |
404 | 404 | } |
405 | 405 | fclose($f); |
406 | - if ($read >= $raw_salt_len) { |
|
406 | + if($read >= $raw_salt_len) { |
|
407 | 407 | $buffer_valid = true; |
408 | 408 | } |
409 | 409 | } |
410 | 410 | |
411 | - if (!$buffer_valid || strlen($buffer) < $raw_salt_len) { |
|
411 | + if(!$buffer_valid || strlen($buffer) < $raw_salt_len) { |
|
412 | 412 | $bl = strlen($buffer); |
413 | - for ($i = 0; $i < $raw_salt_len; $i++) { |
|
414 | - if ($i < $bl) { |
|
413 | + for($i = 0; $i < $raw_salt_len; $i++) { |
|
414 | + if($i < $bl) { |
|
415 | 415 | $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255)); |
416 | 416 | } else { |
417 | 417 | $buffer .= chr(mt_rand(0, 255)); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | { |
454 | 454 | $this->trigger_events('pre_activate'); |
455 | 455 | |
456 | - if ($code !== FALSE) |
|
456 | + if($code !== FALSE) |
|
457 | 457 | { |
458 | 458 | $query = $this->db->select($this->identity_column) |
459 | 459 | ->where('activation_code', $code) |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | $result = $query->row(); |
466 | 466 | |
467 | - if ($query->num_rows() !== 1) |
|
467 | + if($query->num_rows() !== 1) |
|
468 | 468 | { |
469 | 469 | $this->trigger_events(array('post_activate', 'post_activate_unsuccessful')); |
470 | 470 | $this->set_error('activate_unsuccessful'); |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | |
495 | 495 | $return = $this->db->affected_rows() == 1; |
496 | - if ($return) |
|
496 | + if($return) |
|
497 | 497 | { |
498 | 498 | $this->trigger_events(array('post_activate', 'post_activate_successful')); |
499 | 499 | $this->set_message('activate_successful'); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | { |
520 | 520 | $this->trigger_events('deactivate'); |
521 | 521 | |
522 | - if (!isset($id)) |
|
522 | + if(!isset($id)) |
|
523 | 523 | { |
524 | 524 | $this->set_error('deactivate_unsuccessful'); |
525 | 525 | return FALSE; |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $this->db->update($this->tables['users'], $data, array('id' => $id)); |
543 | 543 | |
544 | 544 | $return = $this->db->affected_rows() == 1; |
545 | - if ($return) |
|
545 | + if($return) |
|
546 | 546 | $this->set_message('deactivate_successful'); |
547 | 547 | else |
548 | 548 | $this->set_error('deactivate_unsuccessful'); |
@@ -552,14 +552,14 @@ discard block |
||
552 | 552 | |
553 | 553 | public function clear_forgotten_password_code($code) { |
554 | 554 | |
555 | - if (empty($code)) |
|
555 | + if(empty($code)) |
|
556 | 556 | { |
557 | 557 | return FALSE; |
558 | 558 | } |
559 | 559 | |
560 | 560 | $this->db->where('forgotten_password_code', $code); |
561 | 561 | |
562 | - if ($this->db->count_all_results($this->tables['users']) > 0) |
|
562 | + if($this->db->count_all_results($this->tables['users']) > 0) |
|
563 | 563 | { |
564 | 564 | $data = array( |
565 | 565 | 'forgotten_password_code' => NULL, |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | public function reset_password($identity, $new) { |
584 | 584 | $this->trigger_events('pre_change_password'); |
585 | 585 | |
586 | - if (!$this->identity_check($identity)) { |
|
586 | + if(!$this->identity_check($identity)) { |
|
587 | 587 | $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful')); |
588 | 588 | return FALSE; |
589 | 589 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | ->order_by('id', 'desc') |
597 | 597 | ->get($this->tables['users']); |
598 | 598 | |
599 | - if ($query->num_rows() !== 1) |
|
599 | + if($query->num_rows() !== 1) |
|
600 | 600 | { |
601 | 601 | $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful')); |
602 | 602 | $this->set_error('password_change_unsuccessful'); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | $this->db->update($this->tables['users'], $data, array($this->identity_column => $identity)); |
621 | 621 | |
622 | 622 | $return = $this->db->affected_rows() == 1; |
623 | - if ($return) |
|
623 | + if($return) |
|
624 | 624 | { |
625 | 625 | $this->trigger_events(array('post_change_password', 'post_change_password_successful')); |
626 | 626 | $this->set_message('password_change_successful'); |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | ->order_by('id', 'desc') |
653 | 653 | ->get($this->tables['users']); |
654 | 654 | |
655 | - if ($query->num_rows() !== 1) |
|
655 | + if($query->num_rows() !== 1) |
|
656 | 656 | { |
657 | 657 | $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful')); |
658 | 658 | $this->set_error('password_change_unsuccessful'); |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | |
664 | 664 | $old_password_matches = $this->hash_password_db($user->id, $old); |
665 | 665 | |
666 | - if ($old_password_matches === TRUE) |
|
666 | + if($old_password_matches === TRUE) |
|
667 | 667 | { |
668 | 668 | // store the new password and reset the remember code so all remembered instances have to re-login |
669 | - $hashed_new_password = $this->hash_password($new, $user->salt); |
|
669 | + $hashed_new_password = $this->hash_password($new, $user->salt); |
|
670 | 670 | $data = array( |
671 | 671 | 'password' => $hashed_new_password, |
672 | 672 | 'remember_code' => NULL, |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $this->trigger_events('extra_where'); |
676 | 676 | |
677 | 677 | $successfully_changed_password_in_db = $this->db->update($this->tables['users'], $data, array($this->identity_column => $identity)); |
678 | - if ($successfully_changed_password_in_db) |
|
678 | + if($successfully_changed_password_in_db) |
|
679 | 679 | { |
680 | 680 | $this->trigger_events(array('post_change_password', 'post_change_password_successful')); |
681 | 681 | $this->set_message('password_change_successful'); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | { |
704 | 704 | $this->trigger_events('username_check'); |
705 | 705 | |
706 | - if (empty($username)) |
|
706 | + if(empty($username)) |
|
707 | 707 | { |
708 | 708 | return FALSE; |
709 | 709 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | { |
728 | 728 | $this->trigger_events('email_check'); |
729 | 729 | |
730 | - if (empty($email)) |
|
730 | + if(empty($email)) |
|
731 | 731 | { |
732 | 732 | return FALSE; |
733 | 733 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | { |
752 | 752 | $this->trigger_events('identity_check'); |
753 | 753 | |
754 | - if (empty($identity)) |
|
754 | + if(empty($identity)) |
|
755 | 755 | { |
756 | 756 | return FALSE; |
757 | 757 | } |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | **/ |
771 | 771 | public function forgotten_password($identity) |
772 | 772 | { |
773 | - if (empty($identity)) |
|
773 | + if(empty($identity)) |
|
774 | 774 | { |
775 | 775 | $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful')); |
776 | 776 | return FALSE; |
@@ -782,18 +782,18 @@ discard block |
||
782 | 782 | $activation_code_part = openssl_random_pseudo_bytes(128); |
783 | 783 | } |
784 | 784 | |
785 | - for($i=0;$i<1024;$i++) { |
|
786 | - $activation_code_part = sha1($activation_code_part . mt_rand() . microtime()); |
|
785 | + for($i = 0; $i < 1024; $i++) { |
|
786 | + $activation_code_part = sha1($activation_code_part.mt_rand().microtime()); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | $key = $this->hash_code($activation_code_part.$identity); |
790 | 790 | |
791 | 791 | // If enable query strings is set, then we need to replace any unsafe characters so that the code can still work |
792 | - if ($key != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE) |
|
792 | + if($key != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE) |
|
793 | 793 | { |
794 | 794 | // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards |
795 | 795 | // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern |
796 | - if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $key)) |
|
796 | + if(!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $key)) |
|
797 | 797 | { |
798 | 798 | $key = preg_replace("/[^".$this->config->item('permitted_uri_chars')."]+/i", "-", $key); |
799 | 799 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | |
814 | 814 | $return = $this->db->affected_rows() == 1; |
815 | 815 | |
816 | - if ($return) |
|
816 | + if($return) |
|
817 | 817 | $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_successful')); |
818 | 818 | else |
819 | 819 | $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful')); |
@@ -827,11 +827,11 @@ discard block |
||
827 | 827 | * @return string |
828 | 828 | * @author Mathew |
829 | 829 | **/ |
830 | - public function forgotten_password_complete($code, $salt=FALSE) |
|
830 | + public function forgotten_password_complete($code, $salt = FALSE) |
|
831 | 831 | { |
832 | 832 | $this->trigger_events('pre_forgotten_password_complete'); |
833 | 833 | |
834 | - if (empty($code)) |
|
834 | + if(empty($code)) |
|
835 | 835 | { |
836 | 836 | $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful')); |
837 | 837 | return FALSE; |
@@ -839,12 +839,12 @@ discard block |
||
839 | 839 | |
840 | 840 | $profile = $this->where('forgotten_password_code', $code)->users()->row(); //pass the code to profile |
841 | 841 | |
842 | - if ($profile) { |
|
842 | + if($profile) { |
|
843 | 843 | |
844 | - if ($this->config->item('forgot_password_expiration', 'ion_auth') > 0) { |
|
844 | + if($this->config->item('forgot_password_expiration', 'ion_auth') > 0) { |
|
845 | 845 | //Make sure it isn't expired |
846 | 846 | $expiration = $this->config->item('forgot_password_expiration', 'ion_auth'); |
847 | - if (time() - $profile->forgotten_password_time > $expiration) { |
|
847 | + if(time() - $profile->forgotten_password_time > $expiration) { |
|
848 | 848 | //it has expired |
849 | 849 | $this->set_error('forgot_password_expired'); |
850 | 850 | $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful')); |
@@ -882,20 +882,20 @@ discard block |
||
882 | 882 | |
883 | 883 | $manual_activation = $this->config->item('manual_activation', 'ion_auth'); |
884 | 884 | |
885 | - if ($this->identity_check($identity)) |
|
885 | + if($this->identity_check($identity)) |
|
886 | 886 | { |
887 | 887 | $this->set_error('account_creation_duplicate_identity'); |
888 | 888 | return FALSE; |
889 | 889 | } |
890 | - elseif ( !$this->config->item('default_group', 'ion_auth') && empty($groups) ) |
|
890 | + elseif(!$this->config->item('default_group', 'ion_auth') && empty($groups)) |
|
891 | 891 | { |
892 | 892 | $this->set_error('account_creation_missing_default_group'); |
893 | 893 | return FALSE; |
894 | 894 | } |
895 | 895 | |
896 | 896 | // check if the default set in config exists in database |
897 | - $query = $this->db->get_where($this->tables['groups'],array('name' => $this->config->item('default_group', 'ion_auth')),1)->row(); |
|
898 | - if( !isset($query->id) && empty($groups) ) |
|
897 | + $query = $this->db->get_where($this->tables['groups'], array('name' => $this->config->item('default_group', 'ion_auth')), 1)->row(); |
|
898 | + if(!isset($query->id) && empty($groups)) |
|
899 | 899 | { |
900 | 900 | $this->set_error('account_creation_invalid_default_group'); |
901 | 901 | return FALSE; |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | 'active' => ($manual_activation === false ? 1 : 0) |
921 | 921 | ); |
922 | 922 | |
923 | - if ($this->store_salt) |
|
923 | + if($this->store_salt) |
|
924 | 924 | { |
925 | 925 | $data['salt'] = $salt; |
926 | 926 | } |
@@ -933,18 +933,18 @@ discard block |
||
933 | 933 | |
934 | 934 | $this->db->insert($this->tables['users'], $user_data); |
935 | 935 | |
936 | - $id = $this->db->insert_id($this->tables['users'] . '_id_seq'); |
|
936 | + $id = $this->db->insert_id($this->tables['users'].'_id_seq'); |
|
937 | 937 | |
938 | 938 | // add in groups array if it doesn't exists and stop adding into default group if default group ids are set |
939 | - if( isset($default_group->id) && empty($groups) ) |
|
939 | + if(isset($default_group->id) && empty($groups)) |
|
940 | 940 | { |
941 | 941 | $groups[] = $default_group->id; |
942 | 942 | } |
943 | 943 | |
944 | - if (!empty($groups)) |
|
944 | + if(!empty($groups)) |
|
945 | 945 | { |
946 | 946 | // add to groups |
947 | - foreach ($groups as $group) |
|
947 | + foreach($groups as $group) |
|
948 | 948 | { |
949 | 949 | $this->add_to_group($group, $id); |
950 | 950 | } |
@@ -961,11 +961,11 @@ discard block |
||
961 | 961 | * @return bool |
962 | 962 | * @author Mathew |
963 | 963 | **/ |
964 | - public function login($identity, $password, $remember=FALSE) |
|
964 | + public function login($identity, $password, $remember = FALSE) |
|
965 | 965 | { |
966 | 966 | $this->trigger_events('pre_login'); |
967 | 967 | |
968 | - if (empty($identity) || empty($password)) |
|
968 | + if(empty($identity) || empty($password)) |
|
969 | 969 | { |
970 | 970 | $this->set_error('login_unsuccessful'); |
971 | 971 | return FALSE; |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | |
974 | 974 | $this->trigger_events('extra_where'); |
975 | 975 | |
976 | - $query = $this->db->select($this->identity_column . ', email, id, password, active, last_login') |
|
976 | + $query = $this->db->select($this->identity_column.', email, id, password, active, last_login') |
|
977 | 977 | ->where($this->identity_column, $identity) |
978 | 978 | ->limit(1) |
979 | 979 | ->order_by('id', 'desc') |
@@ -990,15 +990,15 @@ discard block |
||
990 | 990 | return FALSE; |
991 | 991 | } |
992 | 992 | |
993 | - if ($query->num_rows() === 1) |
|
993 | + if($query->num_rows() === 1) |
|
994 | 994 | { |
995 | 995 | $user = $query->row(); |
996 | 996 | |
997 | 997 | $password = $this->hash_password_db($user->id, $password); |
998 | 998 | |
999 | - if ($password === TRUE) |
|
999 | + if($password === TRUE) |
|
1000 | 1000 | { |
1001 | - if ($user->active == 0) |
|
1001 | + if($user->active == 0) |
|
1002 | 1002 | { |
1003 | 1003 | $this->trigger_events('post_login_unsuccessful'); |
1004 | 1004 | $this->set_error('login_unsuccessful_not_active'); |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | $this->clear_login_attempts($identity); |
1014 | 1014 | |
1015 | - if ($remember && $this->config->item('remember_users', 'ion_auth')) |
|
1015 | + if($remember && $this->config->item('remember_users', 'ion_auth')) |
|
1016 | 1016 | { |
1017 | 1017 | $this->remember_user($user->id); |
1018 | 1018 | } |
@@ -1044,19 +1044,19 @@ discard block |
||
1044 | 1044 | { |
1045 | 1045 | $recheck = (null !== $this->config->item('recheck_timer', 'ion_auth')) ? $this->config->item('recheck_timer', 'ion_auth') : 0; |
1046 | 1046 | |
1047 | - if($recheck!==0) |
|
1047 | + if($recheck !== 0) |
|
1048 | 1048 | { |
1049 | 1049 | $last_login = $this->session->userdata('last_check'); |
1050 | - if($last_login+$recheck < time()) |
|
1050 | + if($last_login + $recheck < time()) |
|
1051 | 1051 | { |
1052 | 1052 | $query = $this->db->select('id') |
1053 | - ->where(array($this->identity_column=>$this->session->userdata('identity'),'active'=>'1')) |
|
1053 | + ->where(array($this->identity_column=>$this->session->userdata('identity'), 'active'=>'1')) |
|
1054 | 1054 | ->limit(1) |
1055 | 1055 | ->order_by('id', 'desc') |
1056 | 1056 | ->get($this->tables['users']); |
1057 | - if ($query->num_rows() === 1) |
|
1057 | + if($query->num_rows() === 1) |
|
1058 | 1058 | { |
1059 | - $this->session->set_userdata('last_check',time()); |
|
1059 | + $this->session->set_userdata('last_check', time()); |
|
1060 | 1060 | } |
1061 | 1061 | else |
1062 | 1062 | { |
@@ -1064,13 +1064,13 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | $identity = $this->config->item('identity', 'ion_auth'); |
1066 | 1066 | |
1067 | - if (substr(CI_VERSION, 0, 1) == '2') |
|
1067 | + if(substr(CI_VERSION, 0, 1) == '2') |
|
1068 | 1068 | { |
1069 | - $this->session->unset_userdata( array($identity => '', 'id' => '', 'user_id' => '') ); |
|
1069 | + $this->session->unset_userdata(array($identity => '', 'id' => '', 'user_id' => '')); |
|
1070 | 1070 | } |
1071 | 1071 | else |
1072 | 1072 | { |
1073 | - $this->session->unset_userdata( array($identity, 'id', 'user_id') ); |
|
1073 | + $this->session->unset_userdata(array($identity, 'id', 'user_id')); |
|
1074 | 1074 | } |
1075 | 1075 | return false; |
1076 | 1076 | } |
@@ -1092,9 +1092,9 @@ discard block |
||
1092 | 1092 | * @return boolean |
1093 | 1093 | **/ |
1094 | 1094 | public function is_max_login_attempts_exceeded($identity, $ip_address = NULL) { |
1095 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1095 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1096 | 1096 | $max_attempts = $this->config->item('maximum_login_attempts', 'ion_auth'); |
1097 | - if ($max_attempts > 0) { |
|
1097 | + if($max_attempts > 0) { |
|
1098 | 1098 | $attempts = $this->get_attempts_num($identity, $ip_address); |
1099 | 1099 | return $attempts >= $max_attempts; |
1100 | 1100 | } |
@@ -1115,11 +1115,11 @@ discard block |
||
1115 | 1115 | */ |
1116 | 1116 | public function get_attempts_num($identity, $ip_address = NULL) |
1117 | 1117 | { |
1118 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1118 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1119 | 1119 | $this->db->select('1', FALSE); |
1120 | 1120 | $this->db->where('login', $identity); |
1121 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1122 | - if (!isset($ip_address)) { |
|
1121 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1122 | + if(!isset($ip_address)) { |
|
1123 | 1123 | $ip_address = $this->_prepare_ip($this->input->ip_address()); |
1124 | 1124 | } |
1125 | 1125 | $this->db->where('ip_address', $ip_address); |
@@ -1164,11 +1164,11 @@ discard block |
||
1164 | 1164 | * @return int |
1165 | 1165 | */ |
1166 | 1166 | public function get_last_attempt_time($identity, $ip_address = NULL) { |
1167 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1167 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1168 | 1168 | $this->db->select('time'); |
1169 | 1169 | $this->db->where('login', $identity); |
1170 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1171 | - if (!isset($ip_address)) { |
|
1170 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1171 | + if(!isset($ip_address)) { |
|
1172 | 1172 | $ip_address = $this->_prepare_ip($this->input->ip_address()); |
1173 | 1173 | } |
1174 | 1174 | $this->db->where('ip_address', $ip_address); |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | * @return string |
1192 | 1192 | */ |
1193 | 1193 | public function get_last_attempt_ip($identity) { |
1194 | - if ($this->config->item('track_login_attempts', 'ion_auth') && $this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1194 | + if($this->config->item('track_login_attempts', 'ion_auth') && $this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1195 | 1195 | $this->db->select('ip_address'); |
1196 | 1196 | $this->db->where('login', $identity); |
1197 | 1197 | $this->db->order_by('id', 'desc'); |
@@ -1214,9 +1214,9 @@ discard block |
||
1214 | 1214 | * @param string $identity: user's identity |
1215 | 1215 | **/ |
1216 | 1216 | public function increase_login_attempts($identity) { |
1217 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1217 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1218 | 1218 | $data = array('ip_address' => '', 'login' => $identity, 'time' => time()); |
1219 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1219 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1220 | 1220 | $data['ip_address'] = $this->_prepare_ip($this->input->ip_address()); |
1221 | 1221 | } |
1222 | 1222 | return $this->db->insert($this->tables['login_attempts'], $data); |
@@ -1238,13 +1238,13 @@ discard block |
||
1238 | 1238 | * Use get_last_attempt_ip($identity) to retrieve user's last IP |
1239 | 1239 | **/ |
1240 | 1240 | public function clear_login_attempts($identity, $old_attempts_expire_period = 86400, $ip_address = NULL) { |
1241 | - if ($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1241 | + if($this->config->item('track_login_attempts', 'ion_auth')) { |
|
1242 | 1242 | // Make sure $old_attempts_expire_period is at least equals to lockout_time |
1243 | 1243 | $old_attempts_expire_period = max($old_attempts_expire_period, $this->config->item('lockout_time', 'ion_auth')); |
1244 | 1244 | |
1245 | 1245 | $this->db->where('login', $identity); |
1246 | - if ($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1247 | - if (!isset($ip_address)) { |
|
1246 | + if($this->config->item('track_login_ip_address', 'ion_auth')) { |
|
1247 | + if(!isset($ip_address)) { |
|
1248 | 1248 | $ip_address = $this->_prepare_ip($this->input->ip_address()); |
1249 | 1249 | } |
1250 | 1250 | $this->db->where('ip_address', $ip_address); |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | { |
1278 | 1278 | $this->trigger_events('where'); |
1279 | 1279 | |
1280 | - if (!is_array($where)) |
|
1280 | + if(!is_array($where)) |
|
1281 | 1281 | { |
1282 | 1282 | $where = array($where => $value); |
1283 | 1283 | } |
@@ -1309,7 +1309,7 @@ discard block |
||
1309 | 1309 | return $this; |
1310 | 1310 | } |
1311 | 1311 | |
1312 | - public function order_by($by, $order='desc') |
|
1312 | + public function order_by($by, $order = 'desc') |
|
1313 | 1313 | { |
1314 | 1314 | $this->trigger_events('order_by'); |
1315 | 1315 | |
@@ -1374,9 +1374,9 @@ discard block |
||
1374 | 1374 | { |
1375 | 1375 | $this->trigger_events('users'); |
1376 | 1376 | |
1377 | - if (isset($this->_ion_select) && !empty($this->_ion_select)) |
|
1377 | + if(isset($this->_ion_select) && !empty($this->_ion_select)) |
|
1378 | 1378 | { |
1379 | - foreach ($this->_ion_select as $select) |
|
1379 | + foreach($this->_ion_select as $select) |
|
1380 | 1380 | { |
1381 | 1381 | $this->db->select($select); |
1382 | 1382 | } |
@@ -1394,16 +1394,16 @@ discard block |
||
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | // filter by group id(s) if passed |
1397 | - if (isset($groups)) |
|
1397 | + if(isset($groups)) |
|
1398 | 1398 | { |
1399 | 1399 | // build an array if only one group was passed |
1400 | - if (!is_array($groups)) |
|
1400 | + if(!is_array($groups)) |
|
1401 | 1401 | { |
1402 | 1402 | $groups = Array($groups); |
1403 | 1403 | } |
1404 | 1404 | |
1405 | 1405 | // join and then run a where_in against the group ids |
1406 | - if (isset($groups) && !empty($groups)) |
|
1406 | + if(isset($groups) && !empty($groups)) |
|
1407 | 1407 | { |
1408 | 1408 | $this->db->distinct(); |
1409 | 1409 | $this->db->join( |
@@ -1425,8 +1425,8 @@ discard block |
||
1425 | 1425 | // if group name was used we do one more join with groups |
1426 | 1426 | if(!empty($group_names)) |
1427 | 1427 | { |
1428 | - $this->db->join($this->tables['groups'], $this->tables['users_groups'] . '.' . $this->join['groups'] . ' = ' . $this->tables['groups'] . '.id', 'inner'); |
|
1429 | - $this->db->where_in($this->tables['groups'] . '.name', $group_names); |
|
1428 | + $this->db->join($this->tables['groups'], $this->tables['users_groups'].'.'.$this->join['groups'].' = '.$this->tables['groups'].'.id', 'inner'); |
|
1429 | + $this->db->where_in($this->tables['groups'].'.name', $group_names); |
|
1430 | 1430 | } |
1431 | 1431 | if(!empty($group_ids)) |
1432 | 1432 | { |
@@ -1437,9 +1437,9 @@ discard block |
||
1437 | 1437 | $this->trigger_events('extra_where'); |
1438 | 1438 | |
1439 | 1439 | // run each where that was passed |
1440 | - if (isset($this->_ion_where) && !empty($this->_ion_where)) |
|
1440 | + if(isset($this->_ion_where) && !empty($this->_ion_where)) |
|
1441 | 1441 | { |
1442 | - foreach ($this->_ion_where as $where) |
|
1442 | + foreach($this->_ion_where as $where) |
|
1443 | 1443 | { |
1444 | 1444 | $this->db->where($where); |
1445 | 1445 | } |
@@ -1447,9 +1447,9 @@ discard block |
||
1447 | 1447 | $this->_ion_where = array(); |
1448 | 1448 | } |
1449 | 1449 | |
1450 | - if (isset($this->_ion_like) && !empty($this->_ion_like)) |
|
1450 | + if(isset($this->_ion_like) && !empty($this->_ion_like)) |
|
1451 | 1451 | { |
1452 | - foreach ($this->_ion_like as $like) |
|
1452 | + foreach($this->_ion_like as $like) |
|
1453 | 1453 | { |
1454 | 1454 | $this->db->or_like($like['like'], $like['value'], $like['position']); |
1455 | 1455 | } |
@@ -1457,22 +1457,22 @@ discard block |
||
1457 | 1457 | $this->_ion_like = array(); |
1458 | 1458 | } |
1459 | 1459 | |
1460 | - if (isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
1460 | + if(isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
1461 | 1461 | { |
1462 | 1462 | $this->db->limit($this->_ion_limit, $this->_ion_offset); |
1463 | 1463 | |
1464 | 1464 | $this->_ion_limit = NULL; |
1465 | 1465 | $this->_ion_offset = NULL; |
1466 | 1466 | } |
1467 | - else if (isset($this->_ion_limit)) |
|
1467 | + else if(isset($this->_ion_limit)) |
|
1468 | 1468 | { |
1469 | 1469 | $this->db->limit($this->_ion_limit); |
1470 | 1470 | |
1471 | - $this->_ion_limit = NULL; |
|
1471 | + $this->_ion_limit = NULL; |
|
1472 | 1472 | } |
1473 | 1473 | |
1474 | 1474 | // set the order |
1475 | - if (isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
1475 | + if(isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
1476 | 1476 | { |
1477 | 1477 | $this->db->order_by($this->_ion_order_by, $this->_ion_order); |
1478 | 1478 | |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | * @return array |
1514 | 1514 | * @author Ben Edmunds |
1515 | 1515 | **/ |
1516 | - public function get_users_groups($id=FALSE) |
|
1516 | + public function get_users_groups($id = FALSE) |
|
1517 | 1517 | { |
1518 | 1518 | $this->trigger_events('get_users_group'); |
1519 | 1519 | |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | * @return bool |
1533 | 1533 | * @author Ben Edmunds |
1534 | 1534 | **/ |
1535 | - public function add_to_group($group_ids, $user_id=false) |
|
1535 | + public function add_to_group($group_ids, $user_id = false) |
|
1536 | 1536 | { |
1537 | 1537 | $this->trigger_events('add_to_group'); |
1538 | 1538 | |
@@ -1547,11 +1547,11 @@ discard block |
||
1547 | 1547 | $return = 0; |
1548 | 1548 | |
1549 | 1549 | // Then insert each into the database |
1550 | - foreach ($group_ids as $group_id) |
|
1550 | + foreach($group_ids as $group_id) |
|
1551 | 1551 | { |
1552 | - if ($this->db->insert($this->tables['users_groups'], array( $this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id))) |
|
1552 | + if($this->db->insert($this->tables['users_groups'], array($this->join['groups'] => (float) $group_id, $this->join['users'] => (float) $user_id))) |
|
1553 | 1553 | { |
1554 | - if (isset($this->_cache_groups[$group_id])) { |
|
1554 | + if(isset($this->_cache_groups[$group_id])) { |
|
1555 | 1555 | $group_name = $this->_cache_groups[$group_id]; |
1556 | 1556 | } |
1557 | 1557 | else { |
@@ -1575,7 +1575,7 @@ discard block |
||
1575 | 1575 | * @return bool |
1576 | 1576 | * @author Ben Edmunds |
1577 | 1577 | **/ |
1578 | - public function remove_from_group($group_ids=false, $user_id=false) |
|
1578 | + public function remove_from_group($group_ids = false, $user_id = false) |
|
1579 | 1579 | { |
1580 | 1580 | $this->trigger_events('remove_from_group'); |
1581 | 1581 | |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | // if group id(s) are passed remove user from the group(s) |
1589 | - if( ! empty($group_ids)) |
|
1589 | + if(!empty($group_ids)) |
|
1590 | 1590 | { |
1591 | 1591 | if(!is_array($group_ids)) |
1592 | 1592 | { |
@@ -1595,8 +1595,8 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | foreach($group_ids as $group_id) |
1597 | 1597 | { |
1598 | - $this->db->delete($this->tables['users_groups'], array($this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id)); |
|
1599 | - if (isset($this->_cache_user_in_group[$user_id]) && isset($this->_cache_user_in_group[$user_id][$group_id])) |
|
1598 | + $this->db->delete($this->tables['users_groups'], array($this->join['groups'] => (float) $group_id, $this->join['users'] => (float) $user_id)); |
|
1599 | + if(isset($this->_cache_user_in_group[$user_id]) && isset($this->_cache_user_in_group[$user_id][$group_id])) |
|
1600 | 1600 | { |
1601 | 1601 | unset($this->_cache_user_in_group[$user_id][$group_id]); |
1602 | 1602 | } |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | // otherwise remove user from all groups |
1608 | 1608 | else |
1609 | 1609 | { |
1610 | - if ($return = $this->db->delete($this->tables['users_groups'], array($this->join['users'] => (float)$user_id))) { |
|
1610 | + if($return = $this->db->delete($this->tables['users_groups'], array($this->join['users'] => (float) $user_id))) { |
|
1611 | 1611 | $this->_cache_user_in_group[$user_id] = array(); |
1612 | 1612 | } |
1613 | 1613 | } |
@@ -1625,31 +1625,31 @@ discard block |
||
1625 | 1625 | $this->trigger_events('groups'); |
1626 | 1626 | |
1627 | 1627 | // run each where that was passed |
1628 | - if (isset($this->_ion_where) && !empty($this->_ion_where)) |
|
1628 | + if(isset($this->_ion_where) && !empty($this->_ion_where)) |
|
1629 | 1629 | { |
1630 | - foreach ($this->_ion_where as $where) |
|
1630 | + foreach($this->_ion_where as $where) |
|
1631 | 1631 | { |
1632 | 1632 | $this->db->where($where); |
1633 | 1633 | } |
1634 | 1634 | $this->_ion_where = array(); |
1635 | 1635 | } |
1636 | 1636 | |
1637 | - if (isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
1637 | + if(isset($this->_ion_limit) && isset($this->_ion_offset)) |
|
1638 | 1638 | { |
1639 | 1639 | $this->db->limit($this->_ion_limit, $this->_ion_offset); |
1640 | 1640 | |
1641 | 1641 | $this->_ion_limit = NULL; |
1642 | 1642 | $this->_ion_offset = NULL; |
1643 | 1643 | } |
1644 | - else if (isset($this->_ion_limit)) |
|
1644 | + else if(isset($this->_ion_limit)) |
|
1645 | 1645 | { |
1646 | 1646 | $this->db->limit($this->_ion_limit); |
1647 | 1647 | |
1648 | - $this->_ion_limit = NULL; |
|
1648 | + $this->_ion_limit = NULL; |
|
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | // set the order |
1652 | - if (isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
1652 | + if(isset($this->_ion_order_by) && isset($this->_ion_order)) |
|
1653 | 1653 | { |
1654 | 1654 | $this->db->order_by($this->_ion_order_by, $this->_ion_order); |
1655 | 1655 | } |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | { |
1670 | 1670 | $this->trigger_events('group'); |
1671 | 1671 | |
1672 | - if (isset($id)) |
|
1672 | + if(isset($id)) |
|
1673 | 1673 | { |
1674 | 1674 | $this->where($this->tables['groups'].'.id', $id); |
1675 | 1675 | } |
@@ -1694,7 +1694,7 @@ discard block |
||
1694 | 1694 | |
1695 | 1695 | $this->db->trans_begin(); |
1696 | 1696 | |
1697 | - if (array_key_exists($this->identity_column, $data) && $this->identity_check($data[$this->identity_column]) && $user->{$this->identity_column} !== $data[$this->identity_column]) |
|
1697 | + if(array_key_exists($this->identity_column, $data) && $this->identity_check($data[$this->identity_column]) && $user->{$this->identity_column} !== $data[$this->identity_column]) |
|
1698 | 1698 | { |
1699 | 1699 | $this->db->trans_rollback(); |
1700 | 1700 | $this->set_error('account_creation_duplicate_identity'); |
@@ -1708,11 +1708,11 @@ discard block |
||
1708 | 1708 | // Filter the data passed |
1709 | 1709 | $data = $this->_filter_data($this->tables['users'], $data); |
1710 | 1710 | |
1711 | - if (array_key_exists($this->identity_column, $data) || array_key_exists('password', $data) || array_key_exists('email', $data)) |
|
1711 | + if(array_key_exists($this->identity_column, $data) || array_key_exists('password', $data) || array_key_exists('email', $data)) |
|
1712 | 1712 | { |
1713 | - if (array_key_exists('password', $data)) |
|
1713 | + if(array_key_exists('password', $data)) |
|
1714 | 1714 | { |
1715 | - if( ! empty($data['password'])) |
|
1715 | + if(!empty($data['password'])) |
|
1716 | 1716 | { |
1717 | 1717 | $data['password'] = $this->hash_password($data['password'], $user->salt); |
1718 | 1718 | } |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | $this->trigger_events('extra_where'); |
1728 | 1728 | $this->db->update($this->tables['users'], $data, array('id' => $user->id)); |
1729 | 1729 | |
1730 | - if ($this->db->trans_status() === FALSE) |
|
1730 | + if($this->db->trans_status() === FALSE) |
|
1731 | 1731 | { |
1732 | 1732 | $this->db->trans_rollback(); |
1733 | 1733 | |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | $this->db->delete($this->tables['users'], array('id' => $id)); |
1763 | 1763 | |
1764 | 1764 | |
1765 | - if ($this->db->trans_status() === FALSE) |
|
1765 | + if($this->db->trans_status() === FALSE) |
|
1766 | 1766 | { |
1767 | 1767 | $this->db->trans_rollback(); |
1768 | 1768 | $this->trigger_events(array('post_delete_user', 'post_delete_user_unsuccessful')); |
@@ -1809,7 +1809,7 @@ discard block |
||
1809 | 1809 | // if the user_expire is set to zero we'll set the expiration two years from now. |
1810 | 1810 | if($this->config->item('user_expire', 'ion_auth') === 0) |
1811 | 1811 | { |
1812 | - $expire = (60*60*24*365*2); |
|
1812 | + $expire = (60 * 60 * 24 * 365 * 2); |
|
1813 | 1813 | } |
1814 | 1814 | // otherwise use what is set |
1815 | 1815 | else |
@@ -1863,7 +1863,7 @@ discard block |
||
1863 | 1863 | { |
1864 | 1864 | $this->trigger_events('pre_remember_user'); |
1865 | 1865 | |
1866 | - if (!$id) |
|
1866 | + if(!$id) |
|
1867 | 1867 | { |
1868 | 1868 | return FALSE; |
1869 | 1869 | } |
@@ -1874,12 +1874,12 @@ discard block |
||
1874 | 1874 | |
1875 | 1875 | $this->db->update($this->tables['users'], array('remember_code' => $salt), array('id' => $id)); |
1876 | 1876 | |
1877 | - if ($this->db->affected_rows() > -1) |
|
1877 | + if($this->db->affected_rows() > -1) |
|
1878 | 1878 | { |
1879 | 1879 | // if the user_expire is set to zero we'll set the expiration two years from now. |
1880 | 1880 | if($this->config->item('user_expire', 'ion_auth') === 0) |
1881 | 1881 | { |
1882 | - $expire = (60*60*24*365*2); |
|
1882 | + $expire = (60 * 60 * 24 * 365 * 2); |
|
1883 | 1883 | } |
1884 | 1884 | // otherwise use what is set |
1885 | 1885 | else |
@@ -1918,7 +1918,7 @@ discard block |
||
1918 | 1918 | $this->trigger_events('pre_login_remembered_user'); |
1919 | 1919 | |
1920 | 1920 | // check for valid data |
1921 | - if (!get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) |
|
1921 | + if(!get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) |
|
1922 | 1922 | || !get_cookie($this->config->item('remember_cookie_name', 'ion_auth')) |
1923 | 1923 | || !$this->identity_check(get_cookie($this->config->item('identity_cookie_name', 'ion_auth')))) |
1924 | 1924 | { |
@@ -1931,13 +1931,13 @@ discard block |
||
1931 | 1931 | $query = $this->db->select($this->identity_column.', id, email, last_login') |
1932 | 1932 | ->where($this->identity_column, urldecode(get_cookie($this->config->item('identity_cookie_name', 'ion_auth')))) |
1933 | 1933 | ->where('remember_code', get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))) |
1934 | - ->where('active',1) |
|
1934 | + ->where('active', 1) |
|
1935 | 1935 | ->limit(1) |
1936 | 1936 | ->order_by('id', 'desc') |
1937 | 1937 | ->get($this->tables['users']); |
1938 | 1938 | |
1939 | 1939 | // if the user was found, sign them in |
1940 | - if ($query->num_rows() == 1) |
|
1940 | + if($query->num_rows() == 1) |
|
1941 | 1941 | { |
1942 | 1942 | $user = $query->row(); |
1943 | 1943 | |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | $this->set_session($user); |
1947 | 1947 | |
1948 | 1948 | // extend the users cookies if the option is enabled |
1949 | - if ($this->config->item('user_extend_on_login', 'ion_auth')) |
|
1949 | + if($this->config->item('user_extend_on_login', 'ion_auth')) |
|
1950 | 1950 | { |
1951 | 1951 | $this->remember_user($user->id); |
1952 | 1952 | } |
@@ -1982,17 +1982,17 @@ discard block |
||
1982 | 1982 | return FALSE; |
1983 | 1983 | } |
1984 | 1984 | |
1985 | - $data = array('name'=>$group_name,'description'=>$group_description); |
|
1985 | + $data = array('name'=>$group_name, 'description'=>$group_description); |
|
1986 | 1986 | |
1987 | 1987 | // filter out any data passed that doesnt have a matching column in the groups table |
1988 | 1988 | // and merge the set group data and the additional data |
1989 | - if (!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
1989 | + if(!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
1990 | 1990 | |
1991 | 1991 | $this->trigger_events('extra_group_set'); |
1992 | 1992 | |
1993 | 1993 | // insert the new group |
1994 | 1994 | $this->db->insert($this->tables['groups'], $data); |
1995 | - $group_id = $this->db->insert_id($this->tables['groups'] . '_id_seq'); |
|
1995 | + $group_id = $this->db->insert_id($this->tables['groups'].'_id_seq'); |
|
1996 | 1996 | |
1997 | 1997 | // report success |
1998 | 1998 | $this->set_message('group_creation_successful'); |
@@ -2008,11 +2008,11 @@ discard block |
||
2008 | 2008 | **/ |
2009 | 2009 | public function update_group($group_id = FALSE, $group_name = FALSE, $additional_data = array()) |
2010 | 2010 | { |
2011 | - if (empty($group_id)) return FALSE; |
|
2011 | + if(empty($group_id)) return FALSE; |
|
2012 | 2012 | |
2013 | 2013 | $data = array(); |
2014 | 2014 | |
2015 | - if (!empty($group_name)) |
|
2015 | + if(!empty($group_name)) |
|
2016 | 2016 | { |
2017 | 2017 | // we are changing the name, so do some checks |
2018 | 2018 | |
@@ -2038,12 +2038,12 @@ discard block |
||
2038 | 2038 | |
2039 | 2039 | // IMPORTANT!! Third parameter was string type $description; this following code is to maintain backward compatibility |
2040 | 2040 | // New projects should work with 3rd param as array |
2041 | - if (is_string($additional_data)) $additional_data = array('description' => $additional_data); |
|
2041 | + if(is_string($additional_data)) $additional_data = array('description' => $additional_data); |
|
2042 | 2042 | |
2043 | 2043 | |
2044 | 2044 | // filter out any data passed that doesnt have a matching column in the groups table |
2045 | 2045 | // and merge the set group data and the additional data |
2046 | - if (!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
2046 | + if(!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data); |
|
2047 | 2047 | |
2048 | 2048 | |
2049 | 2049 | $this->db->update($this->tables['groups'], $data, array('id' => $group_id)); |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | // remove the group itself |
2084 | 2084 | $this->db->delete($this->tables['groups'], array('id' => $group_id)); |
2085 | 2085 | |
2086 | - if ($this->db->trans_status() === FALSE) |
|
2086 | + if($this->db->trans_status() === FALSE) |
|
2087 | 2087 | { |
2088 | 2088 | $this->db->trans_rollback(); |
2089 | 2089 | $this->trigger_events(array('post_delete_group', 'post_delete_group_unsuccessful')); |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | |
2109 | 2109 | public function remove_hook($event, $name) |
2110 | 2110 | { |
2111 | - if (isset($this->_ion_hooks->{$event}[$name])) |
|
2111 | + if(isset($this->_ion_hooks->{$event}[$name])) |
|
2112 | 2112 | { |
2113 | 2113 | unset($this->_ion_hooks->{$event}[$name]); |
2114 | 2114 | } |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | |
2117 | 2117 | public function remove_hooks($event) |
2118 | 2118 | { |
2119 | - if (isset($this->_ion_hooks->$event)) |
|
2119 | + if(isset($this->_ion_hooks->$event)) |
|
2120 | 2120 | { |
2121 | 2121 | unset($this->_ion_hooks->$event); |
2122 | 2122 | } |
@@ -2124,7 +2124,7 @@ discard block |
||
2124 | 2124 | |
2125 | 2125 | protected function _call_hook($event, $name) |
2126 | 2126 | { |
2127 | - if (isset($this->_ion_hooks->{$event}[$name]) && method_exists($this->_ion_hooks->{$event}[$name]->class, $this->_ion_hooks->{$event}[$name]->method)) |
|
2127 | + if(isset($this->_ion_hooks->{$event}[$name]) && method_exists($this->_ion_hooks->{$event}[$name]->class, $this->_ion_hooks->{$event}[$name]->method)) |
|
2128 | 2128 | { |
2129 | 2129 | $hook = $this->_ion_hooks->{$event}[$name]; |
2130 | 2130 | |
@@ -2136,18 +2136,18 @@ discard block |
||
2136 | 2136 | |
2137 | 2137 | public function trigger_events($events) |
2138 | 2138 | { |
2139 | - if (is_array($events) && !empty($events)) |
|
2139 | + if(is_array($events) && !empty($events)) |
|
2140 | 2140 | { |
2141 | - foreach ($events as $event) |
|
2141 | + foreach($events as $event) |
|
2142 | 2142 | { |
2143 | 2143 | $this->trigger_events($event); |
2144 | 2144 | } |
2145 | 2145 | } |
2146 | 2146 | else |
2147 | 2147 | { |
2148 | - if (isset($this->_ion_hooks->$events) && !empty($this->_ion_hooks->$events)) |
|
2148 | + if(isset($this->_ion_hooks->$events) && !empty($this->_ion_hooks->$events)) |
|
2149 | 2149 | { |
2150 | - foreach ($this->_ion_hooks->$events as $name => $hook) |
|
2150 | + foreach($this->_ion_hooks->$events as $name => $hook) |
|
2151 | 2151 | { |
2152 | 2152 | $this->_call_hook($events, $name); |
2153 | 2153 | } |
@@ -2215,10 +2215,10 @@ discard block |
||
2215 | 2215 | public function messages() |
2216 | 2216 | { |
2217 | 2217 | $_output = ''; |
2218 | - foreach ($this->messages as $message) |
|
2218 | + foreach($this->messages as $message) |
|
2219 | 2219 | { |
2220 | - $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##'; |
|
2221 | - $_output .= $this->message_start_delimiter . $messageLang . $this->message_end_delimiter; |
|
2220 | + $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##'.$message.'##'; |
|
2221 | + $_output .= $this->message_start_delimiter.$messageLang.$this->message_end_delimiter; |
|
2222 | 2222 | } |
2223 | 2223 | |
2224 | 2224 | return $_output; |
@@ -2234,13 +2234,13 @@ discard block |
||
2234 | 2234 | **/ |
2235 | 2235 | public function messages_array($langify = TRUE) |
2236 | 2236 | { |
2237 | - if ($langify) |
|
2237 | + if($langify) |
|
2238 | 2238 | { |
2239 | 2239 | $_output = array(); |
2240 | - foreach ($this->messages as $message) |
|
2240 | + foreach($this->messages as $message) |
|
2241 | 2241 | { |
2242 | - $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##'; |
|
2243 | - $_output[] = $this->message_start_delimiter . $messageLang . $this->message_end_delimiter; |
|
2242 | + $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##'.$message.'##'; |
|
2243 | + $_output[] = $this->message_start_delimiter.$messageLang.$this->message_end_delimiter; |
|
2244 | 2244 | } |
2245 | 2245 | return $_output; |
2246 | 2246 | } |
@@ -2293,10 +2293,10 @@ discard block |
||
2293 | 2293 | public function errors() |
2294 | 2294 | { |
2295 | 2295 | $_output = ''; |
2296 | - foreach ($this->errors as $error) |
|
2296 | + foreach($this->errors as $error) |
|
2297 | 2297 | { |
2298 | - $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##'; |
|
2299 | - $_output .= $this->error_start_delimiter . $errorLang . $this->error_end_delimiter; |
|
2298 | + $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##'.$error.'##'; |
|
2299 | + $_output .= $this->error_start_delimiter.$errorLang.$this->error_end_delimiter; |
|
2300 | 2300 | } |
2301 | 2301 | |
2302 | 2302 | return $_output; |
@@ -2312,13 +2312,13 @@ discard block |
||
2312 | 2312 | **/ |
2313 | 2313 | public function errors_array($langify = TRUE) |
2314 | 2314 | { |
2315 | - if ($langify) |
|
2315 | + if($langify) |
|
2316 | 2316 | { |
2317 | 2317 | $_output = array(); |
2318 | - foreach ($this->errors as $error) |
|
2318 | + foreach($this->errors as $error) |
|
2319 | 2319 | { |
2320 | - $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##'; |
|
2321 | - $_output[] = $this->error_start_delimiter . $errorLang . $this->error_end_delimiter; |
|
2320 | + $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##'.$error.'##'; |
|
2321 | + $_output[] = $this->error_start_delimiter.$errorLang.$this->error_end_delimiter; |
|
2322 | 2322 | } |
2323 | 2323 | return $_output; |
2324 | 2324 | } |
@@ -2351,11 +2351,11 @@ discard block |
||
2351 | 2351 | $filtered_data = array(); |
2352 | 2352 | $columns = $this->db->list_fields($table); |
2353 | 2353 | |
2354 | - if (is_array($data)) |
|
2354 | + if(is_array($data)) |
|
2355 | 2355 | { |
2356 | - foreach ($columns as $column) |
|
2356 | + foreach($columns as $column) |
|
2357 | 2357 | { |
2358 | - if (array_key_exists($column, $data)) |
|
2358 | + if(array_key_exists($column, $data)) |
|
2359 | 2359 | $filtered_data[$column] = $data[$column]; |
2360 | 2360 | } |
2361 | 2361 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | | salt_prefix: Used for bcrypt. Versions of PHP before 5.3.7 only support "$2a$" as the salt prefix |
67 | 67 | | Versions 5.3.7 or greater should use the default of "$2y$". |
68 | 68 | */ |
69 | -$config['hash_method'] = 'bcrypt'; // sha1 or bcrypt, bcrypt is STRONGLY recommended |
|
70 | -$config['default_rounds'] = 8; // This does not apply if random_rounds is set to true |
|
69 | +$config['hash_method'] = 'bcrypt'; // sha1 or bcrypt, bcrypt is STRONGLY recommended |
|
70 | +$config['default_rounds'] = 8; // This does not apply if random_rounds is set to true |
|
71 | 71 | $config['random_rounds'] = FALSE; |
72 | 72 | $config['min_rounds'] = 5; |
73 | 73 | $config['max_rounds'] = 9; |
@@ -82,24 +82,24 @@ discard block |
||
82 | 82 | | The controller should check this function and act |
83 | 83 | | appropriately. If this variable set to 0, there is no maximum. |
84 | 84 | */ |
85 | -$config['site_title'] = "Manga Tracker"; // Site Title, example.com |
|
86 | -$config['admin_email'] = "[email protected]"; // Admin Email, [email protected] //FIXME: This is being used for a lot of things it shouldn't be. We need a diff config option. |
|
87 | -$config['default_group'] = 'members'; // Default group, use name |
|
88 | -$config['admin_group'] = 'admin'; // Default administrators group, use name |
|
89 | -$config['identity'] = 'email'; // [NOTE: username can be used too] You can use any unique column in your table as identity column. The values in this column, alongside password, will be used for login purposes |
|
90 | -$config['min_password_length'] = 6; // Minimum Required Length of Password |
|
91 | -$config['max_password_length'] = 64; // Maximum Allowed Length of Password |
|
92 | -$config['email_activation'] = FALSE; // Email Activation for registration |
|
93 | -$config['manual_activation'] = FALSE; // Manual Activation for registration |
|
94 | -$config['remember_users'] = TRUE; // Allow users to be remembered and enable auto-login |
|
85 | +$config['site_title'] = "Manga Tracker"; // Site Title, example.com |
|
86 | +$config['admin_email'] = "[email protected]"; // Admin Email, [email protected] //FIXME: This is being used for a lot of things it shouldn't be. We need a diff config option. |
|
87 | +$config['default_group'] = 'members'; // Default group, use name |
|
88 | +$config['admin_group'] = 'admin'; // Default administrators group, use name |
|
89 | +$config['identity'] = 'email'; // [NOTE: username can be used too] You can use any unique column in your table as identity column. The values in this column, alongside password, will be used for login purposes |
|
90 | +$config['min_password_length'] = 6; // Minimum Required Length of Password |
|
91 | +$config['max_password_length'] = 64; // Maximum Allowed Length of Password |
|
92 | +$config['email_activation'] = FALSE; // Email Activation for registration |
|
93 | +$config['manual_activation'] = FALSE; // Manual Activation for registration |
|
94 | +$config['remember_users'] = TRUE; // Allow users to be remembered and enable auto-login |
|
95 | 95 | $config['user_expire'] = 259200; /*3DAYS*/ // How long to remember the user (seconds). Set to zero for no expiration |
96 | -$config['user_extend_on_login'] = TRUE; // Extend the users cookies every time they auto-login |
|
97 | -$config['track_login_attempts'] = FALSE; // Track the number of failed login attempts for each user or ip. //CHECK: Should this be true? |
|
98 | -$config['track_login_ip_address'] = TRUE; // Track login attempts by IP Address, if FALSE will track based on identity. (Default: TRUE) |
|
99 | -$config['maximum_login_attempts'] = 3; // The maximum number of failed login attempts. |
|
100 | -$config['lockout_time'] = 600; // The number of seconds to lockout an account due to exceeded attempts |
|
96 | +$config['user_extend_on_login'] = TRUE; // Extend the users cookies every time they auto-login |
|
97 | +$config['track_login_attempts'] = FALSE; // Track the number of failed login attempts for each user or ip. //CHECK: Should this be true? |
|
98 | +$config['track_login_ip_address'] = TRUE; // Track login attempts by IP Address, if FALSE will track based on identity. (Default: TRUE) |
|
99 | +$config['maximum_login_attempts'] = 3; // The maximum number of failed login attempts. |
|
100 | +$config['lockout_time'] = 600; // The number of seconds to lockout an account due to exceeded attempts |
|
101 | 101 | $config['forgot_password_expiration'] = 43200000; /*12HR*/ // The number of milliseconds after which a forgot password request will expire. If set to 0, forgot password requests will not expire. |
102 | -$config['recheck_timer'] = 0; // The number of seconds after which the session is checked again against database to see if the user still exists and is active. Leave 0 if you don't want session recheck. if you really think you need to recheck the session against database, we would recommend a higher value, as this would affect performance. |
|
102 | +$config['recheck_timer'] = 0; // The number of seconds after which the session is checked again against database to see if the user still exists and is active. Leave 0 if you don't want session recheck. if you really think you need to recheck the session against database, we would recommend a higher value, as this would affect performance. |
|
103 | 103 | |
104 | 104 | /* |
105 | 105 | | ------------------------------------------------------------------------- |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | | Message Delimiters. |
177 | 177 | | ------------------------------------------------------------------------- |
178 | 178 | */ |
179 | -$config['delimiters_source'] = 'config'; // "config" = use the settings defined here, "form_validation" = use the settings defined in CI's form validation library |
|
180 | -$config['message_start_delimiter'] = '<p>'; // Message start delimiter |
|
181 | -$config['message_end_delimiter'] = '</p>'; // Message end delimiter |
|
182 | -$config['error_start_delimiter'] = '<p>'; // Error message start delimiter |
|
183 | -$config['error_end_delimiter'] = '</p>'; // Error message end delimiter |
|
179 | +$config['delimiters_source'] = 'config'; // "config" = use the settings defined here, "form_validation" = use the settings defined in CI's form validation library |
|
180 | +$config['message_start_delimiter'] = '<p>'; // Message start delimiter |
|
181 | +$config['message_end_delimiter'] = '</p>'; // Message end delimiter |
|
182 | +$config['error_start_delimiter'] = '<p>'; // Error message start delimiter |
|
183 | +$config['error_end_delimiter'] = '</p>'; // Error message end delimiter |
|
184 | 184 | |
185 | 185 | /* End of file ion_auth.php */ |
186 | 186 | /* Location: ./application/config/ion_auth.php */ |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | |
4 | 4 | class Bcrypt { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param array $params |
12 | 12 | * @throws Exception |
13 | 13 | */ |
14 | - public function __construct($params=array('rounds'=>7, 'salt_prefix'=>'$2y$')) { |
|
14 | + public function __construct($params = array('rounds'=>7, 'salt_prefix'=>'$2y$')) { |
|
15 | 15 | |
16 | 16 | if(CRYPT_BLOWFISH != 1) { |
17 | 17 | throw new Exception("bcrypt not supported in this installation. See http://php.net/crypt"); |
@@ -52,30 +52,30 @@ discard block |
||
52 | 52 | private function hashEquals($known_string, $user_string) |
53 | 53 | { |
54 | 54 | // For CI3 or PHP >= 5.6 |
55 | - if (function_exists('hash_equals')) |
|
55 | + if(function_exists('hash_equals')) |
|
56 | 56 | { |
57 | 57 | return hash_equals($known_string, $user_string); |
58 | 58 | } |
59 | 59 | |
60 | 60 | // For CI2 with PHP < 5.6 |
61 | 61 | // Code from CI3 https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/compat/hash.php |
62 | - if ( ! is_string($known_string)) |
|
62 | + if(!is_string($known_string)) |
|
63 | 63 | { |
64 | 64 | trigger_error('hash_equals(): Expected known_string to be a string, '.strtolower(gettype($known_string)).' given', E_USER_WARNING); |
65 | 65 | return FALSE; |
66 | 66 | } |
67 | - elseif ( ! is_string($user_string)) |
|
67 | + elseif(!is_string($user_string)) |
|
68 | 68 | { |
69 | 69 | trigger_error('hash_equals(): Expected user_string to be a string, '.strtolower(gettype($user_string)).' given', E_USER_WARNING); |
70 | 70 | return FALSE; |
71 | 71 | } |
72 | - elseif (($length = strlen($known_string)) !== strlen($user_string)) |
|
72 | + elseif(($length = strlen($known_string)) !== strlen($user_string)) |
|
73 | 73 | { |
74 | 74 | return FALSE; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $diff = 0; |
78 | - for ($i = 0; $i < $length; $i++) |
|
78 | + for($i = 0; $i < $length; $i++) |
|
79 | 79 | { |
80 | 80 | $diff |= ord($known_string[$i]) ^ ord($user_string[$i]); |
81 | 81 | } |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | for($i = 0; $i < $count; $i += 16) { |
128 | - $this->randomState = md5(microtime() . $this->randomState); |
|
128 | + $this->randomState = md5(microtime().$this->randomState); |
|
129 | 129 | |
130 | - if (PHP_VERSION >= '5') { |
|
130 | + if(PHP_VERSION >= '5') { |
|
131 | 131 | $bytes .= md5($this->randomState, true); |
132 | 132 | } else { |
133 | 133 | $bytes .= pack('H*', md5($this->randomState)); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $c1 = ord($input[$i++]); |
155 | 155 | $output .= $itoa64[$c1 >> 2]; |
156 | 156 | $c1 = ($c1 & 0x03) << 4; |
157 | - if ($i >= 16) { |
|
157 | + if($i >= 16) { |
|
158 | 158 | $output .= $itoa64[$c1]; |
159 | 159 | break; |
160 | 160 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $c1 |= $c2 >> 6; |
169 | 169 | $output .= $itoa64[$c1]; |
170 | 170 | $output .= $itoa64[$c2 & 0x3f]; |
171 | - } while (1); |
|
171 | + } while(1); |
|
172 | 172 | |
173 | 173 | return $output; |
174 | 174 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * Name: Ion Auth |
4 | 4 | * |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | $this->config->load('ion_auth', TRUE); |
60 | 60 | $this->load->library(array('email')); |
61 | 61 | $this->lang->load('ion_auth'); |
62 | - $this->load->helper(array('cookie', 'language','url')); |
|
62 | + $this->load->helper(array('cookie', 'language', 'url')); |
|
63 | 63 | |
64 | 64 | $this->load->library('session'); |
65 | 65 | |
66 | 66 | $this->load->model('ion_auth_model'); |
67 | 67 | |
68 | - $this->_cache_user_in_group =& $this->ion_auth_model->_cache_user_in_group; |
|
68 | + $this->_cache_user_in_group = & $this->ion_auth_model->_cache_user_in_group; |
|
69 | 69 | |
70 | 70 | $email_config = $this->config->item('email_config', 'ion_auth'); |
71 | 71 | |
72 | - if ($this->config->item('use_ci_email', 'ion_auth') && isset($email_config) && is_array($email_config)) |
|
72 | + if($this->config->item('use_ci_email', 'ion_auth') && isset($email_config) && is_array($email_config)) |
|
73 | 73 | { |
74 | 74 | $this->email->initialize($email_config); |
75 | 75 | } |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function __call($method, $arguments) |
91 | 91 | { |
92 | - if (!method_exists( $this->ion_auth_model, $method) ) |
|
92 | + if(!method_exists($this->ion_auth_model, $method)) |
|
93 | 93 | { |
94 | - throw new Exception('Undefined method Ion_auth::' . $method . '() called'); |
|
94 | + throw new Exception('Undefined method Ion_auth::'.$method.'() called'); |
|
95 | 95 | } |
96 | 96 | if($method == 'create_user') |
97 | 97 | { |
98 | 98 | return call_user_func_array(array($this, 'register'), $arguments); |
99 | 99 | } |
100 | - if($method=='update_user') |
|
100 | + if($method == 'update_user') |
|
101 | 101 | { |
102 | 102 | return call_user_func_array(array($this, 'update'), $arguments); |
103 | 103 | } |
104 | - return call_user_func_array( array($this->ion_auth_model, $method), $arguments); |
|
104 | + return call_user_func_array(array($this->ion_auth_model, $method), $arguments); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function forgotten_password($identity) //changed $email to $identity |
132 | 132 | { |
133 | - if ( $this->ion_auth_model->forgotten_password($identity) ) //changed |
|
133 | + if($this->ion_auth_model->forgotten_password($identity)) //changed |
|
134 | 134 | { |
135 | 135 | // Get user information |
136 | 136 | $identifier = $this->ion_auth_model->identity_column; // use model identity column, so it can be overridden in a controller |
137 | - $user = $this->where($identifier, $identity)->where('active', 1)->users()->row(); // changed to get_user_by_identity from email |
|
137 | + $user = $this->where($identifier, $identity)->where('active', 1)->users()->row(); // changed to get_user_by_identity from email |
|
138 | 138 | |
139 | - if ($user) |
|
139 | + if($user) |
|
140 | 140 | { |
141 | 141 | $data = array( |
142 | 142 | 'identity' => $user->{$this->config->item('identity', 'ion_auth')}, |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | $this->email->clear(); |
155 | 155 | $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth')); |
156 | 156 | $this->email->to($user->email); |
157 | - $this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject')); |
|
157 | + $this->email->subject($this->config->item('site_title', 'ion_auth').' - '.$this->lang->line('email_forgotten_password_subject')); |
|
158 | 158 | $this->email->message($message); |
159 | 159 | |
160 | - if ($this->email->send()) |
|
160 | + if($this->email->send()) |
|
161 | 161 | { |
162 | 162 | $this->set_message('forgot_password_successful'); |
163 | 163 | return TRUE; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $identity = $this->config->item('identity', 'ion_auth'); |
197 | 197 | $profile = $this->where('forgotten_password_code', $code)->users()->row(); //pass the code to profile |
198 | 198 | |
199 | - if (!$profile) |
|
199 | + if(!$profile) |
|
200 | 200 | { |
201 | 201 | $this->ion_auth_model->trigger_events(array('post_password_change', 'password_change_unsuccessful')); |
202 | 202 | $this->set_error('password_change_unsuccessful'); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | $new_password = $this->ion_auth_model->forgotten_password_complete($code, $profile->salt); |
207 | 207 | |
208 | - if ($new_password) |
|
208 | + if($new_password) |
|
209 | 209 | { |
210 | 210 | $data = array( |
211 | 211 | 'identity' => $profile->{$identity}, |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | $this->email->clear(); |
225 | 225 | $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth')); |
226 | 226 | $this->email->to($profile->email); |
227 | - $this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_new_password_subject')); |
|
227 | + $this->email->subject($this->config->item('site_title', 'ion_auth').' - '.$this->lang->line('email_new_password_subject')); |
|
228 | 228 | $this->email->message($message); |
229 | 229 | |
230 | - if ($this->email->send()) |
|
230 | + if($this->email->send()) |
|
231 | 231 | { |
232 | 232 | $this->set_message('password_change_successful'); |
233 | 233 | $this->ion_auth_model->trigger_events(array('post_password_change', 'password_change_successful')); |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | { |
259 | 259 | $profile = $this->where('forgotten_password_code', $code)->users()->row(); //pass the code to profile |
260 | 260 | |
261 | - if (!is_object($profile)) |
|
261 | + if(!is_object($profile)) |
|
262 | 262 | { |
263 | 263 | $this->set_error('password_change_unsuccessful'); |
264 | 264 | return FALSE; |
265 | 265 | } |
266 | 266 | else |
267 | 267 | { |
268 | - if ($this->config->item('forgot_password_expiration', 'ion_auth') > 0) { |
|
268 | + if($this->config->item('forgot_password_expiration', 'ion_auth') > 0) { |
|
269 | 269 | //Make sure it isn't expired |
270 | 270 | $expiration = $this->config->item('forgot_password_expiration', 'ion_auth'); |
271 | - if (time() - $profile->forgotten_password_time > $expiration) { |
|
271 | + if(time() - $profile->forgotten_password_time > $expiration) { |
|
272 | 272 | //it has expired |
273 | 273 | $this->clear_forgotten_password_code($code); |
274 | 274 | $this->set_error('password_change_unsuccessful'); |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | |
299 | 299 | $id = $this->ion_auth_model->register($identity, $password, $email, $additional_data, $group_ids); |
300 | 300 | |
301 | - if (!$email_activation) |
|
301 | + if(!$email_activation) |
|
302 | 302 | { |
303 | - if ($id !== FALSE) |
|
303 | + if($id !== FALSE) |
|
304 | 304 | { |
305 | 305 | $this->set_message('account_creation_successful'); |
306 | 306 | $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful')); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | else |
317 | 317 | { |
318 | - if (!$id) |
|
318 | + if(!$id) |
|
319 | 319 | { |
320 | 320 | $this->set_error('account_creation_unsuccessful'); |
321 | 321 | return FALSE; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $this->ion_auth_model->clear_messages(); |
329 | 329 | |
330 | 330 | |
331 | - if (!$deactivate) |
|
331 | + if(!$deactivate) |
|
332 | 332 | { |
333 | 333 | $this->set_error('deactivate_unsuccessful'); |
334 | 334 | $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful')); |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | $this->email->clear(); |
359 | 359 | $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth')); |
360 | 360 | $this->email->to($email); |
361 | - $this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_activation_subject')); |
|
361 | + $this->email->subject($this->config->item('site_title', 'ion_auth').' - '.$this->lang->line('email_activation_subject')); |
|
362 | 362 | $this->email->message($message); |
363 | 363 | |
364 | - if ($this->email->send() == TRUE) |
|
364 | + if($this->email->send() == TRUE) |
|
365 | 365 | { |
366 | 366 | $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful', 'activation_email_successful')); |
367 | 367 | $this->set_message('activation_email_successful'); |
@@ -388,21 +388,21 @@ discard block |
||
388 | 388 | |
389 | 389 | $identity = $this->config->item('identity', 'ion_auth'); |
390 | 390 | |
391 | - if (substr(CI_VERSION, 0, 1) == '2') |
|
391 | + if(substr(CI_VERSION, 0, 1) == '2') |
|
392 | 392 | { |
393 | - $this->session->unset_userdata( array($identity => '', 'id' => '', 'user_id' => '') ); |
|
393 | + $this->session->unset_userdata(array($identity => '', 'id' => '', 'user_id' => '')); |
|
394 | 394 | } |
395 | 395 | else |
396 | 396 | { |
397 | - $this->session->unset_userdata( array($identity, 'id', 'user_id') ); |
|
397 | + $this->session->unset_userdata(array($identity, 'id', 'user_id')); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | // delete the remember me cookies if they exist |
401 | - if (get_cookie($this->config->item('identity_cookie_name', 'ion_auth'))) |
|
401 | + if(get_cookie($this->config->item('identity_cookie_name', 'ion_auth'))) |
|
402 | 402 | { |
403 | 403 | delete_cookie($this->config->item('identity_cookie_name', 'ion_auth')); |
404 | 404 | } |
405 | - if (get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))) |
|
405 | + if(get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))) |
|
406 | 406 | { |
407 | 407 | delete_cookie($this->config->item('remember_cookie_name', 'ion_auth')); |
408 | 408 | } |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | $this->session->sess_destroy(); |
412 | 412 | |
413 | 413 | //Recreate the session |
414 | - if (substr(CI_VERSION, 0, 1) == '2') |
|
414 | + if(substr(CI_VERSION, 0, 1) == '2') |
|
415 | 415 | { |
416 | 416 | $this->session->sess_create(); |
417 | 417 | } |
418 | 418 | else |
419 | 419 | { |
420 | - if (version_compare(PHP_VERSION, '7.0.0') >= 0) { |
|
420 | + if(version_compare(PHP_VERSION, '7.0.0') >= 0) { |
|
421 | 421 | session_start(); |
422 | 422 | } |
423 | 423 | $this->session->sess_regenerate(TRUE); |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | { |
438 | 438 | $this->ion_auth_model->trigger_events('logged_in'); |
439 | 439 | |
440 | - $recheck= $this->ion_auth_model->recheck_session(); |
|
440 | + $recheck = $this->ion_auth_model->recheck_session(); |
|
441 | 441 | |
442 | 442 | //auto-login the user if they are remembered |
443 | - if ( ! $recheck && get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) && get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))) |
|
443 | + if(!$recheck && get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) && get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))) |
|
444 | 444 | { |
445 | 445 | $recheck = $this->ion_auth_model->login_remembered_user(); |
446 | 446 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | public function get_user_id() |
458 | 458 | { |
459 | 459 | $user_id = $this->session->userdata('user_id'); |
460 | - if (!empty($user_id)) |
|
460 | + if(!empty($user_id)) |
|
461 | 461 | { |
462 | 462 | return $user_id; |
463 | 463 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @return bool |
472 | 472 | * @author Ben Edmunds |
473 | 473 | **/ |
474 | - public function is_admin($id=false) |
|
474 | + public function is_admin($id = false) |
|
475 | 475 | { |
476 | 476 | $this->ion_auth_model->trigger_events('is_admin'); |
477 | 477 | |
@@ -490,18 +490,18 @@ discard block |
||
490 | 490 | * @return bool |
491 | 491 | * @author Phil Sturgeon |
492 | 492 | **/ |
493 | - public function in_group($check_group, $id=false, $check_all = false) |
|
493 | + public function in_group($check_group, $id = false, $check_all = false) |
|
494 | 494 | { |
495 | 495 | $this->ion_auth_model->trigger_events('in_group'); |
496 | 496 | |
497 | 497 | $id || $id = $this->session->userdata('user_id'); |
498 | 498 | |
499 | - if (!is_array($check_group)) |
|
499 | + if(!is_array($check_group)) |
|
500 | 500 | { |
501 | 501 | $check_group = array($check_group); |
502 | 502 | } |
503 | 503 | |
504 | - if (isset($this->_cache_user_in_group[$id])) |
|
504 | + if(isset($this->_cache_user_in_group[$id])) |
|
505 | 505 | { |
506 | 506 | $groups_array = $this->_cache_user_in_group[$id]; |
507 | 507 | } |
@@ -509,13 +509,13 @@ discard block |
||
509 | 509 | { |
510 | 510 | $users_groups = $this->ion_auth_model->get_users_groups($id)->result(); |
511 | 511 | $groups_array = array(); |
512 | - foreach ($users_groups as $group) |
|
512 | + foreach($users_groups as $group) |
|
513 | 513 | { |
514 | 514 | $groups_array[$group->id] = $group->name; |
515 | 515 | } |
516 | 516 | $this->_cache_user_in_group[$id] = $groups_array; |
517 | 517 | } |
518 | - foreach ($check_group as $key => $value) |
|
518 | + foreach($check_group as $key => $value) |
|
519 | 519 | { |
520 | 520 | $groups = (is_string($value)) ? $groups_array : array_keys($groups_array); |
521 | 521 | |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * if !all (default), in_array |
524 | 524 | * if all, !in_array |
525 | 525 | */ |
526 | - if (in_array($value, $groups) xor $check_all) |
|
526 | + if(in_array($value, $groups) xor $check_all) |
|
527 | 527 | { |
528 | 528 | /** |
529 | 529 | * if !all (default), true |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Sekati CodeIgniter Asset Helper |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | * @return string |
52 | 52 | */ |
53 | 53 | |
54 | -if (!function_exists('asset_url')) { |
|
54 | +if(!function_exists('asset_url')) { |
|
55 | 55 | function asset_url() |
56 | 56 | { |
57 | 57 | //get an instance of CI so we can access our configuration |
58 | - $CI =& get_instance(); |
|
58 | + $CI = & get_instance(); |
|
59 | 59 | |
60 | 60 | //return the full asset path |
61 | 61 | return $CI->config->slash_item('static_url')/* . $CI->config->item('asset_path')*/; |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @access public |
69 | 69 | * @return string |
70 | 70 | */ |
71 | -if (!function_exists('css_url')) { |
|
71 | +if(!function_exists('css_url')) { |
|
72 | 72 | function css_url() |
73 | 73 | { |
74 | - $CI =& get_instance(); |
|
74 | + $CI = & get_instance(); |
|
75 | 75 | |
76 | - return $CI->config->slash_item('static_url') . $CI->config->item('css_path'); |
|
76 | + return $CI->config->slash_item('static_url').$CI->config->item('css_path'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | * @access public |
84 | 84 | * @return string |
85 | 85 | */ |
86 | -if (!function_exists('less_url')) { |
|
86 | +if(!function_exists('less_url')) { |
|
87 | 87 | function less_url() |
88 | 88 | { |
89 | - $CI =& get_instance(); |
|
89 | + $CI = & get_instance(); |
|
90 | 90 | |
91 | - return $CI->config->slash_item('static_url') . $CI->config->item('less_path'); |
|
91 | + return $CI->config->slash_item('static_url').$CI->config->item('less_path'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * @access public |
99 | 99 | * @return string |
100 | 100 | */ |
101 | -if (!function_exists('js_url')) { |
|
101 | +if(!function_exists('js_url')) { |
|
102 | 102 | function js_url() |
103 | 103 | { |
104 | - $CI =& get_instance(); |
|
104 | + $CI = & get_instance(); |
|
105 | 105 | |
106 | - return $CI->config->slash_item('static_url') . $CI->config->item('js_path'); |
|
106 | + return $CI->config->slash_item('static_url').$CI->config->item('js_path'); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * @access public |
114 | 114 | * @return string |
115 | 115 | */ |
116 | -if (!function_exists('img_url')) { |
|
116 | +if(!function_exists('img_url')) { |
|
117 | 117 | function img_url() |
118 | 118 | { |
119 | - $CI =& get_instance(); |
|
119 | + $CI = & get_instance(); |
|
120 | 120 | |
121 | - return $CI->config->slash_item('static_url') . $CI->config->item('img_path'); |
|
121 | + return $CI->config->slash_item('static_url').$CI->config->item('img_path'); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | * @access public |
129 | 129 | * @return string |
130 | 130 | */ |
131 | -if (!function_exists('swf_url')) { |
|
131 | +if(!function_exists('swf_url')) { |
|
132 | 132 | function swf_url() |
133 | 133 | { |
134 | - $CI =& get_instance(); |
|
134 | + $CI = & get_instance(); |
|
135 | 135 | |
136 | - return $CI->config->slash_item('static_url') . $CI->config->item('swf_path'); |
|
136 | + return $CI->config->slash_item('static_url').$CI->config->item('swf_path'); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | * @access public |
144 | 144 | * @return string |
145 | 145 | */ |
146 | -if (!function_exists('upload_url')) { |
|
146 | +if(!function_exists('upload_url')) { |
|
147 | 147 | function upload_url() |
148 | 148 | { |
149 | - $CI =& get_instance(); |
|
149 | + $CI = & get_instance(); |
|
150 | 150 | |
151 | - return base_url() . $CI->config->item('upload_path'); |
|
151 | + return base_url().$CI->config->item('upload_path'); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | * @access public |
159 | 159 | * @return string |
160 | 160 | */ |
161 | -if (!function_exists('download_url')) { |
|
161 | +if(!function_exists('download_url')) { |
|
162 | 162 | function download_url() |
163 | 163 | { |
164 | - $CI =& get_instance(); |
|
164 | + $CI = & get_instance(); |
|
165 | 165 | |
166 | - return base_url() . $CI->config->item('download_path'); |
|
166 | + return base_url().$CI->config->item('download_path'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | * @access public |
174 | 174 | * @return string |
175 | 175 | */ |
176 | -if (!function_exists('xml_url')) { |
|
176 | +if(!function_exists('xml_url')) { |
|
177 | 177 | function xml_url() |
178 | 178 | { |
179 | - $CI =& get_instance(); |
|
179 | + $CI = & get_instance(); |
|
180 | 180 | |
181 | - return base_url() . $CI->config->item('xml_path'); |
|
181 | + return base_url().$CI->config->item('xml_path'); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | * @access public |
193 | 193 | * @return string |
194 | 194 | */ |
195 | -if (!function_exists('asset_path')) { |
|
195 | +if(!function_exists('asset_path')) { |
|
196 | 196 | function asset_path() |
197 | 197 | { |
198 | 198 | //get an instance of CI so we can access our configuration |
199 | - $CI =& get_instance(); |
|
199 | + $CI = & get_instance(); |
|
200 | 200 | |
201 | - return FCPATH . $CI->config->item('asset_path'); |
|
201 | + return FCPATH.$CI->config->item('asset_path'); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | * @access public |
209 | 209 | * @return string |
210 | 210 | */ |
211 | -if (!function_exists('css_path')) { |
|
211 | +if(!function_exists('css_path')) { |
|
212 | 212 | function css_path() |
213 | 213 | { |
214 | 214 | //get an instance of CI so we can access our configuration |
215 | - $CI =& get_instance(); |
|
215 | + $CI = & get_instance(); |
|
216 | 216 | |
217 | - return FCPATH . $CI->config->item('css_path'); |
|
217 | + return FCPATH.$CI->config->item('css_path'); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | * @access public |
225 | 225 | * @return string |
226 | 226 | */ |
227 | -if (!function_exists('less_path')) { |
|
227 | +if(!function_exists('less_path')) { |
|
228 | 228 | function less_path() |
229 | 229 | { |
230 | 230 | //get an instance of CI so we can access our configuration |
231 | - $CI =& get_instance(); |
|
231 | + $CI = & get_instance(); |
|
232 | 232 | |
233 | - return FCPATH . $CI->config->item('less_path'); |
|
233 | + return FCPATH.$CI->config->item('less_path'); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | * @access public |
241 | 241 | * @return string |
242 | 242 | */ |
243 | -if (!function_exists('js_path')) { |
|
243 | +if(!function_exists('js_path')) { |
|
244 | 244 | function js_path() |
245 | 245 | { |
246 | 246 | //get an instance of CI so we can access our configuration |
247 | - $CI =& get_instance(); |
|
247 | + $CI = & get_instance(); |
|
248 | 248 | |
249 | - return FCPATH . $CI->config->item('js_path'); |
|
249 | + return FCPATH.$CI->config->item('js_path'); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | * @access public |
257 | 257 | * @return string |
258 | 258 | */ |
259 | -if (!function_exists('img_path')) { |
|
259 | +if(!function_exists('img_path')) { |
|
260 | 260 | function img_path() |
261 | 261 | { |
262 | 262 | //get an instance of CI so we can access our configuration |
263 | - $CI =& get_instance(); |
|
263 | + $CI = & get_instance(); |
|
264 | 264 | |
265 | - return FCPATH . $CI->config->item('img_path'); |
|
265 | + return FCPATH.$CI->config->item('img_path'); |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * @access public |
273 | 273 | * @return string |
274 | 274 | */ |
275 | -if (!function_exists('swf_path')) { |
|
275 | +if(!function_exists('swf_path')) { |
|
276 | 276 | function swf_path() |
277 | 277 | { |
278 | - $CI =& get_instance(); |
|
278 | + $CI = & get_instance(); |
|
279 | 279 | |
280 | - return FCPATH . $CI->config->item('swf_path'); |
|
280 | + return FCPATH.$CI->config->item('swf_path'); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | * @access public |
288 | 288 | * @return string |
289 | 289 | */ |
290 | -if (!function_exists('xml_path')) { |
|
290 | +if(!function_exists('xml_path')) { |
|
291 | 291 | function xml_path() |
292 | 292 | { |
293 | - $CI =& get_instance(); |
|
293 | + $CI = & get_instance(); |
|
294 | 294 | |
295 | - return FCPATH . $CI->config->item('xml_path'); |
|
295 | + return FCPATH.$CI->config->item('xml_path'); |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
@@ -302,12 +302,12 @@ discard block |
||
302 | 302 | * @access public |
303 | 303 | * @return string |
304 | 304 | */ |
305 | -if (!function_exists('upload_path')) { |
|
305 | +if(!function_exists('upload_path')) { |
|
306 | 306 | function upload_path() |
307 | 307 | { |
308 | - $CI =& get_instance(); |
|
308 | + $CI = & get_instance(); |
|
309 | 309 | |
310 | - return FCPATH . $CI->config->item('upload_path'); |
|
310 | + return FCPATH.$CI->config->item('upload_path'); |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | * @access public |
318 | 318 | * @return string |
319 | 319 | */ |
320 | -if (!function_exists('upload_path_relative')) { |
|
320 | +if(!function_exists('upload_path_relative')) { |
|
321 | 321 | function upload_path_relative() |
322 | 322 | { |
323 | - $CI =& get_instance(); |
|
323 | + $CI = & get_instance(); |
|
324 | 324 | |
325 | - return './' . $CI->config->item('upload_path'); |
|
325 | + return './'.$CI->config->item('upload_path'); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @access public |
333 | 333 | * @return string |
334 | 334 | */ |
335 | -if (!function_exists('download_path')) { |
|
335 | +if(!function_exists('download_path')) { |
|
336 | 336 | function download_path() |
337 | 337 | { |
338 | - $CI =& get_instance(); |
|
338 | + $CI = & get_instance(); |
|
339 | 339 | |
340 | - return FCPATH . $CI->config->item('download_path'); |
|
340 | + return FCPATH.$CI->config->item('download_path'); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | * @access public |
348 | 348 | * @return string |
349 | 349 | */ |
350 | -if (!function_exists('download_path_relative')) { |
|
350 | +if(!function_exists('download_path_relative')) { |
|
351 | 351 | function download_path_relative() |
352 | 352 | { |
353 | - $CI =& get_instance(); |
|
353 | + $CI = & get_instance(); |
|
354 | 354 | |
355 | - return './' . $CI->config->item('download_path'); |
|
355 | + return './'.$CI->config->item('download_path'); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @return string |
371 | 371 | */ |
372 | -if (!function_exists('css')) { |
|
372 | +if(!function_exists('css')) { |
|
373 | 373 | function css($file, $media = 'all') |
374 | 374 | { |
375 | - return '<link rel="stylesheet" type="text/css" href="' . css_url() . $file . '" media="' . $media . '">' . "\n"; |
|
375 | + return '<link rel="stylesheet" type="text/css" href="'.css_url().$file.'" media="'.$media.'">'."\n"; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
@@ -385,10 +385,10 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @return string |
387 | 387 | */ |
388 | -if (!function_exists('less')) { |
|
388 | +if(!function_exists('less')) { |
|
389 | 389 | function less($file) |
390 | 390 | { |
391 | - return '<link rel="stylesheet/less" type="text/css" href="' . less_url() . $file . '">' . "\n"; |
|
391 | + return '<link rel="stylesheet/less" type="text/css" href="'.less_url().$file.'">'."\n"; |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
@@ -402,14 +402,14 @@ discard block |
||
402 | 402 | * |
403 | 403 | * @return string |
404 | 404 | */ |
405 | -if (!function_exists('js')) { |
|
405 | +if(!function_exists('js')) { |
|
406 | 406 | function js($file, $atts = array()) |
407 | 407 | { |
408 | - $element = '<script type="text/javascript" src="' . js_url() . $file . '"'; |
|
408 | + $element = '<script type="text/javascript" src="'.js_url().$file.'"'; |
|
409 | 409 | |
410 | - foreach ($atts as $key => $val) |
|
411 | - $element .= ' ' . $key . '="' . $val . '"'; |
|
412 | - $element .= '></script>' . "\n"; |
|
410 | + foreach($atts as $key => $val) |
|
411 | + $element .= ' '.$key.'="'.$val.'"'; |
|
412 | + $element .= '></script>'."\n"; |
|
413 | 413 | |
414 | 414 | return $element; |
415 | 415 | } |
@@ -425,12 +425,12 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @return string |
427 | 427 | */ |
428 | -if (!function_exists('img')) { |
|
428 | +if(!function_exists('img')) { |
|
429 | 429 | function img($file, $atts = array()) |
430 | 430 | { |
431 | - $url = '<img src="' . img_url() . $file . '"'; |
|
432 | - foreach ($atts as $key => $val) |
|
433 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
431 | + $url = '<img src="'.img_url().$file.'"'; |
|
432 | + foreach($atts as $key => $val) |
|
433 | + $url .= ' '.$key.'="'.$val.'"'; |
|
434 | 434 | $url .= " />\n"; |
435 | 435 | |
436 | 436 | return $url; |
@@ -446,12 +446,12 @@ discard block |
||
446 | 446 | * |
447 | 447 | * @return string |
448 | 448 | */ |
449 | -if (!function_exists('jquery')) { |
|
449 | +if(!function_exists('jquery')) { |
|
450 | 450 | function jquery($version = '') |
451 | 451 | { |
452 | 452 | // Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline |
453 | - $out = '<script src="//ajax.googleapis.com/ajax/libs/jquery/' . $version . '/jquery.min.js"></script>' . "\n"; |
|
454 | - $out .= '<script>window.jQuery || document.write(\'<script src="' . js_url() . 'jquery-' . $version . '.min.js"><\/script>\')</script>' . "\n"; |
|
453 | + $out = '<script src="//ajax.googleapis.com/ajax/libs/jquery/'.$version.'/jquery.min.js"></script>'."\n"; |
|
454 | + $out .= '<script>window.jQuery || document.write(\'<script src="'.js_url().'jquery-'.$version.'.min.js"><\/script>\')</script>'."\n"; |
|
455 | 455 | |
456 | 456 | return $out; |
457 | 457 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | * |
467 | 467 | * @return string |
468 | 468 | */ |
469 | -if (!function_exists('google_analytics')) { |
|
469 | +if(!function_exists('google_analytics')) { |
|
470 | 470 | function google_analytics($ua = '') |
471 | 471 | { |
472 | 472 | // Change UA-XXXXX-X to be your site's ID |
@@ -11,14 +11,14 @@ |
||
11 | 11 | |
12 | 12 | $config['gravatar_base_url'] = 'http://www.gravatar.com/'; |
13 | 13 | $config['gravatar_secure_base_url'] = 'https://secure.gravatar.com/'; |
14 | -$config['gravatar_image_extension'] = '.png'; // '', '.png' or '.jpg'. |
|
14 | +$config['gravatar_image_extension'] = '.png'; // '', '.png' or '.jpg'. |
|
15 | 15 | $config['gravatar_image_size'] = 44; |
16 | 16 | |
17 | 17 | $config['gravatar_default_image'] = 'identicon'; // '', '404', 'mm', 'identicon', 'monsterid', 'wavatar', 'retro', 'blank'. |
18 | 18 | //$config['gravatar_default_image'] = BASE_URL.'assets/img/lib/default-person.png'; // Another possible option: a custon image. |
19 | 19 | |
20 | 20 | $config['gravatar_force_default_image'] = false; |
21 | -$config['gravatar_rating'] = ''; // '', 'g' (default), 'pg', 'r', 'x'. |
|
21 | +$config['gravatar_rating'] = ''; // '', 'g' (default), 'pg', 'r', 'x'. |
|
22 | 22 | |
23 | 23 | // Useragent string for server-made requests. |
24 | 24 | // It is for not getting 403 forbidden response. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | protected $gravatar_image_size; |
32 | 32 | protected $gravatar_default_image; |
33 | 33 | protected $gravatar_force_default_image; |
34 | - protected $gravatar_rating ; |
|
34 | + protected $gravatar_rating; |
|
35 | 35 | protected $gravatar_useragent; |
36 | 36 | |
37 | 37 | protected $last_error = GRAVATAR_NO_ERROR; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $allow_url_fopen = $allow_url_fopen === false || in_array(strtolower($allow_url_fopen), array('on', 'true', '1')); |
60 | 60 | $this->allow_url_fopen = $allow_url_fopen; |
61 | 61 | |
62 | - if (!is_array($config)) { |
|
62 | + if(!is_array($config)) { |
|
63 | 63 | $config = array(); |
64 | 64 | } |
65 | 65 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | |
70 | 70 | public function initialize($config = array()) { |
71 | 71 | |
72 | - if (!is_array($config)) { |
|
72 | + if(!is_array($config)) { |
|
73 | 73 | $config = array(); |
74 | 74 | } |
75 | 75 | |
76 | - foreach ($config as $key => $value) { |
|
76 | + foreach($config as $key => $value) { |
|
77 | 77 | $this->{$key} = $value; |
78 | 78 | } |
79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $this->gravatar_image_size = (int) $this->gravatar_image_size; |
85 | 85 | |
86 | - if ($this->gravatar_image_size <= 0) { |
|
86 | + if($this->gravatar_image_size <= 0) { |
|
87 | 87 | $this->gravatar_image_size = 80; |
88 | 88 | } |
89 | 89 | |
@@ -129,45 +129,45 @@ discard block |
||
129 | 129 | |
130 | 130 | $size = (int) $size; |
131 | 131 | |
132 | - if ($size <= 0) { |
|
132 | + if($size <= 0) { |
|
133 | 133 | $size = $this->gravatar_image_size; |
134 | 134 | } |
135 | 135 | |
136 | - if ($size > 0) { |
|
136 | + if($size > 0) { |
|
137 | 137 | $query['s'] = $size; |
138 | 138 | } |
139 | 139 | |
140 | - if (isset($default_image)) { |
|
140 | + if(isset($default_image)) { |
|
141 | 141 | $default_image = (string) $default_image; |
142 | 142 | } else { |
143 | 143 | $default_image = $this->gravatar_default_image; |
144 | 144 | } |
145 | 145 | |
146 | - if ($default_image != '') { |
|
146 | + if($default_image != '') { |
|
147 | 147 | $query['d'] = $default_image; |
148 | 148 | } |
149 | 149 | |
150 | - if (isset($force_default_image)) { |
|
150 | + if(isset($force_default_image)) { |
|
151 | 151 | $force_default_image = !empty($force_default_image); |
152 | 152 | } else { |
153 | 153 | $force_default_image = $this->gravatar_force_default_image; |
154 | 154 | } |
155 | 155 | |
156 | - if ($force_default_image) { |
|
156 | + if($force_default_image) { |
|
157 | 157 | $query['f'] = 'y'; |
158 | 158 | } |
159 | 159 | |
160 | - if (isset($rating)) { |
|
160 | + if(isset($rating)) { |
|
161 | 161 | $rating = (string) $rating; |
162 | 162 | } else { |
163 | 163 | $rating = $this->gravatar_rating; |
164 | 164 | } |
165 | 165 | |
166 | - if ($rating != '') { |
|
166 | + if($rating != '') { |
|
167 | 167 | $query['r'] = $rating; |
168 | 168 | } |
169 | 169 | |
170 | - if (!empty($query)) { |
|
170 | + if(!empty($query)) { |
|
171 | 171 | $url = $url.'?'.http_build_query($query); |
172 | 172 | } |
173 | 173 | |
@@ -185,25 +185,25 @@ discard block |
||
185 | 185 | |
186 | 186 | $result = $this->execute_profile_request($email, 'php'); |
187 | 187 | |
188 | - if ($this->last_error != GRAVATAR_NO_ERROR) { |
|
188 | + if($this->last_error != GRAVATAR_NO_ERROR) { |
|
189 | 189 | return null; |
190 | 190 | } |
191 | 191 | |
192 | 192 | $result = @ unserialize($result); |
193 | 193 | |
194 | - if ($result === false) { |
|
194 | + if($result === false) { |
|
195 | 195 | |
196 | 196 | $this->last_error = GRAVATAR_INCORRECT_FORMAT; |
197 | 197 | return null; |
198 | 198 | } |
199 | 199 | |
200 | - if (!is_array($result)) { |
|
200 | + if(!is_array($result)) { |
|
201 | 201 | |
202 | 202 | $this->last_error = GRAVATAR_PROFILE_DOES_NOT_EXIST; |
203 | 203 | return null; |
204 | 204 | } |
205 | 205 | |
206 | - if (!isset($result['entry']) || !isset($result['entry'][0])) { |
|
206 | + if(!isset($result['entry']) || !isset($result['entry'][0])) { |
|
207 | 207 | |
208 | 208 | $this->last_error = GRAVATAR_INCORRECT_FORMAT; |
209 | 209 | return null; |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | |
225 | 225 | $this->last_error = GRAVATAR_NO_ERROR; |
226 | 226 | |
227 | - if (function_exists('valid_email')) { |
|
227 | + if(function_exists('valid_email')) { |
|
228 | 228 | |
229 | - if (!valid_email($email)) { |
|
229 | + if(!valid_email($email)) { |
|
230 | 230 | |
231 | 231 | $this->last_error = GRAVATAR_INVALID_EMAIL; |
232 | 232 | return null; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | } else { |
236 | 236 | |
237 | - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
237 | + if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
238 | 238 | |
239 | 239 | $this->last_error = GRAVATAR_INVALID_EMAIL; |
240 | 240 | return null; |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | |
244 | 244 | $format = trim($format); |
245 | 245 | |
246 | - if ($format != '') { |
|
246 | + if($format != '') { |
|
247 | 247 | $format = '.'.ltrim($format, '.'); |
248 | 248 | } |
249 | 249 | |
250 | 250 | $result = null; |
251 | 251 | |
252 | - if ($this->curl_exists) { |
|
252 | + if($this->curl_exists) { |
|
253 | 253 | |
254 | 254 | $url = $this->gravatar_secure_base_url.$this->create_hash($email).$format; |
255 | 255 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | CURLOPT_TIMEOUT => 3, |
265 | 265 | ); |
266 | 266 | |
267 | - if (!ini_get('safe_mode') && !ini_get('open_basedir')) { |
|
267 | + if(!ini_get('safe_mode') && !ini_get('open_basedir')) { |
|
268 | 268 | $options[CURLOPT_FOLLOWLOCATION] = true; |
269 | 269 | } |
270 | 270 | |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | |
277 | 277 | @ curl_close($ch); |
278 | 278 | |
279 | - if ($code != 200) { |
|
279 | + if($code != 200) { |
|
280 | 280 | |
281 | 281 | $this->last_error = GRAVATAR_CANT_CONNECT; |
282 | 282 | return null; |
283 | 283 | } |
284 | 284 | |
285 | - } elseif ($this->allow_url_fopen) { |
|
285 | + } elseif($this->allow_url_fopen) { |
|
286 | 286 | |
287 | 287 | $url = $this->gravatar_base_url.$this->create_hash($email).$format; |
288 | 288 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | return null; |
304 | 304 | } |
305 | 305 | |
306 | - if ($result === false) { |
|
306 | + if($result === false) { |
|
307 | 307 | |
308 | 308 | $this->last_error = GRAVATAR_CANT_CONNECT; |
309 | 309 | return null; |
@@ -337,15 +337,15 @@ discard block |
||
337 | 337 | |
338 | 338 | protected function is_https() { |
339 | 339 | |
340 | - if (function_exists('is_https')) { |
|
340 | + if(function_exists('is_https')) { |
|
341 | 341 | return is_https(); |
342 | 342 | } |
343 | 343 | |
344 | - if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { |
|
344 | + if(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { |
|
345 | 345 | return true; |
346 | - } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
|
346 | + } elseif(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
|
347 | 347 | return true; |
348 | - } elseif (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') { |
|
348 | + } elseif(!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') { |
|
349 | 349 | return true; |
350 | 350 | } |
351 | 351 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | { |
372 | 372 | $email = trim(strtolower($email)); |
373 | 373 | |
374 | - if ( ! filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE) |
|
374 | + if(!filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE) |
|
375 | 375 | { |
376 | 376 | return md5($email); |
377 | 377 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | { |
398 | 398 | $hash = $this->set_email($email); |
399 | 399 | |
400 | - if ($hash === NULL) |
|
400 | + if($hash === NULL) |
|
401 | 401 | { |
402 | 402 | // $hash has to be set to a value so the gravatar site can return a default image |
403 | 403 | $hash = 'invalid_email'; |
@@ -406,27 +406,27 @@ discard block |
||
406 | 406 | $query_string = NULL; |
407 | 407 | $options = array(); |
408 | 408 | |
409 | - if ($rating !== NULL) |
|
409 | + if($rating !== NULL) |
|
410 | 410 | { |
411 | 411 | $options['r'] = $rating; |
412 | 412 | } |
413 | 413 | |
414 | - if ($size !== NULL) |
|
414 | + if($size !== NULL) |
|
415 | 415 | { |
416 | 416 | $options['s'] = $size; |
417 | 417 | } |
418 | 418 | |
419 | - if ($default_image !== NULL) |
|
419 | + if($default_image !== NULL) |
|
420 | 420 | { |
421 | 421 | $options['d'] = urlencode($default_image); |
422 | 422 | } |
423 | 423 | |
424 | - if (count($options) > 0) |
|
424 | + if(count($options) > 0) |
|
425 | 425 | { |
426 | - $query_string = '?'. http_build_query($options); |
|
426 | + $query_string = '?'.http_build_query($options); |
|
427 | 427 | } |
428 | 428 | |
429 | - if ($secure !== NULL) |
|
429 | + if($secure !== NULL) |
|
430 | 430 | { |
431 | 431 | $base = $this->gravatar_secure_base_url; |
432 | 432 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $base = $this->gravatar_base_url; |
436 | 436 | } |
437 | 437 | |
438 | - return $base .'avatar/'. $hash . $query_string; |
|
438 | + return $base.'avatar/'.$hash.$query_string; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | { |
453 | 453 | $hash = $this->set_email($email); |
454 | 454 | |
455 | - if ($hash === NULL) |
|
455 | + if($hash === NULL) |
|
456 | 456 | { |
457 | 457 | // A hash value of NULL will return no xml so the method returns NULL |
458 | 458 | return NULL; |
@@ -460,19 +460,19 @@ discard block |
||
460 | 460 | |
461 | 461 | libxml_use_internal_errors(TRUE); |
462 | 462 | |
463 | - if ($fetch_method === 'file') |
|
463 | + if($fetch_method === 'file') |
|
464 | 464 | { |
465 | - if (ini_get('allow_url_fopen') == FALSE) |
|
465 | + if(ini_get('allow_url_fopen') == FALSE) |
|
466 | 466 | { |
467 | 467 | return NULL; |
468 | 468 | } |
469 | 469 | |
470 | - $str = file_get_contents($this->gravatar_base_url . $hash .'.xml'); |
|
470 | + $str = file_get_contents($this->gravatar_base_url.$hash.'.xml'); |
|
471 | 471 | } |
472 | 472 | |
473 | - if ($fetch_method === 'curl') |
|
473 | + if($fetch_method === 'curl') |
|
474 | 474 | { |
475 | - if ( ! function_exists('curl_init')) |
|
475 | + if(!function_exists('curl_init')) |
|
476 | 476 | { |
477 | 477 | return NULL; |
478 | 478 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $options = array( |
482 | 482 | CURLOPT_RETURNTRANSFER => TRUE, |
483 | 483 | CURLOPT_POST => TRUE, |
484 | - CURLOPT_URL => $this->gravatar_secure_base_url . $hash .'.xml', |
|
484 | + CURLOPT_URL => $this->gravatar_secure_base_url.$hash.'.xml', |
|
485 | 485 | CURLOPT_TIMEOUT => 3 |
486 | 486 | ); |
487 | 487 | curl_setopt_array($ch, $options); |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | $xml = simplexml_load_string($str); |
492 | 492 | |
493 | - if ($xml === FALSE) |
|
493 | + if($xml === FALSE) |
|
494 | 494 | { |
495 | 495 | $errors = array(); |
496 | 496 | foreach(libxml_get_errors() as $error) |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $errors[] = $error->message.'\n'; |
499 | 499 | } |
500 | 500 | $error_string = implode('\n', $errors); |
501 | - throw new Exception('Failed loading XML\n'. $error_string); |
|
501 | + throw new Exception('Failed loading XML\n'.$error_string); |
|
502 | 502 | } |
503 | 503 | else |
504 | 504 | { |