/**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objCustomer = new SC_Customer_Ex();
     // クッキー管理クラス
     $objCookie = new SC_Cookie_Ex();
     // ログイン判定
     if ($objCustomer->isLoginSuccess()) {
         $this->tpl_login = true;
         $this->tpl_user_point = $objCustomer->getValue('point');
         $this->tpl_name1 = $objCustomer->getValue('name01');
         $this->tpl_name2 = $objCustomer->getValue('name02');
     } else {
         // クッキー判定
         $this->tpl_login_email = $objCookie->getCookie('login_email');
         if ($this->tpl_login_email != '') {
             $this->tpl_login_memory = '1';
         }
         // POSTされてきたIDがある場合は優先する。
         if (isset($_POST['login_email']) && $_POST['login_email'] != '') {
             $this->tpl_login_email = $_POST['login_email'];
         }
     }
     $this->tpl_disable_logout = $this->lfCheckDisableLogout();
     //スマートフォン版ログアウト処理で不正なページ移動エラーを防ぐ為、トークンをセット
     $this->transactionid = SC_Helper_Session_Ex::getToken();
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     parent::process();
     // ログインチェック
     $objCustomer = new SC_Customer_Ex();
     // ログインしていない場合は必ずログインページを表示する
     if ($objCustomer->isLoginSuccess(true) === false) {
         // クッキー管理クラス
         $objCookie = new SC_Cookie_Ex();
         // クッキー判定(メールアドレスをクッキーに保存しているか)
         $this->tpl_login_email = $objCookie->getCookie('login_email');
         if ($this->tpl_login_email != '') {
             $this->tpl_login_memory = '1';
         }
         // POSTされてきたIDがある場合は優先する。
         if (isset($_POST['login_email']) && $_POST['login_email'] != '') {
             $this->tpl_login_email = $_POST['login_email'];
         }
         // 携帯端末IDが一致する会員が存在するかどうかをチェックする。
         if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
             $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
         }
         $this->tpl_title = t('c_MY page (login)_01');
         $this->tpl_mainpage = 'mypage/login.tpl';
     } else {
         //マイページ会員情報表示用共通処理
         $this->tpl_login = true;
         $this->CustomerName1 = $objCustomer->getvalue('name01');
         $this->CustomerName2 = $objCustomer->getvalue('name02');
         $this->CustomerPoint = $objCustomer->getvalue('point');
         $this->action();
     }
     $this->sendResponse();
 }
예제 #3
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     $this->tpl_title = '';
     $objCustomer = new SC_Customer_Ex();
     $this->isLogin = $objCustomer->isLoginSuccess(true);
 }
예제 #4
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $this->tpl_title = '';
     $objCustomer = new SC_Customer_Ex();
     $this->isLogin = $objCustomer->isLoginSuccess(true);
     $objCart = new SC_CartSession_Ex();
     $this->isMultiple = $objCart->isMultiple();
     $this->hasDownload = $objCart->hasProductType(PRODUCT_TYPE_DOWNLOAD);
     // 旧仕様との互換のため、不自然なセットとなっている
     $this->arrCartList = array(0 => $this->lfGetCartData($objCart));
 }
 /**
  * Page を初期化する.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $objCustomer = new SC_Customer_Ex();
     // 画面更新毎に情報を更新する
     if ($objCustomer->isLoginSuccess()) {
         // 初回アクセス時に更新
         $objCustomer->updateSession();
         $this->tpl_login = true;
         $this->tpl_point = $objCustomer->getValue("point");
         $this->tpl_customer_id = $objCustomer->getValue("customer_id");
         $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date");
         $this->tpl_carrier = $objCustomer->getValue("carrier");
     }
     $objDB = new SC_Helper_DB_Ex();
     $this->arrSiteInfo = $objDB->sfGetBasisData();
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     // ログインチェック
     $objCustomer = new SC_Customer_Ex();
     if (!$objCustomer->isLoginSuccess(true)) {
         SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true);
     }
     // パラメーターチェック
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     // GET、SESSION['customer']値の取得
     $objFormParam->setParam($_SESSION['customer']);
     $objFormParam->setParam($_GET);
     $this->arrErr = $this->lfCheckError($objFormParam);
     if (count($this->arrErr) != 0) {
         SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true);
     }
 }
 /**
  * Page を初期化する.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $objPagelayout = new SC_Helper_PageLayout_Ex();
     $php_path_dir = HTML_REALDIR;
     $tpl_path_dir = $objPagelayout->getTemplatePath(SC_Display_Ex::$device) . BLOC_DIR;
     $this->arrPageLayout["HeadNavi"] = array();
     $this->arrPageLayout["HeadNavi"][] = array("bloc_name" => "【全ページ】CSS設定", "tpl_path" => "{$tpl_path_dir}settings_css.tpl", "filename" => "settings_css", "php_path" => false ? $php_path_dir : "");
     $this->arrPageLayout["BottomNavi"] = array();
     $this->arrPageLayout["BottomNavi"][] = array("bloc_name" => "【全ページ】フッターナビ共通", "tpl_path" => "{$tpl_path_dir}navi_footer_common.tpl", "filename" => "navi_footer_common", "php_path" => false ? $php_path_dir : "");
     //
     $objCustomer = new SC_Customer_Ex();
     // 画面更新毎に情報を更新する
     if ($objCustomer->isLoginSuccess()) {
         // 初回アクセス時に更新
         $objCustomer->updateSession();
         $this->tpl_login = true;
         // ポイントだけは抑止
         $this->tpl_point = $_SESSION["customer"]["point"];
         $this->tpl_customer_id = $objCustomer->getValue("customer_id");
         $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date");
         $this->tpl_carrier = $objCustomer->getValue("carrier");
     }
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     // 会員クラス
     $objCustomer = new SC_Customer_Ex();
     // パラメーター管理クラス
     $this->objFormParam = new SC_FormParam_Ex();
     // パラメーター情報の初期化
     $this->arrForm = $this->lfInitParam($this->objFormParam);
     // ファイル管理クラス
     $this->objUpFile = new SC_UploadFile_Ex(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR);
     // ファイル情報の初期化
     $this->objUpFile = $this->lfInitFile($this->objUpFile);
     // プロダクトIDの正当性チェック
     $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('product_id'));
     $this->mode = $this->getMode();
     $objProduct = new SC_Product_Ex();
     $objProduct->setProductsClassByProductIds(array($product_id));
     // 規格1クラス名
     $this->tpl_class_name1 = $objProduct->className1[$product_id];
     // 規格2クラス名
     $this->tpl_class_name2 = $objProduct->className2[$product_id];
     // 規格1
     $this->arrClassCat1 = $objProduct->classCats1[$product_id];
     // 規格1が設定されている
     $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id];
     // 規格2が設定されている
     $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id];
     $this->tpl_stock_find = $objProduct->stock_find[$product_id];
     $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_class_id'];
     $this->tpl_product_type = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_type'];
     // 在庫が無い場合は、OnLoadしない。(javascriptエラー防止)
     if ($this->tpl_stock_find) {
         // 規格選択セレクトボックスの作成
         $this->js_lnOnload .= $this->lfMakeSelect();
     }
     $this->tpl_javascript .= 'classCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories[$product_id]) . ';';
     $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}';
     $this->tpl_onload .= 'lnOnLoad();';
     // モバイル用 規格選択セレクトボックスの作成
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->lfMakeSelectMobile($this, $product_id, $this->objFormParam->getValue('classcategory_id1'));
     }
     // 商品IDをFORM内に保持する
     $this->tpl_product_id = $product_id;
     switch ($this->mode) {
         case 'cart':
             $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
             if (count($this->arrErr) == 0) {
                 $objCartSess = new SC_CartSession_Ex();
                 $product_class_id = $this->objFormParam->getValue('product_class_id');
                 $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'));
                 SC_Response_Ex::sendRedirect(CART_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'add_favorite':
             // ログイン中のユーザが商品をお気に入りにいれる処理
             if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) {
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam);
                 if (count($this->arrErr) == 0) {
                     if (!$this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) {
                         $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
                         $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite', array($this));
                         SC_Response_Ex::actionExit();
                     }
                 }
             }
             break;
         case 'add_favorite_sphone':
             // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用)
             if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) {
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam);
                 if (count($this->arrErr) == 0) {
                     if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) {
                         $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
                         $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this));
                         print 'true';
                         SC_Response_Ex::actionExit();
                     }
                 }
                 print 'error';
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'select':
         case 'select2':
         case 'selectItem':
             /**
              * モバイルの数量指定・規格選択の際に、
              * $_SESSION['cart_referer_url'] を上書きさせないために、
              * 何もせずbreakする。
              */
             break;
         default:
             // カート「戻るボタン」用に保持
             $netURL = new Net_URL();
             $_SESSION['cart_referer_url'] = $netURL->getURL();
             break;
     }
     // モバイル用 ポストバック処理
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         switch ($this->mode) {
             case 'select':
                 // 規格1が設定されている場合
                 if ($this->tpl_classcat_find1) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find1.tpl';
                     break;
                 }
                 // 数量の入力を行う
                 $this->tpl_mainpage = 'products/select_item.tpl';
                 break;
             case 'select2':
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
                 // 規格1が設定されていて、エラーを検出した場合
                 if ($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find1.tpl';
                     break;
                 }
                 // 規格2が設定されている場合
                 if ($this->tpl_classcat_find2) {
                     $this->arrErr = array();
                     $this->tpl_mainpage = 'products/select_find2.tpl';
                     break;
                 }
             case 'selectItem':
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
                 // 規格2が設定されていて、エラーを検出した場合
                 if ($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find2.tpl';
                     break;
                 }
                 $value1 = $this->objFormParam->getValue('classcategory_id1');
                 // 規格2が設定されている場合.
                 if (SC_Utils_Ex::isBlank($this->objFormParam->getValue('classcategory_id2')) == false) {
                     $value2 = '#' . $this->objFormParam->getValue('classcategory_id2');
                 } else {
                     $value2 = '#0';
                 }
                 if (strlen($value1) === 0) {
                     $value1 = '__unselected';
                 }
                 $this->tpl_product_class_id = $objProduct->classCategories[$product_id][$value1][$value2]['product_class_id'];
                 // この段階では、数量の入力チェックエラーを出させない。
                 unset($this->arrErr['quantity']);
                 // 数量の入力を行う
                 $this->tpl_mainpage = 'products/select_item.tpl';
                 break;
             case 'cart':
                 // この段階でエラーが出る場合は、数量の入力エラーのはず
                 if (count($this->arrErr)) {
                     // 数量の入力を行う
                     $this->tpl_mainpage = 'products/select_item.tpl';
                 }
                 break;
             default:
                 $this->tpl_mainpage = 'products/detail.tpl';
                 break;
         }
     }
     // 商品詳細を取得
     $this->arrProduct = $objProduct->getDetail($product_id);
     // サブタイトルを取得
     $this->tpl_subtitle = $this->arrProduct['name'];
     // 関連カテゴリを取得
     $this->arrRelativeCat = SC_Helper_DB_Ex::sfGetMultiCatTree($product_id);
     // 商品ステータスを取得
     $this->productStatus = $objProduct->getProductStatus($product_id);
     // 画像ファイル指定がない場合の置換処理
     $this->arrProduct['main_image'] = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']);
     $this->subImageFlag = $this->lfSetFile($this->objUpFile, $this->arrProduct, $this->arrFile);
     //レビュー情報の取得
     $this->arrReview = $this->lfGetReviewData($product_id);
     //関連商品情報表示
     $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id);
     // ログイン判定
     if ($objCustomer->isLoginSuccess() === true) {
         //お気に入りボタン表示
         $this->tpl_login = true;
         $this->is_favorite = SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($objCustomer->getValue('customer_id'), $product_id));
     }
 }
 public function checkDbMyPendignOrder()
 {
     $objCustomer = new SC_Customer_Ex();
     if ($objCustomer->isLoginSuccess(true)) {
         $customer_id = $objCustomer->getValue('customer_id');
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $arrVal = array($customer_id, ORDER_PENDING);
         $objQuery->setOrder('create_date desc');
         $objQuery->begin();
         $arrOrders = $objQuery->select('order_id,create_date', 'dtb_order', 'customer_id = ? and status = ? and del_flg = 0', $arrVal);
         if (!SC_Utils_Ex::isBlank($arrOrders)) {
             foreach ($arrOrders as $key => $arrOrder) {
                 $order_id = $arrOrder['order_id'];
                 if ($key == 0) {
                     $objCartSess = new SC_CartSession_Ex();
                     $cartKeys = $objCartSess->getKeys();
                     $term = PENDING_ORDER_CANCEL_TIME + 60 * 60 * 12;
                     // XXX +12 hours;
                     if (preg_match("/^[0-9]+\$/", $term)) {
                         $target_time = strtotime('-' . $term . ' sec');
                         $create_time = strtotime($arrOrder['create_date']);
                         if (SC_Utils_Ex::isBlank($cartKeys) && $target_time < $create_time) {
                             SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true);
                             GC_Utils_Ex::gfPrintLog('order rollback.(my pending) order_id=' . $order_id);
                         } else {
                             SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
                             if ($target_time > $create_time) {
                                 GC_Utils_Ex::gfPrintLog('order cancel.(my pending and time expire) order_id=' . $order_id);
                             } else {
                                 GC_Utils_Ex::gfPrintLog('order cancel.(my pending and set cart) order_id=' . $order_id);
                             }
                         }
                     }
                 } else {
                     SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
                     GC_Utils_Ex::gfPrintLog('order cancel.(my old pending) order_id=' . $order_id);
                 }
             }
         }
         $objQuery->commit();
     }
 }
