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']);
11 if($config['mode'] == 'production')
13 ini_set('display_errors', 0);
14 set_exception_handler(array('\Services\StatusReporter', 'exception'));
17 // Everything time related should be UTC+0 based
18 date_default_timezone_set('UTC');
20 // Set up the DI container
21 $containerBuilder = new DI\
ContainerBuilder();
22 $containerBuilder->addDefinitions('../config/DI.php');
23 $containerBuilder->useAutowiring(true
);
25 $container = $containerBuilder->build();
27 /* @var $router Services\Routing\IRouter */
28 $router = $container->get('Services\Routing\IRouter');
30 $controllerName= $router->getControllerName();
31 $controllerAction = $router->getActionName();
32 $controllerActionArgs = $router->getActionArgs();
34 $controller = $container->get('Controllers\\' . ucfirst($controllerName) . 'Controller' );
36 // Last thing to do, call the action on the specified controller.
37 call_user_func_array(array($controller, $controllerAction . 'Action'), $controllerActionArgs);