/** * Page のAction. * * @return void */ public function action() { $objCustomer = new SC_Customer_Ex(); $objAddress = new SC_Helper_Address_Ex(); $ParentPage = MYPAGE_DELIVADDR_URLPATH; // GETでページを指定されている場合には指定ページに戻す if (isset($_GET['page'])) { $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES); } elseif (isset($_POST['ParentPage'])) { $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES); } // 正しい遷移かをチェック $arrParentPageList = array(DELIV_URLPATH, MYPAGE_DELIVADDR_URLPATH, MULTIPLE_URLPATH); if (!SC_Utils_Ex::isBlank($ParentPage) && !in_array($ParentPage, $arrParentPageList)) { // 遷移が正しくない場合、デフォルトであるマイページの配送先追加の画面を設定する $ParentPage = MYPAGE_DELIVADDR_URLPATH; } $this->ParentPage = $ParentPage; /* * ログイン判定 及び 退会判定 * 未ログインでも, 複数配送設定ページからのアクセスの場合は表示する * * TODO 購入遷移とMyPageで別クラスにすべき */ if (!$objCustomer->isLoginSuccess(true) && $ParentPage != MULTIPLE_URLPATH) { $this->tpl_onload = "eccube.changeParentUrl('" . $ParentPage . "'); window.close();"; } // other_deliv_id のあるなしで追加か編集か判定しているらしい $_SESSION['other_deliv_id'] = $_REQUEST['other_deliv_id']; // パラメーター管理クラス,パラメーター情報の初期化 $objFormParam = new SC_FormParam_Ex(); $objAddress->setFormParam($objFormParam); $objFormParam->setParam($_POST); switch ($this->getMode()) { // 入力は必ずedit case 'edit': $this->arrErr = $objAddress->errorCheck($objFormParam); // 入力エラーなし if (empty($this->arrErr)) { // TODO ここでやるべきではない if (in_array($_POST['ParentPage'], $this->validUrl)) { $this->tpl_onload = "eccube.changeParentUrl('" . $this->getLocation($_POST['ParentPage']) . "'); window.close();"; } else { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } if ($objCustomer->isLoginSuccess(true)) { $this->lfRegistData($objAddress, $objFormParam, $objCustomer->getValue('customer_id')); } else { $this->lfRegistDataNonMember($objFormParam); } if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) { // モバイルの場合、元のページに遷移 SC_Response_Ex::sendRedirect($this->getLocation($_POST['ParentPage'])); SC_Response_Ex::actionExit(); } } break; case 'multiple': // 複数配送先用 break; default: if ($_GET['other_deliv_id'] != '') { $arrOtherDeliv = $objAddress->getAddress($_SESSION['other_deliv_id'], $objCustomer->getValue('customer_id')); //不正アクセス判定 if (!$objCustomer->isLoginSuccess(true) || !$arrOtherDeliv) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } //別のお届け先情報取得 $objFormParam->setParam($arrOtherDeliv); } break; } $this->arrForm = $objFormParam->getFormParamList(); if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) { $this->tpl_mainpage = 'mypage/delivery_addr.tpl'; } else { $this->setTemplate('mypage/delivery_addr.tpl'); } }