예제 #10
0
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function action()
 {
     $objSiteSess = new SC_SiteSession_Ex();
     $objCartSess = new SC_CartSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $objCookie = new SC_Cookie_Ex(COOKIE_EXPIRE);
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->cartKey = $objCartSess->getKey();
     // ログインチェック
     if (!$objCustomer->isLoginSuccess(true)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     // ダウンロード商品の場合は、支払方法画面に転送
     if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) {
         $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping');
         $objPurchase->saveShippingTemp($sqlval);
         $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval, $objCustomer);
         $objSiteSess->setRegistFlag();
         SC_Response_Ex::sendRedirect('payment.php');
         exit;
     }
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $arrErr = $objFormParam->checkError();
     if (!SC_Utils_Ex::isBlank($arrErr)) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
         exit;
     }
     $arrForm = $objFormParam->getHashArray();
     switch ($this->getMode()) {
         // 削除
         case 'delete':
             $this->doDelete($arrForm['other_deliv_id']);
             break;
             // 会員登録住所に送る
         // 会員登録住所に送る
         case 'customer_addr':
             $objPurchase->unsetShippingTemp();
             if ($this->registerDeliv($arrForm['deliv_check'], $this->tpl_uniqid, $objPurchase, $objCustomer)) {
                 $objSiteSess->setRegistFlag();
                 SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
                 exit;
             } else {
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 確認ページへ移動
             SC_Response_Ex::sendRedirect(CART_URLPATH);
             exit;
             break;
             // お届け先複数指定
         // お届け先複数指定
         case 'multiple':
             SC_Response_Ex::sendRedirect('multiple.php');
             exit;
             break;
     }
     // 登録済み住所を取得
     $this->arrAddr = $objCustomer->getCustomerAddress($objCustomer->getValue('customer_id'));
     $this->tpl_addrmax = count($this->arrAddr);
 }
 /**
  * オペレーションの実行権限をチェックする
  *
  * @param string オペレーション名
  * @param array リクエストパラメータ
  * @return boolean 権限がある場合 true; 無い場合 false
  */
 protected function checkOperationAuth($operation_name, &$arrParam, &$arrApiConfig)
 {
     if (SC_Utils_Ex::isBlank($operation_name)) {
         return false;
     }
     $arrAuthTypes = explode('|', $arrApiConfig['auth_types']);
     $result = false;
     foreach ($arrAuthTypes as $auth_type) {
         $ret = false;
         switch ($auth_type) {
             case self::API_AUTH_TYPE_REFERER:
                 $ret = SC_Api_Operation_Ex::checkReferer();
                 break;
             case self::API_AUTH_TYPE_SESSION_TOKEN:
                 $ret = SC_Helper_Session_Ex::isValidToken(false);
                 break;
             case self::API_AUTH_TYPE_API_SIGNATURE:
                 $ret = SC_Api_Operation_Ex::checkApiSignature($operation_name, $arrParam, $arrApiConfig);
                 break;
             case self::API_AUTH_TYPE_CUSTOMER:
                 $ret = SC_Api_Operation_Ex::checkCustomerAccount($arrParam['login_email'], $arrParam['login_password']);
                 break;
             case self::API_AUTH_TYPE_MEMBER:
                 $ret = SC_Api_Operation_Ex::checkMemberAccount($arrParam['member_id'], $arrParam['member_password']);
                 break;
             case self::API_AUTH_TYPE_CUSTOMER_LOGIN_SESSION:
                 $objCustomer = new SC_Customer_Ex();
                 $ret = $objCustomer->isLoginSuccess();
                 break;
             case self::API_AUTH_TYPE_MEMBER_LOGIN_SESSION:
                 $ret = SC_Utils_Ex::sfIsSuccess(new SC_Session_Ex(), false);
                 break;
             case self::API_AUTH_TYPE_IP:
                 $ret = SC_Api_Operation_Ex::checkIp($operation_name);
                 break;
             case self::API_AUTH_TYPE_HOST:
                 $ret = SC_Api_Operation_Ex::checkHost($operation_name);
                 break;
             case self::API_AUTH_TYPE_SSL:
                 $ret = SC_Utils_Ex::sfIsHTTPS();
                 break;
             case self::API_AUTH_TYPE_OPEN:
                 $result = true;
                 break 2;
                 // foreachも抜ける
             // foreachも抜ける
             default:
                 $ret = false;
                 break;
         }
         if ($ret === true) {
             $result = true;
         } else {
             $result = false;
             break;
             // 1つでもfalseがあれば,その時点で終了
         }
     }
     return $result;
 }
