@@ -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,32 +551,32 @@ 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 | } |
| 566 | 566 | return true; |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - public function getUserByAccessCode($key, $methodName=false) |
|
| 569 | + public function getUserByAccessCode($key, $methodName = false) |
|
| 570 | 570 | { |
| 571 | - if($methodName === false) |
|
| 571 | + if ($methodName === false) |
|
| 572 | 572 | { |
| 573 | 573 | $count = count($this->methods); |
| 574 | - for($i = 0; $i < $count; $i++) |
|
| 574 | + for ($i = 0; $i < $count; $i++) |
|
| 575 | 575 | { |
| 576 | - if($this->methods[$i]->current === false) continue; |
|
| 576 | + if ($this->methods[$i]->current === false) continue; |
|
| 577 | 577 | |
| 578 | 578 | $ret = $this->methods[$i]->getUserByAccessCode($key); |
| 579 | - if($ret !== false) |
|
| 579 | + if ($ret !== false) |
|
| 580 | 580 | { |
| 581 | 581 | return $ret; |
| 582 | 582 | } |
@@ -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 | { |
@@ -573,7 +584,9 @@ discard block |
||
| 573 | 584 | $count = count($this->methods); |
| 574 | 585 | for($i = 0; $i < $count; $i++) |
| 575 | 586 | { |
| 576 | - if($this->methods[$i]->current === false) continue; |
|
| 587 | + if($this->methods[$i]->current === false) { |
|
| 588 | + continue; |
|
| 589 | + } |
|
| 577 | 590 | |
| 578 | 591 | $ret = $this->methods[$i]->getUserByAccessCode($key); |
| 579 | 592 | if($ret !== false) |