示例#1
0
 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 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);
         }
     }
 }
示例#3
0
文件: Paginator.php 项目: kevinwan/xf
 /**
  * 执行分页
  */
 public function run()
 {
     $this->_request = XF_Controller_Request_Http::getInstance();
     $this->_params = $this->_request->getCustomParams(false);
     $page = $this->_request->getParam($this->_paginator_param, FALSE) ? intval($this->_request->getParam($this->_paginator_param)) : 1;
     $this->_page = $page;
     //重置最大页数
     if (is_numeric($this->_max_page_size) && $this->_max_page_size > 0 && $this->_page_count > $this->_max_page_size) {
         $this->_page_count = $this->_max_page_size;
     }
     $this->_getDiyResultByArray();
     $this->nowbar();
     //重置相关设置
     $this->setCustomUrl();
     $this->setPaginatorParamName();
     $this->setNowBarCount();
 }