* * see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS */ if (AppConfig::get('security.cors.enabled', false)) { $continue = cross_origin_resource_sharing(AppConfig::get('security.cors.allowed-origins', []), AppConfig::get('security.cors.allow-credentials', false)); if (!$continue) { die; } unset($continue); } /* * get a router to handle and generate URLs. */ require_once APPDIR . '/router.class.php'; $router = new AppRouter(); $router->decode_url($_SERVER['REQUEST_URI']); /* * Find the controller that registered for the requested URI. Note that here * $_REQUEST['controller'] stand for an alias and not a controller class, hence * the need of the router's logic. */ $controller = $router->find_route(isset($_REQUEST['controller']) ? $_REQUEST['controller'] : NULL, isset($_REQUEST['action']) ? $_REQUEST['action'] : NULL, $_SERVER['REQUEST_METHOD']); if (is_null($controller)) { require_once APPDIR . '/controllers/error.class.php'; $controller = new ErrorController(No2_HTTP::NOT_FOUND); } /* * Execute the requested action in order to be able to render the ressource. */ invoke_it: if (No2_Logger::$level >= No2_Logger::DEBUG) {