function execute() { $app_name = Request::get('app_name'); $module = $_REQUEST['module'] ? $_REQUEST['module'] : 'backend'; $action = $_REQUEST['action'] ? $_REQUEST['action'] : 'main'; Request::get('module', $module); Request::get('action', $action); App::$activeAppName = strtolower($app_name); App::$activeAppDir = APP_DIR . DS . $app_name . DS; if (App::hasAppMethod($app_name, 'beforeBackend')) { App::callAppMethod($app_name, 'beforeBackend'); } Load::Action(APP_DIR . DS . Request::get('app_name') . DS, Request::get('action'), Request::get('app_name')); if (App::hasAppMethod($app_name, 'afterBackend')) { App::callAppMethod($app_name, 'afterBackend'); } return false; }
static function load($app_name) { $apps = self::getAppList(); if (!isset($apps[$app_name])) { return; } $app_dir = $apps[$app_name]; self::$activeAppName = strtolower($app_name); self::$activeAppDir = $app_dir; $route_file_name = String::glue($app_dir, DS, APP_CONFIG_DIR, DS, 'route.php'); if (php_sapi_name() != 'cli') { try { Route::setActive(Route::getPath(), file_exists($route_file_name) ? include $route_file_name : array(), true); } catch (Exception $e) { self::parseError($e, $app_name); } } self::setDefaultParams(); // Abort this code, but later if (!Auth::loged() && Core::isSecure(Request::get('module')) && Request::get('module') != 'login' && false) { if (php_sapi_name() == 'cli') { echo 'Auth Error'; exit; } Request::redirect('/login/' . (Request::get(Route::$path) ? '&return=' . Request::get(Route::$path) : '')); } // Settings::load('core', CORE_CONFIG_DIR . DS); self::loadDependences($app_dir); Settings::load($app_name); App::startApp($app_name); try { Load::Action($app_dir . DS, Request::get('action')); } catch (Exception $e) { self::parseError($e, $app_name); } App::endApp($app_name); Language::translate(Language::getActiveLanguageISO()); }