Completed
Push — master ( f2ef51...ef379e )
by Patrick
03:21
created
Auth/class.User.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -128,26 +128,26 @@  discard block
 block discarded – undo
128 128
     public function getTitleNames()
129 129
     {
130 130
         $titles = $this->getTitles();
131
-        if($titles === false)
131
+        if ($titles === false)
132 132
         {
133 133
             return false;
134 134
         }
135
-        if(self::$titlenames === null)
135
+        if (self::$titlenames === null)
136 136
         {
137 137
             $dataSet = \DataSetFactory::getDataSetByName('profiles');
138 138
             $dataTable = $dataSet['position'];
139 139
             $titlenames = $dataTable->read();
140 140
             self::$titlenames = array();
141 141
             $count = count($titlenames);
142
-            for($i = 0; $i < $count; $i++)
142
+            for ($i = 0; $i < $count; $i++)
143 143
             {
144 144
                 self::$titlenames[$titlenames[$i]['short_name']] = $titlenames[$i];
145 145
             }
146 146
         }
147 147
         $count = count($titles);
148
-        for($i = 0; $i < $count; $i++)
148
+        for ($i = 0; $i < $count; $i++)
149 149
         {
150
-            if(isset(self::$titlenames[$titles[$i]]))
150
+            if (isset(self::$titlenames[$titles[$i]]))
151 151
             {
152 152
                 $title = self::$titlenames[$titles[$i]];
153 153
                 $titles[$i] = $title['name'];
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
     public function canLoginWith($provider)
281 281
     {
282 282
         $hosts = $this->getLoginProviders();
283
-        if($hosts === false) return false;
283
+        if ($hosts === false) return false;
284 284
         $count = count($hosts);
285
-        for($i = 0; $i < $count; $i++)
285
+        for ($i = 0; $i < $count; $i++)
286 286
         {
287
-            if(strcasecmp($hosts[$i], $provider) === 0) return true;
287
+            if (strcasecmp($hosts[$i], $provider) === 0) return true;
288 288
         }
289 289
         return false;
290 290
     }
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function isProfileComplete()
310 310
     {
311
-        if($this->getCountry() === false    || $this->getAddress() === false ||
311
+        if ($this->getCountry() === false || $this->getAddress() === false ||
312 312
            $this->getPostalCode() === false || $this->getCity() === false ||
313
-           $this->getState() === false      || $this->getPhoneNumber() === false)
313
+           $this->getState() === false || $this->getPhoneNumber() === false)
314 314
         {
315 315
             return false;
316 316
         }
@@ -354,17 +354,17 @@  discard block
 block discarded – undo
354 354
      *
355 355
      * @return true|false true if the user's password was changed, false otherwise
356 356
      */
357
-    public function change_pass($oldpass, $newpass, $isHash=false)
357
+    public function change_pass($oldpass, $newpass, $isHash = false)
358 358
     {
359
-        if($isHash === false && $this->validate_password($oldpass) === false)
359
+        if ($isHash === false && $this->validate_password($oldpass) === false)
360 360
         {
361 361
             throw new \Exception('Invalid Password!', 3);
362 362
         }
363
-        if($isHash === true && $this->validate_reset_hash($oldpass) === false)
363
+        if ($isHash === true && $this->validate_reset_hash($oldpass) === false)
364 364
         {
365 365
             throw new \Exception('Invalid Reset Hash!', 3);
366 366
         }
367
-        if($this->setPass($newpass) === false)
367
+        if ($this->setPass($newpass) === false)
368 368
         {
369 369
             throw new \Exception('Unable to set password!', 6);
370 370
         }
@@ -605,14 +605,14 @@  discard block
 block discarded – undo
605 605
      */
606 606
     private function editUserPassword($data)
607 607
     {
608
-        if(isset($data->password))
608
+        if (isset($data->password))
609 609
         {
610
-            if(isset($data->oldpass))
610
+            if (isset($data->oldpass))
611 611
             {
612 612
                 $this->change_pass($data->oldpass, $data->password);
613 613
                 unset($data->oldpass);
614 614
             }
615
-            else if(isset($data->hash))
615
+            else if (isset($data->hash))
616 616
             {
617 617
                 $this->change_pass($data->hash, $data->password, true);
618 618
                 unset($data->hash);
@@ -623,22 +623,22 @@  discard block
 block discarded – undo
623 623
 
624 624
     private function editNames($data)
625 625
     {
626
-        if(isset($data->displayName))
626
+        if (isset($data->displayName))
627 627
         {
628 628
             $this->setDisplayName($data->displayName);
629 629
             unset($data->displayName);
630 630
         }
631
-        if(isset($data->givenName))
631
+        if (isset($data->givenName))
632 632
         {
633 633
             $this->setGivenName($data->givenName);
634 634
             unset($data->givenName);
635 635
         }
636
-        if(isset($data->sn))
636
+        if (isset($data->sn))
637 637
         {
638 638
             $this->setLastName($data->sn);
639 639
             unset($data->sn);
640 640
         }
641
-        if(isset($data->cn))
641
+        if (isset($data->cn))
642 642
         {
643 643
             $this->setNickName($data->cn);
644 644
             unset($data->cn);
@@ -647,17 +647,17 @@  discard block
 block discarded – undo
647 647
 
648 648
     private function checkForUnsettableElements($data)
649 649
     {
650
-        if(isset($data->mail))
650
+        if (isset($data->mail))
651 651
         {
652
-            if($data->mail !== $this->getEmail())
652
+            if ($data->mail !== $this->getEmail())
653 653
             {
654 654
                 throw new \Exception('Unable to change email!');
655 655
             }
656 656
             unset($data->mail);
657 657
         }
658
-        if(isset($data->uid))
658
+        if (isset($data->uid))
659 659
         {
660
-            if($data->uid !== $this->getUid())
660
+            if ($data->uid !== $this->getUid())
661 661
             {
662 662
                 throw new \Exception('Unable to change uid!');
663 663
             }
@@ -667,27 +667,27 @@  discard block
 block discarded – undo
667 667
 
668 668
     private function editAddressElements($data)
669 669
     {
670
-        if(isset($data->postalAddress))
670
+        if (isset($data->postalAddress))
671 671
         {
672 672
             $this->setAddress($data->postalAddress);
673 673
             unset($data->postalAddress);
674 674
         }
675
-        if(isset($data->l))
675
+        if (isset($data->l))
676 676
         {
677 677
             $this->setCity($data->l);
678 678
             unset($data->l);
679 679
         }
680
-        if(isset($data->st))
680
+        if (isset($data->st))
681 681
         {
682 682
             $this->setState($data->st);
683 683
             unset($data->st);
684 684
         }
685
-        if(isset($data->postalCode))
685
+        if (isset($data->postalCode))
686 686
         {
687 687
             $this->setPostalCode($data->postalCode);
688 688
             unset($data->postalCode);
689 689
         }
690
-        if(isset($data->c))
690
+        if (isset($data->c))
691 691
         {
692 692
             $this->setCountry($data->c);
693 693
             unset($data->c);
@@ -696,17 +696,17 @@  discard block
 block discarded – undo
696 696
 
697 697
     private function editOrganizationElements($data)
698 698
     {
699
-        if(isset($data->o))
699
+        if (isset($data->o))
700 700
         {
701 701
             $this->setOrganization($data->o);
702 702
             unset($data->o);
703 703
         }
704
-        if(isset($data->title))
704
+        if (isset($data->title))
705 705
         {
706 706
             $this->setTitles($data->title);
707 707
             unset($data->title);
708 708
         }
709
-        if(isset($data->ou))
709
+        if (isset($data->ou))
710 710
         {
711 711
             $this->setOrganizationUnits($data->ou);
712 712
             unset($data->ou);
@@ -730,12 +730,12 @@  discard block
 block discarded – undo
730 730
         $this->editAddressElements($data);
731 731
         $this->editOrganizationElements($data);
732 732
 
733
-        if(isset($data->jpegPhoto))
733
+        if (isset($data->jpegPhoto))
734 734
         {
735 735
             $this->setPhoto(base64_decode($data->jpegPhoto));
736 736
             unset($data->jpegPhoto);
737 737
         }
738
-        if(isset($data->mobile))
738
+        if (isset($data->mobile))
739 739
         {
740 740
             $this->setPhoneNumber($data->mobile);
741 741
             unset($data->mobile);
@@ -790,13 +790,13 @@  discard block
 block discarded – undo
790 790
     public function getVcard()
791 791
     {
792 792
         $ret = "BEGIN:VCARD\nVERSION:2.1\n";
793
-        $ret.= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n";
794
-        $ret.= 'FN:'.$this->getGivenName()."\n";
795
-        $ret.= 'TITLE:'.implode(',', $this->getTitles())."\n";
796
-        $ret.= "ORG: Austin Artistic Reconstruction\n";
797
-        $ret.= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n";
798
-        $ret.= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n";
799
-        $ret.= "END:VCARD\n";
793
+        $ret .= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n";
794
+        $ret .= 'FN:'.$this->getGivenName()."\n";
795
+        $ret .= 'TITLE:'.implode(',', $this->getTitles())."\n";
796
+        $ret .= "ORG: Austin Artistic Reconstruction\n";
797
+        $ret .= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n";
798
+        $ret .= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n";
799
+        $ret .= "END:VCARD\n";
800 800
         return $ret;
801 801
     }
802 802
 }
Please login to merge, or discard this patch.