be2b6953e2ec4c3aea768ec54cd21ec759520c78
3 require_once('../vendor/autoload.php');
5 $config = require('../config/app.php');
7 // Allow these origins to do cross domain JS.
8 header("Access-Control-Allow-Origin: " . $config['allow-origin']);
9 header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
12 if($config['mode'] == 'production')
14 ini_set('display_errors', 0);
15 set_exception_handler(array('\Services\StatusReporter', 'exception'));
17 ini_set('display_errors', 1);
18 error_reporting(E_ALL
);
21 // Everything time related should be UTC+0 based
22 date_default_timezone_set('UTC');
24 // Set up the DI container
25 $containerBuilder = new DI\
ContainerBuilder();
26 $containerBuilder->addDefinitions('../config/DI.php');
27 $containerBuilder->useAutowiring(true
);
29 $container = $containerBuilder->build();
31 /* @var $router Services\Routing\IRouter */
32 $router = $container->get('Services\Routing\IRouter');
34 $controllerName= $router->getControllerName();
35 $controllerAction = $router->getActionName();
36 $controllerActionArgs = $router->getActionArgs();
38 $controller = $container->get('Controllers\\' . ucfirst($controllerName) . 'Controller' );
40 // Last thing to do, call the action on the specified controller.
41 call_user_func_array(array($controller, $controllerAction . 'Action'), $controllerActionArgs);