Exemplo n.º 1
0
 /**
  * 启动路由器
  * @access public
  * @return void
  */
 public function run()
 {
     $this->_request = XF_Controller_Request_Http::getInstance();
     $this->_getFinalUri();
     $status = $this->_validateRewrite();
     if ($status == false) {
         //是否启用默认路由规则
         if (XF_Config::getInstance()->isUseDefaultRouter() == false) {
             if ($this->_final_uri != '' && $this->_final_uri != '/' && $this->_final_uri != '/index.php') {
                 throw new XF_Controller_Router_Exception('404 Not found!', 404);
             } else {
                 $this->_setDefault();
             }
         } else {
             $this->_start();
         }
     }
     //当前分析到的模块是否有效
     if ($this->_request->getModule() == 'unknown') {
         throw new XF_Controller_Router_Exception('404 Not found!', 404);
     }
     if (strtolower($this->_request->getModule()) != 'default' && $this->_close_all_module === true && !isset($this->_open_modules[strtolower($this->_request->getModule())])) {
         throw new XF_Controller_Router_Exception('The module is close', 404);
     }
     if (isset($this->_close_modules[strtolower($this->_request->getModule())])) {
         throw new XF_Controller_Router_Exception('The module is close', 404);
     }
     //当前Action是否禁用了默认路由
     if ($this->_request_default_route === TRUE) {
         if (isset($this->_disabled_default_routes[strtolower($this->_request->getModule() . $this->_request->getController() . $this->_request->getAction())])) {
             throw new XF_Controller_Router_Exception('The action default router disabled', 404);
         }
     }
     $this->_readOldRequestParams();
 }
Exemplo n.º 2
0
 /**
  * 获取当前Action最终对应的缓存标识
  * @access private
  * @param string
  */
 private function getCacheSign()
 {
     $sign = $this->__cacheSign($this->_request->getAction());
     if ($sign == '') {
         if ($this->_cache_time > 0) {
             return md5($this->_request->getModule() . $this->_request->getController() . $this->_request->getAction() . serialize($this->_request->getCustomParams(false)));
         }
         return '';
     }
     return md5($sign);
 }