-
-
Save ganey/fe539b2431eefaf5401b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This is a fork of https://gist.github.com/frzsombor/ddd0e11f93885060ef35 | |
Thanks frzsombor! | |
|-------------------------------------------------------------------------- | |
| Checking the Sentry Auth for CKFinder CheckAuthentication | |
|-------------------------------------------------------------------------- | |
| Put in the CKFinder config.php within the CheckAuthentication() function. | |
| | |
| The following code is tested with Laravel 4.2.11 | |
| | |
| Last update: 2015-01-09 | |
| | |
*/ | |
$isAuthorized = false; | |
try { | |
require $_SERVER['DOCUMENT_ROOT'] . '/../bootstrap/autoload.php'; | |
$app = require_once $_SERVER['DOCUMENT_ROOT'] . '/../bootstrap/start.php'; | |
$request = $app['request']; | |
$client = (new \Stack\Builder) | |
->push('Illuminate\Cookie\Guard', $app['encrypter']) | |
->push('Illuminate\Cookie\Queue', $app['cookie']) | |
->push('Illuminate\Session\Middleware', $app['session'], null); | |
$stack = $client->resolve($app); | |
$stack->handle($request); | |
if (class_exists('Sentry')) { | |
$isAuthorized = Sentry::check(); | |
} | |
} catch (Exception $e) { | |
$isAuthorized = false; | |
} | |
return $isAuthorized?true:false; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment