コード例 #1
0
ファイル: Main.php プロジェクト: kevinwan/gongpingjiaPHP
 /**
  * 检测二级域名
  */
 protected function initCheckDomain()
 {
     $cookie = new XF_Cookie('local');
     $tmp = explode('.', $_SERVER['HTTP_HOST']);
     //是否为地区二级域名
     if (isset($this->_cityDomains->{$tmp[0]})) {
         $this->_nowCityDomain = (object) $this->_cityDomains->{$tmp[0]};
         $this->_nowCityDomain->pinyin = $tmp[0];
         //记录当前浏览的地区id
         $cookie->write($this->_nowCityDomain->id, 604800, '/', '.' . $this->_config->getDomain());
     } else {
         //记录当前浏览的地区id
         $cookie->write(1, 604800, '/', '.' . $this->_config->getDomain());
         XF_Functions::go('http://beijing.' . $this->_config->getDomain());
     }
 }
コード例 #2
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);
         }
     }
 }
コード例 #3
0
 protected function __cacheSign($action_name)
 {
     switch ($action_name) {
         case 'index':
             //是否存在跳转url
             if ($val = $this->getParam('redirect_url')) {
                 //二手车随便看看
                 if (strpos($val, '/used/index/index') !== false) {
                     XF_Functions::go('/used/index/index');
                 } elseif (preg_match_all("/\\/sellreport\\/(\\d+)\\/(.*?)\\/(\\d+)\\/(\\d+)\\/(\\d+)\\//", $this->getParam('redirect_url'), $matchs)) {
                     XF_Functions::go('/sellreport/' . $matchs[1][0] . '/');
                 } elseif (preg_match_all("/\\/buyreport\\/(\\d+)\\/(.*?)\\/(\\d+)\\/(\\d+)\\/(\\d+)\\//", $this->getParam('redirect_url'), $matchs)) {
                     XF_Functions::go('/buyreport/' . $matchs[1][0] . '/');
                 } else {
                     XF_Functions::go($val);
                 }
             }
             if (is_object($this->nowCity)) {
                 return $this->nowCity->id . '_indexhome';
             }
             break;
     }
     return '';
 }
コード例 #4
0
 public function goodinfoAction()
 {
     $submit_statue = $this->getParam('statue');
     $gpj_session = new XF_Session("gpj_session");
     $session_ary = $gpj_session->read();
     if (!$gpj_session->hasContent("userId")) {
         throw new XF_Exception('补充商品信息:用户没有登录');
     }
     if (isset($submit_statue) && !XF_Functions::isEmpty($submit_statue)) {
         if ($submit_statue == "submit") {
             $car_parts = $this->getParam("car_parts");
             $car_color = $this->getParam("car_color");
             $period_insurance = $this->getParam("period_insurance");
             $car_maintain = $this->getParam("car_maintain");
             $max_cost = $this->getParam("max_cost");
             $transfer_num = $this->getParam("transfer_num");
             $sellObj = new Sell_Model_Sellinfo();
             $last_id = $sellObj->addSellInfo($session_ary["userId"], $session_ary["modelId"], $session_ary["changeId"], $session_ary["dataFrom"], $session_ary["infoId"], implode(",", $car_parts), $car_color, $period_insurance, $car_maintain, $max_cost, $transfer_num, $this->nowCity->id);
             if ($last_id) {
                 $session_ary["sellInfoId"] = $last_id;
                 $gpj_session->write($session_ary);
                 XF_Functions::go("/sell/index/upload/");
             }
         }
     } else {
         $submit_statue = "submit";
     }
     $this->setLayout(new Layout_Default());
     $this->_view->headStylesheet('/css/sell/goodinfo.css');
     $this->_view->headStylesheet('/css/common.css');
     $this->_view->headScript('/js/pagejs/goodinfo.js');
     XF_View::getInstance()->assign('statue', $submit_statue);
     $this->_view->detailModel = $session_ary["detail_model"];
     $this->_view->detailYear = $session_ary["detail_year"];
     $this->_view->detailMile = $session_ary["detail_mile"];
     $this->_view->detailPrice = $session_ary["detail_price"];
 }