/** * Generate a Response for the 401 Exception. * * The user should be redirect to a login page. * * @return Response */ public function get_response() { Flash::set('protected_page', Context::instance()->get_page()); if (($page = Model_Page_Front::findByField('behavior_id', 'protected_page')) !== FALSE) { return Request::factory($page->url)->execute(); } throw new HTTP_Exception_401($this->message); }
public function get_response() { $ext = pathinfo(Request::current()->url(), PATHINFO_EXTENSION); $mimetype = FALSE; if ($ext and !($mimetype = File::mime_by_ext($ext))) { $mimetype = 'application/octet-stream'; } if ($mimetype and $mimetype !== 'text/html') { return Response::factory()->headers('content-type', $mimetype)->status(404); } if (($page = Model_Page_Front::findByField('behavior_id', 'page_not_found')) !== FALSE) { return Request::factory($page->url)->query('message', $this->message)->execute()->status(404); } throw new HTTP_Exception_404('Something went wrong'); }