/** * @return contast_router */ public static final function getInstance() { if (!isset(self::$_instance) || !self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) { $if_in_router_white = $this->check_router($request); if ($if_in_router_white) { contast_router::getInstance()->setIFrouterWhite(TRUE); } if (!Yaf_Session::getInstance()->get('userinfo') && !$if_in_router_white) { $request->setModuleName('Index'); $request->setControllerName('Login'); $request->setActionName('index'); } }
/** * 检测状态 */ private function check_login() { $this->set('userinfo', $this->userinfo); $this->set('user_id', $this->user_id); if ($this->userinfo == FALSE && !contast_router::getInstance()->getIfrouterWhite()) { $this->redirect(helper_common::site_url('login')); } }