git-svn-id: https://msi/svn/firstRepo/Service/branches/Manut_2.2.3@28 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+4
-1
@@ -14,7 +14,10 @@ $app = new \Slim\Slim();
|
||||
|
||||
$app->hook('slim.before.router', function () use ($app, $allowedHost) {
|
||||
$currentRefererRequest = $app->request()->getReferer();
|
||||
$currentRefererRequest = substr(substr($currentRefererRequest, 7), 0, strpos(substr($currentRefererRequest, 7), '/'));
|
||||
$currentRefererRequest = substr($currentRefererRequest, 7); //Senza http://
|
||||
$indexDoublePoint = strpos($currentRefererRequest, ':');
|
||||
$indexFirstSlash = strpos($currentRefererRequest, '/');
|
||||
$currentRefererRequest = substr($currentRefererRequest, 0, $indexDoublePoint > 0 && $indexDoublePoint < $indexFirstSlash ? $indexDoublePoint : $indexFirstSlash );
|
||||
if(!in_array($currentRefererRequest, $allowedHost))
|
||||
{
|
||||
$app->halt(500, "Generic error occurred");
|
||||
|
||||
Reference in New Issue
Block a user