예제 #12
0
 function init()
 {
     parent::init();
     $objCustomer = new SC_Customer_Ex();
     if (isset($_GET["sid"]) && isset($_GET["admin"])) {
         $sid = $_REQUEST["sid"];
         $email = $objCustomer->getValue("email");
         $osid = session_id();
         if ($osid != $sid) {
             session_destroy();
             session_id($sid);
             session_start();
         }
         $objCustomer->setLogin($email);
         $get = $_GET;
         unset($get["sid"]);
         SC_Response_Ex::reload($get, true);
     }
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objProduct = new SC_Product_Ex();
     if (GC_Utils_Ex::isFrontFunction() && $this->skip_load_page_layout == false) {
         $objCustomer = new SC_Customer_Ex();
         // 画面更新毎に情報を更新する
         if ($objCustomer->isLoginSuccess()) {
             // 初回アクセス時に更新
             $objCustomer->updateSession();
             $this->tpl_login = true;
             $this->tpl_point = $objCustomer->getValue("point");
             $this->tpl_customer_id = $objCustomer->getValue("customer_id");
             $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date");
             $this->tpl_carrier = $objCustomer->getValue("carrier");
             $downloadable_days = $this->arrSiteInfo["downloadable_days"];
             $downloadable_days_unlimited = $this->arrSiteInfo["downloadable_days_unlimited"];
             $date = null;
             if ($downloadable_days_unlimited) {
                 $date = SC_Utils_Ex::sfGetTimestamp(RELEASE_YEAR, 1, 1, false);
                 $date2 = SC_Utils_Ex::sfGetTimestamp(9999, 12, 31, false);
             } else {
                 $xdate = strtotime("-{$downloadable_days} day");
                 $date = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
                 $xdate = strtotime("+{$downloadable_days} day");
                 $date2 = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
             }
             $this->downloadable_days = $date;
             $this->downloadable_days2 = $date2;
             $objPurchase = new SC_Helper_Purchase_Ex();
             $arrOrderId = $objQuery->getCol("order_id", "dtb_order", "payment_date > ? AND customer_id = ?", array($date, $this->tpl_customer_id));
             $this->arrRedownloadProduct = array();
             foreach ($arrOrderId as $order_id) {
                 $arrOrderDetail = $objPurchase->getOrderDetail($order_id, true);
                 $this->arrRedownloadProduct = array_merge($this->arrRedownloadProduct, $arrOrderDetail);
             }
             // 再ダウンロード可能な商品一覧
             $this->arrRedownloadProduct = SC_Utils_Ex::makeArrayIDToKey("product_id", $this->arrRedownloadProduct);
             foreach ($this->arrRedownloadProduct as $product_id => $row) {
                 $row["product"] = $objProduct->getDetail($product_id);
                 $this->arrRedownloadProduct[$product_id] = $row;
             }
         } else {
             $this->tpl_login = false;
             $this->tpl_point = 0;
             $this->tpl_customer_id = 0;
             $this->tpl_first_buy_date = null;
             $this->tpl_carrier = 9;
             $this->arrRedownloadProduct = array();
         }
         $objDb = new SC_Helper_DB_Ex();
         if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) {
             $where = " customer_id =  ? AND transaction_status =  ? AND continue_account_id IS NOT NULL AND del_flg = 0";
             $arrWhereVal = array($this->tpl_customer_id, 40);
             if ($objQuery->exists("cp_dtb_customer_transaction", $where, $arrWhereVal)) {
                 // OK
             } else {
                 switch (basename(dirname($_SERVER["SCRIPT_NAME"]))) {
                     case "au":
                         break;
                     default:
                         if ($objCustomer->isLoginSuccess()) {
                             $objCustomer->EndSession();
                             SC_Response_Ex::reload();
                         }
                         break;
                 }
             }
         }
         $objCategory = new SC_Helper_Category_Ex();
         $this->arrCommonCategory = $objCategory->getList(true);
         $this->arrCommonCategoryTree = $objCategory->getTree();
         $detect = new Mobile_Detect();
         $script_file = $_SERVER["SCRIPT_NAME"];
         $script_file = ltrim($script_file, "/");
         $script_file2 = str_replace("ios/", "", $script_file);
         if ($detect->is("iOS")) {
             if (file_exists(HTML_REALDIR . "ios/{$script_file}")) {
                 SC_Response_Ex::sendRedirect(HTTP_URL . "ios/{$script_file}", $_GET);
             }
         } elseif (strcmp($script_file, $script_file2) !== 0) {
             SC_Response_Ex::sendRedirect(HTTP_URL . "{$script_file2}", $_GET);
         }
         $_SESSION["is_android"] = $detect->is("AndroidOS");
         if ($detect->isMobile() == false) {
             // NG
             $this->device_support = false;
         } elseif ($detect->is("iOS")) {
             if ($detect->match("iPhone")) {
                 // OK
                 $this->device_support = true;
             } elseif ($detect->match("iPod")) {
                 // NG
                 $this->device_support = false;
             } elseif ($detect->match("iPad")) {
                 // NG
                 $this->device_support = false;
             } else {
                 // NG
                 $this->device_support = false;
             }
             $version = $detect->version("iOS", $detect::VERSION_TYPE_FLOAT);
             if ($version < 6) {
                 // NG
                 $this->device_support = false;
             }
         } elseif ($detect->match("Android") == false) {
             // NG
             $this->device_support = false;
         } elseif (class_exists("SC_DeviceAndroidSelect_Ex", true)) {
             $useragent = array();
             if (preg_match("|.*; ([^;]+) Build/.*|", $_SERVER["HTTP_USER_AGENT"], $useragent)) {
                 $device = new SC_DeviceAndroidSelect_Ex(array("search_device_user_agent_word" => $useragent[1], "search_status" => 1));
                 $this->device_support = $device->exists();
                 $this->tpl_device = $device->getOne();
             }
         } elseif ($detect->match("Android")) {
             // OK
             $this->device_support = true;
         } else {
             // NG
             $this->device_support = false;
         }
     }
     if ($this->device_support) {
         GC_Utils_Ex::gfPrintLog("対応端末:" . $_SERVER['HTTP_USER_AGENT']);
         return;
     } else {
         GC_Utils_Ex::gfPrintLog("非対応端末:" . $_SERVER['HTTP_USER_AGENT']);
         if (is_a($this, "LC_Page_Index")) {
             SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
         } elseif (is_a($this, "LC_Page_Unsupported")) {
             // 非対応端末表示を行わない
             return;
         } elseif (is_a($this, "LC_Page_Entry_Kiyaku")) {
             // 非対応端末表示を行わない
             return;
         } elseif ($this->not_unsupported) {
             // 非対応端末表示を行わない
             return;
         } else {
             SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
         }
     }
 }
