Completed
Push — master ( f2d2ea...222f63 )
by Angus
02:44
created
application/third_party/Ion-Auth/language/romanian/ion_auth_lang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Ion Auth Lang - Romanian
4 6
 *
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/language/romanian/auth_lang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Auth Lang - Romanian
4 6
 *
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/language/finnish/ion_auth_lang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Ion Auth Lang - Finnish
4 6
 *
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/language/korean/ion_auth_lang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Ion Auth Lang - Korean
4 6
 *
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/language/korean/auth_lang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Auth Lang - Korean
4 6
 *
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/language/italian/ion_auth_lang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Ion Auth Lang - Italian
4 6
 *
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/language/italian/auth_lang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Auth Lang - Italian
4 6
 *
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/models/Ion_auth_model.php 1 patch
Braces   +228 added lines, -427 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
 * Name:  Ion Auth Model
4 6
 *
@@ -19,8 +21,7 @@  discard block
 block discarded – undo
19 21
 *
20 22
 */
21 23
 
22
-class Ion_auth_model extends CI_Model
23
-{
24
+class Ion_auth_model extends CI_Model {
24 25
 	/**
25 26
 	 * Holds an array of tables used
26 27
 	 *
@@ -161,8 +162,7 @@  discard block
 block discarded – undo
161 162
 	 **/
162 163
 	protected $_cache_groups = array();
163 164
 
164
-	public function __construct()
165
-	{
165
+	public function __construct() {
166 166
 		parent::__construct();
167 167
 		$this->load->database();
168 168
 		$this->config->load('ion_auth', TRUE);
@@ -194,8 +194,7 @@  discard block
 block discarded – undo
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')
198
-		{
197
+		if ($delimiters_source === 'form_validation') {
199 198
 			// load in delimiters from form_validation
200 199
 			// to keep this simple we'll load the value using reflection since these properties are protected
201 200
 			$this->load->library('form_validation');
@@ -210,9 +209,7 @@  discard block
 block discarded – undo
210 209
 			$error_suffix->setAccessible(TRUE);
211 210
 			$this->error_end_delimiter = $error_suffix->getValue($this->form_validation);
212 211
 			$this->message_end_delimiter = $this->error_end_delimiter;
213
-		}
214
-		else
215
-		{
212
+		} else {
216 213
 			// use delimiters from config
217 214
 			$this->message_start_delimiter = $this->config->item('message_start_delimiter', 'ion_auth');
218 215
 			$this->message_end_delimiter   = $this->config->item('message_end_delimiter', 'ion_auth');
@@ -226,13 +223,10 @@  discard block
 block discarded – undo
226 223
 
227 224
 		// load the bcrypt class if needed
228 225
 		if ($this->hash_method == 'bcrypt') {
229
-			if ($this->random_rounds)
230
-			{
226
+			if ($this->random_rounds) {
231 227
 				$rand = rand($this->min_rounds,$this->max_rounds);
232 228
 				$params = array('rounds' => $rand);
233
-			}
234
-			else
235
-			{
229
+			} else {
236 230
 				$params = array('rounds' => $this->default_rounds);
237 231
 			}
238 232
 
@@ -260,26 +254,20 @@  discard block
 block discarded – undo
260 254
 	 * @return void
261 255
 	 * @author Mathew
262 256
 	 **/
263
-	public function hash_password($password, $salt=false, $use_sha1_override=FALSE)
264
-	{
265
-		if (empty($password))
266
-		{
257
+	public function hash_password($password, $salt=false, $use_sha1_override=FALSE) {
258
+		if (empty($password)) {
267 259
 			return FALSE;
268 260
 		}
269 261
 
270 262
 		// bcrypt
271
-		if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt')
272
-		{
263
+		if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') {
273 264
 			return $this->bcrypt->hash($password);
274 265
 		}
275 266
 
276 267
 
277
-		if ($this->store_salt && $salt)
278
-		{
268
+		if ($this->store_salt && $salt) {
279 269
 			return  sha1($password . $salt);
280
-		}
281
-		else
282
-		{
270
+		} else {
283 271
 			$salt = $this->salt();
284 272
 			return  $salt . substr(sha1($salt . $password), 0, -$this->salt_length);
285 273
 		}
@@ -292,10 +280,8 @@  discard block
 block discarded – undo
292 280
 	 * @return void
293 281
 	 * @author Mathew
294 282
 	 **/
295
-	public function hash_password_db($id, $password, $use_sha1_override=FALSE)
296
-	{
297
-		if (empty($id) || empty($password))
298
-		{
283
+	public function hash_password_db($id, $password, $use_sha1_override=FALSE) {
284
+		if (empty($id) || empty($password)) {
299 285
 			return FALSE;
300 286
 		}
301 287
 
@@ -309,16 +295,13 @@  discard block
 block discarded – undo
309 295
 
310 296
 		$hash_password_db = $query->row();
311 297
 
312
-		if ($query->num_rows() !== 1)
313
-		{
298
+		if ($query->num_rows() !== 1) {
314 299
 			return FALSE;
315 300
 		}
316 301
 
317 302
 		// bcrypt
318
-		if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt')
319
-		{
320
-			if ($this->bcrypt->verify($password,$hash_password_db->password))
321
-			{
303
+		if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt') {
304
+			if ($this->bcrypt->verify($password,$hash_password_db->password)) {
322 305
 				return TRUE;
323 306
 			}
324 307
 
@@ -326,23 +309,17 @@  discard block
 block discarded – undo
326 309
 		}
327 310
 
328 311
 		// sha1
329
-		if ($this->store_salt)
330
-		{
312
+		if ($this->store_salt) {
331 313
 			$db_password = sha1($password . $hash_password_db->salt);
332
-		}
333
-		else
334
-		{
314
+		} else {
335 315
 			$salt = substr($hash_password_db->password, 0, $this->salt_length);
336 316
 
337 317
 			$db_password =  $salt . substr(sha1($salt . $password), 0, -$this->salt_length);
338 318
 		}
339 319
 
340
-		if($db_password == $hash_password_db->password)
341
-		{
320
+		if($db_password == $hash_password_db->password) {
342 321
 			return TRUE;
343
-		}
344
-		else
345
-		{
322
+		} else {
346 323
 			return FALSE;
347 324
 		}
348 325
 	}
@@ -353,8 +330,7 @@  discard block
 block discarded – undo
353 330
 	 * @return void
354 331
 	 * @author Mathew
355 332
 	 **/
356
-	public function hash_code($password)
357
-	{
333
+	public function hash_code($password) {
358 334
 		return $this->hash_password($password, FALSE, TRUE);
359 335
 	}
360 336
 
@@ -366,8 +342,7 @@  discard block
 block discarded – undo
366 342
 	 * @return void
367 343
 	 * @author Anthony Ferrera
368 344
 	 **/
369
-	public function salt()
370
-	{
345
+	public function salt() {
371 346
 
372 347
 		$raw_salt_len = 16;
373 348
 
@@ -449,12 +424,10 @@  discard block
 block discarded – undo
449 424
 	 * @return void
450 425
 	 * @author Mathew
451 426
 	 **/
452
-	public function activate($id, $code = false)
453
-	{
427
+	public function activate($id, $code = false) {
454 428
 		$this->trigger_events('pre_activate');
455 429
 
456
-		if ($code !== FALSE)
457
-		{
430
+		if ($code !== FALSE) {
458 431
 			$query = $this->db->select($this->identity_column)
459 432
 			                  ->where('activation_code', $code)
460 433
 			                  ->where('id', $id)
@@ -464,8 +437,7 @@  discard block
 block discarded – undo
464 437
 
465 438
 			$result = $query->row();
466 439
 
467
-			if ($query->num_rows() !== 1)
468
-			{
440
+			if ($query->num_rows() !== 1) {
469 441
 				$this->trigger_events(array('post_activate', 'post_activate_unsuccessful'));
470 442
 				$this->set_error('activate_unsuccessful');
471 443
 				return FALSE;
@@ -478,9 +450,7 @@  discard block
 block discarded – undo
478 450
 
479 451
 			$this->trigger_events('extra_where');
480 452
 			$this->db->update($this->tables['users'], $data, array('id' => $id));
481
-		}
482
-		else
483
-		{
453
+		} else {
484 454
 			$data = array(
485 455
 			    'activation_code' => NULL,
486 456
 			    'active'          => 1
@@ -493,13 +463,10 @@  discard block
 block discarded – undo
493 463
 
494 464
 
495 465
 		$return = $this->db->affected_rows() == 1;
496
-		if ($return)
497
-		{
466
+		if ($return) {
498 467
 			$this->trigger_events(array('post_activate', 'post_activate_successful'));
499 468
 			$this->set_message('activate_successful');
500
-		}
501
-		else
502
-		{
469
+		} else {
503 470
 			$this->trigger_events(array('post_activate', 'post_activate_unsuccessful'));
504 471
 			$this->set_error('activate_unsuccessful');
505 472
 		}
@@ -515,17 +482,13 @@  discard block
 block discarded – undo
515 482
 	 * @return void
516 483
 	 * @author Mathew
517 484
 	 **/
518
-	public function deactivate($id = NULL)
519
-	{
485
+	public function deactivate($id = NULL) {
520 486
 		$this->trigger_events('deactivate');
521 487
 
522
-		if (!isset($id))
523
-		{
488
+		if (!isset($id)) {
524 489
 			$this->set_error('deactivate_unsuccessful');
525 490
 			return FALSE;
526
-		}
527
-                elseif($this->ion_auth->logged_in() && $this->user()->row()->id == $id)
528
-                {
491
+		} elseif($this->ion_auth->logged_in() && $this->user()->row()->id == $id) {
529 492
                         $this->set_error('deactivate_current_user_unsuccessful');
530 493
                         return FALSE;
531 494
                 }
@@ -542,25 +505,24 @@  discard block
 block discarded – undo
542 505
 		$this->db->update($this->tables['users'], $data, array('id' => $id));
543 506
 
544 507
 		$return = $this->db->affected_rows() == 1;
545
-		if ($return)
546
-			$this->set_message('deactivate_successful');
547
-		else
548
-			$this->set_error('deactivate_unsuccessful');
508
+		if ($return) {
509
+					$this->set_message('deactivate_successful');
510
+		} else {
511
+					$this->set_error('deactivate_unsuccessful');
512
+		}
549 513
 
550 514
 		return $return;
551 515
 	}
552 516
 
553 517
 	public function clear_forgotten_password_code($code) {
554 518
 
555
-		if (empty($code))
556
-		{
519
+		if (empty($code)) {
557 520
 			return FALSE;
558 521
 		}
559 522
 
560 523
 		$this->db->where('forgotten_password_code', $code);
561 524
 
562
-		if ($this->db->count_all_results($this->tables['users']) > 0)
563
-		{
525
+		if ($this->db->count_all_results($this->tables['users']) > 0) {
564 526
 			$data = array(
565 527
 			    'forgotten_password_code' => NULL,
566 528
 			    'forgotten_password_time' => NULL
@@ -596,8 +558,7 @@  discard block
 block discarded – undo
596 558
 		    			  ->order_by('id', 'desc')
597 559
 		                  ->get($this->tables['users']);
598 560
 
599
-		if ($query->num_rows() !== 1)
600
-		{
561
+		if ($query->num_rows() !== 1) {
601 562
 			$this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
602 563
 			$this->set_error('password_change_unsuccessful');
603 564
 			return FALSE;
@@ -620,13 +581,10 @@  discard block
 block discarded – undo
620 581
 		$this->db->update($this->tables['users'], $data, array($this->identity_column => $identity));
621 582
 
622 583
 		$return = $this->db->affected_rows() == 1;
623
-		if ($return)
624
-		{
584
+		if ($return) {
625 585
 			$this->trigger_events(array('post_change_password', 'post_change_password_successful'));
626 586
 			$this->set_message('password_change_successful');
627
-		}
628
-		else
629
-		{
587
+		} else {
630 588
 			$this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
631 589
 			$this->set_error('password_change_unsuccessful');
632 590
 		}
@@ -640,8 +598,7 @@  discard block
 block discarded – undo
640 598
 	 * @return bool
641 599
 	 * @author Mathew
642 600
 	 **/
643
-	public function change_password($identity, $old, $new)
644
-	{
601
+	public function change_password($identity, $old, $new) {
645 602
 		$this->trigger_events('pre_change_password');
646 603
 
647 604
 		$this->trigger_events('extra_where');
@@ -652,8 +609,7 @@  discard block
 block discarded – undo
652 609
 		    			  ->order_by('id', 'desc')
653 610
 		                  ->get($this->tables['users']);
654 611
 
655
-		if ($query->num_rows() !== 1)
656
-		{
612
+		if ($query->num_rows() !== 1) {
657 613
 			$this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
658 614
 			$this->set_error('password_change_unsuccessful');
659 615
 			return FALSE;
@@ -663,8 +619,7 @@  discard block
 block discarded – undo
663 619
 
664 620
 		$old_password_matches = $this->hash_password_db($user->id, $old);
665 621
 
666
-		if ($old_password_matches === TRUE)
667
-		{
622
+		if ($old_password_matches === TRUE) {
668 623
 			// store the new password and reset the remember code so all remembered instances have to re-login
669 624
 			$hashed_new_password  = $this->hash_password($new, $user->salt);
670 625
 			$data = array(
@@ -675,13 +630,10 @@  discard block
 block discarded – undo
675 630
 			$this->trigger_events('extra_where');
676 631
 
677 632
 			$successfully_changed_password_in_db = $this->db->update($this->tables['users'], $data, array($this->identity_column => $identity));
678
-			if ($successfully_changed_password_in_db)
679
-			{
633
+			if ($successfully_changed_password_in_db) {
680 634
 				$this->trigger_events(array('post_change_password', 'post_change_password_successful'));
681 635
 				$this->set_message('password_change_successful');
682
-			}
683
-			else
684
-			{
636
+			} else {
685 637
 				$this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
686 638
 				$this->set_error('password_change_unsuccessful');
687 639
 			}
@@ -699,12 +651,10 @@  discard block
 block discarded – undo
699 651
 	 * @return bool
700 652
 	 * @author Mathew
701 653
 	 **/
702
-	public function username_check($username = '')
703
-	{
654
+	public function username_check($username = '') {
704 655
 		$this->trigger_events('username_check');
705 656
 
706
-		if (empty($username))
707
-		{
657
+		if (empty($username)) {
708 658
 			return FALSE;
709 659
 		}
710 660
 
@@ -723,12 +673,10 @@  discard block
 block discarded – undo
723 673
 	 * @return bool
724 674
 	 * @author Mathew
725 675
 	 **/
726
-	public function email_check($email = '')
727
-	{
676
+	public function email_check($email = '') {
728 677
 		$this->trigger_events('email_check');
729 678
 
730
-		if (empty($email))
731
-		{
679
+		if (empty($email)) {
732 680
 			return FALSE;
733 681
 		}
734 682
 
@@ -747,12 +695,10 @@  discard block
 block discarded – undo
747 695
 	 * @return bool
748 696
 	 * @author Mathew
749 697
 	 **/
750
-	public function identity_check($identity = '')
751
-	{
698
+	public function identity_check($identity = '') {
752 699
 		$this->trigger_events('identity_check');
753 700
 
754
-		if (empty($identity))
755
-		{
701
+		if (empty($identity)) {
756 702
 			return FALSE;
757 703
 		}
758 704
 
@@ -768,10 +714,8 @@  discard block
 block discarded – undo
768 714
 	 * @updated Ryan
769 715
 	 * @updated 52aa456eef8b60ad6754b31fbdcc77bb
770 716
 	 **/
771
-	public function forgotten_password($identity)
772
-	{
773
-		if (empty($identity))
774
-		{
717
+	public function forgotten_password($identity) {
718
+		if (empty($identity)) {
775 719
 			$this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful'));
776 720
 			return FALSE;
777 721
 		}
@@ -789,12 +733,10 @@  discard block
 block discarded – undo
789 733
 		$key = $this->hash_code($activation_code_part.$identity);
790 734
 
791 735
 		// 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)
793
-		{
736
+		if ($key != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE) {
794 737
 			// preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards
795 738
 			// 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))
797
-			{
739
+			if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $key)) {
798 740
 				$key = preg_replace("/[^".$this->config->item('permitted_uri_chars')."]+/i", "-", $key);
799 741
 			}
800 742
 		}
@@ -813,10 +755,11 @@  discard block
 block discarded – undo
813 755
 
814 756
 		$return = $this->db->affected_rows() == 1;
815 757
 
816
-		if ($return)
817
-			$this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_successful'));
818
-		else
819
-			$this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful'));
758
+		if ($return) {
759
+					$this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_successful'));
760
+		} else {
761
+					$this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful'));
762
+		}
820 763
 
821 764
 		return $return;
822 765
 	}
@@ -827,12 +770,10 @@  discard block
 block discarded – undo
827 770
 	 * @return string
828 771
 	 * @author Mathew
829 772
 	 **/
830
-	public function forgotten_password_complete($code, $salt=FALSE)
831
-	{
773
+	public function forgotten_password_complete($code, $salt=FALSE) {
832 774
 		$this->trigger_events('pre_forgotten_password_complete');
833 775
 
834
-		if (empty($code))
835
-		{
776
+		if (empty($code)) {
836 777
 			$this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful'));
837 778
 			return FALSE;
838 779
 		}
@@ -876,27 +817,22 @@  discard block
 block discarded – undo
876 817
 	 * @return bool
877 818
 	 * @author Mathew
878 819
 	 **/
879
-	public function register($identity, $password, $email, $additional_data = array(), $groups = array())
880
-	{
820
+	public function register($identity, $password, $email, $additional_data = array(), $groups = array()) {
881 821
 		$this->trigger_events('pre_register');
882 822
 
883 823
 		$manual_activation = $this->config->item('manual_activation', 'ion_auth');
884 824
 
885
-		if ($this->identity_check($identity))
886
-		{
825
+		if ($this->identity_check($identity)) {
887 826
 			$this->set_error('account_creation_duplicate_identity');
888 827
 			return FALSE;
889
-		}
890
-		elseif ( !$this->config->item('default_group', 'ion_auth') && empty($groups) )
891
-		{
828
+		} elseif ( !$this->config->item('default_group', 'ion_auth') && empty($groups) ) {
892 829
 			$this->set_error('account_creation_missing_default_group');
893 830
 			return FALSE;
894 831
 		}
895 832
 
896 833
 		// check if the default set in config exists in database
897 834
 		$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
-		{
835
+		if( !isset($query->id) && empty($groups) ) {
900 836
 			$this->set_error('account_creation_invalid_default_group');
901 837
 			return FALSE;
902 838
 		}
@@ -920,8 +856,7 @@  discard block
 block discarded – undo
920 856
 		    'active'     => ($manual_activation === false ? 1 : 0)
921 857
 		);
922 858
 
923
-		if ($this->store_salt)
924
-		{
859
+		if ($this->store_salt) {
925 860
 			$data['salt'] = $salt;
926 861
 		}
927 862
 
@@ -936,16 +871,13 @@  discard block
 block discarded – undo
936 871
 		$id = $this->db->insert_id($this->tables['users'] . '_id_seq');
937 872
 
938 873
 		// 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) )
940
-		{
874
+		if( isset($default_group->id) && empty($groups) ) {
941 875
 			$groups[] = $default_group->id;
942 876
 		}
943 877
 
944
-		if (!empty($groups))
945
-		{
878
+		if (!empty($groups)) {
946 879
 			// add to groups
947
-			foreach ($groups as $group)
948
-			{
880
+			foreach ($groups as $group) {
949 881
 				$this->add_to_group($group, $id);
950 882
 			}
951 883
 		}
@@ -961,12 +893,10 @@  discard block
 block discarded – undo
961 893
 	 * @return bool
962 894
 	 * @author Mathew
963 895
 	 **/
964
-	public function login($identity, $password, $remember=FALSE)
965
-	{
896
+	public function login($identity, $password, $remember=FALSE) {
966 897
 		$this->trigger_events('pre_login');
967 898
 
968
-		if (empty($identity) || empty($password))
969
-		{
899
+		if (empty($identity) || empty($password)) {
970 900
 			$this->set_error('login_unsuccessful');
971 901
 			return FALSE;
972 902
 		}
@@ -979,8 +909,7 @@  discard block
 block discarded – undo
979 909
 		    			  ->order_by('id', 'desc')
980 910
 		                  ->get($this->tables['users']);
981 911
 
982
-		if($this->is_max_login_attempts_exceeded($identity))
983
-		{
912
+		if($this->is_max_login_attempts_exceeded($identity)) {
984 913
 			// Hash something anyway, just to take up time
985 914
 			$this->hash_password($password);
986 915
 
@@ -990,16 +919,13 @@  discard block
 block discarded – undo
990 919
 			return FALSE;
991 920
 		}
992 921
 
993
-		if ($query->num_rows() === 1)
994
-		{
922
+		if ($query->num_rows() === 1) {
995 923
 			$user = $query->row();
996 924
 
997 925
 			$password = $this->hash_password_db($user->id, $password);
998 926
 
999
-			if ($password === TRUE)
1000
-			{
1001
-				if ($user->active == 0)
1002
-				{
927
+			if ($password === TRUE) {
928
+				if ($user->active == 0) {
1003 929
 					$this->trigger_events('post_login_unsuccessful');
1004 930
 					$this->set_error('login_unsuccessful_not_active');
1005 931
 
@@ -1012,8 +938,7 @@  discard block
 block discarded – undo
1012 938
 
1013 939
 				$this->clear_login_attempts($identity);
1014 940
 
1015
-				if ($remember && $this->config->item('remember_users', 'ion_auth'))
1016
-				{
941
+				if ($remember && $this->config->item('remember_users', 'ion_auth')) {
1017 942
 					$this->remember_user($user->id);
1018 943
 				}
1019 944
 
@@ -1040,36 +965,27 @@  discard block
 block discarded – undo
1040 965
      * the configuration item recheck_timer. If it does, then it will check if the user is still active
1041 966
      * @return bool
1042 967
      */
1043
-	public function recheck_session()
1044
-    {
968
+	public function recheck_session() {
1045 969
         $recheck = (null !== $this->config->item('recheck_timer', 'ion_auth')) ? $this->config->item('recheck_timer', 'ion_auth') : 0;
1046 970
 
1047
-        if($recheck!==0)
1048
-        {
971
+        if($recheck!==0) {
1049 972
             $last_login = $this->session->userdata('last_check');
1050
-            if($last_login+$recheck < time())
1051
-            {
973
+            if($last_login+$recheck < time()) {
1052 974
                 $query = $this->db->select('id')
1053 975
                     ->where(array($this->identity_column=>$this->session->userdata('identity'),'active'=>'1'))
1054 976
                     ->limit(1)
1055 977
                     ->order_by('id', 'desc')
1056 978
                     ->get($this->tables['users']);
1057
-                if ($query->num_rows() === 1)
1058
-                {
979
+                if ($query->num_rows() === 1) {
1059 980
                     $this->session->set_userdata('last_check',time());
1060
-                }
1061
-                else
1062
-                {
981
+                } else {
1063 982
                     $this->trigger_events('logout');
1064 983
 
1065 984
                     $identity = $this->config->item('identity', 'ion_auth');
1066 985
 
1067
-                    if (substr(CI_VERSION, 0, 1) == '2')
1068
-                    {
986
+                    if (substr(CI_VERSION, 0, 1) == '2') {
1069 987
                         $this->session->unset_userdata( array($identity => '', 'id' => '', 'user_id' => '') );
1070
-                    }
1071
-                    else
1072
-                    {
988
+                    } else {
1073 989
                         $this->session->unset_userdata( array($identity, 'id', 'user_id') );
1074 990
                     }
1075 991
                     return false;
@@ -1113,8 +1029,7 @@  discard block
 block discarded – undo
1113 1029
 	 *                            Use get_last_attempt_ip($identity) to retrieve user's last IP
1114 1030
 	 * @return int
1115 1031
 	 */
1116
-	public function get_attempts_num($identity, $ip_address = NULL)
1117
-	{
1032
+	public function get_attempts_num($identity, $ip_address = NULL) {
1118 1033
         if ($this->config->item('track_login_attempts', 'ion_auth')) {
1119 1034
             $this->db->select('1', FALSE);
1120 1035
             $this->db->where('login', $identity);
@@ -1257,28 +1172,24 @@  discard block
 block discarded – undo
1257 1172
 		return FALSE;
1258 1173
 	}
1259 1174
 
1260
-	public function limit($limit)
1261
-	{
1175
+	public function limit($limit) {
1262 1176
 		$this->trigger_events('limit');
1263 1177
 		$this->_ion_limit = $limit;
1264 1178
 
1265 1179
 		return $this;
1266 1180
 	}
1267 1181
 
1268
-	public function offset($offset)
1269
-	{
1182
+	public function offset($offset) {
1270 1183
 		$this->trigger_events('offset');
1271 1184
 		$this->_ion_offset = $offset;
1272 1185
 
1273 1186
 		return $this;
1274 1187
 	}
1275 1188
 
1276
-	public function where($where, $value = NULL)
1277
-	{
1189
+	public function where($where, $value = NULL) {
1278 1190
 		$this->trigger_events('where');
1279 1191
 
1280
-		if (!is_array($where))
1281
-		{
1192
+		if (!is_array($where)) {
1282 1193
 			$where = array($where => $value);
1283 1194
 		}
1284 1195
 
@@ -1287,8 +1198,7 @@  discard block
 block discarded – undo
1287 1198
 		return $this;
1288 1199
 	}
1289 1200
 
1290
-	public function like($like, $value = NULL, $position = 'both')
1291
-	{
1201
+	public function like($like, $value = NULL, $position = 'both') {
1292 1202
 		$this->trigger_events('like');
1293 1203
 
1294 1204
 		array_push($this->_ion_like, array(
@@ -1300,8 +1210,7 @@  discard block
 block discarded – undo
1300 1210
 		return $this;
1301 1211
 	}
1302 1212
 
1303
-	public function select($select)
1304
-	{
1213
+	public function select($select) {
1305 1214
 		$this->trigger_events('select');
1306 1215
 
1307 1216
 		$this->_ion_select[] = $select;
@@ -1309,8 +1218,7 @@  discard block
 block discarded – undo
1309 1218
 		return $this;
1310 1219
 	}
1311 1220
 
1312
-	public function order_by($by, $order='desc')
1313
-	{
1221
+	public function order_by($by, $order='desc') {
1314 1222
 		$this->trigger_events('order_by');
1315 1223
 
1316 1224
 		$this->_ion_order_by = $by;
@@ -1319,8 +1227,7 @@  discard block
 block discarded – undo
1319 1227
 		return $this;
1320 1228
 	}
1321 1229
 
1322
-	public function row()
1323
-	{
1230
+	public function row() {
1324 1231
 		$this->trigger_events('row');
1325 1232
 
1326 1233
 		$row = $this->response->row();
@@ -1328,8 +1235,7 @@  discard block
 block discarded – undo
1328 1235
 		return $row;
1329 1236
 	}
1330 1237
 
1331
-	public function row_array()
1332
-	{
1238
+	public function row_array() {
1333 1239
 		$this->trigger_events(array('row', 'row_array'));
1334 1240
 
1335 1241
 		$row = $this->response->row_array();
@@ -1337,8 +1243,7 @@  discard block
 block discarded – undo
1337 1243
 		return $row;
1338 1244
 	}
1339 1245
 
1340
-	public function result()
1341
-	{
1246
+	public function result() {
1342 1247
 		$this->trigger_events('result');
1343 1248
 
1344 1249
 		$result = $this->response->result();
@@ -1346,8 +1251,7 @@  discard block
 block discarded – undo
1346 1251
 		return $result;
1347 1252
 	}
1348 1253
 
1349
-	public function result_array()
1350
-	{
1254
+	public function result_array() {
1351 1255
 		$this->trigger_events(array('result', 'result_array'));
1352 1256
 
1353 1257
 		$result = $this->response->result_array();
@@ -1355,8 +1259,7 @@  discard block
 block discarded – undo
1355 1259
 		return $result;
1356 1260
 	}
1357 1261
 
1358
-	public function num_rows()
1359
-	{
1262
+	public function num_rows() {
1360 1263
 		$this->trigger_events(array('num_rows'));
1361 1264
 
1362 1265
 		$result = $this->response->num_rows();
@@ -1370,21 +1273,16 @@  discard block
 block discarded – undo
1370 1273
 	 * @return object Users
1371 1274
 	 * @author Ben Edmunds
1372 1275
 	 **/
1373
-	public function users($groups = NULL)
1374
-	{
1276
+	public function users($groups = NULL) {
1375 1277
 		$this->trigger_events('users');
1376 1278
 
1377
-		if (isset($this->_ion_select) && !empty($this->_ion_select))
1378
-		{
1379
-			foreach ($this->_ion_select as $select)
1380
-			{
1279
+		if (isset($this->_ion_select) && !empty($this->_ion_select)) {
1280
+			foreach ($this->_ion_select as $select) {
1381 1281
 				$this->db->select($select);
1382 1282
 			}
1383 1283
 
1384 1284
 			$this->_ion_select = array();
1385
-		}
1386
-		else
1387
-		{
1285
+		} else {
1388 1286
 			//default selects
1389 1287
 			$this->db->select(array(
1390 1288
 			    $this->tables['users'].'.*',
@@ -1394,17 +1292,14 @@  discard block
 block discarded – undo
1394 1292
 		}
1395 1293
 
1396 1294
 		// filter by group id(s) if passed
1397
-		if (isset($groups))
1398
-		{
1295
+		if (isset($groups)) {
1399 1296
 			// build an array if only one group was passed
1400
-			if (!is_array($groups))
1401
-			{
1297
+			if (!is_array($groups)) {
1402 1298
 				$groups = Array($groups);
1403 1299
 			}
1404 1300
 
1405 1301
 			// join and then run a where_in against the group ids
1406
-			if (isset($groups) && !empty($groups))
1407
-			{
1302
+			if (isset($groups) && !empty($groups)) {
1408 1303
 				$this->db->distinct();
1409 1304
 				$this->db->join(
1410 1305
 				    $this->tables['users_groups'],
@@ -1416,20 +1311,20 @@  discard block
 block discarded – undo
1416 1311
 			// verify if group name or group id was used and create and put elements in different arrays
1417 1312
 			$group_ids = array();
1418 1313
 			$group_names = array();
1419
-			foreach($groups as $group)
1420
-			{
1421
-				if(is_numeric($group)) $group_ids[] = $group;
1422
-				else $group_names[] = $group;
1314
+			foreach($groups as $group) {
1315
+				if(is_numeric($group)) {
1316
+					$group_ids[] = $group;
1317
+				} else {
1318
+					$group_names[] = $group;
1319
+				}
1423 1320
 			}
1424 1321
 			$or_where_in = (!empty($group_ids) && !empty($group_names)) ? 'or_where_in' : 'where_in';
1425 1322
 			// if group name was used we do one more join with groups
1426
-			if(!empty($group_names))
1427
-			{
1323
+			if(!empty($group_names)) {
1428 1324
 				$this->db->join($this->tables['groups'], $this->tables['users_groups'] . '.' . $this->join['groups'] . ' = ' . $this->tables['groups'] . '.id', 'inner');
1429 1325
 				$this->db->where_in($this->tables['groups'] . '.name', $group_names);
1430 1326
 			}
1431
-			if(!empty($group_ids))
1432
-			{
1327
+			if(!empty($group_ids)) {
1433 1328
 				$this->db->{$or_where_in}($this->tables['users_groups'].'.'.$this->join['groups'], $group_ids);
1434 1329
 			}
1435 1330
 		}
@@ -1437,43 +1332,35 @@  discard block
 block discarded – undo
1437 1332
 		$this->trigger_events('extra_where');
1438 1333
 
1439 1334
 		// run each where that was passed
1440
-		if (isset($this->_ion_where) && !empty($this->_ion_where))
1441
-		{
1442
-			foreach ($this->_ion_where as $where)
1443
-			{
1335
+		if (isset($this->_ion_where) && !empty($this->_ion_where)) {
1336
+			foreach ($this->_ion_where as $where) {
1444 1337
 				$this->db->where($where);
1445 1338
 			}
1446 1339
 
1447 1340
 			$this->_ion_where = array();
1448 1341
 		}
1449 1342
 
1450
-		if (isset($this->_ion_like) && !empty($this->_ion_like))
1451
-		{
1452
-			foreach ($this->_ion_like as $like)
1453
-			{
1343
+		if (isset($this->_ion_like) && !empty($this->_ion_like)) {
1344
+			foreach ($this->_ion_like as $like) {
1454 1345
 				$this->db->or_like($like['like'], $like['value'], $like['position']);
1455 1346
 			}
1456 1347
 
1457 1348
 			$this->_ion_like = array();
1458 1349
 		}
1459 1350
 
1460
-		if (isset($this->_ion_limit) && isset($this->_ion_offset))
1461
-		{
1351
+		if (isset($this->_ion_limit) && isset($this->_ion_offset)) {
1462 1352
 			$this->db->limit($this->_ion_limit, $this->_ion_offset);
1463 1353
 
1464 1354
 			$this->_ion_limit  = NULL;
1465 1355
 			$this->_ion_offset = NULL;
1466
-		}
1467
-		else if (isset($this->_ion_limit))
1468
-		{
1356
+		} else if (isset($this->_ion_limit)) {
1469 1357
 			$this->db->limit($this->_ion_limit);
1470 1358
 
1471 1359
 			$this->_ion_limit  = NULL;
1472 1360
 		}
1473 1361
 
1474 1362
 		// set the order
1475
-		if (isset($this->_ion_order_by) && isset($this->_ion_order))
1476
-		{
1363
+		if (isset($this->_ion_order_by) && isset($this->_ion_order)) {
1477 1364
 			$this->db->order_by($this->_ion_order_by, $this->_ion_order);
1478 1365
 
1479 1366
 			$this->_ion_order    = NULL;
@@ -1491,8 +1378,7 @@  discard block
 block discarded – undo
1491 1378
 	 * @return object
1492 1379
 	 * @author Ben Edmunds
1493 1380
 	 **/
1494
-	public function user($id = NULL)
1495
-	{
1381
+	public function user($id = NULL) {
1496 1382
 		$this->trigger_events('user');
1497 1383
 
1498 1384
 		// if no id was passed use the current users id
@@ -1513,8 +1399,7 @@  discard block
 block discarded – undo
1513 1399
 	 * @return array
1514 1400
 	 * @author Ben Edmunds
1515 1401
 	 **/
1516
-	public function get_users_groups($id=FALSE)
1517
-	{
1402
+	public function get_users_groups($id=FALSE) {
1518 1403
 		$this->trigger_events('get_users_group');
1519 1404
 
1520 1405
 		// if no id was passed use the current users id
@@ -1532,29 +1417,24 @@  discard block
 block discarded – undo
1532 1417
 	 * @return bool
1533 1418
 	 * @author Ben Edmunds
1534 1419
 	 **/
1535
-	public function add_to_group($group_ids, $user_id=false)
1536
-	{
1420
+	public function add_to_group($group_ids, $user_id=false) {
1537 1421
 		$this->trigger_events('add_to_group');
1538 1422
 
1539 1423
 		// if no id was passed use the current users id
1540 1424
 		$user_id || $user_id = $this->session->userdata('user_id');
1541 1425
 
1542
-		if(!is_array($group_ids))
1543
-		{
1426
+		if(!is_array($group_ids)) {
1544 1427
 			$group_ids = array($group_ids);
1545 1428
 		}
1546 1429
 
1547 1430
 		$return = 0;
1548 1431
 
1549 1432
 		// Then insert each into the database
1550
-		foreach ($group_ids as $group_id)
1551
-		{
1552
-			if ($this->db->insert($this->tables['users_groups'], array( $this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id)))
1553
-			{
1433
+		foreach ($group_ids as $group_id) {
1434
+			if ($this->db->insert($this->tables['users_groups'], array( $this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id))) {
1554 1435
 				if (isset($this->_cache_groups[$group_id])) {
1555 1436
 					$group_name = $this->_cache_groups[$group_id];
1556
-				}
1557
-				else {
1437
+				} else {
1558 1438
 					$group = $this->group($group_id)->result();
1559 1439
 					$group_name = $group[0]->name;
1560 1440
 					$this->_cache_groups[$group_id] = $group_name;
@@ -1575,29 +1455,23 @@  discard block
 block discarded – undo
1575 1455
 	 * @return bool
1576 1456
 	 * @author Ben Edmunds
1577 1457
 	 **/
1578
-	public function remove_from_group($group_ids=false, $user_id=false)
1579
-	{
1458
+	public function remove_from_group($group_ids=false, $user_id=false) {
1580 1459
 		$this->trigger_events('remove_from_group');
1581 1460
 
1582 1461
 		// user id is required
1583
-		if(empty($user_id))
1584
-		{
1462
+		if(empty($user_id)) {
1585 1463
 			return FALSE;
1586 1464
 		}
1587 1465
 
1588 1466
 		// if group id(s) are passed remove user from the group(s)
1589
-		if( ! empty($group_ids))
1590
-		{
1591
-			if(!is_array($group_ids))
1592
-			{
1467
+		if( ! empty($group_ids)) {
1468
+			if(!is_array($group_ids)) {
1593 1469
 				$group_ids = array($group_ids);
1594 1470
 			}
1595 1471
 
1596
-			foreach($group_ids as $group_id)
1597
-			{
1472
+			foreach($group_ids as $group_id) {
1598 1473
 				$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
-				{
1474
+				if (isset($this->_cache_user_in_group[$user_id]) && isset($this->_cache_user_in_group[$user_id][$group_id])) {
1601 1475
 					unset($this->_cache_user_in_group[$user_id][$group_id]);
1602 1476
 				}
1603 1477
 			}
@@ -1605,8 +1479,7 @@  discard block
 block discarded – undo
1605 1479
 			$return = TRUE;
1606 1480
 		}
1607 1481
 		// otherwise remove user from all groups
1608
-		else
1609
-		{
1482
+		else {
1610 1483
 			if ($return = $this->db->delete($this->tables['users_groups'], array($this->join['users'] => (float)$user_id))) {
1611 1484
 				$this->_cache_user_in_group[$user_id] = array();
1612 1485
 			}
@@ -1620,37 +1493,30 @@  discard block
 block discarded – undo
1620 1493
 	 * @return object
1621 1494
 	 * @author Ben Edmunds
1622 1495
 	 **/
1623
-	public function groups()
1624
-	{
1496
+	public function groups() {
1625 1497
 		$this->trigger_events('groups');
1626 1498
 
1627 1499
 		// run each where that was passed
1628
-		if (isset($this->_ion_where) && !empty($this->_ion_where))
1629
-		{
1630
-			foreach ($this->_ion_where as $where)
1631
-			{
1500
+		if (isset($this->_ion_where) && !empty($this->_ion_where)) {
1501
+			foreach ($this->_ion_where as $where) {
1632 1502
 				$this->db->where($where);
1633 1503
 			}
1634 1504
 			$this->_ion_where = array();
1635 1505
 		}
1636 1506
 
1637
-		if (isset($this->_ion_limit) && isset($this->_ion_offset))
1638
-		{
1507
+		if (isset($this->_ion_limit) && isset($this->_ion_offset)) {
1639 1508
 			$this->db->limit($this->_ion_limit, $this->_ion_offset);
1640 1509
 
1641 1510
 			$this->_ion_limit  = NULL;
1642 1511
 			$this->_ion_offset = NULL;
1643
-		}
1644
-		else if (isset($this->_ion_limit))
1645
-		{
1512
+		} else if (isset($this->_ion_limit)) {
1646 1513
 			$this->db->limit($this->_ion_limit);
1647 1514
 
1648 1515
 			$this->_ion_limit  = NULL;
1649 1516
 		}
1650 1517
 
1651 1518
 		// set the order
1652
-		if (isset($this->_ion_order_by) && isset($this->_ion_order))
1653
-		{
1519
+		if (isset($this->_ion_order_by) && isset($this->_ion_order)) {
1654 1520
 			$this->db->order_by($this->_ion_order_by, $this->_ion_order);
1655 1521
 		}
1656 1522
 
@@ -1665,12 +1531,10 @@  discard block
 block discarded – undo
1665 1531
 	 * @return object
1666 1532
 	 * @author Ben Edmunds
1667 1533
 	 **/
1668
-	public function group($id = NULL)
1669
-	{
1534
+	public function group($id = NULL) {
1670 1535
 		$this->trigger_events('group');
1671 1536
 
1672
-		if (isset($id))
1673
-		{
1537
+		if (isset($id)) {
1674 1538
 			$this->where($this->tables['groups'].'.id', $id);
1675 1539
 		}
1676 1540
 
@@ -1686,16 +1550,14 @@  discard block
 block discarded – undo
1686 1550
 	 * @return bool
1687 1551
 	 * @author Phil Sturgeon
1688 1552
 	 **/
1689
-	public function update($id, array $data)
1690
-	{
1553
+	public function update($id, array $data) {
1691 1554
 		$this->trigger_events('pre_update_user');
1692 1555
 
1693 1556
 		$user = $this->user($id)->row();
1694 1557
 
1695 1558
 		$this->db->trans_begin();
1696 1559
 
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
-		{
1560
+		if (array_key_exists($this->identity_column, $data) && $this->identity_check($data[$this->identity_column]) && $user->{$this->identity_column} !== $data[$this->identity_column]) {
1699 1561
 			$this->db->trans_rollback();
1700 1562
 			$this->set_error('account_creation_duplicate_identity');
1701 1563
 
@@ -1708,16 +1570,11 @@  discard block
 block discarded – undo
1708 1570
 		// Filter the data passed
1709 1571
 		$data = $this->_filter_data($this->tables['users'], $data);
1710 1572
 
1711
-		if (array_key_exists($this->identity_column, $data) || array_key_exists('password', $data) || array_key_exists('email', $data))
1712
-		{
1713
-			if (array_key_exists('password', $data))
1714
-			{
1715
-				if( ! empty($data['password']))
1716
-				{
1573
+		if (array_key_exists($this->identity_column, $data) || array_key_exists('password', $data) || array_key_exists('email', $data)) {
1574
+			if (array_key_exists('password', $data)) {
1575
+				if( ! empty($data['password'])) {
1717 1576
 					$data['password'] = $this->hash_password($data['password'], $user->salt);
1718
-				}
1719
-				else
1720
-				{
1577
+				} else {
1721 1578
 					// unset password so it doesn't effect database entry if no password passed
1722 1579
 					unset($data['password']);
1723 1580
 				}
@@ -1727,8 +1584,7 @@  discard block
 block discarded – undo
1727 1584
 		$this->trigger_events('extra_where');
1728 1585
 		$this->db->update($this->tables['users'], $data, array('id' => $user->id));
1729 1586
 
1730
-		if ($this->db->trans_status() === FALSE)
1731
-		{
1587
+		if ($this->db->trans_status() === FALSE) {
1732 1588
 			$this->db->trans_rollback();
1733 1589
 
1734 1590
 			$this->trigger_events(array('post_update_user', 'post_update_user_unsuccessful'));
@@ -1749,8 +1605,7 @@  discard block
 block discarded – undo
1749 1605
 	* @return bool
1750 1606
 	* @author Phil Sturgeon
1751 1607
 	**/
1752
-	public function delete_user($id)
1753
-	{
1608
+	public function delete_user($id) {
1754 1609
 		$this->trigger_events('pre_delete_user');
1755 1610
 
1756 1611
 		$this->db->trans_begin();
@@ -1762,8 +1617,7 @@  discard block
 block discarded – undo
1762 1617
 		$this->db->delete($this->tables['users'], array('id' => $id));
1763 1618
 
1764 1619
 
1765
-		if ($this->db->trans_status() === FALSE)
1766
-		{
1620
+		if ($this->db->trans_status() === FALSE) {
1767 1621
 			$this->db->trans_rollback();
1768 1622
 			$this->trigger_events(array('post_delete_user', 'post_delete_user_unsuccessful'));
1769 1623
 			$this->set_error('delete_unsuccessful');
@@ -1783,8 +1637,7 @@  discard block
 block discarded – undo
1783 1637
 	 * @return bool
1784 1638
 	 * @author Ben Edmunds
1785 1639
 	 **/
1786
-	public function update_last_login($id)
1787
-	{
1640
+	public function update_last_login($id) {
1788 1641
 		$this->trigger_events('update_last_login');
1789 1642
 
1790 1643
 		$this->load->helper('date');
@@ -1802,18 +1655,15 @@  discard block
 block discarded – undo
1802 1655
 	 * @return bool
1803 1656
 	 * @author Ben Edmunds
1804 1657
 	 **/
1805
-	public function set_lang($lang = 'en')
1806
-	{
1658
+	public function set_lang($lang = 'en') {
1807 1659
 		$this->trigger_events('set_lang');
1808 1660
 
1809 1661
 		// if the user_expire is set to zero we'll set the expiration two years from now.
1810
-		if($this->config->item('user_expire', 'ion_auth') === 0)
1811
-		{
1662
+		if($this->config->item('user_expire', 'ion_auth') === 0) {
1812 1663
 			$expire = (60*60*24*365*2);
1813 1664
 		}
1814 1665
 		// otherwise use what is set
1815
-		else
1816
-		{
1666
+		else {
1817 1667
 			$expire = $this->config->item('user_expire', 'ion_auth');
1818 1668
 		}
1819 1669
 
@@ -1832,8 +1682,7 @@  discard block
 block discarded – undo
1832 1682
 	 * @return bool
1833 1683
 	 * @author jrmadsen67
1834 1684
 	 **/
1835
-	public function set_session($user)
1836
-	{
1685
+	public function set_session($user) {
1837 1686
 
1838 1687
 		$this->trigger_events('pre_set_session');
1839 1688
 
@@ -1859,12 +1708,10 @@  discard block
 block discarded – undo
1859 1708
 	 * @return bool
1860 1709
 	 * @author Ben Edmunds
1861 1710
 	 **/
1862
-	public function remember_user($id)
1863
-	{
1711
+	public function remember_user($id) {
1864 1712
 		$this->trigger_events('pre_remember_user');
1865 1713
 
1866
-		if (!$id)
1867
-		{
1714
+		if (!$id) {
1868 1715
 			return FALSE;
1869 1716
 		}
1870 1717
 
@@ -1874,16 +1721,13 @@  discard block
 block discarded – undo
1874 1721
 
1875 1722
 		$this->db->update($this->tables['users'], array('remember_code' => $salt), array('id' => $id));
1876 1723
 
1877
-		if ($this->db->affected_rows() > -1)
1878
-		{
1724
+		if ($this->db->affected_rows() > -1) {
1879 1725
 			// if the user_expire is set to zero we'll set the expiration two years from now.
1880
-			if($this->config->item('user_expire', 'ion_auth') === 0)
1881
-			{
1726
+			if($this->config->item('user_expire', 'ion_auth') === 0) {
1882 1727
 				$expire = (60*60*24*365*2);
1883 1728
 			}
1884 1729
 			// otherwise use what is set
1885
-			else
1886
-			{
1730
+			else {
1887 1731
 				$expire = $this->config->item('user_expire', 'ion_auth');
1888 1732
 			}
1889 1733
 
@@ -1913,15 +1757,13 @@  discard block
 block discarded – undo
1913 1757
 	 * @return bool
1914 1758
 	 * @author Ben Edmunds
1915 1759
 	 **/
1916
-	public function login_remembered_user()
1917
-	{
1760
+	public function login_remembered_user() {
1918 1761
 		$this->trigger_events('pre_login_remembered_user');
1919 1762
 
1920 1763
 		// check for valid data
1921 1764
 		if (!get_cookie($this->config->item('identity_cookie_name', 'ion_auth'))
1922 1765
 			|| !get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))
1923
-			|| !$this->identity_check(get_cookie($this->config->item('identity_cookie_name', 'ion_auth'))))
1924
-		{
1766
+			|| !$this->identity_check(get_cookie($this->config->item('identity_cookie_name', 'ion_auth')))) {
1925 1767
 			$this->trigger_events(array('post_login_remembered_user', 'post_login_remembered_user_unsuccessful'));
1926 1768
 			return FALSE;
1927 1769
 		}
@@ -1937,8 +1779,7 @@  discard block
 block discarded – undo
1937 1779
 		                  ->get($this->tables['users']);
1938 1780
 
1939 1781
 		// if the user was found, sign them in
1940
-		if ($query->num_rows() == 1)
1941
-		{
1782
+		if ($query->num_rows() == 1) {
1942 1783
 			$user = $query->row();
1943 1784
 
1944 1785
 			$this->update_last_login($user->id);
@@ -1946,8 +1787,7 @@  discard block
 block discarded – undo
1946 1787
 			$this->set_session($user);
1947 1788
 
1948 1789
 			// extend the users cookies if the option is enabled
1949
-			if ($this->config->item('user_extend_on_login', 'ion_auth'))
1950
-			{
1790
+			if ($this->config->item('user_extend_on_login', 'ion_auth')) {
1951 1791
 				$this->remember_user($user->id);
1952 1792
 			}
1953 1793
 
@@ -1965,19 +1805,16 @@  discard block
 block discarded – undo
1965 1805
 	 *
1966 1806
 	 * @author aditya menon
1967 1807
 	*/
1968
-	public function create_group($group_name = FALSE, $group_description = '', $additional_data = array())
1969
-	{
1808
+	public function create_group($group_name = FALSE, $group_description = '', $additional_data = array()) {
1970 1809
 		// bail if the group name was not passed
1971
-		if(!$group_name)
1972
-		{
1810
+		if(!$group_name) {
1973 1811
 			$this->set_error('group_name_required');
1974 1812
 			return FALSE;
1975 1813
 		}
1976 1814
 
1977 1815
 		// bail if the group name already exists
1978 1816
 		$existing_group = $this->db->get_where($this->tables['groups'], array('name' => $group_name))->num_rows();
1979
-		if($existing_group !== 0)
1980
-		{
1817
+		if($existing_group !== 0) {
1981 1818
 			$this->set_error('group_already_exists');
1982 1819
 			return FALSE;
1983 1820
 		}
@@ -1986,7 +1823,9 @@  discard block
 block discarded – undo
1986 1823
 
1987 1824
 		// filter out any data passed that doesnt have a matching column in the groups table
1988 1825
 		// 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);
1826
+		if (!empty($additional_data)) {
1827
+			$data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data);
1828
+		}
1990 1829
 
1991 1830
 		$this->trigger_events('extra_group_set');
1992 1831
 
@@ -2006,20 +1845,19 @@  discard block
 block discarded – undo
2006 1845
 	 * @return bool
2007 1846
 	 * @author aditya menon
2008 1847
 	 **/
2009
-	public function update_group($group_id = FALSE, $group_name = FALSE, $additional_data = array())
2010
-	{
2011
-		if (empty($group_id)) return FALSE;
1848
+	public function update_group($group_id = FALSE, $group_name = FALSE, $additional_data = array()) {
1849
+		if (empty($group_id)) {
1850
+			return FALSE;
1851
+		}
2012 1852
 
2013 1853
 		$data = array();
2014 1854
 
2015
-		if (!empty($group_name))
2016
-		{
1855
+		if (!empty($group_name)) {
2017 1856
 			// we are changing the name, so do some checks
2018 1857
 
2019 1858
 			// bail if the group name already exists
2020 1859
 			$existing_group = $this->db->get_where($this->tables['groups'], array('name' => $group_name))->row();
2021
-			if(isset($existing_group->id) && $existing_group->id != $group_id)
2022
-			{
1860
+			if(isset($existing_group->id) && $existing_group->id != $group_id) {
2023 1861
 				$this->set_error('group_already_exists');
2024 1862
 				return FALSE;
2025 1863
 			}
@@ -2029,8 +1867,7 @@  discard block
 block discarded – undo
2029 1867
 
2030 1868
 		// restrict change of name of the admin group
2031 1869
         $group = $this->db->get_where($this->tables['groups'], array('id' => $group_id))->row();
2032
-        if($this->config->item('admin_group', 'ion_auth') === $group->name && $group_name !== $group->name)
2033
-        {
1870
+        if($this->config->item('admin_group', 'ion_auth') === $group->name && $group_name !== $group->name) {
2034 1871
             $this->set_error('group_name_admin_not_alter');
2035 1872
             return FALSE;
2036 1873
         }
@@ -2038,12 +1875,16 @@  discard block
 block discarded – undo
2038 1875
 
2039 1876
 		// IMPORTANT!! Third parameter was string type $description; this following code is to maintain backward compatibility
2040 1877
 		// New projects should work with 3rd param as array
2041
-		if (is_string($additional_data)) $additional_data = array('description' => $additional_data);
1878
+		if (is_string($additional_data)) {
1879
+			$additional_data = array('description' => $additional_data);
1880
+		}
2042 1881
 
2043 1882
 
2044 1883
 		// filter out any data passed that doesnt have a matching column in the groups table
2045 1884
 		// 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);
1885
+		if (!empty($additional_data)) {
1886
+			$data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data);
1887
+		}
2047 1888
 
2048 1889
 
2049 1890
 		$this->db->update($this->tables['groups'], $data, array('id' => $group_id));
@@ -2059,16 +1900,13 @@  discard block
 block discarded – undo
2059 1900
 	* @return bool
2060 1901
 	* @author aditya menon
2061 1902
 	**/
2062
-	public function delete_group($group_id = FALSE)
2063
-	{
1903
+	public function delete_group($group_id = FALSE) {
2064 1904
 		// bail if mandatory param not set
2065
-		if(!$group_id || empty($group_id))
2066
-		{
1905
+		if(!$group_id || empty($group_id)) {
2067 1906
 			return FALSE;
2068 1907
 		}
2069 1908
 		$group = $this->group($group_id)->row();
2070
-		if($group->name == $this->config->item('admin_group', 'ion_auth'))
2071
-		{
1909
+		if($group->name == $this->config->item('admin_group', 'ion_auth')) {
2072 1910
 			$this->trigger_events(array('post_delete_group', 'post_delete_group_notallowed'));
2073 1911
 			$this->set_error('group_delete_notallowed');
2074 1912
 			return FALSE;
@@ -2083,8 +1921,7 @@  discard block
 block discarded – undo
2083 1921
 		// remove the group itself
2084 1922
 		$this->db->delete($this->tables['groups'], array('id' => $group_id));
2085 1923
 
2086
-		if ($this->db->trans_status() === FALSE)
2087
-		{
1924
+		if ($this->db->trans_status() === FALSE) {
2088 1925
 			$this->db->trans_rollback();
2089 1926
 			$this->trigger_events(array('post_delete_group', 'post_delete_group_unsuccessful'));
2090 1927
 			$this->set_error('group_delete_unsuccessful');
@@ -2098,34 +1935,27 @@  discard block
 block discarded – undo
2098 1935
 		return TRUE;
2099 1936
 	}
2100 1937
 
2101
-	public function set_hook($event, $name, $class, $method, $arguments)
2102
-	{
1938
+	public function set_hook($event, $name, $class, $method, $arguments) {
2103 1939
 		$this->_ion_hooks->{$event}[$name] = new stdClass;
2104 1940
 		$this->_ion_hooks->{$event}[$name]->class     = $class;
2105 1941
 		$this->_ion_hooks->{$event}[$name]->method    = $method;
2106 1942
 		$this->_ion_hooks->{$event}[$name]->arguments = $arguments;
2107 1943
 	}
2108 1944
 
2109
-	public function remove_hook($event, $name)
2110
-	{
2111
-		if (isset($this->_ion_hooks->{$event}[$name]))
2112
-		{
1945
+	public function remove_hook($event, $name) {
1946
+		if (isset($this->_ion_hooks->{$event}[$name])) {
2113 1947
 			unset($this->_ion_hooks->{$event}[$name]);
2114 1948
 		}
2115 1949
 	}
2116 1950
 
2117
-	public function remove_hooks($event)
2118
-	{
2119
-		if (isset($this->_ion_hooks->$event))
2120
-		{
1951
+	public function remove_hooks($event) {
1952
+		if (isset($this->_ion_hooks->$event)) {
2121 1953
 			unset($this->_ion_hooks->$event);
2122 1954
 		}
2123 1955
 	}
2124 1956
 
2125
-	protected function _call_hook($event, $name)
2126
-	{
2127
-		if (isset($this->_ion_hooks->{$event}[$name]) && method_exists($this->_ion_hooks->{$event}[$name]->class, $this->_ion_hooks->{$event}[$name]->method))
2128
-		{
1957
+	protected function _call_hook($event, $name) {
1958
+		if (isset($this->_ion_hooks->{$event}[$name]) && method_exists($this->_ion_hooks->{$event}[$name]->class, $this->_ion_hooks->{$event}[$name]->method)) {
2129 1959
 			$hook = $this->_ion_hooks->{$event}[$name];
2130 1960
 
2131 1961
 			return call_user_func_array(array($hook->class, $hook->method), $hook->arguments);
@@ -2134,21 +1964,14 @@  discard block
 block discarded – undo
2134 1964
 		return FALSE;
2135 1965
 	}
2136 1966
 
2137
-	public function trigger_events($events)
2138
-	{
2139
-		if (is_array($events) && !empty($events))
2140
-		{
2141
-			foreach ($events as $event)
2142
-			{
1967
+	public function trigger_events($events) {
1968
+		if (is_array($events) && !empty($events)) {
1969
+			foreach ($events as $event) {
2143 1970
 				$this->trigger_events($event);
2144 1971
 			}
2145
-		}
2146
-		else
2147
-		{
2148
-			if (isset($this->_ion_hooks->$events) && !empty($this->_ion_hooks->$events))
2149
-			{
2150
-				foreach ($this->_ion_hooks->$events as $name => $hook)
2151
-				{
1972
+		} else {
1973
+			if (isset($this->_ion_hooks->$events) && !empty($this->_ion_hooks->$events)) {
1974
+				foreach ($this->_ion_hooks->$events as $name => $hook) {
2152 1975
 					$this->_call_hook($events, $name);
2153 1976
 				}
2154 1977
 			}
@@ -2163,8 +1986,7 @@  discard block
 block discarded – undo
2163 1986
 	 * @return void
2164 1987
 	 * @author Ben Edmunds
2165 1988
 	 **/
2166
-	public function set_message_delimiters($start_delimiter, $end_delimiter)
2167
-	{
1989
+	public function set_message_delimiters($start_delimiter, $end_delimiter) {
2168 1990
 		$this->message_start_delimiter = $start_delimiter;
2169 1991
 		$this->message_end_delimiter   = $end_delimiter;
2170 1992
 
@@ -2179,8 +2001,7 @@  discard block
 block discarded – undo
2179 2001
 	 * @return void
2180 2002
 	 * @author Ben Edmunds
2181 2003
 	 **/
2182
-	public function set_error_delimiters($start_delimiter, $end_delimiter)
2183
-	{
2004
+	public function set_error_delimiters($start_delimiter, $end_delimiter) {
2184 2005
 		$this->error_start_delimiter = $start_delimiter;
2185 2006
 		$this->error_end_delimiter   = $end_delimiter;
2186 2007
 
@@ -2195,8 +2016,7 @@  discard block
 block discarded – undo
2195 2016
 	 * @return void
2196 2017
 	 * @author Ben Edmunds
2197 2018
 	 **/
2198
-	public function set_message($message)
2199
-	{
2019
+	public function set_message($message) {
2200 2020
 		$this->messages[] = $message;
2201 2021
 
2202 2022
 		return $message;
@@ -2212,11 +2032,9 @@  discard block
 block discarded – undo
2212 2032
 	 * @return void
2213 2033
 	 * @author Ben Edmunds
2214 2034
 	 **/
2215
-	public function messages()
2216
-	{
2035
+	public function messages() {
2217 2036
 		$_output = '';
2218
-		foreach ($this->messages as $message)
2219
-		{
2037
+		foreach ($this->messages as $message) {
2220 2038
 			$messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##';
2221 2039
 			$_output .= $this->message_start_delimiter . $messageLang . $this->message_end_delimiter;
2222 2040
 		}
@@ -2232,20 +2050,15 @@  discard block
 block discarded – undo
2232 2050
 	 * @return array
2233 2051
 	 * @author Raul Baldner Junior
2234 2052
 	 **/
2235
-	public function messages_array($langify = TRUE)
2236
-	{
2237
-		if ($langify)
2238
-		{
2053
+	public function messages_array($langify = TRUE) {
2054
+		if ($langify) {
2239 2055
 			$_output = array();
2240
-			foreach ($this->messages as $message)
2241
-			{
2056
+			foreach ($this->messages as $message) {
2242 2057
 				$messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##';
2243 2058
 				$_output[] = $this->message_start_delimiter . $messageLang . $this->message_end_delimiter;
2244 2059
 			}
2245 2060
 			return $_output;
2246
-		}
2247
-		else
2248
-		{
2061
+		} else {
2249 2062
 			return $this->messages;
2250 2063
 		}
2251 2064
 	}
@@ -2259,8 +2072,7 @@  discard block
 block discarded – undo
2259 2072
 	 * @return void
2260 2073
 	 * @author Ben Edmunds
2261 2074
 	 **/
2262
-	public function clear_messages()
2263
-	{
2075
+	public function clear_messages() {
2264 2076
 		$this->messages = array();
2265 2077
 
2266 2078
 		return TRUE;
@@ -2275,8 +2087,7 @@  discard block
 block discarded – undo
2275 2087
 	 * @return void
2276 2088
 	 * @author Ben Edmunds
2277 2089
 	 **/
2278
-	public function set_error($error)
2279
-	{
2090
+	public function set_error($error) {
2280 2091
 		$this->errors[] = $error;
2281 2092
 
2282 2093
 		return $error;
@@ -2290,11 +2101,9 @@  discard block
 block discarded – undo
2290 2101
 	 * @return void
2291 2102
 	 * @author Ben Edmunds
2292 2103
 	 **/
2293
-	public function errors()
2294
-	{
2104
+	public function errors() {
2295 2105
 		$_output = '';
2296
-		foreach ($this->errors as $error)
2297
-		{
2106
+		foreach ($this->errors as $error) {
2298 2107
 			$errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##';
2299 2108
 			$_output .= $this->error_start_delimiter . $errorLang . $this->error_end_delimiter;
2300 2109
 		}
@@ -2310,20 +2119,15 @@  discard block
 block discarded – undo
2310 2119
 	 * @return array
2311 2120
 	 * @author Raul Baldner Junior
2312 2121
 	 **/
2313
-	public function errors_array($langify = TRUE)
2314
-	{
2315
-		if ($langify)
2316
-		{
2122
+	public function errors_array($langify = TRUE) {
2123
+		if ($langify) {
2317 2124
 			$_output = array();
2318
-			foreach ($this->errors as $error)
2319
-			{
2125
+			foreach ($this->errors as $error) {
2320 2126
 				$errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##';
2321 2127
 				$_output[] = $this->error_start_delimiter . $errorLang . $this->error_end_delimiter;
2322 2128
 			}
2323 2129
 			return $_output;
2324
-		}
2325
-		else
2326
-		{
2130
+		} else {
2327 2131
 			return $this->errors;
2328 2132
 		}
2329 2133
 	}
@@ -2337,8 +2141,7 @@  discard block
 block discarded – undo
2337 2141
 	 * @return void
2338 2142
 	 * @author Ben Edmunds
2339 2143
 	 **/
2340
-	public function clear_errors()
2341
-	{
2144
+	public function clear_errors() {
2342 2145
 		$this->errors = array();
2343 2146
 
2344 2147
 		return TRUE;
@@ -2346,17 +2149,15 @@  discard block
 block discarded – undo
2346 2149
 
2347 2150
 
2348 2151
 
2349
-	protected function _filter_data($table, $data)
2350
-	{
2152
+	protected function _filter_data($table, $data) {
2351 2153
 		$filtered_data = array();
2352 2154
 		$columns = $this->db->list_fields($table);
2353 2155
 
2354
-		if (is_array($data))
2355
-		{
2356
-			foreach ($columns as $column)
2357
-			{
2358
-				if (array_key_exists($column, $data))
2359
-					$filtered_data[$column] = $data[$column];
2156
+		if (is_array($data)) {
2157
+			foreach ($columns as $column) {
2158
+				if (array_key_exists($column, $data)) {
2159
+									$filtered_data[$column] = $data[$column];
2160
+				}
2360 2161
 			}
2361 2162
 		}
2362 2163
 
Please login to merge, or discard this patch.
application/third_party/Ion-Auth/libraries/Bcrypt.php 1 patch
Braces   +11 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 
4 6
 class Bcrypt {
@@ -49,34 +51,26 @@  discard block
 block discarded – undo
49 51
    * @param  string  $user_string
50 52
    * @return  bool
51 53
    */
52
-  private function hashEquals($known_string, $user_string)
53
-  {
54
+  private function hashEquals($known_string, $user_string) {
54 55
     // For CI3 or PHP >= 5.6
55
-    if (function_exists('hash_equals')) 
56
-    {
56
+    if (function_exists('hash_equals')) {
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))
63
-    {
62
+    if ( ! is_string($known_string)) {
64 63
       trigger_error('hash_equals(): Expected known_string to be a string, '.strtolower(gettype($known_string)).' given', E_USER_WARNING);
65 64
       return FALSE;
66
-    }
67
-    elseif ( ! is_string($user_string))
68
-    {
65
+    } elseif ( ! is_string($user_string)) {
69 66
       trigger_error('hash_equals(): Expected user_string to be a string, '.strtolower(gettype($user_string)).' given', E_USER_WARNING);
70 67
       return FALSE;
71
-    }
72
-    elseif (($length = strlen($known_string)) !== strlen($user_string))
73
-    {
68
+    } elseif (($length = strlen($known_string)) !== strlen($user_string)) {
74 69
       return FALSE;
75 70
     }
76 71
 
77 72
     $diff = 0;
78
-    for ($i = 0; $i < $length; $i++)
79
-    {
73
+    for ($i = 0; $i < $length; $i++) {
80 74
       $diff |= ord($known_string[$i]) ^ ord($user_string[$i]);
81 75
     }
82 76
 
@@ -104,7 +98,8 @@  discard block
 block discarded – undo
104 98
     $bytes = '';
105 99
 
106 100
     if(function_exists('openssl_random_pseudo_bytes') &&
107
-        (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) { // OpenSSL slow on Win
101
+        (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) {
102
+// OpenSSL slow on Win
108 103
       $bytes = openssl_random_pseudo_bytes($count);
109 104
     }
110 105
 
Please login to merge, or discard this patch.