public static function getAppInfo() { if (self::$app == NULL) { self::$app = new Application(); } return self::$app; }
public static function trigger_error($errmsg = '', $errtype = 0) { $app = Application::app(); if ($app != null) { $app->setErrorNo($errtype); $app->setErrorMsg($errmsg); } trigger_error($errmsg, $errtype); }
/** * Ініціалізація роутера */ public static function init() { $requestUrl = explode('/', $_SERVER['REQUEST_URI']); self::$controller = ucfirst(isset($requestUrl[1]) ? $requestUrl[1] : ''); self::$action = strtolower(isset($requestUrl[2]) ? $requestUrl[2] : ''); self::$id = strtolower(isset($requestUrl[3]) ? $requestUrl[3] : ''); if (!self::$controller) { self::$controller = Application::app()->getConfig('DefaultController'); } if (!self::$action) { self::$action = 'index'; } self::runController(); }
public static function set($_key, $_default = "") { if (empty($_key)) { return $_default; } $subkeys = explode('.', $_key); $_len = count($subkeys); if ($_len == 1) { Application::app()->{$subkeys}[0] = $_default; } else { if ($_len <= 2) { $_tobj = Application::app()->{$subkeys}[0]; if (is_array($_tobj) && isset($_tobj[$subkeys[1]])) { $_tobj[$subkeys[1]] = $_default; Application::app()->{$subkeys}[0] = $_tobj; } } } }
/** * 退出登录 */ public function loginoutAction() { $send['state'] = false; $params = $this->filterParams($this->_params); $model = new MobileModel(); $patternArr = Application::app()->getConfig()->application->environment; $configArr = $patternArr->toArray(); $pattern = $configArr['mode']; // 移动端已修改用户退出方案,这里不论私有云还是公有云,都只退出当前移动终端上的app if ($pattern == 'public') { $res = $model->loginOutPublicCloud($params); } else { $res = $model->loginOutPublicCloud($params); } if (!$res) { $send['error'] = 'Loginout failed'; } else { $send['state'] = true; $send['data']['message'] = 'success'; } $this->sendOutput($send); }
/** * returns the application * * @return Yaf_Application */ public function getApplication() { return Application::app(); }
/** * Static method to initialise the application * * This method is called from {@link index.php} and inititalises the an application of * the class defined in {@link sys.config.php}. When developing an application with * RocketSled, you will usually override the Application class of an 'Application * Level Package'. In order for that class to be used by RocketSled, you need to set * the required constant in {@link sys.config.php}, and then it will be returned by * {@link index.php}'s call to Application::appInit(). * * The Application::appInit() function also calls several functions that setup the * application, which also give any overriding applications a good chance to do some * things they may required: * - {@link Application::systemSetup()} * - {@link Application::initUser()} * - {@link Application::siteNavigationInit()} * * @return Application - an initialised application class * @see Session,User,SiteNavigation,NavigationItem,sys.config.php * @access public * @static */ public static function appInit() { Application::initSession(); $app_class = constant('APPLICATION'); self::$app = new $app_class(); $ret = self::$app; $ret->systemSetup(); $ret->initUser(); $ret->siteNavigationInit(); $ret->setRedirectionListener(Display::current(false)); $ret->fetchRedirectedParameters(); return $ret; }
public function __construct() { $this->application = Application::app(); }
public static function checkController($_name) { self::$_router->strNameSpace = sprintf("\\%s\\%s\\Controller\\%s", Application::app()->src, self::$_router->getAppName(), $_name); $controller = self::$_router->getControllerNameSpace(); if (is_file(self::$appsPath . sprintf("%s/Controller/%s.php", self::$_router->getAppName(), $_name)) && class_exists(self::$_router->strNameSpace)) { self::$_router->setController(new $controller()); return true; } return false; }
/** * 最小的ID 是Admin */ public function isSuperAdmin() { if (!$this->isLogin()) { redirect('index/login'); } Session::getInstance()->set('redirect', Application::app()->request()->curUrl()); $db = \hmvc\Db\Db::getConnection(); $user = $db->getRow("SELECT MIN( id ) as id FROM `h_admin`"); if ($user['id'] == $this->session->get('auth.id')) { return true; } return false; }
public function urlRef() { $rtn = Application::session()->get('hurlref'); return $rtn ? $rtn : Application::app()->request()->curUrl(); }
public static function app() { return Application::app(); }