public function __melody_invoke($method, $args) { $role = isset($_SESSION[Config::Core_get('session_content_varname')][Config::Core_get('access_role_session_key')]) ? $_SESSION[Config::Core_get('session_content_varname')][Config::Core_get('access_role_session_key')] : Config::Core_get('access_role_if_missing'); $access_role = isset($this->method_access[$method]) ? $this->method_access[$method] : (!is_null(Config::get('access_role_app')) ? Config::get('access_role_app') : Config::Core_get('access_role_default')); if ($role >= $access_role) { $class = get_class($this); if (false === ($cache = Cache::get('controller', $class . '_' . $method))) { ob_start(); $__melody_response = call_user_func_array(array($this, $method), $args); $buffer = ob_get_clean(); echo self::execute_view($__melody_response, $buffer, $class, $args[0]); } else { echo $cache; } } else { FrontController::throwError(403); } }
static function init($rootDir, $dev = false) { session_start(); self::$root = $rootDir; define('ROOT', self::$root); define('DEV_ENV', $dev); define('PROD_ENV', !$dev); $autoloader = new Autoloader(); $autoloader->registerAutoload(); if ($dev) { @Tools::rrmdir(ROOT . DIRECTORY_SEPARATOR . 'private' . DIRECTORY_SEPARATOR . 'cache'); } //include(__DIR__.DIRECTORY_SEPARATOR.'alias.php'); Config::Init(); if (!empty(Config::Core_get('session_user_lifetime'))) { ini_set('session.cookie_lifetime', Config::Core_get('session_client_lifetime')); ini_set('session.gc_maxlifetime', Config::Core_get('session_server_lifetime')); } }
public function __unset($name) { unset($_SESSION[Config::Core_get('session_content_varname')][$name]); }
public function getReferer($num = 0) { return $_SESSION[Config::Core_get('session_history_varname')][$num]; }