git-svn-id: https://msi/svn/firstRepo/Service/branches/Manut_2.2.3@28 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2015-02-01 09:49:26 +00:00
parent d7010a19ca
commit 42837e9ee9
6 changed files with 76 additions and 37 deletions
+4 -1
View File
@@ -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");