Completed
Push — master ( e89277...1caf4d )
by Patrick
03:08
created
class.FlipAdminPage.php 1 patch
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.
Auth/class.LDAPCachableObject.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
8 8
         try
9 9
         {
10 10
             return $this->server->update($obj);
11
-        }
12
-        catch(\Exception $ex)
11
+        } catch(\Exception $ex)
13 12
         {
14 13
             $auth = \AuthProvider::getInstance();
15 14
             $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator');
@@ -115,8 +114,7 @@  discard block
 block discarded – undo
115 114
         if($fieldValue !== null && strlen($fieldValue) > 0)
116 115
         {
117 116
             $obj[$fieldName] = $fieldValue;
118
-        }
119
-        else
117
+        } else
120 118
         {
121 119
             $obj[$fieldName] = null;
122 120
         }
@@ -133,8 +131,7 @@  discard block
 block discarded – undo
133 131
             $obj[$fieldName] = $this->ldapObj->{$fieldName};
134 132
             $obj[$fieldName][$obj[$fieldName]['count']] = $fieldValue;
135 133
             $obj[$fieldName]['count']++;
136
-        }
137
-        else
134
+        } else
138 135
         {
139 136
             $obj[$fieldName] = $fieldValue;
140 137
         }
Please login to merge, or discard this patch.
Auth/class.Group.php 1 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.LDAPGroup.php 1 patch
Braces   +12 added lines, -19 removed lines patch added patch discarded remove patch
@@ -78,8 +78,7 @@  discard block
 block discarded – undo
78 78
                 {
79 79
                     $members = array_merge($members, $child->members());
80 80
                 }
81
-            }
82
-            else
81
+            } else
83 82
             {
84 83
                 array_push($members, $rawMembers[$i]);
85 84
             }
@@ -123,12 +122,10 @@  discard block
 block discarded – undo
123 122
                 {
124 123
                     $members = array_merge($members, $child->members());
125 124
                 }
126
-            }
127
-            else if($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0)
125
+            } else if($includeGroups === false && strncmp($rawMembers[$i], 'cn=', 3) === 0)
128 126
             {
129 127
                 //Drop this member
130
-            }
131
-            else
128
+            } else
132 129
             {
133 130
                 array_push($members, $rawMembers[$i]);
134 131
             }
@@ -160,8 +157,7 @@  discard block
 block discarded – undo
160 157
             if(strncmp($members[$i], "uid=", 4) == 0)
161 158
             {
162 159
                 $userFilter.='(!('.$dnComps[0].'))';
163
-            }
164
-            else
160
+            } else
165 161
             {
166 162
                 $groupFilter.='(!('.$dnComps[0].'))';
167 163
             }
@@ -172,7 +168,9 @@  discard block
 block discarded – undo
172 168
         $count = count($groups);
173 169
         for($i = 0; $i < $count; $i++)
174 170
         {
175
-            if($groups[$i] === false || $groups[$i] === null) continue;
171
+            if($groups[$i] === false || $groups[$i] === null) {
172
+                continue;
173
+            }
176 174
             array_push($data, new LDAPGroup($groups[$i]));
177 175
         }
178 176
         $users = $this->server->read($this->server->user_base, $userFilter, false, $select);
@@ -189,12 +187,10 @@  discard block
 block discarded – undo
189 187
         if(isset($this->ldapObj['member']))
190 188
         {
191 189
             $this->ldapObj['member'] = array();
192
-        }
193
-        else if(isset($this->ldapObj['uniquemember']))
190
+        } else if(isset($this->ldapObj['uniquemember']))
194 191
         {
195 192
             $this->ldapObj['uniquemember'] = array();
196
-        }
197
-        else if(isset($this->ldapObj['memberuid']))
193
+        } else if(isset($this->ldapObj['memberuid']))
198 194
         {
199 195
             $this->ldapObj['memberuid'] = array();
200 196
         }
@@ -206,8 +202,7 @@  discard block
 block discarded – undo
206 202
         if($isGroup)
207 203
         {
208 204
             $dn = 'cn='.$name.','.$this->server->group_base;
209
-        }
210
-        else
205
+        } else
211 206
         {
212 207
             $dn = 'uid='.$name.','.$this->server->user_base;
213 208
         }
@@ -224,8 +219,7 @@  discard block
 block discarded – undo
224 219
                 throw new \Exception('Unable to add a group as a child of this group type');
225 220
             }
226 221
             array_push($rawMembers, $name);
227
-        }
228
-        else
222
+        } else
229 223
         {
230 224
             array_push($rawMembers, $dn);
231 225
         }
@@ -236,8 +230,7 @@  discard block
 block discarded – undo
236 230
             $obj = array('dn'=>$this->ldapObj->dn);
237 231
             $obj[$propName] = $rawMembers;
238 232
             return $this->server->update($obj);
239
-        }
240
-        else
233
+        } else
241 234
         {
242 235
             return true;
243 236
         }
Please login to merge, or discard this patch.
Auth/class.LDAPAuthenticator.php 1 patch
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,10 +34,14 @@  discard block
 block discarded – undo
34 34
             switch($orderby[$keys[0]])
35 35
             {
36 36
                 case 1:
37
-                    if($d > 0) swap($array, $i, $j);
37
+                    if($d > 0) {
38
+                        swap($array, $i, $j);
39
+                    }
38 40
                     break;
39 41
                 case 0:
40
-                    if($d < 0) swap($array, $i, $j);
42
+                    if($d < 0) {
43
+                        swap($array, $i, $j);
44
+                    }
41 45
                     break;
42 46
             }
43 47
         }
@@ -158,8 +162,7 @@  discard block
 block discarded – undo
158 162
         if($bind_write === false)
