<?php class Lib_HttpAccessDeniedException extends FuelException { public function handle() { $response = new \Response(\View::forge('403'), 403); \Event::shutdown(); $response->send(true); } public function __construct($message, $code = 0) { parent::__construct($message, $code); } public function __toString() { return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; } public static function _init() { } public static function show_403() { logger(\Fuel::L_WARNING, 'This method is deprecated. Please use a HttpAccessDeniedException instead.', __METHOD__); $error = 'Access Denied'; throw new Lib_HttpAccessDeniedException($error); } }
// Generate the request, execute it and send the output. try { $response = Request::forge()->execute()->response(); } catch (HttpNotFoundException $e) { $route = array_key_exists('_404_', Router::$routes) ? Router::$routes['_404_']->translation : Config::get('routes._404_'); if ($route) { $response = Request::forge($route)->execute()->response(); } else { throw $e; } } catch (\Lib_HttpAccessDeniedException $e) { $route = array_key_exists('_403_', Router::$routes) ? Router::$routes['_403_']->translation : Config::get('routes._403_'); if ($route) { $response = Request::forge($route)->execute()->response(); } else { throw $e; } }
'_403_' => 'welcome/403', // The main 403 route
if(!Auth::has_access("$class_name.$action") && Auth::check()) { Lib_HttpAccessDeniedException::show_403(); }
if (!Auth::has_access("$class_name.$action") && Auth::check()) { throw new Lib_HttpAccessDeniedException(); }instead of calling the deprecated method? And I don't think that Auth::check() is needed. If not logged in, has_access() will return false anyway.
It looks like you're new here. If you want to get involved, click one of these buttons!