예제 #13
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $this->tpl_title = '';
     $objCustomer = new SC_Customer_Ex();
     $this->isLogin = $objCustomer->isLoginSuccess(true);
 }
예제 #14
0
 /**
  * 現在有効な税率設定情報を返す
  *
  * @param int $product_id 商品ID
  * @param int $product_class_id 商品規格ID
  * @param int $pref_id 都道府県ID
  * @param int $country_id 国ID
  * @return integer 税設定情報
  */
 public static function getTaxRule($product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0)
 {
     // 複数回呼出があるのでキャッシュ化
     static $data_c = array();
     // 初期化
     $product_id = $product_id > 0 ? $product_id : 0;
     $product_class_id = $product_class_id > 0 ? $product_class_id : 0;
     $pref_id = $pref_id > 0 ? $pref_id : 0;
     $country_id = $country_id > 0 ? $country_id : 0;
     // 一覧画面の速度向上のため商品単位税率設定がOFFの時はキャッシュキーを丸めてしまう
     if (OPTION_PRODUCT_TAX_RULE == 1) {
         $cache_key = "{$product_id},{$product_class_id},{$pref_id},{$country_id}";
     } else {
         $cache_key = "{$pref_id},{$country_id}";
     }
     if (empty($data_c[$cache_key])) {
         // ログイン済み会員で国と地域指定が無い場合は、会員情報をデフォルトで利用。管理画面では利用しない
         if (!(defined('ADMIN_FUNCTION') && ADMIN_FUNCTION == true)) {
             $objCustomer = new SC_Customer_Ex();
             if ($objCustomer->isLoginSuccess(true)) {
                 if ($country_id == 0) {
                     $country_id = $objCustomer->getValue('country_id');
                 }
                 if ($pref_id == 0) {
                     $pref_id = $objCustomer->getValue('pref');
                 }
             }
         }
         $arrRet = array();
         // リクエストの配列化
         $arrRequest = array('product_id' => $product_id, 'product_class_id' => $product_class_id, 'pref_id' => $pref_id, 'country_id' => $country_id);
         // 地域設定を優先するが、システムパラメーターなどに設定を持っていくか
         // 後に書いてあるほど優先される、詳細後述MEMO参照
         $arrPriorityKeys = explode(',', TAX_RULE_PRIORITY);
         // 条件に基づいて税の設定情報を取得
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $table = 'dtb_tax_rule';
         $cols = '*';
         // 商品税率有無設定により分岐
         if (OPTION_PRODUCT_TAX_RULE == 1) {
             $where = '
                     (
                         (product_id = 0 OR product_id = ?)
                         AND (product_class_id = 0 OR product_class_id = ?)
                     )
                 AND (pref_id = 0 OR pref_id = ?)
                 AND (country_id = 0 OR country_id = ?)
                 AND apply_date < CURRENT_TIMESTAMP
                 AND del_flg = 0';
             $arrVal = array($product_id, $product_class_id, $pref_id, $country_id);
         } else {
             $where = '     product_id = 0 ' . ' AND product_class_id = 0 ' . ' AND (pref_id = 0 OR pref_id = ?)' . ' AND (country_id = 0 OR country_id = ?)' . ' AND apply_date < CURRENT_TIMESTAMP' . ' AND del_flg = 0';
             $arrVal = array($pref_id, $country_id);
         }
         $order = 'apply_date DESC';
         $objQuery->setOrder($order);
         $arrData = $objQuery->select($cols, $table, $where, $arrVal);
         // 優先度付け
         // MEMO: 税の設定は相反する設定を格納可能だが、その中で優先度を付けるため
         //       キーの優先度により、利用する税設定を判断する
         //       優先度が同等の場合、適用日付で判断する
         foreach ($arrData as $data_key => $data) {
             $res = 0;
             foreach ($arrPriorityKeys as $key_no => $key) {
                 if ($arrRequest[$key] != 0 && $data[$key] == $arrRequest[$key]) {
                     // 配列の数値添字を重みとして利用する
                     $res += 1 << $key_no + 1;
                 }
             }
             $arrData[$data_key]['rank'] = $res;
         }
         // 優先順位が高いものを返却値として確定
         // 適用日降順に並んでいるので、単に優先順位比較のみで格納判断可能
         foreach ($arrData as $data) {
             if (!isset($arrRet['rank']) || $arrRet['rank'] < $data['rank']) {
                 // 優先度が高い場合, または空の場合
                 $arrRet = $data;
             }
         }
         // XXXX: 互換性のためtax_ruleにもcalc_ruleを設定
         $arrRet['tax_rule'] = $arrRet['calc_rule'];
         $data_c[$cache_key] = $arrRet;
     }
     return $data_c[$cache_key];
 }
