admin) { access::forbidden(); } parent::__construct(); } public function __call($controller_name, $args) { if (auth::must_reauth_for_admin_area()) { return self::_prompt_for_reauth($controller_name, $args); } if (request::method() == "post") { access::verify_csrf(); } if ($controller_name == "index") { $controller_name = "dashboard"; } $controller_name = "Admin_{$controller_name}_Controller"; if ($args) { $method = array_shift($args); } else { $method = "index"; } if (!method_exists($controller_name, $method)) { throw new Kohana_404_Exception(); } call_user_func_array(array(new $controller_name, $method), $args); } private static function _prompt_for_reauth($controller_name, $args) { if (request::method() == "get" && !request::is_ajax()) { $url_args = array("admin", $controller_name) + $args; $continue_url = join("/", $url_args); // Avoid anti-phishing protection by passing the url as session variable. Session::instance()->set("continue_url", $continue_url); } url::redirect("reauthenticate"); } }