コード例 #1
0
ファイル: Main.php プロジェクト: kevinwan/gongpingjiaPHP
 public function routeShutdown(XF_Controller_Request_Abstract $request)
 {
     //如果存在强制清除缓存命令
     $auth = new XF_Auth_Storage_Session();
     if ($auth->isEmpty() == false && $auth->read()->role_id != '0') {
         if ($request->getParam('clear') == 'cache') {
             XF_DataPool::getInstance()->add('clearCache', TRUE);
         }
         if ($request->getParam('clear') == 'action') {
             XF_DataPool::getInstance()->add('clearActionCache', TRUE);
         }
     }
     //自动清除缓存
     if ($request->getParam('autoclear') == 'true') {
         XF_DataPool::getInstance()->add('clearActionCache', TRUE);
     }
     //获取用户当前真实的地区id
     $data = array('id' => '1', 'name' => '北京', 'pinyin' => 'beijing');
     $ip = new Application_Model_IP();
     $ip->table()->setAssociatedAuto('city');
     $row = $ip->getByIP($request->getClientIp());
     if ($row != false) {
         $data = array('id' => $row->province_id, 'name' => $row->city_province_id->name, 'pinyin' => $row->city_province_id->pinyin);
     }
     XF_View::getInstance()->assign('trueCity', (object) $data);
 }
コード例 #2
0
 public function __construct($controller)
 {
     parent::__construct($controller);
     //获取用户登录信息
     $auth = new XF_Auth_Storage_Session();
     if ($auth->isEmpty() == FALSE) {
         $this->_auth = $auth->read();
     }
 }
コード例 #3
0
ファイル: Front.php プロジェクト: kevinwan/gongpingjiaPHP
 public function routeShutdown(XF_Controller_Request_Abstract $request)
 {
     //检测访问权限
     $m = $request->getModule();
     $c = $request->getController();
     if ($m == 'user' && $c != 'front') {
         $auth = new XF_Auth_Storage_Session();
         if ($auth->isEmpty()) {
             XF_Functions::go('/login/?redirect_url=' . urlencode($request->getRequestUrl()));
         }
     }
     //如果存在强制清除缓存命令
     $auth = new XF_Auth_Storage_Session();
     if ($auth->isEmpty() == false && $auth->read()->role_id != '0') {
         if ($request->getParam('clear') == 'cache') {
             XF_DataPool::getInstance()->add('clearCache', TRUE);
         }
         if ($request->getParam('clear') == 'action') {
             XF_DataPool::getInstance()->add('clearActionCache', TRUE);
         }
     }
 }