예제 #15
0
 /**
  * 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');
     }
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     $ParentPage = MYPAGE_DELIVADDR_URLPATH;
     // GETでページを指定されている場合には指定ページに戻す
     if (isset($_GET['page'])) {
         $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES);
     } else {
         if (isset($_POST['ParentPage'])) {
             $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES);
         }
     }
     $this->ParentPage = $ParentPage;
     /*
      * ログイン判定 及び 退会判定
      * 未ログインでも, 複数配送設定ページからのアクセスの場合は表示する
      *
      * TODO 購入遷移とMyPageで別クラスにすべき
      */
     if (!$objCustomer->isLoginSuccess(true) && $ParentPage != MULTIPLE_URLPATH) {
         $this->tpl_onload = "fnUpdateParent('" . $this->getLocation($_POST['ParentPage']) . "'); window.close();";
     }
     // other_deliv_id のあるなしで追加か編集か判定しているらしい
     $_SESSION['other_deliv_id'] = $_REQUEST['other_deliv_id'];
     // パラメーター管理クラス,パラメーター情報の初期化
     $objFormParam = new SC_FormParam_Ex();
     SC_Helper_Customer_Ex::sfCustomerOtherDelivParam($objFormParam);
     $objFormParam->setParam($_POST);
     $this->arrForm = $objFormParam->getHashArray();
     switch ($this->getMode()) {
         // 入力は必ずedit
         case 'edit':
             $this->arrErr = SC_Helper_Customer_Ex::sfCustomerOtherDelivErrorCheck($objFormParam);
             // 入力エラーなし
             if (empty($this->arrErr)) {
                 // TODO ここでやるべきではない
                 if (in_array($_POST['ParentPage'], $this->validUrl)) {
                     $this->tpl_onload = "fnUpdateParent('" . $this->getLocation($_POST['ParentPage']) . "'); window.close();";
                 } else {
                     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                 }
                 if ($objCustomer->isLoginSuccess(true)) {
                     $this->lfRegistData($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']));
                     exit;
                 }
             }
             break;
         case 'multiple':
             // 複数配送先用
             break;
         default:
             if ($_GET['other_deliv_id'] != "") {
                 $arrOtherDeliv = $this->lfGetOtherDeliv($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id']);
                 //不正アクセス判定
                 if (!$objCustomer->isLoginSuccess(true) || count($arrOtherDeliv) == 0) {
                     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                 }
                 //別のお届け先情報取得
                 $this->arrForm = $arrOtherDeliv[0];
             }
             break;
     }
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
         $this->tpl_mainpage = 'mypage/delivery_addr.tpl';
     } else {
         $this->setTemplate('mypage/delivery_addr.tpl');
     }
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function action()
 {
     $objSiteSess = new SC_SiteSession_Ex();
     $objCartSess = new SC_CartSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objCookie = new SC_Cookie_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $nonmember_mainpage = 'shopping/nonmember_input.tpl';
     $nonmember_title = 'お客様情報入力';
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->cartKey = $objCartSess->getKey();
     // ログイン済みの場合は次画面に遷移
     if ($objCustomer->isLoginSuccess(true)) {
         SC_Response_Ex::sendRedirect($this->getNextlocation($this->cartKey, $this->tpl_uniqid, $objCustomer, $objPurchase, $objSiteSess));
         SC_Response_Ex::actionExit();
     } else {
         if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) {
             $msg = 'ダウンロード商品を含むお買い物は、会員登録が必要です。<br/>' . 'お手数ですが、会員登録をお願いします。';
             SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, $objSiteSess, false, $msg);
             SC_Response_Ex::actionExit();
         }
     }
     switch ($this->getMode()) {
         // ログイン実行
         case 'login':
             $this->lfInitLoginFormParam($objFormParam);
             $objFormParam->setParam($_POST);
             $objFormParam->trimParam();
             $objFormParam->convParam();
             $objFormParam->toLower('login_email');
             $this->arrErr = $objFormParam->checkError();
             // ログイン判定
             if (SC_Utils_Ex::isBlank($this->arrErr) && $objCustomer->doLogin($objFormParam->getValue('login_email'), $objFormParam->getValue('login_pass'))) {
                 // モバイルサイトで携帯アドレスの登録が無い場合、携帯アドレス登録ページへ遷移
                 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
                     if (!$objCustomer->hasValue('email_mobile')) {
                         SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php');
                         SC_Response_Ex::actionExit();
                     }
                 } elseif (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                     echo SC_Utils_Ex::jsonEncode(array('success' => $this->getNextLocation($this->cartKey, $this->tpl_uniqid, $objCustomer, $objPurchase, $objSiteSess)));
                     SC_Response_Ex::actionExit();
                 }
                 SC_Response_Ex::sendRedirect($this->getNextLocation($this->cartKey, $this->tpl_uniqid, $objCustomer, $objPurchase, $objSiteSess));
                 SC_Response_Ex::actionExit();
             } else {
                 // 仮登録の場合
                 if (SC_Helper_Customer_Ex::checkTempCustomer($objFormParam->getValue('login_email'))) {
                     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                         echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR);
                         SC_Response_Ex::actionExit();
                     } else {
                         SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                         SC_Response_Ex::actionExit();
                     }
                 } else {
                     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
                         echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR);
                         SC_Response_Ex::actionExit();
                     } else {
                         SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
                         SC_Response_Ex::actionExit();
                     }
                 }
             }
             break;
             // お客様情報登録
         // お客様情報登録
         case 'nonmember_confirm':
             $this->tpl_mainpage = $nonmember_mainpage;
             $this->tpl_title = $nonmember_title;
             $this->lfInitParam($objFormParam);
             $objFormParam->setParam($_POST);
             $this->arrErr = $this->lfCheckError($objFormParam);
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam);
                 $arrParams = $objFormParam->getHashArray();
                 $shipping_id = $arrParams['deliv_check'] == '1' ? 1 : 0;
                 $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id);
                 $objSiteSess->setRegistFlag();
                 SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             SC_Response_Ex::sendRedirect(CART_URLPATH);
             SC_Response_Ex::actionExit();
             break;
             // 複数配送ページへ遷移
         // 複数配送ページへ遷移
         case 'multiple':
             // 複数配送先指定が無効な場合はエラー
             if (USE_MULTIPLE_SHIPPING === false) {
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
                 SC_Response_Ex::actionExit();
             }
             $this->lfInitParam($objFormParam);
             $objFormParam->setParam($_POST);
             $this->arrErr = $this->lfCheckError($objFormParam);
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam, true);
                 $objSiteSess->setRegistFlag();
                 SC_Response_Ex::sendRedirect(MULTIPLE_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             $this->tpl_mainpage = $nonmember_mainpage;
             $this->tpl_title = $nonmember_title;
             break;
             // お客様情報入力ページの表示
         // お客様情報入力ページの表示
         case 'nonmember':
             $this->tpl_mainpage = $nonmember_mainpage;
             $this->tpl_title = $nonmember_title;
             $this->lfInitParam($objFormParam);
             // ※breakなし
         // ※breakなし
         default:
             // 前のページから戻ってきた場合は, お客様情報入力ページ
             if (isset($_GET['from']) && $_GET['from'] == 'nonmember') {
                 $this->tpl_mainpage = $nonmember_mainpage;
                 $this->tpl_title = $nonmember_title;
                 $this->lfInitParam($objFormParam);
             } else {
                 $this->lfInitLoginFormParam($objFormParam);
             }
             $this->setFormParams($objFormParam, $objPurchase, $this->tpl_uniqid);
             break;
     }
     // 記憶したメールアドレスを取得
     $this->tpl_login_email = $objCookie->getCookie('login_email');
     if (!SC_Utils_Ex::isBlank($this->tpl_login_email)) {
         $this->tpl_login_memory = '1';
     }
     // 入力値の取得
     $this->arrForm = $objFormParam->getFormParamList();
     // 携帯端末IDが一致する会員が存在するかどうかをチェックする。
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
         $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
     }
 }
