Completed
Push — master ( ef379e...0b8878 )
by Patrick
03:01
created
Auth/class.User.php 1 patch
Spacing   +44 added lines, -44 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
         }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
         //Make sure we are bound in write mode
598 598
         $auth = \AuthProvider::getInstance();
599 599
         $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator');
600
-        if($ldap !== false)
600
+        if ($ldap !== false)
601 601
         {
602 602
             $ldap->get_and_bind_server(true);
603 603
         }
@@ -608,14 +608,14 @@  discard block
 block discarded – undo
608 608
      */
609 609
     private function editUserPassword($data)
610 610
     {
611
-        if(isset($data->password))
611
+        if (isset($data->password))
612 612
         {
613
-            if(isset($data->oldpass))
613
+            if (isset($data->oldpass))
614 614
             {
615 615
                 $this->change_pass($data->oldpass, $data->password);
616 616
                 unset($data->oldpass);
617 617
             }
618
-            else if(isset($data->hash))
618
+            else if (isset($data->hash))
619 619
             {
620 620
                 $this->change_pass($data->hash, $data->password, true);
621 621
                 unset($data->hash);
@@ -626,22 +626,22 @@  discard block
 block discarded – undo
626 626
 
627 627
     private function editNames($data)
628 628
     {
629
-        if(isset($data->displayName))
629
+        if (isset($data->displayName))
630 630
         {
631 631
             $this->setDisplayName($data->displayName);
632 632
             unset($data->displayName);
633 633
         }
634
-        if(isset($data->givenName))
634
+        if (isset($data->givenName))
635 635
         {
636 636
             $this->setGivenName($data->givenName);
637 637
             unset($data->givenName);
638 638
         }
639
-        if(isset($data->sn))
639
+        if (isset($data->sn))
640 640
         {
641 641
             $this->setLastName($data->sn);
642 642
             unset($data->sn);
643 643
         }
644
-        if(isset($data->cn))
644
+        if (isset($data->cn))
645 645
         {
646 646
             $this->setNickName($data->cn);
647 647
             unset($data->cn);
@@ -650,17 +650,17 @@  discard block
 block discarded – undo
650 650
 
651 651
     private function checkForUnsettableElements($data)
652 652
     {
653
-        if(isset($data->mail))
653
+        if (isset($data->mail))
654 654
         {
655
-            if($data->mail !== $this->getEmail())
655
+            if ($data->mail !== $this->getEmail())
656 656
             {
657 657
                 throw new \Exception('Unable to change email!');
658 658
             }
659 659
             unset($data->mail);
660 660
         }
661
-        if(isset($data->uid))
661
+        if (isset($data->uid))
662 662
         {
663
-            if($data->uid !== $this->getUid())
663
+            if ($data->uid !== $this->getUid())
664 664
             {
665 665
                 throw new \Exception('Unable to change uid!');
666 666
             }
@@ -670,27 +670,27 @@  discard block
 block discarded – undo
670 670
 
671 671
     private function editAddressElements($data)
672 672
     {
673
-        if(isset($data->postalAddress))
673
+        if (isset($data->postalAddress))
674 674
         {
675 675
             $this->setAddress($data->postalAddress);
676 676
             unset($data->postalAddress);
677 677
         }
678
-        if(isset($data->l))
678
+        if (isset($data->l))
679 679
         {
680 680
             $this->setCity($data->l);
681 681
             unset($data->l);
682 682
         }
683
-        if(isset($data->st))
683
+        if (isset($data->st))
684 684
         {
685 685
             $this->setState($data->st);
686 686
             unset($data->st);
687 687
         }
688
-        if(isset($data->postalCode))
688
+        if (isset($data->postalCode))
689 689
         {
690 690
             $this->setPostalCode($data->postalCode);
691 691
             unset($data->postalCode);
692 692
         }
693
-        if(isset($data->c))
693
+        if (isset($data->c))
694 694
         {
695 695
             $this->setCountry($data->c);
696 696
             unset($data->c);
@@ -699,17 +699,17 @@  discard block
 block discarded – undo
699 699
 
700 700
     private function editOrganizationElements($data)
701 701
     {
702
-        if(isset($data->o))
702
+        if (isset($data->o))
703 703
         {
704 704
             $this->setOrganization($data->o);
705 705
             unset($data->o);
706 706
         }
707
-        if(isset($data->title))
707
+        if (isset($data->title))
708 708
         {
709 709
             $this->setTitles($data->title);
710 710
             unset($data->title);
711 711
         }
712
-        if(isset($data->ou))
712
+        if (isset($data->ou))
713 713
         {
714 714
             $this->setOrganizationUnits($data->ou);
715 715
             unset($data->ou);
@@ -733,12 +733,12 @@  discard block
 block discarded – undo
733 733
         $this->editAddressElements($data);
734 734
         $this->editOrganizationElements($data);
735 735
 
736
-        if(isset($data->jpegPhoto))
736
+        if (isset($data->jpegPhoto))
737 737
         {
738 738
             $this->setPhoto(base64_decode($data->jpegPhoto));
739 739
             unset($data->jpegPhoto);
740 740
         }
741
-        if(isset($data->mobile))
741
+        if (isset($data->mobile))
742 742
         {
743 743
             $this->setPhoneNumber($data->mobile);
744 744
             unset($data->mobile);
@@ -793,17 +793,17 @@  discard block
 block discarded – undo
793 793
     public function getVcard()
794 794
     {
795 795
         $ret = "BEGIN:VCARD\nVERSION:2.1\n";
796
-        $ret.= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n";
797
-        $ret.= 'FN:'.$this->getGivenName()."\n";
796
+        $ret .= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n";
797
+        $ret .= 'FN:'.$this->getGivenName()."\n";
798 798
         $titles = $this->getTitles();
799
-        if($titles !== false)
799
+        if ($titles !== false)
800 800
         {
801
-            $ret.= 'TITLE:'.implode(',', $titles)."\n";
801
+            $ret .= 'TITLE:'.implode(',', $titles)."\n";
802 802
         }
803
-        $ret.= "ORG: Austin Artistic Reconstruction\n";
804
-        $ret.= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n";
805
-        $ret.= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n";
806
-        $ret.= "END:VCARD\n";
803
+        $ret .= "ORG: Austin Artistic Reconstruction\n";
804
+        $ret .= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n";
805
+        $ret .= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n";
806
+        $ret .= "END:VCARD\n";
807 807
         return $ret;
808 808
     }
809 809
 }
Please login to merge, or discard this patch.