/** * Handle exception * * @param Exception $e */ public static function handle(Exception $e) { if ($e instanceof Kohana_404_Exception) { if (Kohana::config('site.inviteonly') && !Visitor::instance()->get_user()) { // Redirect to invite login if invite only and not logged in url::redirect('invite'); } else { if (!headers_sent()) { $e->sendHeaders(); } $page = new Error_Controller(); $page->_404(); } } else { return parent::handle($e); } }