예제 #18
0
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function action()
 {
     $objSiteSess = new SC_SiteSession_Ex();
     $objCartSess = new SC_CartSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->cartKey = $objCartSess->getKey();
     // ログインチェック
     if (!$objCustomer->isLoginSuccess(true)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     // ダウンロード商品の場合は、支払方法画面に転送
     if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) {
         $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping');
         $objPurchase->saveShippingTemp($sqlval);
         $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval, $objCustomer);
         $objSiteSess->setRegistFlag();
         SC_Response_Ex::sendRedirect('payment.php');
         SC_Response_Ex::actionExit();
     }
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $arrErr = $objFormParam->checkError();
     if (!SC_Utils_Ex::isBlank($arrErr)) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
         SC_Response_Ex::actionExit();
     }
     $arrForm = $objFormParam->getHashArray();
     switch ($this->getMode()) {
         // 削除
         case 'delete':
             $this->doDelete($arrForm['other_deliv_id']);
             break;
             // 会員登録住所に送る
         // 会員登録住所に送る
         case 'customer_addr':
             $objPurchase->unsetShippingTemp();
             $shipping_id = $arrForm['deliv_check'] == -1 ? 0 : $arrForm['deliv_check'];
             $success = $this->registerDeliv($shipping_id, $this->tpl_uniqid, $objPurchase, $objCustomer);
             if (!$success) {
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
             }
             $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id);
             $objSiteSess->setRegistFlag();
             SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
             SC_Response_Ex::actionExit();
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 確認ページへ移動
             SC_Response_Ex::sendRedirect(CART_URLPATH);
             SC_Response_Ex::actionExit();
             break;
             // お届け先複数指定
         // お届け先複数指定
         case 'multiple':
             // 複数配送先指定が無効な場合はエラー
             if (USE_MULTIPLE_SHIPPING === false) {
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
                 SC_Response_Ex::actionExit();
             }
             SC_Response_Ex::sendRedirect('multiple.php');
             SC_Response_Ex::actionExit();
             break;
         default:
             // 配送IDの取得
             $shippingData = $objPurchase->getShippingTemp();
             $arrShippingId = array_keys($shippingData);
             if (isset($arrShippingId[0])) {
                 $this->arrForm['deliv_check']['value'] = $arrShippingId[0] == 0 ? -1 : $arrShippingId[0];
             }
             break;
     }
     // 登録済み住所を取得
     $this->arrAddr = $objCustomer->getCustomerAddress($objCustomer->getValue('customer_id'));
     $this->tpl_addrmax = count($this->arrAddr);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objSiteSess = new SC_SiteSession_Ex();
     $objCartSess = new SC_CartSession_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $this->is_multiple = $objPurchase->isMultiple();
     // カートの情報を取得
     $this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $cart_key = $objCartSess->getKey();
     $this->cartKey = $cart_key;
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     // 配送業者を取得
     $this->arrDeliv = $objPurchase->getDeliv($cart_key);
     $this->is_single_deliv = $this->isSingleDeliv($this->arrDeliv);
     // 会員情報の取得
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = '******';
         $this->tpl_user_point = $objCustomer->getValue('point');
         $this->name01 = $objCustomer->getValue('name01');
         $this->name02 = $objCustomer->getValue('name02');
     }
     // 戻り URL の設定
     // @deprecated 2.12.0 テンプレート直書きに戻した
     $this->tpl_back_url = '?mode=return';
     $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
     // 正常に受注情報が格納されていない場合はカート画面へ戻す
     if (SC_Utils_Ex::isBlank($arrOrderTemp)) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     // カート内商品の妥当性チェック
     $this->tpl_message = $objCartSess->checkProducts($cart_key);
     if (strlen($this->tpl_message) >= 1) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     /*
      * 購入金額の取得
      * ここでは送料を加算しない
      */
     $this->arrPrices = $objCartSess->calculate($cart_key, $objCustomer);
     // お届け日一覧の取得
     $this->arrDelivDate = $objPurchase->getDelivDate($objCartSess, $cart_key);
     switch ($this->getMode()) {
         /*
          * 配送業者選択時のアクション
          * モバイル端末以外の場合は, JSON 形式のデータを出力し, ajax で取得する.
          */
         case 'select_deliv':
             $this->setFormParams($objFormParam, $arrOrderTemp, true, $this->arrShipping);
             $objFormParam->setParam($_POST);
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $deliv_id = $objFormParam->getValue('deliv_id');
                 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
                 $arrSelectedDeliv['error'] = false;
             } else {
                 $arrSelectedDeliv = array('error' => true);
                 $this->tpl_mainpage = 'shopping/select_deliv.tpl';
                 // モバイル用
             }
             if (SC_Display_Ex::detectDevice() != DEVICE_TYPE_MOBILE) {
                 echo SC_Utils_Ex::jsonEncode($arrSelectedDeliv);
                 SC_Response_Ex::actionExit();
             } else {
                 $this->arrPayment = $arrSelectedDeliv['arrPayment'];
                 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
             }
             break;
             // 登録処理
         // 登録処理
         case 'confirm':
             // パラメーター情報の初期化
             $this->setFormParams($objFormParam, $_POST, false, $this->arrShipping);
             $deliv_id = $objFormParam->getValue('deliv_id');
             $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
             $this->arrPayment = $arrSelectedDeliv['arrPayment'];
             $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
             $this->img_show = $arrSelectedDeliv['img_show'];
             $this->arrErr = $this->lfCheckError($objFormParam, $this->arrPrices['subtotal'], $this->tpl_user_point);
             if (empty($this->arrErr)) {
                 $this->saveShippings($objFormParam, $this->arrDelivTime);
                 $this->lfRegistData($this->tpl_uniqid, $objFormParam->getDbArray(), $objPurchase, $this->arrPayment);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
                 // 確認ページへ移動
                 SC_Response_Ex::sendRedirect(SHOPPING_CONFIRM_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
             $url = null;
             if ($this->is_multiple) {
                 $url = MULTIPLE_URLPATH . '?from=multiple';
             } elseif ($objCustomer->isLoginSuccess(true)) {
                 if ($product_type_id == PRODUCT_TYPE_DOWNLOAD) {
                     $url = CART_URLPATH;
                 } else {
                     $url = DELIV_URLPATH;
                 }
             } else {
                 $url = SHOPPING_URL . '?from=nonmember';
             }
             SC_Response_Ex::sendRedirect($url);
             SC_Response_Ex::actionExit();
             break;
         default:
             // FIXME 前のページから戻ってきた場合は別パラメーター(mode)で処理分岐する必要があるのかもしれない
             $this->setFormParams($objFormParam, $arrOrderTemp, false, $this->arrShipping);
             if (!$this->is_single_deliv) {
                 $deliv_id = $objFormParam->getValue('deliv_id');
             } else {
                 $deliv_id = $this->arrDeliv[0]['deliv_id'];
             }
             if (!SC_Utils_Ex::isBlank($deliv_id)) {
                 $objFormParam->setValue('deliv_id', $deliv_id);
                 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
                 $this->arrPayment = $arrSelectedDeliv['arrPayment'];
                 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
                 $this->img_show = $arrSelectedDeliv['img_show'];
             }
             break;
     }
     // モバイル用 ポストバック処理
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_Utils_Ex::isBlank($this->arrErr)) {
         $this->tpl_mainpage = $this->getMobileMainpage($this->is_single_deliv, $this->getMode());
     }
     $this->arrForm = $objFormParam->getFormParamList();
 }
