@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param string $username The username |
25 | 25 | * @param string $password The password |
26 | 26 | * |
27 | - * @return mixed False if unsuccessfuly login, opaque data otherwise |
|
27 | + * @return boolean False if unsuccessfuly login, opaque data otherwise |
|
28 | 28 | * |
29 | 29 | * @SuppressWarnings("UnusedFormalParameter") |
30 | 30 | */ |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Does the data indicate a logged in user? |
38 | 38 | * |
39 | - * @param mixed $data The data returned from login |
|
39 | + * @param \stdClass $data The data returned from login |
|
40 | 40 | * |
41 | 41 | * @return boolean True if successfully logged in, false otherwise |
42 | 42 | * |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * Get the user data for the specified data |
52 | 52 | * |
53 | - * @param mixed $data The data returned from login |
|
53 | + * @param \stdClass $data The data returned from login |
|
54 | 54 | * |
55 | 55 | * @return Auth\User The user object if successfully logged in or null otherwise |
56 | 56 | * |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | * Get the groups that match the filters |
94 | 94 | * |
95 | 95 | * @param mixed $filter The filter to use to find a set of groups |
96 | - * @param mixed $select The list of fields to select |
|
96 | + * @param boolean $select The list of fields to select |
|
97 | 97 | * @param mixed $top The number of groups to select |
98 | 98 | * @param mixed $skip The number of groups to skip |
99 | 99 | * @param mixed $orderby The fields to sort by |
100 | 100 | * |
101 | - * @return array All groups that fit the filters |
|
101 | + * @return boolean All groups that fit the filters |
|
102 | 102 | * |
103 | 103 | * @SuppressWarnings("UnusedFormalParameter") |
104 | 104 | */ |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | * Get the users that match the filters |
112 | 112 | * |
113 | 113 | * @param mixed $filter The filter to use to find a set of users |
114 | - * @param mixed $select The list of fields to select |
|
114 | + * @param boolean $select The list of fields to select |
|
115 | 115 | * @param mixed $top The number of users to select |
116 | 116 | * @param mixed $skip The number of users to skip |
117 | 117 | * @param mixed $orderby The fields to sort by |
118 | 118 | * |
119 | - * @return array All users that fit the filters |
|
119 | + * @return boolean All users that fit the filters |
|
120 | 120 | * |
121 | 121 | * @SuppressWarnings("UnusedFormalParameter") |
122 | 122 | */ |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | * Get the pending users that match the filters |
130 | 130 | * |
131 | 131 | * @param mixed $filter The filter to use to find a set of users |
132 | - * @param mixed $select The list of fields to select |
|
132 | + * @param boolean $select The list of fields to select |
|
133 | 133 | * @param mixed $top The number of users to select |
134 | 134 | * @param mixed $skip The number of users to skip |
135 | 135 | * @param mixed $orderby The fields to sort by |
136 | 136 | * |
137 | - * @return array All users that fit the filters |
|
137 | + * @return boolean All users that fit the filters |
|
138 | 138 | * |
139 | 139 | * @SuppressWarnings("UnusedFormalParameter") |
140 | 140 | */ |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | /** |
192 | 192 | * Get the link to login using this method |
193 | 193 | * |
194 | - * @return string The link to login using this method |
|
194 | + * @return boolean The link to login using this method |
|
195 | 195 | */ |
196 | 196 | public function getSupplementLink() |
197 | 197 | { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | /** |
216 | 216 | * Convert a pending user to an active user |
217 | 217 | * |
218 | - * @param Auth\PendingUser $user The user to activate |
|
218 | + * @param PendingUser $user The user to activate |
|
219 | 219 | * |
220 | 220 | * @return boolean True if activated, false otherwise |
221 | 221 | * |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @param string $hash The hash to search by |
233 | 233 | * |
234 | - * @return Auth\User The user whoes hash was specified |
|
234 | + * @return boolean The user whoes hash was specified |
|
235 | 235 | * |
236 | 236 | * @SuppressWarnings("UnusedFormalParameter") |
237 | 237 | */ |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @param string $hash The hash to search by |
247 | 247 | * |
248 | - * @return Auth\PendingUser The user whoes hash was specified |
|
248 | + * @return boolean The user whoes hash was specified |
|
249 | 249 | * |
250 | 250 | * @SuppressWarnings("UnusedFormalParameter") |
251 | 251 | */ |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | /** |
258 | 258 | * Get the host name this authenticator uses |
259 | 259 | * |
260 | - * @return string The host name this authenticator uses |
|
260 | + * @return boolean The host name this authenticator uses |
|
261 | 261 | */ |
262 | 262 | public function getHostName() |
263 | 263 | { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @SuppressWarnings("UnusedFormalParameter") |
104 | 104 | */ |
105 | - public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
105 | + public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
106 | 106 | { |
107 | 107 | return false; |
108 | 108 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @SuppressWarnings("UnusedFormalParameter") |
122 | 122 | */ |
123 | - public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
123 | + public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
124 | 124 | { |
125 | 125 | return false; |
126 | 126 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @SuppressWarnings("UnusedFormalParameter") |
140 | 140 | */ |
141 | - public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
141 | + public function getPendingUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
142 | 142 | { |
143 | 143 | return false; |
144 | 144 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function getActiveUserCount() |
152 | 152 | { |
153 | 153 | $users = $this->getUsersByFilter(false); |
154 | - if($users === false) |
|
154 | + if ($users === false) |
|
155 | 155 | { |
156 | 156 | return 0; |
157 | 157 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function getPendingUserCount() |
167 | 167 | { |
168 | 168 | $users = $this->getPendingUsersByFilter(false); |
169 | - if($users === false) |
|
169 | + if ($users === false) |
|
170 | 170 | { |
171 | 171 | return 0; |
172 | 172 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | public function getGroupCount() |
182 | 182 | { |
183 | 183 | $groups = $this->getGroupsByFilter(false); |
184 | - if($groups === false) |
|
184 | + if ($groups === false) |
|
185 | 185 | { |
186 | 186 | return 0; |
187 | 187 | } |
@@ -279,6 +279,12 @@ discard block |
||
279 | 279 | return $server->count($this->user_base); |
280 | 280 | } |
281 | 281 | |
282 | + /** |
|
283 | + * @param boolean $select |
|
284 | + * @param boolean $top |
|
285 | + * @param boolean $skip |
|
286 | + * @param boolean $orderby |
|
287 | + */ |
|
282 | 288 | private function processFilteringParams(&$data, &$select, $top, $skip, $orderby) |
283 | 289 | { |
284 | 290 | if($orderby !== false) |
@@ -303,6 +309,9 @@ discard block |
||
303 | 309 | } |
304 | 310 | } |
305 | 311 | |
312 | + /** |
|
313 | + * @param \Data\Filter $filter |
|
314 | + */ |
|
306 | 315 | public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
307 | 316 | { |
308 | 317 | $server = $this->get_and_bind_server(); |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | { |
27 | 27 | $count = count($array); |
28 | 28 | $keys = array_keys($orderby); |
29 | - for($i = 0; $i < $count; $i++) |
|
29 | + for ($i = 0; $i < $count; $i++) |
|
30 | 30 | { |
31 | - for($j = $i; $j < $count; $j++) |
|
31 | + for ($j = $i; $j < $count; $j++) |
|
32 | 32 | { |
33 | 33 | $d = strcasecmp($array[$i][$keys[0]][0], $array[$j][$keys[0]][0]); |
34 | - switch($orderby[$keys[0]]) |
|
34 | + switch ($orderby[$keys[0]]) |
|
35 | 35 | { |
36 | 36 | case 1: |
37 | - if($d > 0) swap($array, $i, $j); |
|
37 | + if ($d > 0) swap($array, $i, $j); |
|
38 | 38 | break; |
39 | 39 | case 0: |
40 | - if($d < 0) swap($array, $i, $j); |
|
40 | + if ($d < 0) swap($array, $i, $j); |
|
41 | 41 | break; |
42 | 42 | } |
43 | 43 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $this->host = $this->getHostParam($params); |
86 | 86 | $this->user_base = $this->getParam($params, 'user_base'); |
87 | 87 | $this->group_base = $this->getParam($params, 'group_base'); |
88 | - $this->bind_dn = $this->getParam($params, 'bind_dn', '$ldap_auth', 'read_write_pass'); |
|
88 | + $this->bind_dn = $this->getParam($params, 'bind_dn', '$ldap_auth', 'read_write_pass'); |
|
89 | 89 | $this->bind_pass = $this->getParam($params, 'bind_pass', '$ldap_auth', 'read_write_user'); |
90 | 90 | } |
91 | 91 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function getHostParam($params) |
102 | 102 | { |
103 | - if(isset($params['host'])) |
|
103 | + if (isset($params['host'])) |
|
104 | 104 | { |
105 | 105 | return $params['host']; |
106 | 106 | } |
107 | - if(isset(\FlipsideSettings::$ldap['proto'])) |
|
107 | + if (isset(\FlipsideSettings::$ldap['proto'])) |
|
108 | 108 | { |
109 | 109 | return \FlipsideSettings::$ldap['proto'].'://'.\FlipsideSettings::$ldap['host']; |
110 | 110 | } |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @SuppressWarnings("StaticAccess") |
125 | 125 | */ |
126 | - private function getParam($params, $paramName, $settingsLocation='$ldap', $settingsName=false) |
|
126 | + private function getParam($params, $paramName, $settingsLocation = '$ldap', $settingsName = false) |
|
127 | 127 | { |
128 | - if($settingsName === false) |
|
128 | + if ($settingsName === false) |
|
129 | 129 | { |
130 | 130 | $settingsName = $paramName; |
131 | 131 | } |
132 | - if(isset($params[$paramName])) |
|
132 | + if (isset($params[$paramName])) |
|
133 | 133 | { |
134 | 134 | return $params[$paramName]; |
135 | 135 | } |
136 | - if($settingsLocation === '$ldap') |
|
136 | + if ($settingsLocation === '$ldap') |
|
137 | 137 | { |
138 | 138 | return \FlipsideSettings::$ldap[$settingsName]; |
139 | 139 | } |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @SuppressWarnings("StaticAccess") |
151 | 151 | */ |
152 | - public function get_and_bind_server($bind_write=false) |
|
152 | + public function get_and_bind_server($bind_write = false) |
|
153 | 153 | { |
154 | 154 | $server = \LDAP\LDAPServer::getInstance(); |
155 | 155 | $server->user_base = $this->user_base; |
156 | 156 | $server->group_base = $this->group_base; |
157 | 157 | $server->connect($this->host); |
158 | - if($bind_write === false) |
|
158 | + if ($bind_write === false) |
|
159 | 159 | { |
160 | 160 | $ret = $server->bind(); |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $ret = $server->bind($this->bind_dn, $this->bind_pass); |
165 | 165 | } |
166 | - if($ret === false) |
|
166 | + if ($ret === false) |
|
167 | 167 | { |
168 | 168 | return false; |
169 | 169 | } |
@@ -181,20 +181,20 @@ discard block |
||
181 | 181 | public function login($username, $password) |
182 | 182 | { |
183 | 183 | $server = $this->get_and_bind_server(); |
184 | - if($server === false) |
|
184 | + if ($server === false) |
|
185 | 185 | { |
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | $filter = new \Data\Filter("uid eq $username or mail eq $username"); |
189 | 189 | $user = $server->read($this->user_base, $filter); |
190 | - if($user === false || count($user) === 0) |
|
190 | + if ($user === false || count($user) === 0) |
|
191 | 191 | { |
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | $user = $user[0]; |
195 | 195 | $server->unbind(); |
196 | 196 | $ret = $server->bind($user->dn, $password); |
197 | - if($ret !== false) |
|
197 | + if ($ret !== false) |
|
198 | 198 | { |
199 | 199 | return array('res'=>true, 'extended'=>$user); |
200 | 200 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function isLoggedIn($data) |
212 | 212 | { |
213 | - if(isset($data['res'])) |
|
213 | + if (isset($data['res'])) |
|
214 | 214 | { |
215 | 215 | return $data['res']; |
216 | 216 | } |
@@ -232,35 +232,35 @@ discard block |
||
232 | 232 | public function getGroupByName($name) |
233 | 233 | { |
234 | 234 | $server = $this->get_and_bind_server(); |
235 | - if($server === false) |
|
235 | + if ($server === false) |
|
236 | 236 | { |
237 | 237 | return false; |
238 | 238 | } |
239 | 239 | return LDAPGroup::from_name($name, $server); |
240 | 240 | } |
241 | 241 | |
242 | - public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
242 | + public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
243 | 243 | { |
244 | 244 | $server = $this->get_and_bind_server(); |
245 | - if($server === false) |
|
245 | + if ($server === false) |
|
246 | 246 | { |
247 | 247 | return false; |
248 | 248 | } |
249 | - if($filter === false) |
|
249 | + if ($filter === false) |
|
250 | 250 | { |
251 | 251 | $filter = new \Data\Filter('cn eq *'); |
252 | 252 | } |
253 | 253 | $groups = $server->read($this->group_base, $filter); |
254 | - if($groups === false) |
|
254 | + if ($groups === false) |
|
255 | 255 | { |
256 | 256 | return false; |
257 | 257 | } |
258 | 258 | $this->processFilteringParams($groups, $select, $top, $skip, $orderby); |
259 | 259 | $count = count($groups); |
260 | - for($i = 0; $i < $count; $i++) |
|
260 | + for ($i = 0; $i < $count; $i++) |
|
261 | 261 | { |
262 | 262 | $groups[$i] = new LDAPGroup($groups[$i]); |
263 | - if($select !== false) |
|
263 | + if ($select !== false) |
|
264 | 264 | { |
265 | 265 | $groups[$i] = json_decode(json_encode($groups[$i]), true); |
266 | 266 | $groups[$i] = array_intersect_key($groups[$i], array_flip($select)); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | public function getActiveUserCount() |
273 | 273 | { |
274 | 274 | $server = $this->get_and_bind_server(); |
275 | - if($server === false) |
|
275 | + if ($server === false) |
|
276 | 276 | { |
277 | 277 | return false; |
278 | 278 | } |
@@ -281,50 +281,50 @@ discard block |
||
281 | 281 | |
282 | 282 | private function processFilteringParams(&$data, &$select, $top, $skip, $orderby) |
283 | 283 | { |
284 | - if($orderby !== false) |
|
284 | + if ($orderby !== false) |
|
285 | 285 | { |
286 | 286 | sort_array($data, $orderby); |
287 | 287 | } |
288 | - if($select !== false) |
|
288 | + if ($select !== false) |
|
289 | 289 | { |
290 | 290 | $select = array_flip($select); |
291 | 291 | } |
292 | - if($skip !== false && $top !== false) |
|
292 | + if ($skip !== false && $top !== false) |
|
293 | 293 | { |
294 | 294 | $data = array_slice($data, $skip, $top); |
295 | 295 | } |
296 | - else if($top !== false) |
|
296 | + else if ($top !== false) |
|
297 | 297 | { |
298 | 298 | $data = array_slice($data, 0, $top); |
299 | 299 | } |
300 | - else if($skip !== false) |
|
300 | + else if ($skip !== false) |
|
301 | 301 | { |
302 | 302 | $data = array_slice($data, $skip); |
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | - public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
306 | + public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
307 | 307 | { |
308 | 308 | $server = $this->get_and_bind_server(); |
309 | - if($server === false) |
|
309 | + if ($server === false) |
|
310 | 310 | { |
311 | 311 | return false; |
312 | 312 | } |
313 | - if($filter === false) |
|
313 | + if ($filter === false) |
|
314 | 314 | { |
315 | 315 | $filter = new \Data\Filter('cn eq *'); |
316 | 316 | } |
317 | 317 | $users = $server->read($this->user_base, $filter, false, $select); |
318 | - if($users === false) |
|
318 | + if ($users === false) |
|
319 | 319 | { |
320 | 320 | return false; |
321 | 321 | } |
322 | 322 | $this->processFilteringParams($users, $select, $top, $skip, $orderby); |
323 | 323 | $count = count($users); |
324 | - for($i = 0; $i < $count; $i++) |
|
324 | + for ($i = 0; $i < $count; $i++) |
|
325 | 325 | { |
326 | 326 | $tmp = new LDAPUser($users[$i]); |
327 | - if($select !== false) |
|
327 | + if ($select !== false) |
|
328 | 328 | { |
329 | 329 | $tmp = $tmp->jsonSerialize(); |
330 | 330 | $tmp = array_intersect_key($tmp, $select); |
@@ -342,36 +342,36 @@ discard block |
||
342 | 342 | $email = $user->getEmail(); |
343 | 343 | $new_user->setEmail($email); |
344 | 344 | $pass = $user->getPassword(); |
345 | - if($pass !== false) |
|
345 | + if ($pass !== false) |
|
346 | 346 | { |
347 | 347 | $new_user->setPass($pass); |
348 | 348 | } |
349 | 349 | $sn = $user->getLastName(); |
350 | - if($sn !== false) |
|
350 | + if ($sn !== false) |
|
351 | 351 | { |
352 | 352 | $new_user->setLastName($sn); |
353 | 353 | } |
354 | 354 | $givenName = $user->getGivenName(); |
355 | - if($givenName !== false) |
|
355 | + if ($givenName !== false) |
|
356 | 356 | { |
357 | 357 | $new_user->setGivenName($givenName); |
358 | 358 | } |
359 | 359 | $hosts = $user->getLoginProviders(); |
360 | - if($hosts !== false) |
|
360 | + if ($hosts !== false) |
|
361 | 361 | { |
362 | 362 | $count = count($hosts); |
363 | - for($i = 0; $i < $count; $i++) |
|
363 | + for ($i = 0; $i < $count; $i++) |
|
364 | 364 | { |
365 | 365 | $new_user->addLoginProvider($hosts[$i]); |
366 | 366 | } |
367 | 367 | } |
368 | 368 | $ret = $new_user->flushUser(); |
369 | - if($ret) |
|
369 | + if ($ret) |
|
370 | 370 | { |
371 | 371 | $user->delete(); |
372 | 372 | } |
373 | 373 | $users = $this->getUsersByFilter(new \Data\Filter('mail eq '.$email)); |
374 | - if($users === false || !isset($users[0])) |
|
374 | + if ($users === false || !isset($users[0])) |
|
375 | 375 | { |
376 | 376 | throw new \Exception('Error creating user!'); |
377 | 377 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | public function getUserByResetHash($hash) |
382 | 382 | { |
383 | 383 | $users = $this->getUsersByFilter(new \Data\Filter("uniqueIdentifier eq $hash")); |
384 | - if($users === false || !isset($users[0])) |
|
384 | + if ($users === false || !isset($users[0])) |
|
385 | 385 | { |
386 | 386 | return false; |
387 | 387 | } |
@@ -34,10 +34,14 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -18,6 +18,9 @@ discard block |
||
18 | 18 | } |
19 | 19 | } |
20 | 20 | |
21 | + /** |
|
22 | + * @param string $fieldName |
|
23 | + */ |
|
21 | 24 | protected function getField($fieldName) |
22 | 25 | { |
23 | 26 | if(!is_object($this->ldapObj)) |
@@ -27,6 +30,9 @@ discard block |
||
27 | 30 | return $this->getFieldServer($fieldName); |
28 | 31 | } |
29 | 32 | |
33 | + /** |
|
34 | + * @param string $fieldName |
|
35 | + */ |
|
30 | 36 | protected function getFieldSingleValue($fieldName) |
31 | 37 | { |
32 | 38 | if(!is_object($this->ldapObj)) |
@@ -36,6 +42,9 @@ discard block |
||
36 | 42 | return $this->getFieldServerSingleValue($fieldName); |
37 | 43 | } |
38 | 44 | |
45 | + /** |
|
46 | + * @param string $fieldName |
|
47 | + */ |
|
39 | 48 | protected function setField($fieldName, $fieldValue) |
40 | 49 | { |
41 | 50 | if(!is_object($this->ldapObj)) |
@@ -45,6 +54,9 @@ discard block |
||
45 | 54 | return $this->setFieldServer($fieldName, $fieldValue); |
46 | 55 | } |
47 | 56 | |
57 | + /** |
|
58 | + * @param string $fieldName |
|
59 | + */ |
|
48 | 60 | protected function appendField($fieldName, $fieldValue) |
49 | 61 | { |
50 | 62 | if(!is_object($this->ldapObj)) |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | { |
10 | 10 | return $this->server->update($obj); |
11 | 11 | } |
12 | - catch(\Exception $ex) |
|
12 | + catch (\Exception $ex) |
|
13 | 13 | { |
14 | 14 | $auth = \AuthProvider::getInstance(); |
15 | 15 | $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator'); |
16 | - if($ldap === false) return false; |
|
16 | + if ($ldap === false) return false; |
|
17 | 17 | $this->server = $ldap->get_and_bind_server(true); |
18 | 18 | return $this->server->update($obj); |
19 | 19 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | protected function getField($fieldName) |
23 | 23 | { |
24 | - if(!is_object($this->ldapObj)) |
|
24 | + if (!is_object($this->ldapObj)) |
|
25 | 25 | { |
26 | 26 | return $this->getFieldLocal($fieldName); |
27 | 27 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | protected function getFieldSingleValue($fieldName) |
32 | 32 | { |
33 | - if(!is_object($this->ldapObj)) |
|
33 | + if (!is_object($this->ldapObj)) |
|
34 | 34 | { |
35 | 35 | return $this->getFieldLocalSingleValue($fieldName); |
36 | 36 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | protected function setField($fieldName, $fieldValue) |
41 | 41 | { |
42 | - if(!is_object($this->ldapObj)) |
|
42 | + if (!is_object($this->ldapObj)) |
|
43 | 43 | { |
44 | 44 | return $this->setFieldLocal($fieldName, $fieldValue); |
45 | 45 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function appendField($fieldName, $fieldValue) |
50 | 50 | { |
51 | - if(!is_object($this->ldapObj)) |
|
51 | + if (!is_object($this->ldapObj)) |
|
52 | 52 | { |
53 | 53 | return $this->appendFieldLocal($fieldName, $fieldValue); |
54 | 54 | } |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | |
58 | 58 | private function getFieldLocal($fieldName) |
59 | 59 | { |
60 | - if($this->ldapObj === false) |
|
60 | + if ($this->ldapObj === false) |
|
61 | 61 | { |
62 | 62 | return false; |
63 | 63 | } |
64 | - if(!isset($this->ldapObj[$fieldName])) |
|
64 | + if (!isset($this->ldapObj[$fieldName])) |
|
65 | 65 | { |
66 | 66 | return false; |
67 | 67 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | private function getFieldServer($fieldName) |
72 | 72 | { |
73 | 73 | $lowerName = strtolower($fieldName); |
74 | - if(!isset($this->ldapObj->{$lowerName})) |
|
74 | + if (!isset($this->ldapObj->{$lowerName})) |
|
75 | 75 | { |
76 | 76 | return false; |
77 | 77 | } |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | |
81 | 81 | private function getFieldLocalSingleValue($fieldName) |
82 | 82 | { |
83 | - if($this->ldapObj === false) |
|
83 | + if ($this->ldapObj === false) |
|
84 | 84 | { |
85 | 85 | return false; |
86 | 86 | } |
87 | - if(!isset($this->ldapObj[$fieldName])) |
|
87 | + if (!isset($this->ldapObj[$fieldName])) |
|
88 | 88 | { |
89 | 89 | return false; |
90 | 90 | } |
91 | - if(is_array($this->ldapObj[$fieldName])) |
|
91 | + if (is_array($this->ldapObj[$fieldName])) |
|
92 | 92 | { |
93 | 93 | return $this->ldapObj[$fieldName][0]; |
94 | 94 | } |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | private function getFieldServerSingleValue($fieldName) |
99 | 99 | { |
100 | 100 | $lowerName = strtolower($fieldName); |
101 | - if(!isset($this->ldapObj->{$lowerName})) |
|
101 | + if (!isset($this->ldapObj->{$lowerName})) |
|
102 | 102 | { |
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | $field = $this->ldapObj->{$lowerName}; |
106 | - if(!isset($field[0])) |
|
106 | + if (!isset($field[0])) |
|
107 | 107 | { |
108 | 108 | return false; |
109 | 109 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | private function setFieldServer($fieldName, $fieldValue) |
114 | 114 | { |
115 | 115 | $obj = array('dn'=>$this->ldapObj->dn); |
116 | - if($fieldValue !== null && strlen($fieldValue) > 0) |
|
116 | + if ($fieldValue !== null && strlen($fieldValue) > 0) |
|
117 | 117 | { |
118 | 118 | $obj[$fieldName] = $fieldValue; |
119 | 119 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | private function appendFieldServer($fieldName, $fieldValue) |
130 | 130 | { |
131 | 131 | $obj = array('dn'=>$this->ldapObj->dn); |
132 | - if(isset($this->ldapObj->{$fieldName})) |
|
132 | + if (isset($this->ldapObj->{$fieldName})) |
|
133 | 133 | { |
134 | 134 | $obj[$fieldName] = $this->ldapObj->{$fieldName}; |
135 | 135 | $obj[$fieldName][$obj[$fieldName]['count']] = $fieldValue; |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | |
145 | 145 | private function setFieldLocal($fieldName, $fieldValue) |
146 | 146 | { |
147 | - if($this->ldapObj === false) |
|
147 | + if ($this->ldapObj === false) |
|
148 | 148 | { |
149 | 149 | $this->ldapObj = array(); |
150 | 150 | } |
151 | - if($fieldValue === null || strlen($fieldValue) === 0) |
|
151 | + if ($fieldValue === null || strlen($fieldValue) === 0) |
|
152 | 152 | { |
153 | - if(isset($this->ldapObj[$fieldName])) |
|
153 | + if (isset($this->ldapObj[$fieldName])) |
|
154 | 154 | { |
155 | 155 | unset($this->ldapObj[$fieldName]); |
156 | 156 | } |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | |
163 | 163 | private function appendFieldLocal($fieldName, $fieldValue) |
164 | 164 | { |
165 | - if($this->ldapObj === false) |
|
165 | + if ($this->ldapObj === false) |
|
166 | 166 | { |
167 | 167 | $this->ldapObj = array(); |
168 | 168 | } |
169 | - if(!isset($this->ldapObj[$fieldName])) |
|
169 | + if (!isset($this->ldapObj[$fieldName])) |
|
170 | 170 | { |
171 | 171 | $this->ldapObj[$fieldName] = array(); |
172 | 172 | } |
@@ -8,12 +8,13 @@ discard block |
||
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'); |
16 | - if($ldap === false) return false; |
|
15 | + if($ldap === false) { |
|
16 | + return false; |
|
17 | + } |
|
17 | 18 | $this->server = $ldap->get_and_bind_server(true); |
18 | 19 | return $this->server->update($obj); |
19 | 20 | } |
@@ -116,8 +117,7 @@ discard block |
||
116 | 117 | if($fieldValue !== null && strlen($fieldValue) > 0) |
117 | 118 | { |
118 | 119 | $obj[$fieldName] = $fieldValue; |
119 | - } |
|
120 | - else |
|
120 | + } else |
|
121 | 121 | { |
122 | 122 | $obj[$fieldName] = null; |
123 | 123 | } |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | $obj[$fieldName] = $this->ldapObj->{$fieldName}; |
135 | 135 | $obj[$fieldName][$obj[$fieldName]['count']] = $fieldValue; |
136 | 136 | $obj[$fieldName]['count']++; |
137 | - } |
|
138 | - else |
|
137 | + } else |
|
139 | 138 | { |
140 | 139 | $obj[$fieldName] = $fieldValue; |
141 | 140 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $name The name of the group to check if the user is in |
37 | 37 | * |
38 | - * @return true|false True if the user is in the group, false otherwise |
|
38 | + * @return boolean True if the user is in the group, false otherwise |
|
39 | 39 | */ |
40 | 40 | public function isInGroupNamed($name) |
41 | 41 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * We need the ability to obtain the user's unhashed plain text password to allow for it to be sent |
91 | 91 | * to the correct backend which will hash it |
92 | 92 | * |
93 | - * @return string The current password |
|
93 | + * @return boolean The current password |
|
94 | 94 | */ |
95 | 95 | public function getPassword() |
96 | 96 | { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param string $email The user's new email address |
137 | 137 | * |
138 | - * @return true|false true if the user's email address was changed, false otherwise |
|
138 | + * @return boolean true if the user's email address was changed, false otherwise |
|
139 | 139 | */ |
140 | 140 | public function setEmail($email) |
141 | 141 | { |
@@ -146,9 +146,8 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * Set the user's given (first) name |
148 | 148 | * |
149 | - * @param string $name The user's new given name |
|
150 | 149 | * |
151 | - * @return true|false true if the user's given name was changed, false otherwise |
|
150 | + * @return boolean true if the user's given name was changed, false otherwise |
|
152 | 151 | */ |
153 | 152 | public function setGivenName($givenName) |
154 | 153 | { |
@@ -161,7 +160,7 @@ discard block |
||
161 | 160 | * |
162 | 161 | * @param string $sn The user's new last name |
163 | 162 | * |
164 | - * @return true|false true if the user's last name was changed, false otherwise |
|
163 | + * @return boolean true if the user's last name was changed, false otherwise |
|
165 | 164 | */ |
166 | 165 | public function setLastName($sn) |
167 | 166 | { |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -34,8 +34,7 @@ |
||
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(); |
@@ -138,6 +138,9 @@ discard block |
||
138 | 138 | return $dataTable; |
139 | 139 | } |
140 | 140 | |
141 | + /** |
|
142 | + * @return boolean |
|
143 | + */ |
|
141 | 144 | private function getPendingUserDataTable() |
142 | 145 | { |
143 | 146 | if(isset($this->params['pending_user_table'])) |
@@ -208,6 +211,14 @@ discard block |
||
208 | 211 | return $dataTable->read($filter, $select, $top, $skip, $orderby); |
209 | 212 | } |
210 | 213 | |
214 | + /** |
|
215 | + * @param string $dataTableName |
|
216 | + * @param string $className |
|
217 | + * @param boolean $select |
|
218 | + * @param boolean $top |
|
219 | + * @param boolean $skip |
|
220 | + * @param boolean $orderby |
|
221 | + */ |
|
211 | 222 | private function convertDataToClass($dataTableName, $className, $filter, $select, $top, $skip, $orderby) |
212 | 223 | { |
213 | 224 | $data = $this->getDataByFilter($dataTableName, $filter, $select, $top, $skip, $orderby); |
@@ -241,6 +252,12 @@ discard block |
||
241 | 252 | return $dataTable->count(); |
242 | 253 | } |
243 | 254 | |
255 | + /** |
|
256 | + * @param boolean $select |
|
257 | + * @param boolean $top |
|
258 | + * @param boolean $skip |
|
259 | + * @param boolean $orderby |
|
260 | + */ |
|
244 | 261 | private function searchPendingUsers($filter, $select, $top, $skip, $orderby) |
245 | 262 | { |
246 | 263 | $userDataTable = $this->getPendingUserDataTable(); |
@@ -272,6 +289,9 @@ discard block |
||
272 | 289 | return $ret; |
273 | 290 | } |
274 | 291 | |
292 | + /** |
|
293 | + * @param \Data\Filter $filter |
|
294 | + */ |
|
275 | 295 | public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
276 | 296 | |
277 | 297 | { |
@@ -116,26 +116,26 @@ |
||
116 | 116 | |
117 | 117 | private function getDataTable($name, $pending=false) |
118 | 118 | { |
119 | - if(isset($this->dataTables[$name]) && isset($this->dataTables[$name][$pending])) |
|
120 | - { |
|
121 | - return $this->dataTables[$name][$pending]; |
|
122 | - } |
|
123 | - $dataSet = $this->dataSet; |
|
124 | - if($pending) |
|
125 | - { |
|
126 | - $dataSet = $this->pendingDataSet; |
|
127 | - } |
|
128 | - if($dataSet === null) |
|
129 | - { |
|
130 | - throw new \Exception('Unable to obtain dataset for SQL Authentication!'); |
|
131 | - } |
|
132 | - $dataTable = $dataSet[$name]; |
|
133 | - if(!isset($this->dataTables[$name])) |
|
134 | - { |
|
135 | - $this->dataTables[$name] = array(); |
|
136 | - } |
|
137 | - $this->dataTables[$name][$pending] = $dataTable; |
|
138 | - return $dataTable; |
|
119 | + if(isset($this->dataTables[$name]) && isset($this->dataTables[$name][$pending])) |
|
120 | + { |
|
121 | + return $this->dataTables[$name][$pending]; |
|
122 | + } |
|
123 | + $dataSet = $this->dataSet; |
|
124 | + if($pending) |
|
125 | + { |
|
126 | + $dataSet = $this->pendingDataSet; |
|
127 | + } |
|
128 | + if($dataSet === null) |
|
129 | + { |
|
130 | + throw new \Exception('Unable to obtain dataset for SQL Authentication!'); |
|
131 | + } |
|
132 | + $dataTable = $dataSet[$name]; |
|
133 | + if(!isset($this->dataTables[$name])) |
|
134 | + { |
|
135 | + $this->dataTables[$name] = array(); |
|
136 | + } |
|
137 | + $this->dataTables[$name][$pending] = $dataTable; |
|
138 | + return $dataTable; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | private function getPendingUserDataTable() |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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::get_data_set($this->params['current_data_set']); |
101 | 101 | } |
@@ -107,30 +107,30 @@ discard block |
||
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::get_data_set($this->params['pending_data_set']); |
113 | 113 | } |
114 | 114 | return \DataSetFactory::get_data_set('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 |
||
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 |
||
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, 'uid,pass'); |
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]['uid']); |
163 | 163 | } |
@@ -166,7 +166,7 @@ discard block |
||
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 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $groupDataTable = $this->getDataTable('group'); |
184 | 184 | $filter = new \Data\Filter("gid eq '$name'"); |
185 | 185 | $groups = $groupDataTable->read($filter); |
186 | - if($groups === false || !isset($groups[0])) |
|
186 | + if ($groups === false || !isset($groups[0])) |
|
187 | 187 | { |
188 | 188 | return false; |
189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $userDataTable = $this->getDataTable('user'); |
196 | 196 | $filter = new \Data\Filter("uid eq '$name'"); |
197 | 197 | $users = $userDataTable->read($filter); |
198 | - if($users === false || !isset($users[0])) |
|
198 | + if ($users === false || !isset($users[0])) |
|
199 | 199 | { |
200 | 200 | return false; |
201 | 201 | } |
@@ -211,33 +211,33 @@ discard block |
||
211 | 211 | private function convertDataToClass($dataTableName, $className, $filter, $select, $top, $skip, $orderby) |
212 | 212 | { |
213 | 213 | $data = $this->getDataByFilter($dataTableName, $filter, $select, $top, $skip, $orderby); |
214 | - if($data === false) |
|
214 | + if ($data === false) |
|
215 | 215 | { |
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | $count = count($data); |
219 | - for($i = 0; $i < $count; $i++) |
|
219 | + for ($i = 0; $i < $count; $i++) |
|
220 | 220 | { |
221 | 221 | $data[$i] = new $className($groups[$i]); |
222 | 222 | } |
223 | 223 | return $data; |
224 | 224 | } |
225 | 225 | |
226 | - public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
226 | + public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
227 | 227 | { |
228 | 228 | return $this->convertDataToClass('group', 'SQLGroup', $filter, $select, $top, $skip, $orderby); |
229 | 229 | } |
230 | 230 | |
231 | - public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
231 | + public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
232 | 232 | { |
233 | 233 | return $this->convertDataToClass('group', 'SQLUser', $filter, $select, $top, $skip, $orderby); |
234 | 234 | } |
235 | 235 | |
236 | 236 | public function getPendingUserCount() |
237 | 237 | { |
238 | - if($this->pending === false) return 0; |
|
238 | + if ($this->pending === false) return 0; |
|
239 | 239 | $dataTable = $this->getPendingUserDataTable(); |
240 | - if($dataTable === null) return 0; |
|
240 | + if ($dataTable === null) return 0; |
|
241 | 241 | return $dataTable->count(); |
242 | 242 | } |
243 | 243 | |
@@ -245,26 +245,26 @@ discard block |
||
245 | 245 | { |
246 | 246 | $userDataTable = $this->getPendingUserDataTable(); |
247 | 247 | $fieldData = $filter->to_mongo_filter(); |
248 | - $firstFilter = new \Data\Filter('substringof(data,"'.implode($fieldData,' ').'")'); |
|
248 | + $firstFilter = new \Data\Filter('substringof(data,"'.implode($fieldData, ' ').'")'); |
|
249 | 249 | $users = $userDataTable->read($firstFilter, $select, $top, $skip, $orderby); |
250 | - if($users === false) |
|
250 | + if ($users === false) |
|
251 | 251 | { |
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | $ret = array(); |
255 | 255 | $count = count($users); |
256 | - for($i = 0; $i < $count; $i++) |
|
256 | + for ($i = 0; $i < $count; $i++) |
|
257 | 257 | { |
258 | 258 | $user = new SQLPendingUser($users[$i], $userDataTable); |
259 | 259 | $err = false; |
260 | - foreach($fieldData as $field=>$data) |
|
260 | + foreach ($fieldData as $field=>$data) |
|
261 | 261 | { |
262 | - if(strcasecmp($user[$field], $data) !== 0) |
|
262 | + if (strcasecmp($user[$field], $data) !== 0) |
|
263 | 263 | { |
264 | 264 | $err = true; break; |
265 | 265 | } |
266 | 266 | } |
267 | - if(!$err) |
|
267 | + if (!$err) |
|
268 | 268 | { |
269 | 269 | array_push($ret, $user); |
270 | 270 | } |
@@ -272,22 +272,22 @@ discard block |
||
272 | 272 | return $ret; |
273 | 273 | } |
274 | 274 | |
275 | - public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
275 | + public function getPendingUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
276 | 276 | |
277 | 277 | { |
278 | - if($this->pending === false) return false; |
|
279 | - if($filter !== false && !$filter->contains('hash')) |
|
278 | + if ($this->pending === false) return false; |
|
279 | + if ($filter !== false && !$filter->contains('hash')) |
|
280 | 280 | { |
281 | 281 | return $this->searchPendingUsers($filter, $select, $top, $skip, $orderby); |
282 | 282 | } |
283 | 283 | $userDataTable = $this->getPendingUserDataTable(); |
284 | 284 | $users = $userDataTable->read($filter, $select, $top, $skip, $orderby); |
285 | - if($users === false) |
|
285 | + if ($users === false) |
|
286 | 286 | { |
287 | 287 | return false; |
288 | 288 | } |
289 | 289 | $count = count($users); |
290 | - for($i = 0; $i < $count; $i++) |
|
290 | + for ($i = 0; $i < $count; $i++) |
|
291 | 291 | { |
292 | 292 | $users[$i] = new SQLPendingUser($users[$i], $userDataTable); |
293 | 293 | } |
@@ -296,9 +296,9 @@ discard block |
||
296 | 296 | |
297 | 297 | public function createPendingUser($user) |
298 | 298 | { |
299 | - if($this->pending === false) return false; |
|
299 | + if ($this->pending === false) return false; |
|
300 | 300 | $userDataTable = $this->getPendingUserDataTable(); |
301 | - if(isset($user->password2)) |
|
301 | + if (isset($user->password2)) |
|
302 | 302 | { |
303 | 303 | unset($user->password2); |
304 | 304 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | $hash = hash('sha512', $json); |
307 | 307 | $array = array('hash'=>$hash, 'data'=>$json); |
308 | 308 | $ret = $userDataTable->create($array); |
309 | - if($ret !== false) |
|
309 | + if ($ret !== false) |
|
310 | 310 | { |
311 | 311 | $users = $this->getPendingUsersByFilter(new \Data\Filter("hash eq '$hash'")); |
312 | - if($users === false || !isset($users[0])) |
|
312 | + if ($users === false || !isset($users[0])) |
|
313 | 313 | { |
314 | 314 | throw new \Exception('Error retreiving user object after successful create!'); |
315 | 315 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | public function getTempUserByHash($hash) |
322 | 322 | { |
323 | 323 | $users = $this->getPendingUsersByFilter(new \Data\Filter("hash eq '$hash'")); |
324 | - if($users === false || !isset($users[0])) |
|
324 | + if ($users === false || !isset($users[0])) |
|
325 | 325 | { |
326 | 326 | return false; |
327 | 327 | } |
@@ -149,7 +149,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -109,7 +109,7 @@ |
||
109 | 109 | * @param $params The set of parameters obtained from the authentication call |
110 | 110 | * @param $current_user The user from the current system if the user is not authorized to login via this method |
111 | 111 | * |
112 | - * @return SUCCESS|LOGIN_FAILED|ALREADY_PRESENT SUCCESS if the user is now logged in. ALREADY_PRESENT if the authorization was |
|
112 | + * @return integer SUCCESS if the user is now logged in. ALREADY_PRESENT if the authorization was |
|
113 | 113 | * successful, but the user has not authorized that login method. LOGIN_FAILED for all other errors |
114 | 114 | */ |
115 | 115 | public function authenticate($params, &$current_user) |
@@ -14,7 +14,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -34,8 +34,7 @@ |
||
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(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param string $methodName The class name of the Authenticator to get the instance for |
55 | 55 | * |
56 | - * @return Auth\Authenticator|false The specified Authenticator class instance or false if it is not loaded |
|
56 | + * @return string The specified Authenticator class instance or false if it is not loaded |
|
57 | 57 | */ |
58 | 58 | public function getAuthenticator($methodName) |
59 | 59 | { |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * Get an array of Auth\PendingUser from a filtered set |
270 | 270 | * |
271 | 271 | * @param Data\Filter|false $filter The filter conditions or false to retreive all |
272 | - * @param array|false $methodName The user fields to obtain or false to obtain all |
|
273 | - * @param integer|false $top The number of users to obtain or false to obtain all |
|
274 | - * @param integer|false $skip The number of users to skip or false to skip none |
|
275 | - * @param array|false $orderby The field to sort by and the method to sort or false to not sort |
|
276 | - * @param string|false $methodName The AuthMethod if information is desired only from a particular Auth\Authenticator |
|
272 | + * @param boolean $methodName The user fields to obtain or false to obtain all |
|
273 | + * @param boolean $top The number of users to obtain or false to obtain all |
|
274 | + * @param boolean $skip The number of users to skip or false to skip none |
|
275 | + * @param boolean $orderby The field to sort by and the method to sort or false to not sort |
|
276 | + * @param boolean $methodName The AuthMethod if information is desired only from a particular Auth\Authenticator |
|
277 | 277 | * |
278 | 278 | * @return array|false An array of Auth\PendingUser objects or false if no pending users were found |
279 | 279 | */ |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Require the FlipsideSettings file |
20 | 20 | */ |
21 | -if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
21 | +if (isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
22 | 22 | { |
23 | 23 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
24 | 24 | } |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | protected function __construct() |
44 | 44 | { |
45 | 45 | $this->methods = array(); |
46 | - if(isset(FlipsideSettings::$authProviders)) |
|
46 | + if (isset(FlipsideSettings::$authProviders)) |
|
47 | 47 | { |
48 | 48 | $keys = array_keys(FlipsideSettings::$authProviders); |
49 | 49 | $count = count($keys); |
50 | - for($i = 0; $i < $count; $i++) |
|
50 | + for ($i = 0; $i < $count; $i++) |
|
51 | 51 | { |
52 | 52 | $class = $keys[$i]; |
53 | 53 | array_push($this->methods, new $class(FlipsideSettings::$authProviders[$keys[$i]])); |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | public function getAuthenticator($methodName) |
66 | 66 | { |
67 | 67 | $count = count($this->methods); |
68 | - for($i = 0; $i < $count; $i++) |
|
68 | + for ($i = 0; $i < $count; $i++) |
|
69 | 69 | { |
70 | - if(strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
70 | + if (strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
71 | 71 | { |
72 | 72 | return $this->methods[$i]; |
73 | 73 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | { |
90 | 90 | $res = false; |
91 | 91 | $count = count($this->methods); |
92 | - for($i = 0; $i < $count; $i++) |
|
92 | + for ($i = 0; $i < $count; $i++) |
|
93 | 93 | { |
94 | 94 | $res = $this->methods[$i]->login($username, $password); |
95 | - if($res !== false) |
|
95 | + if ($res !== false) |
|
96 | 96 | { |
97 | 97 | return $this->methods[$i]->getUser($res); |
98 | 98 | } |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | { |
113 | 113 | $res = false; |
114 | 114 | $count = count($this->methods); |
115 | - for($i = 0; $i < $count; $i++) |
|
115 | + for ($i = 0; $i < $count; $i++) |
|
116 | 116 | { |
117 | 117 | $res = $this->methods[$i]->login($username, $password); |
118 | - if($res !== false) |
|
118 | + if ($res !== false) |
|
119 | 119 | { |
120 | 120 | FlipSession::setVar('AuthMethod', get_class($this->methods[$i])); |
121 | 121 | FlipSession::setVar('AuthData', $res); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | */ |
164 | 164 | private function mergeResult(&$returnValue, $res) |
165 | 165 | { |
166 | - if($res === false) |
|
166 | + if ($res === false) |
|
167 | 167 | { |
168 | 168 | return; |
169 | 169 | } |
170 | - if($returnValue === false) |
|
170 | + if ($returnValue === false) |
|
171 | 171 | { |
172 | 172 | $returnValue = $res; |
173 | 173 | return; |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | { |
190 | 190 | $ret = false; |
191 | 191 | $count = count($this->methods); |
192 | - for($i = 0; $i < $count; $i++) |
|
192 | + for ($i = 0; $i < $count; $i++) |
|
193 | 193 | { |
194 | - if($checkField) |
|
194 | + if ($checkField) |
|
195 | 195 | { |
196 | - if($this->methods[$i]->{$checkField} === $checkValue) |
|
196 | + if ($this->methods[$i]->{$checkField} === $checkValue) |
|
197 | 197 | { |
198 | 198 | continue; |
199 | 199 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | { |
218 | 218 | $retCount = 0; |
219 | 219 | $count = count($this->methods); |
220 | - for($i = 0; $i < $count; $i++) |
|
220 | + for ($i = 0; $i < $count; $i++) |
|
221 | 221 | { |
222 | - if($checkField) |
|
222 | + if ($checkField) |
|
223 | 223 | { |
224 | - if($this->methods[$i]->{$checkField} === $checkValue) |
|
224 | + if ($this->methods[$i]->{$checkField} === $checkValue) |
|
225 | 225 | { |
226 | 226 | continue; |
227 | 227 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function getGroupByName($name, $methodName = false) |
244 | 244 | { |
245 | - if($methodName === false) |
|
245 | + if ($methodName === false) |
|
246 | 246 | { |
247 | 247 | return $this->callOnEach('getGroupByName', array($name)); |
248 | 248 | } |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @return array|false An array of Auth\User objects or false if no users were found |
264 | 264 | */ |
265 | - public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false, $methodName = false) |
|
265 | + public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false, $methodName = false) |
|
266 | 266 | { |
267 | - if($methodName === false) |
|
267 | + if ($methodName === false) |
|
268 | 268 | { |
269 | 269 | return $this->callOnEach('getUsersByFilter', array($filter, $select, $top, $skip, $orderby), 'current'); |
270 | 270 | } |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return array|false An array of Auth\PendingUser objects or false if no pending users were found |
286 | 286 | */ |
287 | - public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false, $methodName = false) |
|
287 | + public function getPendingUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false, $methodName = false) |
|
288 | 288 | { |
289 | - if($methodName === false) |
|
289 | + if ($methodName === false) |
|
290 | 290 | { |
291 | 291 | return $this->callOnEach('getPendingUsersByFilter', array($filter, $select, $top, $skip, $orderby), 'pending'); |
292 | 292 | } |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return array|false An array of Auth\Group objects or false if no pending users were found |
308 | 308 | */ |
309 | - public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false, $methodName = false) |
|
309 | + public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false, $methodName = false) |
|
310 | 310 | { |
311 | - if($methodName === false) |
|
311 | + if ($methodName === false) |
|
312 | 312 | { |
313 | 313 | return $this->callOnEach('getGroupsByFilter', array($filter, $select, $top, $skip, $orderby), 'current'); |
314 | 314 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function getActiveUserCount($methodName = false) |
327 | 327 | { |
328 | - if($methodName === false) |
|
328 | + if ($methodName === false) |
|
329 | 329 | { |
330 | 330 | return $this->addFromEach('getActiveUserCount', 'current'); |
331 | 331 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function getPendingUserCount($methodName = false) |
344 | 344 | { |
345 | - if($methodName === false) |
|
345 | + if ($methodName === false) |
|
346 | 346 | { |
347 | 347 | return $this->addFromEach('getPendingUserCount', 'pending'); |
348 | 348 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | */ |
360 | 360 | public function getGroupCount($methodName = false) |
361 | 361 | { |
362 | - if($methodName === false) |
|
362 | + if ($methodName === false) |
|
363 | 363 | { |
364 | 364 | return $this->addFromEach('getGroupCount', 'current'); |
365 | 365 | } |
@@ -379,9 +379,9 @@ discard block |
||
379 | 379 | { |
380 | 380 | $ret = array(); |
381 | 381 | $count = count($this->methods); |
382 | - for($i = 0; $i < $count; $i++) |
|
382 | + for ($i = 0; $i < $count; $i++) |
|
383 | 383 | { |
384 | - if($this->methods[$i]->supplement === false) continue; |
|
384 | + if ($this->methods[$i]->supplement === false) continue; |
|
385 | 385 | |
386 | 386 | array_push($ret, $this->methods[$i]->getSupplementLink()); |
387 | 387 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function impersonateUser($userArray) |
400 | 400 | { |
401 | - if(!is_object($userArray)) |
|
401 | + if (!is_object($userArray)) |
|
402 | 402 | { |
403 | 403 | $user = new $userArray['class']($userArray); |
404 | 404 | } |
@@ -415,15 +415,15 @@ discard block |
||
415 | 415 | */ |
416 | 416 | public function getTempUserByHash($hash, $methodName = false) |
417 | 417 | { |
418 | - if($methodName === false) |
|
418 | + if ($methodName === false) |
|
419 | 419 | { |
420 | 420 | $count = count($this->methods); |
421 | - for($i = 0; $i < $count; $i++) |
|
421 | + for ($i = 0; $i < $count; $i++) |
|
422 | 422 | { |
423 | - if($this->methods[$i]->pending === false) continue; |
|
423 | + if ($this->methods[$i]->pending === false) continue; |
|
424 | 424 | |
425 | 425 | $ret = $this->methods[$i]->getTempUserByHash($hash); |
426 | - if($ret !== false) |
|
426 | + if ($ret !== false) |
|
427 | 427 | { |
428 | 428 | return $ret; |
429 | 429 | } |
@@ -444,15 +444,15 @@ discard block |
||
444 | 444 | */ |
445 | 445 | public function createPendingUser($user, $methodName = false) |
446 | 446 | { |
447 | - if($methodName === false) |
|
447 | + if ($methodName === false) |
|
448 | 448 | { |
449 | 449 | $count = count($this->methods); |
450 | - for($i = 0; $i < $count; $i++) |
|
450 | + for ($i = 0; $i < $count; $i++) |
|
451 | 451 | { |
452 | - if($this->methods[$i]->pending === false) continue; |
|
452 | + if ($this->methods[$i]->pending === false) continue; |
|
453 | 453 | |
454 | 454 | $ret = $this->methods[$i]->createPendingUser($user); |
455 | - if($ret !== false) |
|
455 | + if ($ret !== false) |
|
456 | 456 | { |
457 | 457 | return true; |
458 | 458 | } |
@@ -476,15 +476,15 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function activatePendingUser($user, $methodName = false) |
478 | 478 | { |
479 | - if($methodName === false) |
|
479 | + if ($methodName === false) |
|
480 | 480 | { |
481 | 481 | $count = count($this->methods); |
482 | - for($i = 0; $i < $count; $i++) |
|
482 | + for ($i = 0; $i < $count; $i++) |
|
483 | 483 | { |
484 | - if($this->methods[$i]->current === false) continue; |
|
484 | + if ($this->methods[$i]->current === false) continue; |
|
485 | 485 | |
486 | 486 | $ret = $this->methods[$i]->activatePendingUser($user); |
487 | - if($ret !== false) |
|
487 | + if ($ret !== false) |
|
488 | 488 | { |
489 | 489 | $this->impersonateUser($ret); |
490 | 490 | return true; |
@@ -506,15 +506,15 @@ discard block |
||
506 | 506 | */ |
507 | 507 | public function getUserByResetHash($hash, $methodName = false) |
508 | 508 | { |
509 | - if($methodName === false) |
|
509 | + if ($methodName === false) |
|
510 | 510 | { |
511 | 511 | $count = count($this->methods); |
512 | - for($i = 0; $i < $count; $i++) |
|
512 | + for ($i = 0; $i < $count; $i++) |
|
513 | 513 | { |
514 | - if($this->methods[$i]->current === false) continue; |
|
514 | + if ($this->methods[$i]->current === false) continue; |
|
515 | 515 | |
516 | 516 | $ret = $this->methods[$i]->getUserByResetHash($hash); |
517 | - if($ret !== false) |
|
517 | + if ($ret !== false) |
|
518 | 518 | { |
519 | 519 | return $ret; |
520 | 520 | } |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | return false; |
523 | 523 | } |
524 | 524 | $auth = $this->getAuthenticator($methodName); |
525 | - if($auth === false) |
|
525 | + if ($auth === false) |
|
526 | 526 | { |
527 | 527 | return $this->getUserByResetHash($hash, false); |
528 | 528 | } |
@@ -539,11 +539,11 @@ discard block |
||
539 | 539 | public function getSuplementalProviderByHost($host) |
540 | 540 | { |
541 | 541 | $count = count($this->methods); |
542 | - for($i = 0; $i < $count; $i++) |
|
542 | + for ($i = 0; $i < $count; $i++) |
|
543 | 543 | { |
544 | - if($this->methods[$i]->supplement === false) continue; |
|
544 | + if ($this->methods[$i]->supplement === false) continue; |
|
545 | 545 | |
546 | - if($this->methods[$i]->getHostName() === $host) |
|
546 | + if ($this->methods[$i]->getHostName() === $host) |
|
547 | 547 | { |
548 | 548 | return $this->methods[$i]; |
549 | 549 | } |
@@ -551,15 +551,15 @@ discard block |
||
551 | 551 | return false; |
552 | 552 | } |
553 | 553 | |
554 | - public function deletePendingUsersByFilter($filter, $methodName=false) |
|
554 | + public function deletePendingUsersByFilter($filter, $methodName = false) |
|
555 | 555 | { |
556 | 556 | $users = $this->getPendingUsersByFilter($filter, false, false, false, false, $methodName); |
557 | - if($users === false) |
|
557 | + if ($users === false) |
|
558 | 558 | { |
559 | 559 | return false; |
560 | 560 | } |
561 | 561 | $count = count($users); |
562 | - for($i = 0; $i < $count; $i++) |
|
562 | + for ($i = 0; $i < $count; $i++) |
|
563 | 563 | { |
564 | 564 | $users[$i]->delete(); |
565 | 565 | } |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
22 | 22 | { |
23 | 23 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
24 | -} |
|
25 | -else |
|
24 | +} else |
|
26 | 25 | { |
27 | 26 | require_once('/var/www/secure_settings/class.FlipsideSettings.php'); |
28 | 27 | } |
@@ -381,7 +380,9 @@ discard block |
||
381 | 380 | $count = count($this->methods); |
382 | 381 | for($i = 0; $i < $count; $i++) |
383 | 382 | { |
384 | - if($this->methods[$i]->supplement === false) continue; |
|
383 | + if($this->methods[$i]->supplement === false) { |
|
384 | + continue; |
|
385 | + } |
|
385 | 386 | |
386 | 387 | array_push($ret, $this->methods[$i]->getSupplementLink()); |
387 | 388 | } |
@@ -420,7 +421,9 @@ discard block |
||
420 | 421 | $count = count($this->methods); |
421 | 422 | for($i = 0; $i < $count; $i++) |
422 | 423 | { |
423 | - if($this->methods[$i]->pending === false) continue; |
|
424 | + if($this->methods[$i]->pending === false) { |
|
425 | + continue; |
|
426 | + } |
|
424 | 427 | |
425 | 428 | $ret = $this->methods[$i]->getTempUserByHash($hash); |
426 | 429 | if($ret !== false) |
@@ -449,7 +452,9 @@ discard block |
||
449 | 452 | $count = count($this->methods); |
450 | 453 | for($i = 0; $i < $count; $i++) |
451 | 454 | { |
452 | - if($this->methods[$i]->pending === false) continue; |
|
455 | + if($this->methods[$i]->pending === false) { |
|
456 | + continue; |
|
457 | + } |
|
453 | 458 | |
454 | 459 | $ret = $this->methods[$i]->createPendingUser($user); |
455 | 460 | if($ret !== false) |
@@ -481,7 +486,9 @@ discard block |
||
481 | 486 | $count = count($this->methods); |
482 | 487 | for($i = 0; $i < $count; $i++) |
483 | 488 | { |
484 | - if($this->methods[$i]->current === false) continue; |
|
489 | + if($this->methods[$i]->current === false) { |
|
490 | + continue; |
|
491 | + } |
|
485 | 492 | |
486 | 493 | $ret = $this->methods[$i]->activatePendingUser($user); |
487 | 494 | if($ret !== false) |
@@ -511,7 +518,9 @@ discard block |
||
511 | 518 | $count = count($this->methods); |
512 | 519 | for($i = 0; $i < $count; $i++) |
513 | 520 | { |
514 | - if($this->methods[$i]->current === false) continue; |
|
521 | + if($this->methods[$i]->current === false) { |
|
522 | + continue; |
|
523 | + } |
|
515 | 524 | |
516 | 525 | $ret = $this->methods[$i]->getUserByResetHash($hash); |
517 | 526 | if($ret !== false) |
@@ -541,7 +550,9 @@ discard block |
||
541 | 550 | $count = count($this->methods); |
542 | 551 | for($i = 0; $i < $count; $i++) |
543 | 552 | { |
544 | - if($this->methods[$i]->supplement === false) continue; |
|
553 | + if($this->methods[$i]->supplement === false) { |
|
554 | + continue; |
|
555 | + } |
|
545 | 556 | |
546 | 557 | if($this->methods[$i]->getHostName() === $host) |
547 | 558 | { |
@@ -20,6 +20,9 @@ |
||
20 | 20 | $this->addWellKnownJS(JS_METISMENU, false); |
21 | 21 | } |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $adminGroup |
|
25 | + */ |
|
23 | 26 | protected function userIsAdmin($adminGroup) |
24 | 27 | { |
25 | 28 | if($this->user === false || $this->user === null) |
@@ -34,8 +34,7 @@ discard block |
||
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 |
||
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"> |
@@ -6,13 +6,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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"> |
@@ -487,7 +487,6 @@ discard block |
||
487 | 487 | /** |
488 | 488 | * Add a Cascading Style Sheet file from its src URI |
489 | 489 | * |
490 | - * @param string $src The webpath to the Cascading Style Sheet file |
|
491 | 490 | * @param boolean $async Can the CSS be loaded asynchronously? |
492 | 491 | */ |
493 | 492 | public function addCSSByURI($uri, $async=false) |
@@ -514,6 +513,9 @@ discard block |
||
514 | 513 | $this->addWellKnownJS($type, $async); |
515 | 514 | } |
516 | 515 | |
516 | + /** |
|
517 | + * @param integer $type |
|
518 | + */ |
|
517 | 519 | function add_js($type, $async=true) |
518 | 520 | { |
519 | 521 | $this->addWellKnownJS($type, $async); |
@@ -582,6 +584,9 @@ discard block |
||
582 | 584 | return $ret; |
583 | 585 | } |
584 | 586 | |
587 | + /** |
|
588 | + * @return string |
|
589 | + */ |
|
585 | 590 | protected function getHrefForDropdown(&$link) |
586 | 591 | { |
587 | 592 | if(isset($link['_'])) |
@@ -685,7 +690,7 @@ discard block |
||
685 | 690 | * |
686 | 691 | * @param string $msg The message to show in the notifcation |
687 | 692 | * @param string $sev The severity of the notifcation |
688 | - * @param boolean $dismissible Can the user dismiss the notificaton? |
|
693 | + * @param integer $dismissible Can the user dismiss the notificaton? |
|
689 | 694 | * |
690 | 695 | * @deprecated 2.0.0 Use the addNotification function instead |
691 | 696 | */ |
@@ -699,7 +704,7 @@ discard block |
||
699 | 704 | * Add a notification to the page |
700 | 705 | * |
701 | 706 | * @param string $message The message to show in the notifcation |
702 | - * @param string $sevity The severity of the notifcation |
|
707 | + * @param string $severity The severity of the notifcation |
|
703 | 708 | * @param boolean $dismissible Can the user dismiss the notificaton? |
704 | 709 | * |
705 | 710 | * @deprecated 2.0.0 Use the addNotification function instead |
@@ -793,7 +798,6 @@ discard block |
||
793 | 798 | * Draw the page |
794 | 799 | * |
795 | 800 | * @param boolean $header Draw the header |
796 | - * @param boolean $analytics Include analytics on the page |
|
797 | 801 | */ |
798 | 802 | public function printPage($header=true) |
799 | 803 | { |
@@ -812,7 +816,7 @@ discard block |
||
812 | 816 | * |
813 | 817 | * @param string $name The name of the link |
814 | 818 | * @param false|string $url The URL to link to |
815 | - * @param false|array $subment Any submenu items for the dropdown |
|
819 | + * @param false|array $submenu Any submenu items for the dropdown |
|
816 | 820 | * |
817 | 821 | * @deprecated 1.0.0 Use addLink instead |
818 | 822 | */ |
@@ -826,7 +830,7 @@ discard block |
||
826 | 830 | * |
827 | 831 | * @param string $name The name of the link |
828 | 832 | * @param false|string $url The URL to link to |
829 | - * @param false|array $subment Any submenu items for the dropdown |
|
833 | + * @param false|array $submenu Any submenu items for the dropdown |
|
830 | 834 | */ |
831 | 835 | public function addLink($name, $url=false, $submenu=false) |
832 | 836 | { |
@@ -59,239 +59,239 @@ |
||
59 | 59 | |
60 | 60 | global $jsArray; |
61 | 61 | $jsArray = array( |
62 | - JS_JQUERY => array( |
|
63 | - 'no' => array( |
|
64 | - 'no' => '/js/common/jquery.js', |
|
65 | - 'min' => '/js/common/jquery.min.js' |
|
66 | - ), |
|
67 | - 'cdn' => array( |
|
68 | - 'no' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.js', |
|
69 | - 'min' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js' |
|
70 | - ) |
|
71 | - ), |
|
72 | - JS_JQUERY_UI => array( |
|
73 | - 'no' => array( |
|
74 | - 'no' => '/js/common/jquery-ui.js', |
|
75 | - 'min' => '/js/common/jquery-ui.min.js' |
|
76 | - ), |
|
77 | - 'cdn' => array( |
|
78 | - 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js', |
|
79 | - 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js' |
|
80 | - ) |
|
81 | - ), |
|
82 | - JS_BOOTSTRAP => array( |
|
83 | - 'no' => array( |
|
84 | - 'no' => '/js/common/bootstrap.js', |
|
85 | - 'min' => '/js/common/bootstrap.min.js' |
|
86 | - ), |
|
87 | - 'cdn' => array( |
|
88 | - 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.js', |
|
89 | - 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js' |
|
90 | - ) |
|
91 | - ), |
|
92 | - JQUERY_VALIDATE => array( |
|
93 | - 'no' => array( |
|
94 | - 'no' => '/js/common/jquery.validate.js', |
|
95 | - 'min' => '/js/common/jquery.validate.min.js' |
|
96 | - ), |
|
97 | - 'cdn' => array( |
|
98 | - 'no' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.js', |
|
99 | - 'min' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js' |
|
100 | - ) |
|
101 | - ), |
|
102 | - JQUERY_TOUCH => array( |
|
103 | - 'no' => array( |
|
104 | - 'no' => '/js/common/jquery.ui.touch-punch.min.js', |
|
105 | - 'min' => '/js/common/jquery.ui.touch-punch.min.js' |
|
106 | - ), |
|
107 | - 'cdn' => array( |
|
108 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js', |
|
109 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' |
|
110 | - ) |
|
111 | - ), |
|
112 | - JS_TINYNAV => array( |
|
113 | - 'no' => array( |
|
114 | - 'no' => '/js/common/tinynav.js', |
|
115 | - 'min' => '/js/common/tinynav.min.js' |
|
116 | - ), |
|
117 | - 'cdn' => array( |
|
118 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.js', |
|
119 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.min.js' |
|
120 | - ) |
|
121 | - ), |
|
122 | - JS_BOOTSTRAP_FH => array( |
|
123 | - 'no' => array( |
|
124 | - 'no' => '/js/common/bootstrap-formhelpers.js', |
|
125 | - 'min' => '/js/common/bootstrap-formhelpers.min.js' |
|
126 | - ), |
|
127 | - 'cdn' => array( |
|
128 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.js', |
|
129 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.min.js' |
|
130 | - ) |
|
131 | - ), |
|
132 | - JS_BOOTSTRAP_SW => array( |
|
133 | - 'no' => array( |
|
134 | - 'no' => '/js/common/bootstrap-switch.js', |
|
135 | - 'min' => '/js/common/bootstrap-switch.min.js' |
|
136 | - ), |
|
137 | - 'cdn' => array( |
|
138 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.js', |
|
139 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js' |
|
140 | - ) |
|
141 | - ), |
|
142 | - JS_DATATABLE => array( |
|
143 | - 'no' => array( |
|
144 | - 'no' => '/js/common/jquery.dataTables.js', |
|
145 | - 'min' => '/js/common/jquery.dataTables.min.js' |
|
146 | - ), |
|
147 | - 'cdn' => array( |
|
148 | - 'no' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.js', |
|
149 | - 'min' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js' |
|
150 | - ) |
|
151 | - ), |
|
152 | - JS_CHART => array( |
|
153 | - 'no' => array( |
|
154 | - 'no' => '/js/common/Chart.js', |
|
155 | - 'min' => '/js/common/Chart.min.js' |
|
156 | - ), |
|
157 | - 'cdn' => array( |
|
158 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js', |
|
159 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js' |
|
160 | - ) |
|
161 | - ), |
|
162 | - JS_METISMENU => array( |
|
163 | - 'no' => array( |
|
164 | - 'no' => '/js/common/metisMenu.js', |
|
165 | - 'min' => '/js/common/metisMenu.min.js' |
|
166 | - ), |
|
167 | - 'cdn' => array( |
|
168 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.js', |
|
169 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.min.js' |
|
170 | - ) |
|
171 | - ), |
|
172 | - JS_BOOTBOX => array( |
|
173 | - 'no' => array( |
|
174 | - 'no' => '/js/common/bootbox.js', |
|
175 | - 'min' => '/js/common/bootbox.min.js' |
|
176 | - ), |
|
177 | - 'cdn' => array( |
|
178 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.js', |
|
179 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.min.js' |
|
180 | - ) |
|
181 | - ), |
|
182 | - JS_DATATABLE_ODATA => array( |
|
183 | - 'no' => array( |
|
184 | - 'no' => '/js/common/jquery.dataTables.odata.js', |
|
185 | - 'min' => '/js/common/jquery.dataTables.odata.js', |
|
186 | - ), |
|
187 | - 'cdn' => array( |
|
188 | - 'no' => '/js/common/jquery.dataTables.odata.js', |
|
189 | - 'min' => '/js/common/jquery.dataTables.odata.js', |
|
190 | - ) |
|
191 | - ), |
|
192 | - JS_CRYPTO_MD5_JS => array( |
|
193 | - 'no' => array( |
|
194 | - 'no' => '/js/common/md5.js', |
|
195 | - 'min' => '/js/common/md5.js', |
|
196 | - ), |
|
197 | - 'cdn' => array( |
|
198 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
199 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
200 | - ) |
|
201 | - ), |
|
202 | - JS_JCROP => array( |
|
203 | - 'no' => array( |
|
204 | - 'no' => '/js/common/jquery.Jcrop.min.js', |
|
205 | - 'min' => '/js/common/jquery.Jcrop.min.js' |
|
206 | - ), |
|
207 | - 'cdn' => array( |
|
208 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js', |
|
209 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js' |
|
210 | - ) |
|
211 | - ), |
|
212 | - JS_TYPEAHEAD => array( |
|
213 | - 'no' => array( |
|
214 | - 'no' => '/js/common/typeahead.bundle.js', |
|
215 | - 'min' => '/js/common/typeahead.bundle.min.js' |
|
216 | - ), |
|
217 | - 'cdn' => array( |
|
218 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.js', |
|
219 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.min.js' |
|
220 | - ) |
|
221 | - ), |
|
222 | - JS_FLIPSIDE => array( |
|
223 | - 'no' => array( |
|
224 | - 'no' => '/js/common/flipside.js', |
|
225 | - 'min' => '/js/common/flipside.min.js' |
|
226 | - ), |
|
227 | - 'cdn' => array( |
|
228 | - 'no' => '/js/common/flipside.js', |
|
229 | - 'min' => '/js/common/flipside.min.js' |
|
230 | - ) |
|
231 | - ), |
|
232 | - JS_LOGIN => array( |
|
233 | - 'no' => array( |
|
234 | - 'no' => '/js/common/login.js', |
|
235 | - 'min' => '/js/common/login.min.js' |
|
236 | - ), |
|
237 | - 'cdn' => array( |
|
238 | - 'no' => '/js/common/login.js', |
|
239 | - 'min' => '/js/common/login.min.js' |
|
240 | - ) |
|
241 | - ) |
|
62 | + JS_JQUERY => array( |
|
63 | + 'no' => array( |
|
64 | + 'no' => '/js/common/jquery.js', |
|
65 | + 'min' => '/js/common/jquery.min.js' |
|
66 | + ), |
|
67 | + 'cdn' => array( |
|
68 | + 'no' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.js', |
|
69 | + 'min' => '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js' |
|
70 | + ) |
|
71 | + ), |
|
72 | + JS_JQUERY_UI => array( |
|
73 | + 'no' => array( |
|
74 | + 'no' => '/js/common/jquery-ui.js', |
|
75 | + 'min' => '/js/common/jquery-ui.min.js' |
|
76 | + ), |
|
77 | + 'cdn' => array( |
|
78 | + 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js', |
|
79 | + 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js' |
|
80 | + ) |
|
81 | + ), |
|
82 | + JS_BOOTSTRAP => array( |
|
83 | + 'no' => array( |
|
84 | + 'no' => '/js/common/bootstrap.js', |
|
85 | + 'min' => '/js/common/bootstrap.min.js' |
|
86 | + ), |
|
87 | + 'cdn' => array( |
|
88 | + 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.js', |
|
89 | + 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js' |
|
90 | + ) |
|
91 | + ), |
|
92 | + JQUERY_VALIDATE => array( |
|
93 | + 'no' => array( |
|
94 | + 'no' => '/js/common/jquery.validate.js', |
|
95 | + 'min' => '/js/common/jquery.validate.min.js' |
|
96 | + ), |
|
97 | + 'cdn' => array( |
|
98 | + 'no' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.js', |
|
99 | + 'min' => '//ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js' |
|
100 | + ) |
|
101 | + ), |
|
102 | + JQUERY_TOUCH => array( |
|
103 | + 'no' => array( |
|
104 | + 'no' => '/js/common/jquery.ui.touch-punch.min.js', |
|
105 | + 'min' => '/js/common/jquery.ui.touch-punch.min.js' |
|
106 | + ), |
|
107 | + 'cdn' => array( |
|
108 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js', |
|
109 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js' |
|
110 | + ) |
|
111 | + ), |
|
112 | + JS_TINYNAV => array( |
|
113 | + 'no' => array( |
|
114 | + 'no' => '/js/common/tinynav.js', |
|
115 | + 'min' => '/js/common/tinynav.min.js' |
|
116 | + ), |
|
117 | + 'cdn' => array( |
|
118 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.js', |
|
119 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/TinyNav.js/1.2.0/tinynav.min.js' |
|
120 | + ) |
|
121 | + ), |
|
122 | + JS_BOOTSTRAP_FH => array( |
|
123 | + 'no' => array( |
|
124 | + 'no' => '/js/common/bootstrap-formhelpers.js', |
|
125 | + 'min' => '/js/common/bootstrap-formhelpers.min.js' |
|
126 | + ), |
|
127 | + 'cdn' => array( |
|
128 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.js', |
|
129 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/js/bootstrap-formhelpers.min.js' |
|
130 | + ) |
|
131 | + ), |
|
132 | + JS_BOOTSTRAP_SW => array( |
|
133 | + 'no' => array( |
|
134 | + 'no' => '/js/common/bootstrap-switch.js', |
|
135 | + 'min' => '/js/common/bootstrap-switch.min.js' |
|
136 | + ), |
|
137 | + 'cdn' => array( |
|
138 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.js', |
|
139 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js' |
|
140 | + ) |
|
141 | + ), |
|
142 | + JS_DATATABLE => array( |
|
143 | + 'no' => array( |
|
144 | + 'no' => '/js/common/jquery.dataTables.js', |
|
145 | + 'min' => '/js/common/jquery.dataTables.min.js' |
|
146 | + ), |
|
147 | + 'cdn' => array( |
|
148 | + 'no' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.js', |
|
149 | + 'min' => '//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js' |
|
150 | + ) |
|
151 | + ), |
|
152 | + JS_CHART => array( |
|
153 | + 'no' => array( |
|
154 | + 'no' => '/js/common/Chart.js', |
|
155 | + 'min' => '/js/common/Chart.min.js' |
|
156 | + ), |
|
157 | + 'cdn' => array( |
|
158 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js', |
|
159 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js' |
|
160 | + ) |
|
161 | + ), |
|
162 | + JS_METISMENU => array( |
|
163 | + 'no' => array( |
|
164 | + 'no' => '/js/common/metisMenu.js', |
|
165 | + 'min' => '/js/common/metisMenu.min.js' |
|
166 | + ), |
|
167 | + 'cdn' => array( |
|
168 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.js', |
|
169 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.2/metisMenu.min.js' |
|
170 | + ) |
|
171 | + ), |
|
172 | + JS_BOOTBOX => array( |
|
173 | + 'no' => array( |
|
174 | + 'no' => '/js/common/bootbox.js', |
|
175 | + 'min' => '/js/common/bootbox.min.js' |
|
176 | + ), |
|
177 | + 'cdn' => array( |
|
178 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.js', |
|
179 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.min.js' |
|
180 | + ) |
|
181 | + ), |
|
182 | + JS_DATATABLE_ODATA => array( |
|
183 | + 'no' => array( |
|
184 | + 'no' => '/js/common/jquery.dataTables.odata.js', |
|
185 | + 'min' => '/js/common/jquery.dataTables.odata.js', |
|
186 | + ), |
|
187 | + 'cdn' => array( |
|
188 | + 'no' => '/js/common/jquery.dataTables.odata.js', |
|
189 | + 'min' => '/js/common/jquery.dataTables.odata.js', |
|
190 | + ) |
|
191 | + ), |
|
192 | + JS_CRYPTO_MD5_JS => array( |
|
193 | + 'no' => array( |
|
194 | + 'no' => '/js/common/md5.js', |
|
195 | + 'min' => '/js/common/md5.js', |
|
196 | + ), |
|
197 | + 'cdn' => array( |
|
198 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
199 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js', |
|
200 | + ) |
|
201 | + ), |
|
202 | + JS_JCROP => array( |
|
203 | + 'no' => array( |
|
204 | + 'no' => '/js/common/jquery.Jcrop.min.js', |
|
205 | + 'min' => '/js/common/jquery.Jcrop.min.js' |
|
206 | + ), |
|
207 | + 'cdn' => array( |
|
208 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js', |
|
209 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js' |
|
210 | + ) |
|
211 | + ), |
|
212 | + JS_TYPEAHEAD => array( |
|
213 | + 'no' => array( |
|
214 | + 'no' => '/js/common/typeahead.bundle.js', |
|
215 | + 'min' => '/js/common/typeahead.bundle.min.js' |
|
216 | + ), |
|
217 | + 'cdn' => array( |
|
218 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.js', |
|
219 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.min.js' |
|
220 | + ) |
|
221 | + ), |
|
222 | + JS_FLIPSIDE => array( |
|
223 | + 'no' => array( |
|
224 | + 'no' => '/js/common/flipside.js', |
|
225 | + 'min' => '/js/common/flipside.min.js' |
|
226 | + ), |
|
227 | + 'cdn' => array( |
|
228 | + 'no' => '/js/common/flipside.js', |
|
229 | + 'min' => '/js/common/flipside.min.js' |
|
230 | + ) |
|
231 | + ), |
|
232 | + JS_LOGIN => array( |
|
233 | + 'no' => array( |
|
234 | + 'no' => '/js/common/login.js', |
|
235 | + 'min' => '/js/common/login.min.js' |
|
236 | + ), |
|
237 | + 'cdn' => array( |
|
238 | + 'no' => '/js/common/login.js', |
|
239 | + 'min' => '/js/common/login.min.js' |
|
240 | + ) |
|
241 | + ) |
|
242 | 242 | ); |
243 | 243 | |
244 | 244 | global $cssArray; |
245 | 245 | $cssArray = array( |
246 | 246 | CSS_JQUERY_UI => array( |
247 | 247 | 'no' => array( |
248 | - 'no' => '/css/common/jquery-ui.css', |
|
249 | - 'min' => '/css/common/jquery-ui.min.css' |
|
250 | - ), |
|
251 | - 'cdn' => array( |
|
252 | - 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css', |
|
253 | - 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css' |
|
254 | - ) |
|
248 | + 'no' => '/css/common/jquery-ui.css', |
|
249 | + 'min' => '/css/common/jquery-ui.min.css' |
|
250 | + ), |
|
251 | + 'cdn' => array( |
|
252 | + 'no' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css', |
|
253 | + 'min' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css' |
|
254 | + ) |
|
255 | 255 | ), |
256 | 256 | CSS_BOOTSTRAP => array( |
257 | - 'no' => array( |
|
258 | - 'no' => '/css/common/bootstrap.css', |
|
259 | - 'min' => '/css/common/bootstrap.min.css' |
|
260 | - ), |
|
261 | - 'cdn' => array( |
|
262 | - 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css', |
|
263 | - 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' |
|
264 | - ) |
|
257 | + 'no' => array( |
|
258 | + 'no' => '/css/common/bootstrap.css', |
|
259 | + 'min' => '/css/common/bootstrap.min.css' |
|
260 | + ), |
|
261 | + 'cdn' => array( |
|
262 | + 'no' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css', |
|
263 | + 'min' => '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' |
|
264 | + ) |
|
265 | 265 | ), |
266 | 266 | CSS_BOOTSTRAP_FH => array( |
267 | 267 | 'no' => array( |
268 | - 'no' => '/css/common/bootstrap-formhelpers.css', |
|
269 | - 'min' => '/css/common/bootstrap-formhelpers.min.css' |
|
270 | - ), |
|
271 | - 'cdn' => array( |
|
272 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.css', |
|
273 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.min.css' |
|
274 | - ) |
|
268 | + 'no' => '/css/common/bootstrap-formhelpers.css', |
|
269 | + 'min' => '/css/common/bootstrap-formhelpers.min.css' |
|
270 | + ), |
|
271 | + 'cdn' => array( |
|
272 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.css', |
|
273 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-formhelpers/2.3.0/css/bootstrap-formhelpers.min.css' |
|
274 | + ) |
|
275 | 275 | ), |
276 | 276 | CSS_BOOTSTRAP_SW => array( |
277 | - 'no' => array( |
|
278 | - 'no' => '/css/common/bootstrap-switch.css', |
|
279 | - 'min' => '/css/common/bootstrap-switch.min.css' |
|
280 | - ), |
|
281 | - 'cdn' => array( |
|
282 | - 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.css', |
|
283 | - 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css' |
|
284 | - ) |
|
277 | + 'no' => array( |
|
278 | + 'no' => '/css/common/bootstrap-switch.css', |
|
279 | + 'min' => '/css/common/bootstrap-switch.min.css' |
|
280 | + ), |
|
281 | + 'cdn' => array( |
|
282 | + 'no' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.css', |
|
283 | + 'min' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css' |
|
284 | + ) |
|
285 | 285 | ), |
286 | 286 | CSS_DATATABLE => array( |
287 | 287 | 'no' => array( |
288 | - 'no' => '/css/common/jquery.dataTables.css', |
|
289 | - 'min' => '/css/common/jquery.dataTables.min.css' |
|
290 | - ), |
|
291 | - 'cdn' => array( |
|
292 | - 'no' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.css', |
|
293 | - 'min' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css' |
|
294 | - ) |
|
288 | + 'no' => '/css/common/jquery.dataTables.css', |
|
289 | + 'min' => '/css/common/jquery.dataTables.min.css' |
|
290 | + ), |
|
291 | + 'cdn' => array( |
|
292 | + 'no' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.css', |
|
293 | + 'min' => '//cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css' |
|
294 | + ) |
|
295 | 295 | ), |
296 | 296 | CSS_JCROP => array( |
297 | 297 | 'no' => array( |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * We use the FlipsideSettings class for a list of sites and settings |
17 | 17 | * about CDNs and minified JS/CSS |
18 | 18 | */ |
19 | -if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
19 | +if (isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
20 | 20 | { |
21 | 21 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
22 | 22 | } |
@@ -30,32 +30,32 @@ discard block |
||
30 | 30 | */ |
31 | 31 | require_once('class.WebPage.php'); |
32 | 32 | |
33 | -define('JS_JQUERY', 0); |
|
34 | -define('JS_JQUERY_UI', 1); |
|
35 | -define('JS_BOOTSTRAP', 2); |
|
33 | +define('JS_JQUERY', 0); |
|
34 | +define('JS_JQUERY_UI', 1); |
|
35 | +define('JS_BOOTSTRAP', 2); |
|
36 | 36 | define('JQUERY_VALIDATE', 3); |
37 | -define('JQUERY_TOUCH', 4); |
|
38 | -define('JS_TINYNAV', 5); |
|
37 | +define('JQUERY_TOUCH', 4); |
|
38 | +define('JS_TINYNAV', 5); |
|
39 | 39 | define('JS_BOOTSTRAP_FH', 6); |
40 | 40 | define('JS_BOOTSTRAP_SW', 7); |
41 | -define('JS_DATATABLE', 8); |
|
42 | -define('JS_CHART', 9); |
|
43 | -define('JS_METISMENU', 10); |
|
44 | -define('JS_BOOTBOX', 11); |
|
41 | +define('JS_DATATABLE', 8); |
|
42 | +define('JS_CHART', 9); |
|
43 | +define('JS_METISMENU', 10); |
|
44 | +define('JS_BOOTBOX', 11); |
|
45 | 45 | define('JS_DATATABLE_ODATA', 12); |
46 | -define('JS_CRYPTO_MD5_JS', 13); |
|
47 | -define('JS_JCROP', 14); |
|
48 | -define('JS_TYPEAHEAD', 15); |
|
49 | -define('JS_FLIPSIDE', 20); |
|
50 | -define('JS_LOGIN', 21); |
|
51 | - |
|
52 | -define('CSS_JQUERY_UI', 0); |
|
53 | -define('CSS_BOOTSTRAP', 1); |
|
46 | +define('JS_CRYPTO_MD5_JS', 13); |
|
47 | +define('JS_JCROP', 14); |
|
48 | +define('JS_TYPEAHEAD', 15); |
|
49 | +define('JS_FLIPSIDE', 20); |
|
50 | +define('JS_LOGIN', 21); |
|
51 | + |
|
52 | +define('CSS_JQUERY_UI', 0); |
|
53 | +define('CSS_BOOTSTRAP', 1); |
|
54 | 54 | define('CSS_BOOTSTRAP_FH', 2); |
55 | 55 | define('CSS_BOOTSTRAP_SW', 3); |
56 | -define('CSS_DATATABLE', 4); |
|
57 | -define('CSS_JCROP', 5); |
|
58 | -define('CSS_FONTAWESOME', 6); |
|
56 | +define('CSS_DATATABLE', 4); |
|
57 | +define('CSS_JCROP', 5); |
|
58 | +define('CSS_FONTAWESOME', 6); |
|
59 | 59 | |
60 | 60 | global $jsArray; |
61 | 61 | $jsArray = array( |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @SuppressWarnings("StaticAccess") |
351 | 351 | */ |
352 | - function __construct($title, $header=true) |
|
352 | + function __construct($title, $header = true) |
|
353 | 353 | { |
354 | 354 | parent::__construct($title); |
355 | 355 | $this->setupVars(); |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | $this->notifications = array(); |
362 | 362 | $this->loginUrl = 'login.php'; |
363 | 363 | $this->logoutUrl = 'logout.php'; |
364 | - if(isset(FlipsideSettings::$global)) |
|
364 | + if (isset(FlipsideSettings::$global)) |
|
365 | 365 | { |
366 | - if(isset(FlipsideSettings::$global['login_url'])) |
|
366 | + if (isset(FlipsideSettings::$global['login_url'])) |
|
367 | 367 | { |
368 | 368 | $this->loginUrl = FlipsideSettings::$global['login_url']; |
369 | 369 | } |
370 | - if(isset(FlipsideSettings::$global['logout_url'])) |
|
370 | + if (isset(FlipsideSettings::$global['logout_url'])) |
|
371 | 371 | { |
372 | 372 | $this->logoutUrl = FlipsideSettings::$global['logout_url']; |
373 | 373 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | protected function getSites() |
384 | 384 | { |
385 | - if(isset(FlipsideSettings::$sites)) |
|
385 | + if (isset(FlipsideSettings::$sites)) |
|
386 | 386 | { |
387 | 387 | return FlipsideSettings::$sites; |
388 | 388 | } |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | */ |
399 | 399 | protected function addAllLinks() |
400 | 400 | { |
401 | - if($this->user === false || $this->user === null) |
|
401 | + if ($this->user === false || $this->user === null) |
|
402 | 402 | { |
403 | - if(isset($_SERVER['REQUEST_URI']) && strstr($_SERVER['REQUEST_URI'], 'logout.php') === false) |
|
403 | + if (isset($_SERVER['REQUEST_URI']) && strstr($_SERVER['REQUEST_URI'], 'logout.php') === false) |
|
404 | 404 | { |
405 | 405 | $this->addLink('Login', $this->loginUrl); |
406 | 406 | } |
@@ -423,16 +423,16 @@ discard block |
||
423 | 423 | */ |
424 | 424 | private function setupVars() |
425 | 425 | { |
426 | - if($this->minified !== null && $this->cdn !== null) return; |
|
426 | + if ($this->minified !== null && $this->cdn !== null) return; |
|
427 | 427 | $this->minified = 'min'; |
428 | 428 | $this->cdn = 'cdn'; |
429 | - if(isset(FlipsideSettings::$global)) |
|
429 | + if (isset(FlipsideSettings::$global)) |
|
430 | 430 | { |
431 | - if(isset(FlipsideSettings::$global['use_minified']) && !FlipsideSettings::$global['use_minified']) |
|
431 | + if (isset(FlipsideSettings::$global['use_minified']) && !FlipsideSettings::$global['use_minified']) |
|
432 | 432 | { |
433 | 433 | $this->minified = 'no'; |
434 | 434 | } |
435 | - if(isset(FlipsideSettings::$global['use_cdn']) && !FlipsideSettings::$global['use_cdn']) |
|
435 | + if (isset(FlipsideSettings::$global['use_cdn']) && !FlipsideSettings::$global['use_cdn']) |
|
436 | 436 | { |
437 | 437 | $this->cdn = 'no'; |
438 | 438 | } |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * |
448 | 448 | * @deprecated 2.0.0 Please use addJSByURI() instead |
449 | 449 | */ |
450 | - function add_js_from_src($src, $async=true) |
|
450 | + function add_js_from_src($src, $async = true) |
|
451 | 451 | { |
452 | 452 | $this->addJSByURI($src, $async); |
453 | 453 | } |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | * @param string $uri The webpath to the JavaScript file |
459 | 459 | * @param boolean $async Can the JavaScript be loaded asynchronously? |
460 | 460 | */ |
461 | - public function addJSByURI($uri, $async=true) |
|
461 | + public function addJSByURI($uri, $async = true) |
|
462 | 462 | { |
463 | 463 | $attributes = array('src'=>$uri, 'type'=>'text/javascript'); |
464 | - if($async === true) |
|
464 | + if ($async === true) |
|
465 | 465 | { |
466 | 466 | $attributes['async'] = true; |
467 | 467 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @deprecated 2.0.0 Please use addCSSByURI() instead |
481 | 481 | */ |
482 | - function add_css_from_src($src, $import=false) |
|
482 | + function add_css_from_src($src, $import = false) |
|
483 | 483 | { |
484 | 484 | $this->addCSSByURI($src, $import); |
485 | 485 | } |
@@ -490,10 +490,10 @@ discard block |
||
490 | 490 | * @param string $src The webpath to the Cascading Style Sheet file |
491 | 491 | * @param boolean $async Can the CSS be loaded asynchronously? |
492 | 492 | */ |
493 | - public function addCSSByURI($uri, $async=false) |
|
493 | + public function addCSSByURI($uri, $async = false) |
|
494 | 494 | { |
495 | 495 | $attributes = array('rel'=>'stylesheet', 'href'=>$uri, 'type'=>'text/css'); |
496 | - if($async === true && $this->importSupport === true) |
|
496 | + if ($async === true && $this->importSupport === true) |
|
497 | 497 | { |
498 | 498 | $attributes['rel'] = 'import'; |
499 | 499 | } |
@@ -509,12 +509,12 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @deprecated 2.0.0 Please use addWellKnownJS() instead |
511 | 511 | */ |
512 | - function addJS($type, $async=true) |
|
512 | + function addJS($type, $async = true) |
|
513 | 513 | { |
514 | 514 | $this->addWellKnownJS($type, $async); |
515 | 515 | } |
516 | 516 | |
517 | - function add_js($type, $async=true) |
|
517 | + function add_js($type, $async = true) |
|
518 | 518 | { |
519 | 519 | $this->addWellKnownJS($type, $async); |
520 | 520 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param string $jsFileID the ID of the JS file |
526 | 526 | * @param boolean $async Can the JS file be loaded asynchronously? |
527 | 527 | */ |
528 | - public function addWellKnownJS($jsFileID, $async=true) |
|
528 | + public function addWellKnownJS($jsFileID, $async = true) |
|
529 | 529 | { |
530 | 530 | global $jsArray; |
531 | 531 | $this->setupVars(); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @deprecated 2.0.0 Please use addWellKnownCSS() instead |
543 | 543 | */ |
544 | - function add_css($type, $import=false) |
|
544 | + function add_css($type, $import = false) |
|
545 | 545 | { |
546 | 546 | $this->addWellKnownCSS($type, $import); |
547 | 547 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * @param string $cssFileID the ID of the CSS file |
553 | 553 | * @param boolean $async Can the CSS file be loaded asynchronously? |
554 | 554 | */ |
555 | - public function addWellKnownCSS($cssFileID, $async=true) |
|
555 | + public function addWellKnownCSS($cssFileID, $async = true) |
|
556 | 556 | { |
557 | 557 | global $cssArray; |
558 | 558 | $this->setupVars(); |
@@ -575,16 +575,16 @@ discard block |
||
575 | 575 | $sites = $this->getSites(); |
576 | 576 | $names = array_keys($sites); |
577 | 577 | $ret = ''; |
578 | - foreach($names as $name) |
|
578 | + foreach ($names as $name) |
|
579 | 579 | { |
580 | - $ret.='<li>'.$this->createLink($name, $sites[$name]).'</li>'; |
|
580 | + $ret .= '<li>'.$this->createLink($name, $sites[$name]).'</li>'; |
|
581 | 581 | } |
582 | 582 | return $ret; |
583 | 583 | } |
584 | 584 | |
585 | 585 | protected function getHrefForDropdown(&$link) |
586 | 586 | { |
587 | - if(isset($link['_'])) |
|
587 | + if (isset($link['_'])) |
|
588 | 588 | { |
589 | 589 | $ret = $link['_']; |
590 | 590 | unset($link['_']); |
@@ -597,24 +597,24 @@ discard block |
||
597 | 597 | { |
598 | 598 | $ret = '<li class="dropdown">'; |
599 | 599 | $href = $this->getHrefForDropdown($link); |
600 | - $ret.= '<a href="'.$href.'" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.$name.' <span class="caret"></span></a>'; |
|
601 | - $ret.='<ul class="dropdown-menu">'; |
|
600 | + $ret .= '<a href="'.$href.'" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.$name.' <span class="caret"></span></a>'; |
|
601 | + $ret .= '<ul class="dropdown-menu">'; |
|
602 | 602 | $subNames = array_keys($link); |
603 | - foreach($subNames as $subName) |
|
603 | + foreach ($subNames as $subName) |
|
604 | 604 | { |
605 | - $ret.=$this->getLinkByName($subName, $link); |
|
605 | + $ret .= $this->getLinkByName($subName, $link); |
|
606 | 606 | } |
607 | - $ret.='</ul></li>'; |
|
607 | + $ret .= '</ul></li>'; |
|
608 | 608 | return $ret; |
609 | 609 | } |
610 | 610 | |
611 | 611 | protected function getLinkByName($name, $links) |
612 | 612 | { |
613 | - if(is_array($links[$name])) |
|
613 | + if (is_array($links[$name])) |
|
614 | 614 | { |
615 | 615 | return $this->getDropdown($links[$name], $name); |
616 | 616 | } |
617 | - if($links[$name] === false) |
|
617 | + if ($links[$name] === false) |
|
618 | 618 | { |
619 | 619 | return '<li>'.$name.'</li>'; |
620 | 620 | } |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | { |
626 | 626 | $names = array_keys($this->links); |
627 | 627 | $ret = ''; |
628 | - foreach($names as $name) |
|
628 | + foreach ($names as $name) |
|
629 | 629 | { |
630 | - $ret.=$this->getLinkByName($name, $this->links); |
|
630 | + $ret .= $this->getLinkByName($name, $this->links); |
|
631 | 631 | } |
632 | 632 | return $ret; |
633 | 633 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | { |
640 | 640 | $sites = $this->getSiteLinksForHeader(); |
641 | 641 | $links = $this->getLinksMenus(); |
642 | - $header ='<nav class="navbar navbar-default navbar-fixed-top"> |
|
642 | + $header = '<nav class="navbar navbar-default navbar-fixed-top"> |
|
643 | 643 | <div class="container-fluid"> |
644 | 644 | <!-- Brand and toggle get grouped for better mobile display --> |
645 | 645 | <div class="navbar-header"> |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | </div> |
669 | 669 | </nav>'; |
670 | 670 | $this->body = $header.$this->body; |
671 | - $this->body_tags.='style="padding-top: 60px;"'; |
|
671 | + $this->body_tags .= 'style="padding-top: 60px;"'; |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | /** Notification that is green for success */ |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @deprecated 2.0.0 Use the addNotification function instead |
691 | 691 | */ |
692 | - function add_notification($msg, $sev=self::NOTIFICATION_INFO, $dismissible=1) |
|
692 | + function add_notification($msg, $sev = self::NOTIFICATION_INFO, $dismissible = 1) |
|
693 | 693 | { |
694 | 694 | $notice = array('msg'=>$msg, 'sev'=>$sev, 'dismissible'=>$dismissible); |
695 | 695 | array_push($this->notifications, $notice); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * |
705 | 705 | * @deprecated 2.0.0 Use the addNotification function instead |
706 | 706 | */ |
707 | - public function addNotification($message, $severity=self::NOTIFICATION_INFO, $dismissible=true) |
|
707 | + public function addNotification($message, $severity = self::NOTIFICATION_INFO, $dismissible = true) |
|
708 | 708 | { |
709 | 709 | array_push($this->notificatons, array('msg'=>$message, 'sev'=>$severity, 'dismissible'=>$dismissible)); |
710 | 710 | } |
@@ -715,21 +715,21 @@ discard block |
||
715 | 715 | private function renderNotifications() |
716 | 716 | { |
717 | 717 | $count = count($this->notifications); |
718 | - if($count === 0) |
|
718 | + if ($count === 0) |
|
719 | 719 | { |
720 | 720 | return; |
721 | 721 | } |
722 | - for($i = 0; $i < $count; $i++) |
|
722 | + for ($i = 0; $i < $count; $i++) |
|
723 | 723 | { |
724 | 724 | $class = 'alert '.$this->notifications[$i]['sev']; |
725 | 725 | $button = ''; |
726 | - if($this->notifications[$i]['dismissible']) |
|
726 | + if ($this->notifications[$i]['dismissible']) |
|
727 | 727 | { |
728 | 728 | $class .= ' alert-dismissible'; |
729 | 729 | $button = '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; |
730 | 730 | } |
731 | 731 | $prefix = ''; |
732 | - switch($this->notifications[$i]['sev']) |
|
732 | + switch ($this->notifications[$i]['sev']) |
|
733 | 733 | { |
734 | 734 | case self::NOTIFICATION_INFO: |
735 | 735 | $prefix = '<strong>Notice:</strong> '; |
@@ -742,10 +742,10 @@ discard block |
||
742 | 742 | break; |
743 | 743 | } |
744 | 744 | $style = ''; |
745 | - if($i+1 < count($this->notifications)) |
|
745 | + if ($i + 1 < count($this->notifications)) |
|
746 | 746 | { |
747 | 747 | //Not the last notification, remove the end margin |
748 | - $style='style="margin: 0px;"'; |
|
748 | + $style = 'style="margin: 0px;"'; |
|
749 | 749 | } |
750 | 750 | $this->body = ' |
751 | 751 | <div class="'.$class.'" role="alert" '.$style.'> |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | */ |
774 | 774 | private function addAnalyticsBlock() |
775 | 775 | { |
776 | - if($this->analytics === false) |
|
776 | + if ($this->analytics === false) |
|
777 | 777 | { |
778 | 778 | return; |
779 | 779 | } |
@@ -795,12 +795,12 @@ discard block |
||
795 | 795 | * @param boolean $header Draw the header |
796 | 796 | * @param boolean $analytics Include analytics on the page |
797 | 797 | */ |
798 | - public function printPage($header=true) |
|
798 | + public function printPage($header = true) |
|
799 | 799 | { |
800 | 800 | $this->renderNotifications(); |
801 | 801 | $this->addNoScript(); |
802 | 802 | $this->addAnalyticsBlock(); |
803 | - if($this->header || $header) |
|
803 | + if ($this->header || $header) |
|
804 | 804 | { |
805 | 805 | $this->addHeader(); |
806 | 806 | } |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @deprecated 1.0.0 Use addLink instead |
818 | 818 | */ |
819 | - function add_link($name, $url=false, $submenu=false) |
|
819 | + function add_link($name, $url = false, $submenu = false) |
|
820 | 820 | { |
821 | 821 | $this->addLink($name, $url, $submenu); |
822 | 822 | } |
@@ -828,9 +828,9 @@ discard block |
||
828 | 828 | * @param false|string $url The URL to link to |
829 | 829 | * @param false|array $subment Any submenu items for the dropdown |
830 | 830 | */ |
831 | - public function addLink($name, $url=false, $submenu=false) |
|
831 | + public function addLink($name, $url = false, $submenu = false) |
|
832 | 832 | { |
833 | - if(is_array($submenu)) |
|
833 | + if (is_array($submenu)) |
|
834 | 834 | { |
835 | 835 | $submenu['_'] = $url; |
836 | 836 | $this->links[$name] = $submenu; |
@@ -852,11 +852,11 @@ discard block |
||
852 | 852 | $authLinks = $auth->getSupplementaryLinks(); |
853 | 853 | $authLinksStr = ''; |
854 | 854 | $count = count($authLinks); |
855 | - for($i = 0; $i < $count; $i++) |
|
855 | + for ($i = 0; $i < $count; $i++) |
|
856 | 856 | { |
857 | 857 | $authLinksStr .= $authLinks[$i]; |
858 | 858 | } |
859 | - if($count > 0) |
|
859 | + if ($count > 0) |
|
860 | 860 | { |
861 | 861 | $authLinksStr = 'Sign in with '.$authLinksStr; |
862 | 862 | } |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
20 | 20 | { |
21 | 21 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
22 | -} |
|
23 | -else |
|
22 | +} else |
|
24 | 23 | { |
25 | 24 | require_once('/var/www/secure_settings/class.FlipsideSettings.php'); |
26 | 25 | } |
@@ -404,8 +403,7 @@ discard block |
||
404 | 403 | { |
405 | 404 | $this->addLink('Login', $this->loginUrl); |
406 | 405 | } |
407 | - } |
|
408 | - else |
|
406 | + } else |
|
409 | 407 | { |
410 | 408 | $this->add_links(); |
411 | 409 | $this->addLink('Logout', $this->logoutUrl); |
@@ -423,7 +421,9 @@ discard block |
||
423 | 421 | */ |
424 | 422 | private function setupVars() |
425 | 423 | { |
426 | - if($this->minified !== null && $this->cdn !== null) return; |
|
424 | + if($this->minified !== null && $this->cdn !== null) { |
|
425 | + return; |
|
426 | + } |
|
427 | 427 | $this->minified = 'min'; |
428 | 428 | $this->cdn = 'cdn'; |
429 | 429 | if(isset(FlipsideSettings::$global)) |
@@ -834,8 +834,7 @@ discard block |
||
834 | 834 | { |
835 | 835 | $submenu['_'] = $url; |
836 | 836 | $this->links[$name] = $submenu; |
837 | - } |
|
838 | - else |
|
837 | + } else |
|
839 | 838 | { |
840 | 839 | $this->links[$name] = $url; |
841 | 840 | } |