BurningFlipside /
Profiles
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | require_once('vendor/autoload.php'); |
||
| 3 | require_once('class.AuthProvider.php'); |
||
| 4 | |||
| 5 | if($_SERVER['REQUEST_URI'][0] == '/' && $_SERVER['REQUEST_URI'][1] == '/') |
||
| 6 | { |
||
| 7 | $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 1); |
||
| 8 | } |
||
| 9 | |||
| 10 | $app = new \Slim\App(); |
||
| 11 | $app->get('/callbacks/{host}', 'oauthCallback'); |
||
| 12 | |||
| 13 | function oauthCallback($request, $response, $args) |
||
|
0 ignored issues
–
show
|
|||
| 14 | { |
||
| 15 | $host = $args['host']; |
||
| 16 | $auth = AuthProvider::getInstance(); |
||
| 17 | $provider = $auth->getSuplementalProviderByHost($host); |
||
| 18 | if($provider === false) |
||
| 19 | { |
||
| 20 | return $response->withStatus(404); |
||
| 21 | } |
||
| 22 | $res = $provider->authenticate($app->request->get(), $currentUser); |
||
|
0 ignored issues
–
show
|
|||
| 23 | switch($res) |
||
| 24 | { |
||
| 25 | case \Auth\Authenticator::SUCCESS: |
||
| 26 | $response = $response->withHeader('Location', '/'); |
||
| 27 | break; |
||
| 28 | default: |
||
| 29 | case \Auth\Authenticator::LOGIN_FAILED: |
||
|
0 ignored issues
–
show
case \Auth\Authenticator...?failed=1'); break; does not seem to be reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last Loading history...
|
|||
| 30 | $response = $response->withHeader('Location', '/login.php?failed=1'); |
||
| 31 | break; |
||
| 32 | case \Auth\Authenticator::ALREADY_PRESENT: |
||
| 33 | $response = $response->withHeader('Location', '/user_exists.php?src='.$host.'&uid='.$currentUser->getUID()); |
||
| 34 | break; |
||
| 35 | } |
||
| 36 | return $response->withStatus(302); |
||
| 37 | } |
||
| 38 | |||
| 39 | $app->run(); |
||
| 40 | ?> |
||
|
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. Loading history...
|
|||
| 41 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.