예제 #20
0
 /**
  * Page のプロセス.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     $objSiteSess = new SC_SiteSession_Ex();
     $objCartSess = new SC_CartSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $objAddress = new SC_Helper_Address_Ex();
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->cartKey = $objCartSess->getKey();
     // ログインチェック
     if (!$objCustomer->isLoginSuccess(true)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     // ダウンロード商品の場合は、支払方法画面に転送
     if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) {
         $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping');
         $objPurchase->saveShippingTemp($sqlval);
         $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval, $objCustomer);
         $objSiteSess->setRegistFlag();
         SC_Response_Ex::sendRedirect('payment.php');
         SC_Response_Ex::actionExit();
     }
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $arrErr = $objFormParam->checkError();
     if (!SC_Utils_Ex::isBlank($arrErr)) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
         SC_Response_Ex::actionExit();
     }
     $arrForm = $objFormParam->getHashArray();
     switch ($this->getMode()) {
         // 削除
         case 'delete':
             if (!$objAddress->deleteAddress($arrForm['other_deliv_id'], $objCustomer->getValue('customer_id'))) {
                 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, '別のお届け先を削除できませんでした。');
                 SC_Response_Ex::actionExit();
             }
             break;
             // 会員登録住所に送る
         // 会員登録住所に送る
         case 'customer_addr':
             $objPurchase->unsetShippingTemp();
             $shipping_id = $arrForm['deliv_check'] == -1 ? 0 : $arrForm['deliv_check'];
             $success = $this->registerDeliv($shipping_id, $this->tpl_uniqid, $objPurchase, $objCustomer, $objAddress);
             if (!$success) {
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
             }
             $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id);
             $objSiteSess->setRegistFlag();
             SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
             SC_Response_Ex::actionExit();
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 確認ページへ移動
             SC_Response_Ex::sendRedirect(CART_URL);
             SC_Response_Ex::actionExit();
             break;
             // お届け先複数指定
         // お届け先複数指定
         case 'multiple':
             // 複数配送先指定が無効な場合はエラー
             if (USE_MULTIPLE_SHIPPING === false) {
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
                 SC_Response_Ex::actionExit();
             }
             SC_Response_Ex::sendRedirect('multiple.php');
             SC_Response_Ex::actionExit();
             break;
         default:
             // 配送IDの取得
             $shippingData = $objPurchase->getShippingTemp();
             if (!SC_Utils_Ex::isBlank($shippingData)) {
                 $arrShippingId = array_keys($shippingData);
             }
             if (isset($arrShippingId[0])) {
                 $this->arrForm['deliv_check']['value'] = $arrShippingId[0] == 0 ? -1 : $arrShippingId[0];
             }
             break;
     }
     // 登録済み住所を取得
     $addr = array(array('other_deliv_id' => NULL, 'customer_id' => $objCustomer->getValue('customer_id'), 'name01' => $objCustomer->getValue('name01'), 'name02' => $objCustomer->getValue('name02'), 'kana01' => $objCustomer->getValue('kana01'), 'kana02' => $objCustomer->getValue('kana02'), 'company_name' => $objCustomer->getValue('company_name'), 'country_id' => $objCustomer->getValue('country_id'), 'zipcode' => $objCustomer->getValue('zipcode'), 'zip01' => $objCustomer->getValue('zip01'), 'zip02' => $objCustomer->getValue('zip02'), 'pref' => $objCustomer->getValue('pref'), 'addr01' => $objCustomer->getValue('addr01'), 'addr02' => $objCustomer->getValue('addr02'), 'tel01' => $objCustomer->getValue('tel01'), 'tel02' => $objCustomer->getValue('tel02'), 'tel03' => $objCustomer->getValue('tel03')));
     $this->arrAddr = array_merge($addr, $objAddress->getList($objCustomer->getValue('customer_id')));
     $this->tpl_addrmax = count($this->arrAddr) - 1;
     // 会員の住所をカウントしない
 }
예제 #21
0
 public function lfRegistRecommendData(&$objFormParam)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objCustomer = new SC_Customer_Ex();
     $arrRegist = $objFormParam->getDbArray();
     $arrRegist['create_date'] = 'CURRENT_TIMESTAMP';
     $arrRegist['update_date'] = 'CURRENT_TIMESTAMP';
     $arrRegist['creator_id'] = '0';
     if ($objCustomer->isLoginSuccess(true)) {
         $arrRegist['customer_id'] = $objCustomer->getValue('customer_id');
     }
     //-- 登録実行
     $objQuery->begin();
     $arrRegist['review_id'] = $objQuery->nextVal('dtb_review_review_id');
     $objQuery->insert('dtb_review', $arrRegist);
     $objQuery->commit();
 }
 function setLoginInfo(&$customer)
 {
     $objCustomer = new SC_Customer_Ex();
     $customer["status"] = 2;
     $customer["carrier"] = 2;
     $customer["last_login_useragent"] = $_SERVER["HTTP_USER_AGENT"];
     $customer["last_login_date"] = "CURRENT_TIMESTAMP";
     $customer["secret_key"] = SC_Helper_Customer_Ex::sfGetUniqSecretKey();
     GC_Utils_Ex::gfPrintLog(print_r($customer, true), DEBUG_LOG_REALFILE);
     SC_Helper_Customer_Ex::sfEditCustomerData($customer, $customer["customer_id"]);
     $objCustomer->setLogin($customer["email"]);
     if ($objCustomer->isLoginSuccess()) {
         $this->tpl_login = true;
         $this->tpl_point = $objCustomer->getValue("point");
         $this->tpl_customer_id = $objCustomer->getValue("customer_id");
         $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date");
         $this->tpl_carrier = $objCustomer->getValue("carrier");
     }
     $this->sendRedirectPage();
 }
 /**
  * 会員登録エラーチェック
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @access public
  * @return array エラーの配列
  */
 public function sfCustomerEntryErrorCheck(&$objFormParam)
 {
     $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam);
     $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck($objErr);
     /*
      * sfCustomerRegisterErrorCheck() では, ログイン中の場合は重複チェック
      * されないので, 再度チェックを行う
      */
     $objCustomer = new SC_Customer_Ex();
     if ($objCustomer->isLoginSuccess(true) && SC_Helper_Customer_Ex::sfCustomerEmailDuplicationCheck($objCustomer->getValue('customer_id'), $objFormParam->getValue('email'))) {
         $objErr->arrErr['email'] .= '※ すでに会員登録で使用されているメールアドレスです。<br />';
     }
     if ($objCustomer->isLoginSuccess(true) && SC_Helper_Customer_Ex::sfCustomerEmailDuplicationCheck($objCustomer->getValue('customer_id'), $objFormParam->getValue('email_mobile'))) {
         $objErr->arrErr['email_mobile'] .= '※ すでに会員登録で使用されているメールアドレスです。<br />';
     }
     return $objErr->arrErr;
 }
 /**
  * 会員登録エラーチェック
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @access public
  * @return array エラーの配列
  */
 function sfCustomerEntryErrorCheck(&$objFormParam)
 {
     $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam);
     $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck($objErr);
     /*
      * sfCustomerRegisterErrorCheck() では, ログイン中の場合は重複チェック
      * されないので, 再度チェックを行う
      */
     $objCustomer = new SC_Customer_Ex();
     if ($objCustomer->isLoginSuccess(true) && SC_Helper_Customer_Ex::sfCustomerEmailDuplicationCheck($objCustomer->getValue('customer_id'), $objFormParam->getValue('email'))) {
         $objErr->arrErr['email'] .= t('c_* This is an e-mail address already used in member registration. <br />_01');
     }
     if ($objCustomer->isLoginSuccess(true) && SC_Helper_Customer_Ex::sfCustomerEmailDuplicationCheck($objCustomer->getValue('customer_id'), $objFormParam->getValue('email_mobile'))) {
         $objErr->arrErr['email_mobile'] .= t('c_* This is an e-mail address already used in member registration. <br />_01');
     }
     return $objErr->arrErr;
 }