Completed
Push — master ( 3952d5...0ae0e5 )
by Patrick
03:00
created
class.FlipAdminPage.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
         if($this->user === false || $this->user === null)
35 35
         {
36 36
             $this->add_link('<i class="fa fa-sign-in"></i> Login', $this->loginUrl);
37
-        }
38
-        else
37
+        } else
39 38
         {
40 39
             $this->add_links();
41 40
             $this->add_link('<i class="fa fa-sign-out"></i> Logout', $this->logoutUrl);
@@ -166,8 +165,7 @@  discard block
 block discarded – undo
166 165
                 <h1 class="page-header">You must <a href="'.$this->loginUrl.'?return='.$this->current_url().'">log in <span class="glyphicon glyphicon-log-in"></span></a> to access the '.$this->title.' Admin system!</h1>
167 166
             </div>
168 167
         </div>';
169
-        }
170
-        else if($this->is_admin === false)
168
+        } else if($this->is_admin === false)
171 169
         {
172 170
             $this->body = '
173 171
         <div class="row">
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
     public $user;
7 7
     public $is_admin = false;
8 8
 
9
-    function __construct($title, $adminGroup='LDAPAdmins')
9
+    function __construct($title, $adminGroup = 'LDAPAdmins')
10 10
     {
11 11
         $this->user = FlipSession::getUser();
12 12
         $this->is_admin = $this->userIsAdmin($adminGroup);
13 13
         parent::__construct($title);
14 14
         $adminCSS = '/css/common/admin.min.css';
15
-        if($this->minified !== 'min')
15
+        if ($this->minified !== 'min')
16 16
         {
17 17
             $adminCSS = '/css/common/admin.css';
18 18
         }
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     protected function userIsAdmin($adminGroup)
24 24
     {
25
-        if($this->user === false || $this->user === null)
25
+        if ($this->user === false || $this->user === null)
26 26
         {
27 27
             return false;
28 28
         }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     function addAllLinks()
33 33
     {
34
-        if($this->user === false || $this->user === null)
34
+        if ($this->user === false || $this->user === null)
35 35
         {
36 36
             $this->addLink('<i class="fa fa-sign-in"></i> Login', $this->loginUrl);
37 37
         }
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
         $ret  = '<li>';
48 48
         $href = $this->getHrefForDropdown($link);
49 49
         $ret .= $this->createLink($name.' <i class="fa fa-arrow-right"></i>', $href);
50
-        $ret.='<ul>';
50
+        $ret .= '<ul>';
51 51
         $subNames = array_keys($link);
52
-        foreach($subNames as $subName)
52
+        foreach ($subNames as $subName)
53 53
         {
54
-            $ret.=$this->getLinkByName($subName, $link);
54
+            $ret .= $this->getLinkByName($subName, $link);
55 55
         }
56
-        $ret.='</ul></li>';
56
+        $ret .= '</ul></li>';
57 57
         return $ret;
58 58
     }
59 59
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $sites   = $this->getSiteLinksForHeader();
63 63
         $sideNav = $this->getLinksMenus();
64 64
         $log     = '<a href="https://profiles.burningflipside.com/logout.php"><i class="fa fa-sign-out"></i></a>';
65
-        if($this->user === false || $this->user === null)
65
+        if ($this->user === false || $this->user === null)
66 66
         {
67 67
             $log = '<a href="https://profiles.burningflipside.com/login.php?return='.$this->currentUrl().'"><i class="fa fa-sign-in"></i></a>';
68 68
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     const CARD_YELLOW = 'panel-yellow';
109 109
     const CARD_RED    = 'panel-red';
110 110
 
111
-    function add_card($iconName, $bigText, $littleText, $link='#', $color = self::CARD_BLUE, $textColor=false)
111
+    function add_card($iconName, $bigText, $littleText, $link = '#', $color = self::CARD_BLUE, $textColor = false)
112 112
     {
113 113
         $card = '<div class="col-lg-3 col-md-6">
114 114
                      <div class="panel '.$color.'">
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
         $this->body .= $card;
136 136
     }
137 137
 
138
-    function printPage($header=true)
138
+    function printPage($header = true)
139 139
     {
140
-        if($this->user === false || $this->user === null)
140
+        if ($this->user === false || $this->user === null)
141 141
         {
142 142
             $this->body = '
143 143
         <div class="row">
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             </div>
147 147
         </div>';
148 148
         }
149
-        else if($this->is_admin === false)
149
+        else if ($this->is_admin === false)
150 150
         {
151 151
             $this->body = '
152 152
         <div class="row">
Please login to merge, or discard this patch.
Auth/class.PendingUser.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function getEmail()
51 51
     {
52
-        if(isset($this->email))
52
+        if (isset($this->email))
53 53
         {
54 54
             return $this->email;
55 55
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function getGivenName()
65 65
     {
66
-        if(isset($this->givenName))
66
+        if (isset($this->givenName))
67 67
         {
68 68
             return $this->givenName;
69 69
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getLastName()
79 79
     {
80
-        if(isset($this->sn))
80
+        if (isset($this->sn))
81 81
         {
82 82
             return $this->sn;
83 83
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     function getLoginProviders()
106 106
     {
107
-        if(isset($this->host))
107
+        if (isset($this->host))
108 108
         {
109 109
             return $this->host;
110 110
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     function addLoginProvider($provider)
122 122
     {
123
-        if(isset($this->host))
123
+        if (isset($this->host))
124 124
         {
125 125
             array_push($this->host, $provider);
126 126
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                 Burning Flipside Technology Team');
200 200
         $email_msg->setSubject('Burning Flipside Registration');
201 201
         $email_provider = \EmailProvider::getInstance();
202
-        if($email_provider->sendEmail($email_msg) === false)
202
+        if ($email_provider->sendEmail($email_msg) === false)
203 203
         {
204 204
             throw new \Exception('Unable to send email!');
205 205
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
             $args['RawMessage'] = array();
35 35
             $args['RawMessage']['Data'] = base64_encode($email->getRawMessage());
36 36
             return $this->ses->sendRawEmail($args);
37
-        }
38
-        else
37
+        } else
39 38
         {
40 39
             $args = array();
41 40
             $args['Source'] = $email->getFromAddress();
Please login to merge, or discard this patch.
Auth/class.FlipsideAPIUser.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Auth;
3
-if(!class_exists('Httpful\Request'))
3
+if (!class_exists('Httpful\Request'))
4 4
 {
5 5
     require(realpath(dirname(__FILE__)).'/../libs/httpful/bootstrap.php');
6 6
 }
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
     private $userData;
11 11
     private $groupData = null;
12 12
 
13
-    public function __construct($data=false)
13
+    public function __construct($data = false)
14 14
     {
15
-        if($data !== false && !isset($data['extended']))
15
+        if ($data !== false && !isset($data['extended']))
16 16
         {
17 17
             //Generic user object
18 18
             //TODO get from API
19 19
         }
20 20
         else
21 21
         {
22
-            if(isset($data['extended']))
22
+            if (isset($data['extended']))
23 23
             {
24 24
                 $this->userData = $data['extended'];
25 25
             }
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 
29 29
     function isInGroupNamed($name)
30 30
     {
31
-        if($this->groupData === null)
31
+        if ($this->groupData === null)
32 32
         {
33 33
             $resp = \Httpful\Request::get('https://profiles.test.burningflipside.com/api/v1/users/me/groups')->authenticateWith($this->userData->uid, $this->userData->userPassword)->send();
34
-            if($resp->hasErrors())
34
+            if ($resp->hasErrors())
35 35
             {
36 36
                 return false;
37 37
             }
38 38
             $this->groupData = $resp->body;
39 39
         }
40 40
         $count = count($this->groupData);
41
-        for($i = 0; $i < $count; $i++)
41
+        for ($i = 0; $i < $count; $i++)
42 42
         {
43
-            if($this->groupData[$i]->cn === $name)
43
+            if ($this->groupData[$i]->cn === $name)
44 44
             {
45 45
                 return true;
46 46
             }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     function getDisplayName()
52 52
     {
53
-        if($this->userData === null)
53
+        if ($this->userData === null)
54 54
         {
55 55
             return parent::getDisplayName();
56 56
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     function getGivenName()
61 61
     {
62
-        if($this->userData === null)
62
+        if ($this->userData === null)
63 63
         {
64 64
             return parent::getGivenName();
65 65
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     function getEmail()
70 70
     {
71
-        if($this->userData === null)
71
+        if ($this->userData === null)
72 72
         {
73 73
             return parent::getEmail();
74 74
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     function getUid()
79 79
     {
80
-        if($this->userData === null)
80
+        if ($this->userData === null)
81 81
         {
82 82
             return parent::getUid();
83 83
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     function getPhoneNumber()
88 88
     {
89
-        if($this->userData === null)
89
+        if ($this->userData === null)
90 90
         {
91 91
             return parent::getPhoneNumber();
92 92
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     function getOrganization()
97 97
     {
98
-        if($this->userData === null)
98
+        if ($this->userData === null)
99 99
         {
100 100
             return parent::getOrganization();
101 101
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
     function getTitles()
106 106
     {
107
-        if($this->userData === null)
107
+        if ($this->userData === null)
108 108
         {
109 109
             return parent::getTitles();
110 110
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     function getState()
115 115
     {
116
-        if($this->userData === null)
116
+        if ($this->userData === null)
117 117
         {
118 118
             return parent::getState();
119 119
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
     function getCity()
124 124
     {
125
-        if($this->userData === null)
125
+        if ($this->userData === null)
126 126
         {
127 127
             return parent::getCity();
128 128
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     function getLastName()
133 133
     {
134
-        if($this->userData === null)
134
+        if ($this->userData === null)
135 135
         {
136 136
             return parent::getLastName();
137 137
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     function getNickName()
142 142
     {
143
-        if($this->userData === null)
143
+        if ($this->userData === null)
144 144
         {
145 145
             return parent::getNickName();
146 146
         }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     function getAddress()
151 151
     {
152
-        if($this->userData === null)
152
+        if ($this->userData === null)
153 153
         {
154 154
             return parent::getAddress();
155 155
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
     function getPostalCode()
160 160
     {
161
-        if($this->userData === null)
161
+        if ($this->userData === null)
162 162
         {
163 163
             return parent::getPostalCode();
164 164
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
     function getCountry()
169 169
     {
170
-        if($this->userData === null)
170
+        if ($this->userData === null)
171 171
         {
172 172
             return parent::getCountry();
173 173
         }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     function getOrganizationUnits()
178 178
     {
179
-        if($this->userData === null)
179
+        if ($this->userData === null)
180 180
         {
181 181
             return parent::getOrganizationUnits();
182 182
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
     function getLoginProviders()
187 187
     {
188
-        if($this->userData === null)
188
+        if ($this->userData === null)
189 189
         {
190 190
             return parent::getLoginProviders();
191 191
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
             $args['RawMessage'] = array();
35 35
             $args['RawMessage']['Data'] = base64_encode($email->getRawMessage());
36 36
             return $this->ses->sendRawEmail($args);
37
-        }
38
-        else
37
+        } else
39 38
         {
40 39
             $args = array();
41 40
             $args['Source'] = $email->getFromAddress();
Please login to merge, or discard this patch.
Auth/class.Group.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
         return false;
24 24
     }
25 25
 
26
-    public function getMemberUids($recursive=true)
26
+    public function getMemberUids($recursive = true)
27 27
     {
28 28
         return array();
29 29
     }
30 30
 
31
-    public function members($details=false, $recursive=true, $includeGroups=true)
31
+    public function members($details = false, $recursive = true, $includeGroups = true)
32 32
     {
33 33
         return array();
34 34
     }
@@ -46,20 +46,20 @@  discard block
 block discarded – undo
46 46
     public function jsonSerialize()
47 47
     {
48 48
         $group = array();
49
-        try{
49
+        try {
50 50
         $group['cn'] = $this->getGroupName();
51 51
         $group['description'] = $this->getDescription();
52 52
         $group['member'] = $this->getMemberUids();
53
-        } catch(\Exception $e) {echo $e->getMessage(); die();}
53
+        } catch (\Exception $e) {echo $e->getMessage(); die(); }
54 54
         return $group;
55 55
     }
56 56
 
57
-    public function getNonMembers($select=false)
57
+    public function getNonMembers($select = false)
58 58
     {
59 59
         return array();
60 60
     }
61 61
 
62
-    public function addMember($name, $isGroup=false, $flush=true)
62
+    public function addMember($name, $isGroup = false, $flush = true)
63 63
     {
64 64
         return false;
65 65
     }
@@ -70,24 +70,24 @@  discard block
 block discarded – undo
70 70
         $auth = \AuthProvider::getInstance();
71 71
         $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator');
72 72
         $ldap->get_and_bind_server(true);
73
-        if(isset($group->description))
73
+        if (isset($group->description))
74 74
         {
75 75
             $this->setDescription($group->description);
76 76
             unset($group->description);
77 77
         }
78
-        if(isset($group->member))
78
+        if (isset($group->member))
79 79
         {
80 80
             $this->clearMembers();
81 81
             $count = count($group->member);
82
-            for($i = 0; $i < $count; $i++)
82
+            for ($i = 0; $i < $count; $i++)
83 83
             {
84 84
                 $isLast = false;
85
-                if($i === $count - 1)
85
+                if ($i === $count - 1)
86 86
                 {
87 87
                     $isLast = true;
88 88
                 }
89
-                if(!isset($group->member[$i]->type)) continue;
90
-                if($group->member[$i]->type === 'Group')
89
+                if (!isset($group->member[$i]->type)) continue;
90
+                if ($group->member[$i]->type === 'Group')
91 91
                 {
92 92
                     $this->addMember($group->member[$i]->cn, true, $isLast);
93 93
                 }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         return true;
102 102
     }
103 103
 
104
-    static function from_name($name, $data=false)
104
+    static function from_name($name, $data = false)
105 105
     {
106 106
         return false;
107 107
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,12 +86,13 @@
 block discarded – undo
86 86
                 {
87 87
                     $isLast = true;
88 88
                 }
89
-                if(!isset($group->member[$i]->type)) continue;
89
+                if(!isset($group->member[$i]->type)) {
90
+                    continue;
91
+                }
90 92
                 if($group->member[$i]->type === 'Group')
91 93
                 {
92 94
                     $this->addMember($group->member[$i]->cn, true, $isLast);
93
-                }
94
-                else
95
+                } else
95 96
                 {
96 97
                     $this->addMember($group->member[$i]->uid, false, $isLast);
97 98
                 }
Please login to merge, or discard this patch.
Auth/class.SQLPendingUser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     function getEmail()
30 30
     {
31
-        if(is_array($this->blob->mail))
31
+        if (is_array($this->blob->mail))
32 32
         {
33 33
             return $this->blob->mail[0];
34 34
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     function getUid()
39 39
     {
40
-        if(is_array($this->blob->uid))
40
+        if (is_array($this->blob->uid))
41 41
         {
42 42
             return $this->blob->uid[0];
43 43
         }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     function getPassword()
48 48
     {
49
-        if(is_array($this->blob->password))
49
+        if (is_array($this->blob->password))
50 50
         {
51 51
             return $this->blob->password[0];
52 52
         }
Please login to merge, or discard this patch.
Auth/class.SQLAuthenticator.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -149,7 +149,9 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function login($username, $password)
151 151
     {
152
-        if($this->current === false) return false;
152
+        if($this->current === false) {
153
+            return false;
154
+        }
153 155
         $userDataTable = $this->getDataTable('user');
154 156
         $filter = new \Data\Filter("uid eq '$username'");
155 157
         $users = $userDataTable->read($filter, 'uid,pass');
@@ -235,9 +237,13 @@  discard block
 block discarded – undo
235 237
 
236 238
     public function getPendingUserCount()
237 239
     {
238
-        if($this->pending === false) return 0;
240
+        if($this->pending === false) {
241
+            return 0;
242
+        }
239 243
         $dataTable = $this->getPendingUserDataTable();
240
-        if($dataTable === null) return 0;
244
+        if($dataTable === null) {
245
+            return 0;
246
+        }
241 247
         return $dataTable->count();
242 248
     }
243 249
 
@@ -275,7 +281,9 @@  discard block
 block discarded – undo
275 281
     public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false)
276 282
 
277 283
     {
278
-        if($this->pending === false) return false;
284
+        if($this->pending === false) {
285
+            return false;
286
+        }
279 287
         if($filter !== false && !$filter->contains('hash'))
280 288
         {
281 289
             return $this->searchPendingUsers($filter, $select, $top, $skip, $orderby);
@@ -296,7 +304,9 @@  discard block
 block discarded – undo
296 304
 
297 305
     public function createPendingUser($user)
298 306
     {
299
-        if($this->pending === false) return false;
307
+        if($this->pending === false) {
308
+            return false;
309
+        }
300 310
         $userDataTable = $this->getPendingUserDataTable();
301 311
         if(isset($user->password2))
302 312
         {
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Auth;
3 3
 
4
-if(!function_exists('password_hash') || !function_exists('password_verify')) 
4
+if (!function_exists('password_hash') || !function_exists('password_verify')) 
5 5
 {
6 6
     define('PASSWORD_BCRYPT', 1);
7 7
     define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 
10 10
     function password_hash($password, $algo = PASSWORD_DEFAULT)
11 11
     {
12
-        if(is_null($password) || is_int($password))
12
+        if (is_null($password) || is_int($password))
13 13
         {
14 14
             $password = (string)$password;
15 15
         }
16
-        if(!is_string($password))
16
+        if (!is_string($password))
17 17
         {
18 18
             trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
19 19
             return false;
20 20
         }
21
-        if(!is_int($algo))
21
+        if (!is_int($algo))
22 22
         {
23
-            trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING);
23
+            trigger_error("password_hash() expects parameter 2 to be long, ".gettype($algo)." given", E_USER_WARNING);
24 24
             return false;
25 25
         }
26 26
         $resultLength = 0;
27
-        switch($algo)
27
+        switch ($algo)
28 28
         {
29 29
             case PASSWORD_BCRYPT:
30 30
                 $cost = PASSWORD_BCRYPT_DEFAULT_COST;
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
         $base64String = base64_encode($salt);
44 44
         $salt = strtr(rtrim($base64String, '='), $base64Digits, $bcrypt64Digits);
45 45
         $salt = substr($salt, 0, $requiredSaltLen);
46
-        $hash = $hashFormat . $salt;
46
+        $hash = $hashFormat.$salt;
47 47
         $ret = crypt($password, $hash);
48
-        if(!is_string($ret) || strlen($ret) != $resultLength)
48
+        if (!is_string($ret) || strlen($ret) != $resultLength)
49 49
         {
50 50
             return false;
51 51
         }
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
     function password_verify($password, $hash)
56 56
     {
57 57
         $ret = crypt($password, $hash);
58
-        if(!is_string($ret) || strlen($ret) != strlen($hash) || strlen($ret) <= 13)
58
+        if (!is_string($ret) || strlen($ret) != strlen($hash) || strlen($ret) <= 13)
59 59
         {
60 60
             return false;
61 61
         }
62 62
         $status = 0;
63 63
         $count  = strlen($ret);
64
-        for($i = 0; $i < $count; $i++)
64
+        for ($i = 0; $i < $count; $i++)
65 65
         {
66 66
             $status |= (ord($ret[$i]) ^ ord($hash[$i]));
67 67
         }
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
     {
81 81
         parent::__construct($params);
82 82
         $this->params = $params;
83
-        if($this->current)
83
+        if ($this->current)
84 84
         {
85 85
             $this->dataSet = $this->getCurrentDataSet();
86 86
         }
87
-        if($this->pending)
87
+        if ($this->pending)
88 88
         {
89 89
             $this->pendingDataSet = $this->getPendingDataSet();
90 90
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     private function getCurrentDataSet()
97 97
     {
98
-        if(isset($this->params['current_data_set']))
98
+        if (isset($this->params['current_data_set']))
99 99
         {
100 100
             return \DataSetFactory::getDataSetByName($this->params['current_data_set']);
101 101
         }
@@ -107,30 +107,30 @@  discard block
 block discarded – undo
107 107
      */
108 108
     private function getPendingDataSet()
109 109
     {
110
-        if(isset($this->params['pending_data_set']))
110
+        if (isset($this->params['pending_data_set']))
111 111
         {
112 112
             return \DataSetFactory::getDataSetByName($this->params['pending_data_set']);
113 113
         }
114 114
         return \DataSetFactory::getDataSetByName('pending_authentication');
115 115
     }
116 116
 
117
-    private function getDataTable($name, $pending=false)
117
+    private function getDataTable($name, $pending = false)
118 118
     {
119
-         if(isset($this->dataTables[$name]) && isset($this->dataTables[$name][$pending]))
119
+         if (isset($this->dataTables[$name]) && isset($this->dataTables[$name][$pending]))
120 120
          {
121 121
              return $this->dataTables[$name][$pending];
122 122
          }
123 123
          $dataSet = $this->dataSet;
124
-         if($pending)
124
+         if ($pending)
125 125
          {
126 126
              $dataSet = $this->pendingDataSet;
127 127
          }
128
-         if($dataSet === null)
128
+         if ($dataSet === null)
129 129
          {
130 130
              throw new \Exception('Unable to obtain dataset for SQL Authentication!');
131 131
          }
132 132
          $dataTable = $dataSet[$name];
133
-         if(!isset($this->dataTables[$name]))
133
+         if (!isset($this->dataTables[$name]))
134 134
          {
135 135
              $this->dataTables[$name] = array();
136 136
          }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     private function getPendingUserDataTable()
142 142
     {
143
-        if(isset($this->params['pending_user_table']))
143
+        if (isset($this->params['pending_user_table']))
144 144
         {
145 145
             return $this->getDataTable($this->params['pending_user_table'], true);
146 146
         }
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function login($username, $password)
151 151
     {
152
-        if($this->current === false) return false;
152
+        if ($this->current === false) return false;
153 153
         $userDataTable = $this->getDataTable('user');
154 154
         $filter = new \Data\Filter("uid eq '$username'");
155 155
         $users = $userDataTable->read($filter);
156
-        if($users === false || !isset($users[0]))
156
+        if ($users === false || !isset($users[0]))
157 157
         {
158 158
             return false;
159 159
         }
160
-        if(password_verify($password, $users[0]['pass']))
160
+        if (password_verify($password, $users[0]['pass']))
161 161
         {
162 162
             return array('res'=>true, 'extended'=>$users[0]);
163 163
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
     public function isLoggedIn($data)
168 168
     {
169
-        if(isset($data['res']))
169
+        if (isset($data['res']))
170 170
         {
171 171
             return $data['res'];
172 172
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
     public function getUser($data)
177 177
     {
178
-        if(isset($this->params['current_data_set']))
178
+        if (isset($this->params['current_data_set']))
179 179
         {
180 180
             $data['current_data_set'] = $this->params['current_data_set'];
181 181
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $groupDataTable = $this->getDataTable('group');
188 188
         $filter = new \Data\Filter("gid eq '$name'");
189 189
         $groups = $groupDataTable->read($filter);
190
-        if($groups === false || !isset($groups[0]))
190
+        if ($groups === false || !isset($groups[0]))
191 191
         {
192 192
             return false;
193 193
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $userDataTable = $this->getDataTable('user');
200 200
         $filter = new \Data\Filter("uid eq '$name'");
201 201
         $users = $userDataTable->read($filter);
202
-        if($users === false || !isset($users[0]))
202
+        if ($users === false || !isset($users[0]))
203 203
         {
204 204
             return false;
205 205
         }
@@ -215,33 +215,33 @@  discard block
 block discarded – undo
215 215
     private function convertDataToClass($dataTableName, $className, $filter, $select, $top, $skip, $orderby)
216 216
     {
217 217
         $data = $this->getDataByFilter($dataTableName, $filter, $select, $top, $skip, $orderby);
218
-        if($data === false)
218
+        if ($data === false)
219 219
         {
220 220
             return false;
221 221
         }
222 222
         $count = count($data);
223
-        for($i = 0; $i < $count; $i++)
223
+        for ($i = 0; $i < $count; $i++)
224 224
         {
225 225
             $data[$i] = new $className($groups[$i]);
226 226
         }
227 227
         return $data;
228 228
     }
229 229
 
230
-    public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false)
230
+    public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false)
231 231
     {
232 232
         return $this->convertDataToClass('group', 'SQLGroup', $filter, $select, $top, $skip, $orderby);
233 233
     }
234 234
 
235
-    public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false)
235
+    public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false)
236 236
     {
237 237
         return $this->convertDataToClass('group', 'SQLUser', $filter, $select, $top, $skip, $orderby);
238 238
     }
239 239
 
240 240
     public function getPendingUserCount()
241 241
     {
242
-        if($this->pending === false) return 0;
242
+        if ($this->pending === false) return 0;
243 243
         $dataTable = $this->getPendingUserDataTable();
244
-        if($dataTable === null) return 0;
244
+        if ($dataTable === null) return 0;
245 245
         return $dataTable->count();
246 246
     }
247 247
 
@@ -249,26 +249,26 @@  discard block
 block discarded – undo
249 249
     {
250 250
         $userDataTable = $this->getPendingUserDataTable();
251 251
         $fieldData = $filter->to_mongo_filter();
252
-        $firstFilter = new \Data\Filter('substringof(data,"'.implode($fieldData,' ').'")');
252
+        $firstFilter = new \Data\Filter('substringof(data,"'.implode($fieldData, ' ').'")');
253 253
         $users = $userDataTable->read($firstFilter, $select, $top, $skip, $orderby);
254
-        if($users === false)
254
+        if ($users === false)
255 255
         {
256 256
             return false;
257 257
         }
258 258
         $ret = array();
259 259
         $count = count($users);
260
-        for($i = 0; $i < $count; $i++)
260
+        for ($i = 0; $i < $count; $i++)
261 261
         {
262 262
             $user = new SQLPendingUser($users[$i], $userDataTable);
263 263
             $err = false;
264
-            foreach($fieldData as $field=>$data)
264
+            foreach ($fieldData as $field=>$data)
265 265
             {
266
-                if(strcasecmp($user[$field], $data) !== 0)
266
+                if (strcasecmp($user[$field], $data) !== 0)
267 267
                 {
268 268
                     $err = true; break;
269 269
                 }
270 270
             }
271
-            if(!$err)
271
+            if (!$err)
272 272
             {
273 273
                 array_push($ret, $user);
274 274
             }
@@ -276,22 +276,22 @@  discard block
 block discarded – undo
276 276
         return $ret;
277 277
     }
278 278
 
279
-    public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false)
279
+    public function getPendingUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false)
280 280
 
281 281
     {
282
-        if($this->pending === false) return false;
283
-        if($filter !== false && !$filter->contains('hash'))
282
+        if ($this->pending === false) return false;
283
+        if ($filter !== false && !$filter->contains('hash'))
284 284
         {
285 285
             return $this->searchPendingUsers($filter, $select, $top, $skip, $orderby);
286 286
         }
287 287
         $userDataTable = $this->getPendingUserDataTable();
288 288
         $users = $userDataTable->read($filter, $select, $top, $skip, $orderby);
289
-        if($users === false)
289
+        if ($users === false)
290 290
         {
291 291
             return false;
292 292
         }
293 293
         $count = count($users);
294
-        for($i = 0; $i < $count; $i++)
294
+        for ($i = 0; $i < $count; $i++)
295 295
         {
296 296
             $users[$i] = new SQLPendingUser($users[$i], $userDataTable);
297 297
         }
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 
301 301
     public function createPendingUser($user)
302 302
     {
303
-        if($this->pending === false) return false;
303
+        if ($this->pending === false) return false;
304 304
         $userDataTable = $this->getPendingUserDataTable();
305
-        if(isset($user->password2))
305
+        if (isset($user->password2))
306 306
         {
307 307
             unset($user->password2);
308 308
         }
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
         $hash = hash('sha512', $json);
311 311
         $array = array('hash'=>$hash, 'data'=>$json);
312 312
         $ret = $userDataTable->create($array);
313
-        if($ret !== false)
313
+        if ($ret !== false)
314 314
         {
315 315
             $users = $this->getPendingUsersByFilter(new \Data\Filter("hash eq '$hash'"));
316
-            if($users === false || !isset($users[0]))
316
+            if ($users === false || !isset($users[0]))
317 317
             {
318 318
                 throw new \Exception('Error retreiving user object after successful create!');
319 319
             }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     public function getTempUserByHash($hash)
326 326
     {
327 327
         $users = $this->getPendingUsersByFilter(new \Data\Filter("hash eq '$hash'"));
328
-        if($users === false || !isset($users[0]))
328
+        if ($users === false || !isset($users[0]))
329 329
         {
330 330
             return false;
331 331
         }
Please login to merge, or discard this patch.
Auth/class.GoogleAuthenticator.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
     public function __construct($params)
11 11
     {
12 12
         parent::__construct($params);
13
-        if(!isset($params['client_secrets_path']))
13
+        if (!isset($params['client_secrets_path']))
14 14
         {
15 15
             throw new \Exception('Missing required parameter client_secrets_path!');
16 16
         }
17
-        if(!isset($params['redirect_url']))
17
+        if (!isset($params['redirect_url']))
18 18
         {
19 19
             $params['redirect_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/oauth2callback.php?src=google';
20 20
         }
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
     public function authenticate($code, &$currentUser = false)
35 35
     {
36 36
         $googleUser = false;
37
-        try{
37
+        try {
38 38
             $this->client->authenticate($code);
39 39
             $this->token = $this->client->getAccessToken();
40 40
             \FlipSession::setVar('GoogleToken', $this->token);
41 41
             $oauth2Service = new \Google_Service_Oauth2($this->client);
42 42
             $googleUser = $oauth2Service->userinfo->get();
43
-        } catch(\Exception $ex) {
43
+        } catch (\Exception $ex) {
44 44
             return self::LOGIN_FAILED;
45 45
         }
46 46
 
47 47
         $auth = \AuthProvider::getInstance();
48 48
         $localUsers = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$googleUser->email));
49
-        if($localUsers !== false && isset($localUsers[0]))
49
+        if ($localUsers !== false && isset($localUsers[0]))
50 50
         {
51
-            if($localUsers[0]->canLoginWith('google.com'))
51
+            if ($localUsers[0]->canLoginWith('google.com'))
52 52
             {
53 53
                 $auth->impersonateUser($localUsers[0]);
54 54
                 return self::SUCCESS;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $user->setLastName($googleUser->familyName);
65 65
             $user->addLoginProvider('google.com');
66 66
             $ret = $auth->activatePendingUser($user);
67
-            if($ret === false)
67
+            if ($ret === false)
68 68
             {
69 69
                  throw new \Exception('Unable to create user! '.$res);
70 70
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function getUser($data = false)
76 76
     {
77
-        if($data === false)
77
+        if ($data === false)
78 78
         {
79 79
             $data = $this->token;
80 80
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $profileUser['displayName'] = $googleUser->name;
90 90
             $profileUser['jpegPhoto'] = base64_encode(file_get_contents($googleUser->picture));
91 91
             return $profileUser;
92
-        } catch(\Exception $e)
92
+        } catch (\Exception $e)
93 93
         {
94 94
             return false;
95 95
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@
 block discarded – undo
55 55
             }
56 56
             $currentUser = $localUsers[0];
57 57
             return self::ALREADY_PRESENT;
58
-        }
59
-        else
58
+        } else
60 59
         {
61 60
             $user = new PendingUser();
62 61
             $user->setEmail($googleUser->email);
Please login to merge, or discard this patch.
Auth/OAuth2/class.OAuth2Authenticator.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 namespace Auth\OAuth2;
15 15
 
16 16
 /** Only load the HTTPFul bootstrap if it isn't already loaded*/
17
-if(!class_exists('Httpful\Request'))
17
+if (!class_exists('Httpful\Request'))
18 18
 {
19 19
     require('/var/www/common/libs/httpful/bootstrap.php');
20 20
 }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function __construct($params)
38 38
     {
39 39
         parent::__construct($params);
40
-        if(!isset($params['redirect_url']))
40
+        if (!isset($params['redirect_url']))
41 41
         {
42 42
             $this->redirect_uri = 'https://'.$_SERVER['HTTP_HOST'].'/oauth/callbacks/'.$this->getHostName();
43 43
         }
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
     public function authenticate($params, &$current_user)
116 116
     {
117 117
         $resp = $this->doAuthPost($params);
118
-        if($resp->hasErrors())
118
+        if ($resp->hasErrors())
119 119
         {
120 120
             return self::LOGIN_FAILED; 
121 121
         }
122 122
         \FlipSession::setVar('OAuthToken', $resp->body);
123 123
         $user = $this->getUserFromToken($resp->body);
124
-        if($user === false)
124
+        if ($user === false)
125 125
         {
126 126
             return self::LOGIN_FAILED;
127 127
         }
128 128
         $auth = \AuthProvider::getInstance();
129 129
         $local_users = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$user->getEmail()));
130
-        if($local_users !== false && isset($local_users[0]))
130
+        if ($local_users !== false && isset($local_users[0]))
131 131
         {
132
-            if($local_users[0]->canLoginWith($this->getHostName()))
132
+            if ($local_users[0]->canLoginWith($this->getHostName()))
133 133
             {
134 134
                 $auth->impersonateUser($local_users[0]);
135 135
                 return self::SUCCESS;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             return self::ALREADY_PRESENT;
139 139
         }
140 140
         $ret = $auth->activatePendingUser($user);
141
-        if($ret === false)
141
+        if ($ret === false)
142 142
         {
143 143
             throw new \Exception('Unable to create user! '.$res);
144 144
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
             $args['RawMessage'] = array();
35 35
             $args['RawMessage']['Data'] = base64_encode($email->getRawMessage());
36 36
             return $this->ses->sendRawEmail($args);
37
-        }
38
-        else
37
+        } else
39 38
         {
40 39
             $args = array();
41 40
             $args['Source'] = $email->getFromAddress();
Please login to merge, or discard this patch.
Auth/OAuth2/class.GitLabAuthenticator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
     public function getUserFromToken($token)
32 32
     {
33
-        if($token === false)
33
+        if ($token === false)
34 34
         {
35 35
             $token = \FlipSession::getVar('OAuthToken');
36 36
         }
Please login to merge, or discard this patch.