This commit is contained in:
Ruben 2016-11-03 03:43:08 +01:00
parent 6a0bef07fb
commit 9fc3de9bd3
1 changed files with 22 additions and 0 deletions

View File

@ -27,6 +27,17 @@ class InterfaceControllerProvider implements ControllerProviderInterface
// /interface/game/last
$controllers->get('/games/last', function (Application $app) {
$http_origin = $_SERVER['HTTP_ORIGIN'];
if ($http_origin == "https://emotionhero.com" || $http_origin == "http://emotionhero.com")
{
header("Access-Control-Allow-Origin: $http_origin");
// header("Access-Control-Allow-Origin: https://emotionhero.com");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS");
header("Access-Control-Allow-Headers: X-PINGOTHER");
header("Access-Control-Max-Age: 1728000");
}
$gameRepo = $this->_eh->getEm()->getRepository(\EmotionHero\Models\Game::class);
/* @var $hitRepo EmotionHero\Models\HitRepository */
$hitRepo = $this->_eh->getEm()->getRepository(\EmotionHero\Models\Hit::class);
@ -106,6 +117,17 @@ class InterfaceControllerProvider implements ControllerProviderInterface
// /interface/images
$controllers->get('/images', function (Application $app) {
$http_origin = $_SERVER['HTTP_ORIGIN'];
if ($http_origin == "https://emotionhero.com" || $http_origin == "http://emotionhero.com")
{
header("Access-Control-Allow-Origin: $http_origin");
// header("Access-Control-Allow-Origin: https://emotionhero.com");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS");
header("Access-Control-Allow-Headers: X-PINGOTHER");
header("Access-Control-Max-Age: 1728000");
}
$getEmoBlocks = function($emotion, $feature, $steps = 6) {
$hitRepo = $this->_eh->getEm()->getRepository(Models\Hit::class);
$blocks = [];