159 163
         {
160 164
             $ret = $server->bind();
161
-        }
162
-        else
165
+        } else
163 166
         {
164 167
             $ret = $server->bind($this->bind_dn, $this->bind_pass);
165 168
         }
@@ -292,12 +295,10 @@  discard block
 block discarded – undo
292 295
         if($skip !== false && $top !== false)
293 296
         {
294 297
             $data = array_slice($data, $skip, $top);
295
-        }
296
-        else if($top !== false)
298
+        } else if($top !== false)
297 299
         {
298 300
             $data = array_slice($data, 0, $top);
299
-        }
300
-        else if($skip !== false)
301
+        } else if($skip !== false)
301 302
         {
302 303
             $data = array_slice($data, $skip);
303 304
         }
Please login to merge, or discard this patch.
Auth/class.LDAPUser.php 1 patch
Braces   +13 added lines, -21 removed lines patch added patch discarded remove patch
@@ -21,14 +21,12 @@  discard block
 block discarded – undo
21 21
                 throw new \Exception('No such LDAP User!');
22 22
             }
23 23
             $this->ldapObj = $users[0];
24
-        }
25
-        else
24
+        } else
26 25
         {
27 26
             if(isset($data['extended']))
28 27
             {
29 28
                 $this->ldapObj = $data['extended'];
30
-            }
31
-            else
29
+            } else
32 30
             {
33 31
                 $this->ldapObj = $data;
34 32
             }
@@ -44,7 +42,9 @@  discard block
 block discarded – undo
44 42
             {
45 43
                 $dn = explode(',', $array[$i]);
46 44
                 $res = $this->isInGroupNamed(substr($dn[0], 3));
47
-                if($res) return $res;
45
+                if($res) {
46
+                    return $res;
47
+                }
48 48
             }
49 49
         }
50 50
         return $res;
@@ -64,24 +64,20 @@  discard block
 block discarded – undo
64 64
                 if(in_array($dn, $group['member']))
65 65
                 {
66 66
                     return true;
67
-                }
68
-                else
67
+                } else
69 68
                 {
70 69
                     return $this->check_child_group($group['member']);
71 70
                 }
72
-            }
73
-            else if(isset($group['uniquemember']))
71
+            } else if(isset($group['uniquemember']))
74 72
             {
75 73
                 if(in_array($dn, $group['uniquemember']))
76 74
                 {
77 75
                     return true;
78
-                }
79
-                else
76
+                } else
80 77
                 {
81 78
                     return $this->check_child_group($group['uniquemember']);
82 79
                 }
83
-            }
84
-            else if(isset($group['memberUid']) && in_array($uid, $group['memberUid']))
80
+            } else if(isset($group['memberUid']) && in_array($uid, $group['memberUid']))
85 81
             {
86 82
                 return true;
87 83
             }
@@ -209,8 +205,7 @@  discard block
 block discarded – undo
209 205
                 }
210 206
             }
211 207
             return $res;
212
-        }
213
-        else
208
+        } else
214 209
         {
215 210
             return false;
216 211
         }
@@ -234,8 +229,7 @@  discard block
 block discarded – undo
234 229
         if(!is_object($this->ldap_obj))
235 230
         {
236 231
             return $this->setFieldLocal('userPassword',  $this->generateLDAPPass($password));
237
-        }
238
-        else
232
+        } else
239 233
         {
240 234
             $obj = array('dn'=>$this->ldap_obj->dn);
241 235
             $obj['userPassword'] = $this->generateLDAPPass($password);
@@ -324,8 +318,7 @@  discard block
 block discarded – undo
324 318
         if(!is_object($this->ldapObj))
325 319
         {
326 320
             return $this->setFieldLocal('uid', $uid);
327
-        }
328
-        else
321
+        } else
329 322
         {
330 323
             throw new \Exception('Unsupported!');
331 324
         }
@@ -419,8 +412,7 @@  discard block
 block discarded – undo
419 412
         if(isset($ldapObj->userpassword))
420 413
         {
421 414
             $hash = hash('sha512', $ldapObj->dn.';'.$ldapObj->userpassword[0].';'.$ldapObj->mail[0]);
422
-        }
423
-        else
415
+        } else
424 416
         {
425 417
             $hash = hash('sha512', $ldapObj->dn.';'.openssl_random_pseudo_bytes(10).';'.$ldapObj->mail[0]);
426 418
         }
Please login to merge, or discard this patch.
Auth/class.SQLAuthenticator.php 1 patch
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.
Auth/class.GoogleAuthenticator.php 1 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/class.User.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -280,11 +280,15 @@  discard block
 block discarded – undo
280 280
     function canLoginWith($provider)
281 281
     {
282 282
         $hosts = $this->getLoginProviders();
283
-        if($hosts === false) return false;
283
+        if($hosts === false) {
284
+            return false;
285
+        }
284 286
         $count = count($hosts);
285 287
         for($i = 0; $i < $count; $i++)
286 288
         {
287
-            if(strcasecmp($hosts[$i], $provider) === 0) return true;
289
+            if(strcasecmp($hosts[$i], $provider) === 0) {
290
+                return true;
291
+            }
288 292
         }
289 293
         return false;
290 294
     }
@@ -607,8 +611,7 @@  discard block
 block discarded – undo
607 611
             $this->change_pass($data->oldpass, $data->password);
608 612
             unset($data->oldpass);
609 613
             unset($data->password);
610
-        }
611
-        else if(isset($data->hash) && isset($data->password))
614
+        } else if(isset($data->hash) && isset($data->password))
612 615
         {
613 616
             $this->change_pass($data->hash, $data->password, true);
614 617
             return;
Please login to merge, or discard this patch.