protected function __construct() { $uri = array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : $_SERVER['PATH_INFO']; $this->uri = self::clean_uri($uri); if ($match = moojon_routes::map($this->uri)) { $config = array_merge(moojon_config::get_data(), moojon_config::read(moojon_paths::get_project_config_environment_app_directory(ENVIRONMENT, $match->get('app')))); if (array_key_exists('secure', $config) && $config['secure'] === true && !moojon_security::authenticate()) { moojon_cache::disable(); $pattern = ':app/:controller/:action'; $match = new moojon_route_match($pattern, array_merge($match->get_params(), array('app' => $config['security_app'], 'controller' => $config['security_controller'], 'action' => $config['security_action'])), new moojon_route($pattern)); $this->uri = $config['security_app'] . '/' . $config['security_controller'] . '/' . $config['security_action']; } $this->match = $match; $this->data = $this->match->get_params(); $this->route = $this->match->get_route(); self::try_define('APP', $this->data['app']); self::try_define('CONTROLLER', $this->data['controller']); self::try_define('ACTION', $this->data['action']); } else { self::_404($this->uri); } }