/**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     if (!SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $arrMailView = $this->lfGetMailView($_GET['send_id'], $objCustomer->getValue('customer_id'));
     if (empty($arrMailView)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $this->tpl_subject = $arrMailView[0]['subject'];
     $this->tpl_body = $arrMailView[0]['mail_body'];
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_PC) {
         $this->setTemplate('mypage/mail_view.tpl');
     } else {
         $this->tpl_title = 'メール履歴詳細';
         $this->tpl_mainpage = 'mypage/mail_view.tpl';
     }
     switch ($this->getMode()) {
         case 'getDetail':
             echo SC_Utils_Ex::jsonEncode($arrMailView);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
 }
 /**
  * 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();
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     switch ($this->getMode()) {
         case 'confirm':
             // トークンを設定
             $this->refusal_transactionid = $this->getRefusalToken();
             $this->tpl_mainpage = 'mypage/refusal_confirm.tpl';
             $this->tpl_subtitle = '退会手続き(確認ページ)';
             break;
         case 'complete':
             // トークン入力チェック
             if (!$this->isValidRefusalToken()) {
                 // エラー画面へ遷移する
                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
                 SC_Response_Ex::actionExit();
             }
             $objCustomer = new SC_Customer_Ex();
             $this->lfDeleteCustomer($objCustomer->getValue('customer_id'));
             $objCustomer->EndSession();
             SC_Response_Ex::sendRedirect('refusal_complete.php');
             break;
         default:
             if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
                 $this->refusal_transactionid = $this->getRefusalToken();
             }
             break;
     }
 }
 /**
  * Return a string which corresponding with message alias.
  *
  * @param   string  $string     message alias
  * @param   array   $options    options
  * @return  string  a string corresponding with message alias
  */
 public static function get_locale($string, &$options)
 {
     is_null(SC_Helper_Locale_Ex::$_instance) and SC_Helper_Locale_Ex::$_instance = new SC_Helper_Locale_Ex();
     // If language code is not specified, use site default.
     if (empty($options['lang_code'])) {
         $lang_code = $options['lang_code'] = defined('LANG_CODE') ? LANG_CODE : 'en-US';
     } else {
         $lang_code = $options['lang_code'];
     }
     // If device type ID is not specified, detect the viewing device.
     if (!isset($options['device_type_id']) || $options['device_type_id'] !== FALSE && !strlen($options['device_type_id'])) {
         if (method_exists('SC_Display_Ex', 'detectDevice')) {
             $device_type_id = SC_Display_Ex::detectDevice();
         } else {
             $device_type_id = FALSE;
         }
     } else {
         $device_type_id = $options['device_type_id'];
     }
     $return = $string;
     // Get string list of specified language.
     $translations = SC_Helper_Locale_Ex::$_instance->get_translations($lang_code, $device_type_id);
     // Whether a string which corresponding with alias is exist.
     if (isset($translations[$return])) {
         $return = $translations[$return];
     }
     if (is_array($options['escape'])) {
         foreach ($options['escape'] as $esc_type) {
             $return = SC_Helper_Locale_Ex::escape($return, $esc_type);
         }
     }
     return $return;
 }
Example #5
0
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     $objCustomer = new SC_Customer_Ex();
     $customer_id = $objCustomer->getValue('customer_id');
     //ページ送り用
     $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'], $this->lfGetOrderHistory($customer_id), SEARCH_PMAX, 'eccube.movePage', NAVI_PMAX, 'pageno=#page#', SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
     $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
     switch ($this->getMode()) {
         case 'getList':
             echo SC_Utils_Ex::jsonEncode($this->arrOrder);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     // 支払い方法の取得
     $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
     // 1ページあたりの件数
     $this->dispNumber = SEARCH_PMAX;
     $this->json_payment = SC_Utils::jsonEncode($this->arrPayment);
     $this->json_customer_order_status = SC_Utils::jsonEncode($this->arrCustomerOrderStatus);
 }
 /**
  * アップデート
  * updateはアップデート時に実行されます.
  * 引数にはdtb_pluginのプラグイン情報が渡されます.
  * 
  * @param array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
  * @return void
  */
 function update($arrPlugin)
 {
     self::copyFiles($arrPlugin);
     $arrOldPlugin = self::getOldPlugin($arrPlugin);
     $arrVersionKeys = array_flip(self::$arrVersions);
     $current_version_key = $arrVersionKeys[$arrPlugin['plugin_version']];
     if (is_numeric($current_version_key)) {
         foreach (self::$arrVersions as $version_key => $version) {
             if ($current_version_key < $version_key) {
                 switch ($version) {
                     case '1.0.fix1':
                     case '1.0.fix2':
                     case '1.0.fix3':
                     case '1.1':
                     case '1.1.fix1':
                     case '1.1.fix2':
                     case '1.1.fix3':
                         break;
                     case '2.0':
                         self::deleteFiles_2_0($arrPlugin);
                         self::alterTables_2_0($arrPlugin);
                         break;
                     case '2.0.fix1':
                         self::alterTables_2_0_fix1($arrPlugin);
                         break;
                     case '2.0.fix2':
                         break;
                     case '2.0.fix3':
                         break;
                     case '2.0.fix4':
                         break;
                 }
             }
         }
     }
     self::updatePluginRow($arrPlugin, '2.0.fix4');
     self::updateHookPoints($arrPlugin);
     if (isset($arrOldPlugin['enable']) && $arrOldPlugin['enable'] == PLUGIN_ENABLE_TRUE) {
         SC_Utils_Ex::clearCompliedTemplate();
         $_SESSION['Message.AddProductColumns.Updated'] = 'プラグインをアップデートしました。';
         $objDisplay = new SC_Display_Ex();
         $objDisplay->reload();
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $arrKiyaku = $this->lfGetKiyakuData();
     $this->max = count($arrKiyaku);
     // mobile時はGETでページ指定
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->offset = $this->lfSetOffset($_GET['offset']);
     }
     $this->tpl_kiyaku_text = $this->lfMakeKiyakuText($arrKiyaku, $this->max, $this->offset);
 }
/**
 * 数値を数字絵文字に変換する。
 *
 * 入力が0~9ではない場合、または、携帯端末からのアクセスではない場合は、
 * 入力を [ と ] で囲んだ文字列を返す。
 *
 * @param string $value 入力
 * @return string 出力
 */
function smarty_modifier_numeric_emoji($value)
{
    // 数字絵文字 (0~9) の絵文字番号
    static $numeric_emoji_index = array('134', '125', '126', '127', '128', '129', '130', '131', '132', '133');
    if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && isset($numeric_emoji_index[$value])) {
        return '[emoji:' . $numeric_emoji_index[$value] . ']';
    } else {
        return '[' . $value . ']';
    }
}
 /**
  * Page を初期化する.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $this->tpl_title = t('c_MY page_01');
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
         $this->tpl_title .= t('c_/Withdrawal procedure (completion page)_01');
     } else {
         $this->tpl_subtitle = t('c_Withdrawal procedure (completion page)_01');
     }
     $this->tpl_navi = SC_Helper_PageLayout::getTemplatePath(SC_Display_Ex::detectDevice()) . 'mypage/navi.tpl';
     $this->tpl_mypageno = 'refusal';
     $this->point_disp = false;
 }
 /**
  * Page を初期化する.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $this->tpl_title = 'MYページ';
     if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
         $this->tpl_title .= '/退会手続き(完了ページ)';
     } else {
         $this->tpl_subtitle = '退会手続き(完了ページ)';
     }
     $this->tpl_navi = SC_Helper_PageLayout::getTemplatePath(SC_Display_Ex::detectDevice()) . 'mypage/navi.tpl';
     $this->tpl_mypageno = 'refusal';
     $this->point_disp = false;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     $arrKiyaku = $this->lfGetKiyakuData();
     $this->max = count($arrKiyaku);
     // mobile時はGETでページ指定
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->offset = $this->lfSetOffset($_GET['offset']);
     }
     $this->tpl_kiyaku_text = $this->lfMakeKiyakuText($arrKiyaku, $this->max, $this->offset);
 }
/**
 * marqueeタグで囲む。
 *
 * DoCoMoの携帯端末の場合はmarqueeを使用しない。
 *
 * @param string $value 入力
 * @return string 出力
 */
function smarty_block_marquee($params, $content, &$smarty, &$repeat)
{
    // {/marquee}の場合のみ出力する。
    if ($repeat || !isset($content)) {
        return null;
    }
    // 末尾の改行などを取り除く。
    $content = rtrim($content);
    // marqueeタグを使用しない場合
    if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_MobileUserAgent::getCarrier() == 'docomo') {
        return "<div>\n{$content}\n</div>\n";
    }
    return "<marquee>\n{$content}\n</marquee>\n";
}
 /**
  * Page を初期化する.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $this->tpl_title = 'パスワードを忘れた方';
     $this->tpl_mainpage = 'forgot/index.tpl';
     $this->tpl_mainno = '';
     $masterData = new SC_DB_MasterData_Ex();
     $this->arrReminder = $masterData->getMasterData('mtb_reminder');
     $this->device_type = SC_Display_Ex::detectDevice();
     $this->httpCacheControl('nocache');
     // デフォルトログインアドレスロード
     $objCookie = new SC_Cookie_Ex();
     $this->tpl_login_email = $objCookie->getCookie('login_email');
 }
Example #14
0
 /**
  * Page を初期化する.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->tpl_title = 'お問い合わせ';
     } else {
         $this->tpl_title = 'お問い合わせ(入力ページ)';
     }
     $this->tpl_page_category = 'contact';
     $this->httpCacheControl('nocache');
     $masterData = new SC_DB_MasterData_Ex();
     $this->arrPref = $masterData->getMasterData('mtb_pref');
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->CONF = SC_Helper_DB_Ex::sfGetBasisData();
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     // モバイル判定
     switch (SC_Display_Ex::detectDevice()) {
         case DEVICE_TYPE_MOBILE:
             // メインカテゴリの取得
             $this->arrCat = $this->lfGetMainCat(true);
             break;
         default:
             // 選択中のカテゴリID
             $this->tpl_category_id = $this->lfGetSelectedCategoryId($_GET);
             // カテゴリツリーの取得
             $this->arrTree = $this->lfGetCatTree($this->tpl_category_id, true);
             break;
     }
 }
Example #16
0
 /**
  * Page を初期化する.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->tpl_title = 'お問い合わせ';
     } else {
         $this->tpl_title = 'お問い合わせ(入力ページ)';
     }
     $this->httpCacheControl('nocache');
     $masterData = new SC_DB_MasterData_Ex();
     $this->arrPref = $masterData->getMasterData('mtb_pref');
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         // @deprecated EC-CUBE 2.11 テンプレート互換用
         $this->CONF = SC_Helper_DB_Ex::sfGetBasisData();
     }
 }
 /**
  * Page を初期化する.
  *
  * @return void
  */
 function init()
 {
     parent::init();
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         $this->tpl_title = t('c_Inquiry_01');
     } else {
         $this->tpl_title = t('c_Inquiry_02');
     }
     $this->tpl_page_category = 'contact';
     $this->httpCacheControl('nocache');
     $masterData = new SC_DB_MasterData_Ex();
     $this->arrPref = $masterData->getMasterData('mtb_pref');
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         // @deprecated EC-CUBE 2.11 テンプレート互換用
         $this->CONF = SC_Helper_DB_Ex::sfGetBasisData();
     }
 }
Example #18
0
 public function isLoginSuccess($dont_check_email_mobile = false)
 {
     // ログイン時のメールアドレスとDBのメールアドレスが一致している場合
     if (isset($_SESSION['customer']['customer_id']) && SC_Utils_Ex::sfIsInt($_SESSION['customer']['customer_id'])) {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $email = $objQuery->get('email', 'dtb_customer', 'customer_id = ?', array($_SESSION['customer']['customer_id']));
         if ($email == $_SESSION['customer']['email']) {
             // モバイルサイトの場合は携帯のメールアドレスが登録されていることもチェックする。
             // ただし $dont_check_email_mobile が true の場合はチェックしない。
             if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && !$dont_check_email_mobile) {
                 $email_mobile = $objQuery->get('email_mobile', 'dtb_customer', 'customer_id = ?', array($_SESSION['customer']['customer_id']));
                 return isset($email_mobile);
             }
             return true;
         }
     }
     return false;
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     $customer_id = $objCustomer->getvalue('customer_id');
     //ページ送り用
     $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'], $this->lfGetOrderHistory($customer_id), SEARCH_PMAX, 'fnNaviPage', NAVI_PMAX, 'pageno=#page#', SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
     $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
     switch ($this->getMode()) {
         case 'getList':
             echo SC_Utils_Ex::jsonEncode($this->arrOrder);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     // 支払い方法の取得
     $this->arrPayment = SC_Helper_DB_Ex::sfGetIDValueList('dtb_payment', 'payment_id', 'payment_method');
     // 1ページあたりの件数
     $this->dispNumber = SEARCH_PMAX;
 }
 /**
  * 新着情報を取得する.
  *
  * @return array $arrNewsList 新着情報の配列を返す
  */
 function lfGetNews(&$objQuery)
 {
     if (DB_TYPE != 'sqlsrv') {
         return parent::lfGetNews($objQuery);
     } else {
         $objQuery->setOrder('rank DESC ');
         $arrNewsList = $objQuery->select("* ,convert(varchar(4), YEAR(news_date)) + '-' + convert(varchar(2), MONTH(news_date)) + '-' + convert(varchar(10), DAY(news_date)) as news_date_disp", 'dtb_news', 'del_flg = 0');
         // モバイルサイトのセッション保持 (#797)
         if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
             foreach (array_keys($arrNewsList) as $key) {
                 $arrRow =& $arrNewsList[$key];
                 if (SC_Utils_Ex::isAppInnerUrl($arrRow['news_url'])) {
                     $netUrl = new Net_URL($arrRow['news_url']);
                     $netUrl->addQueryString(session_name(), session_id());
                     $arrRow['news_url'] = $netUrl->getURL();
                 }
             }
         }
         return $arrNewsList;
     }
 }
Example #21
0
 /**
  * パラメーター管理で設定したセッション維持設定に従って適切なオブジェクトを返す.
  *
  * @return SC_SessionFactory
  */
 function getInstance()
 {
     $type = defined('SESSION_KEEP_METHOD') ? SESSION_KEEP_METHOD : '';
     switch ($type) {
         // セッションの維持にリクエストパラメーターを使用する
         case 'useRequest':
             $session = new SC_SessionFactory_UseRequest();
             SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE ? $session->setState('mobile') : $session->setState('pc');
             break;
             // クッキーを使用する
         // クッキーを使用する
         case 'useCookie':
             // モバイルの場合はSC_SessionFactory_UseRequestを使用する
             if (Net_UserAgent_Mobile::isMobile() === true) {
                 $session = new SC_SessionFactory_UseRequest();
                 $session->setState('mobile');
                 break;
             }
         default:
             $session = new SC_SessionFactory_UseCookie();
             break;
     }
     return $session;
 }
 /**
  * 会員登録編集共通の相関チェック
  *
  * @param  SC_CheckError $objErr  SC_CheckError インスタンス
  * @param  boolean       $isAdmin 管理画面チェック時:true
  * @return SC_CheckError $objErr エラー情報
  */
 public function sfCustomerRegisterErrorCheck(&$objErr, $isAdmin = false)
 {
     $objErr->doFunc(array('生年月日', 'year', 'month', 'day'), array('CHECK_BIRTHDAY'));
     $objErr->doFunc(array('パスワード', 'password', PASSWORD_MIN_LEN, PASSWORD_MAX_LEN), array('NUM_RANGE_CHECK'));
     if (SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE) {
         if (!$isAdmin) {
             $objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)', 'email', 'email02'), array('EQUAL_CHECK'));
         }
         $objErr->doFunc(array('パスワード', 'パスワード(確認)', 'password', 'password02'), array('EQUAL_CHECK'));
     }
     if (!$isAdmin) {
         // 現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
         $objErr->doFunc(array('メールアドレス', 'email'), array('CHECK_REGIST_CUSTOMER_EMAIL'));
         $objErr->doFunc(array('携帯メールアドレス', 'email_mobile'), array('CHECK_REGIST_CUSTOMER_EMAIL', 'MOBILE_EMAIL_CHECK'));
     }
     return $objErr;
 }
 /**
  * Page のResponse.
  *
  * todo たいした処理でないのに異常に処理が重い
  * @return void
  */
 function sendResponse()
 {
     // TODO sendResponseをオーバーライドしている為、afterフックポイントが実行されない.直接実行する.(#1790)
     $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
     $objPlugin->doAction('LC_Page_Mypage_DownLoad_action_after', array($this));
     $this->objDisplay->noAction();
     // パラメーター取得
     $customer_id = $_SESSION['customer']['customer_id'];
     $order_id = $_GET['order_id'];
     $product_id = $_GET['product_id'];
     $product_class_id = $_GET['product_class_id'];
     //DBから商品情報の読込
     $arrForm = $this->lfGetRealFileName($customer_id, $order_id, $product_id, $product_class_id);
     //ファイル情報が無い場合はNG
     if ($arrForm['down_realfilename'] == '') {
         SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true);
     }
     //ファイルそのものが無い場合もとりあえずNG
     $realpath = DOWN_SAVE_REALDIR . $arrForm['down_realfilename'];
     if (!file_exists($realpath)) {
         SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true);
     }
     //ファイル名をエンコードする Safariの対策はUTF-8で様子を見る
     $encoding = 'Shift_JIS';
     if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')) {
         $encoding = 'UTF-8';
     }
     $sdown_filename = mb_convert_encoding($arrForm['down_filename'], $encoding, 'auto');
     // flushなどを利用しているので、現行のSC_Displayは利用できません。
     // SC_DisplayやSC_Responseに大容量ファイルレスポンスが実装されたら移行可能だと思います。
     // ダウンロード実行 モバイル端末はダウンロード方法が異なる
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         // キャリアがAUのモバイル端末はさらにダウンロード方法が異なる
         if (SC_MobileUserAgent::getCarrier() == 'ezweb') {
             // AUモバイル
             $this->lfMobileAuDownload($realpath, $sdown_filename);
         } else {
             // AU以外のモバイル
             $this->lfMobileDownload($realpath, $sdown_filename);
         }
     } else {
         // PC、スマフォ
         $this->lfDownload($realpath, $sdown_filename);
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objCartSess = new SC_CartSession_Ex();
     $objSiteSess = new SC_SiteSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objFormParam = $this->lfInitParam($_POST);
     $this->mode = $this->getMode();
     // モバイル対応
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         if (isset($_GET['cart_no'])) {
             $objFormParam->setValue('cart_no', $_GET['cart_no']);
         }
         if (isset($_GET['cartKey'])) {
             $objFormParam->setValue('cartKey', $_GET['cartKey']);
         }
     }
     $this->cartKeys = $objCartSess->getKeys();
     foreach ($this->cartKeys as $key) {
         // 商品購入中にカート内容が変更された。
         if ($objCartSess->getCancelPurchase($key)) {
             $this->tpl_message .= "商品購入中にカート内容が変更されましたので、お手数ですが購入手続きをやり直して下さい。\n";
         }
     }
     $cart_no = $objFormParam->getValue('cart_no');
     $cartKey = $objFormParam->getValue('cartKey');
     // エラーチェック
     $arrError = $objFormParam->checkError();
     if (isset($arrError) && !empty($arrError)) {
         SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND);
         SC_Response_Ex::actionExit();
     }
     switch ($this->mode) {
         case 'confirm':
             // カート内情報の取得
             $cartList = $objCartSess->getCartList($cartKey);
             // カート商品が1件以上存在する場合
             if (count($cartList) > 0) {
                 // カートを購入モードに設定
                 $this->lfSetCurrentCart($objSiteSess, $objCartSess, $cartKey);
                 // 購入ページへ
                 SC_Response_Ex::sendRedirect(SHOPPING_URL);
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'up':
             //1個追加
             $objCartSess->upQuantity($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'down':
             //1個減らす
             $objCartSess->downQuantity($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'setQuantity':
             //数量変更
             $objCartSess->setQuantity($objFormParam->getValue('quantity'), $cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'delete':
             //カートから削除
             $objCartSess->delProduct($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
     $totalIncTax = 0;
     foreach ($this->cartKeys as $key) {
         // カート集計処理
         $this->tpl_message .= $objCartSess->checkProducts($key);
         $this->tpl_total_inctax[$key] = $objCartSess->getAllProductsTotal($key);
         $totalIncTax += $this->tpl_total_inctax[$key];
         $this->tpl_total_tax[$key] = $objCartSess->getAllProductsTax($key);
         // ポイント合計
         $this->tpl_total_point[$key] = $objCartSess->getAllProductsPoint($key);
         $this->arrData[$key] = $objCartSess->calculate($key, $objCustomer);
         // 送料無料チェック
         $this->arrData[$key]['is_deliv_free'] = $objCartSess->isDelivFree($key);
         // 送料無料までの金額を計算
         $this->tpl_deliv_free[$key] = $this->arrInfo['free_rule'] - $this->tpl_total_inctax[$key];
     }
     //商品の合計金額をセット
     $this->tpl_all_total_inctax = $totalIncTax;
     $this->tpl_category_id = $objFormParam->getValue('category_id');
     // ログイン判定
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = true;
         $this->tpl_user_point = $objCustomer->getValue('point');
         $this->tpl_name = $objCustomer->getValue('name01');
     }
     // 前頁のURLを取得
     // TODO: SC_CartSession::setPrevURL()利用不可。
     $this->lfGetCartPrevUrl($_SESSION, $_SERVER['HTTP_REFERER']);
     $this->tpl_prev_url = isset($_SESSION['cart_prev_url']) ? $_SESSION['cart_prev_url'] : '';
     // すべてのカートの内容を取得する
     $this->cartItems = $objCartSess->getAllCartList();
 }
Example #25
0
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
// rtrim は PHP バージョン依存対策
define('HTML_REALDIR', rtrim(realpath(rtrim(realpath(dirname(__FILE__)), '/\\') . '/'), '/\\') . '/');
if (!defined('ADMIN_FUNCTION') || ADMIN_FUNCTION !== true) {
    define('FRONT_FUNCTION', true);
}
require_once HTML_REALDIR . 'define.php';
if (ob_get_level() > 0 && ob_get_length() > 0) {
    while (ob_end_clean()) {
    }
}
require_once HTML_REALDIR . HTML2DATA_DIR . 'require_base.php';
// 絵文字変換 (除去) フィルターを組み込む。
ob_start(array('SC_MobileEmoji', 'handler'));
if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
    // resize_image.phpは除外
    if (stripos($_SERVER['REQUEST_URI'], ROOT_URLPATH . 'resize_image.php') === FALSE) {
        $objMobile = new SC_Helper_Mobile_Ex();
        $objMobile->sfMobileInit();
    }
}
 /**
  * ログインを実行する.
  *
  * ログインを実行し, 成功した場合はユーザー情報をセッションに格納し,
  * true を返す.
  * モバイル端末の場合は, 携帯端末IDを保存する.
  * ログインに失敗した場合は, false を返す.
  *
  * @param string $login_email ログインメールアドレス
  * @param string $login_pass ログインパスワード
  * @return boolean ログインに成功した場合 true; 失敗した場合 false
  */
 function doLogin($login_email, $login_pass)
 {
     switch (SC_Display_Ex::detectDevice()) {
         case DEVICE_TYPE_MOBILE:
             if (!$this->is->getCustomerDataFromMobilePhoneIdPass($login_pass) && !$this->getCustomerDataFromEmailPass($login_pass, $login_email, true)) {
                 return false;
             } else {
                 $this->updateMobilePhoneId();
                 return true;
             }
             break;
         case DEVICE_TYPE_SMARTPHONE:
         case DEVICE_TYPE_PC:
         default:
             if (!$this->getCustomerDataFromEmailPass($login_pass, $login_email)) {
                 return false;
             } else {
                 return true;
             }
             break;
     }
 }
Example #27
0
 function sfDispSiteError($type, $objSiteSess = '', $return_top = false, $err_msg = '')
 {
     require_once CLASS_EX_REALDIR . 'page_extends/error/LC_Page_Error_Ex.php';
     $objPage = new LC_Page_Error_Ex();
     register_shutdown_function(array($objPage, 'destroy'));
     $objPage->init();
     $objPage->type = $type;
     $objPage->objSiteSess = $objSiteSess;
     $objPage->return_top = $return_top;
     $objPage->err_msg = $err_msg;
     $objPage->is_mobile = SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE;
     $objPage->process();
     exit;
 }
 /**
  * 端末種別を判別する。
  *
  * SC_Display::MOBILE = ガラケー = 1
  * SC_Display::SMARTPHONE = スマホ = 2
  * SC_Display::PC = PC = 10
  *
  * @static
  * @param   $reset  boolean
  * @return integer 端末種別ID
  */
 public static function detectDevice($reset = FALSE)
 {
     if (is_null(SC_Display_Ex::$device) || $reset) {
         $nu = new Net_UserAgent_Mobile();
         $su = new SC_SmartphoneUserAgent_Ex();
         if ($nu->isMobile()) {
             SC_Display_Ex::$device = DEVICE_TYPE_MOBILE;
         } elseif ($su->isSmartphone()) {
             SC_Display_Ex::$device = DEVICE_TYPE_SMARTPHONE;
         } else {
             SC_Display_Ex::$device = DEVICE_TYPE_PC;
         }
     }
     return SC_Display_Ex::$device;
 }
Example #29
0
 /**
  * アプリケーション内でリダイレクトする
  *
  * 内部で生成する URL の searchpart は、下記の順で上書きしていく。(後勝ち)
  * 1. 引数 $inheritQueryString が true の場合、$_SERVER['QUERY_STRING']
  * 2. $location に含まれる searchpart
  * 3. 引数 $arrQueryString
  * @param string $location 「url-path」「現在のURLからのパス」「URL」のいずれか。「../」の解釈は行なわない。
  * @param array $arrQueryString URL に付加する searchpart
  * @param bool $inheritQueryString 現在のリクエストの searchpart を継承するか
  * @param bool|null $useSsl true:HTTPSを強制, false:HTTPを強制, null:継承
  * @return void
  * @static
  */
 function sendRedirect($location, $arrQueryString = array(), $inheritQueryString = false, $useSsl = null)
 {
     // ローカルフックポイント処理
     $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
     $arrBacktrace = debug_backtrace();
     if (is_object($arrBacktrace[0]['object']) && method_exists($arrBacktrace[0]['object'], 'getMode')) {
         $parent_class_name = get_parent_class($arrBacktrace[0]['object']);
         $objPlugin->doAction($parent_class_name . '_action_' . $arrBacktrace[0]['object']->getMode(), array($arrBacktrace[0]['object']));
         $class_name = get_class($arrBacktrace[0]['object']);
         if ($class_name != $parent_class_name) {
             $objPlugin->doAction($class_name . '_action_' . $arrBacktrace[0]['object']->getMode(), array($this));
         }
     } elseif (is_object($arrBacktrace[0]['object'])) {
         $pattern = '/^[a-zA-Z0-9_]+$/';
         $mode = null;
         if (isset($_GET['mode']) && preg_match($pattern, $_GET['mode'])) {
             $mode = $_GET['mode'];
         } elseif (isset($_POST['mode']) && preg_match($pattern, $_POST['mode'])) {
             $mode = $_POST['mode'];
         }
         $parent_class_name = get_parent_class($arrBacktrace[0]['object']);
         $objPlugin->doAction($parent_class_name . '_action_' . $mode, array($arrBacktrace[0]['object']));
         $class_name = get_class($arrBacktrace[0]['object']);
         if ($class_name != $parent_class_name) {
             $objPlugin->doAction($class_name . '_action_' . $mode, array($this));
         }
     }
     // url-path → URL 変換
     if ($location[0] === '/') {
         $netUrl = new Net_URL($location);
         $location = $netUrl->getUrl();
     }
     // URL の場合
     if (preg_match('/^https?:/', $location)) {
         $url = $location;
         if (is_bool($useSsl)) {
             if ($useSsl) {
                 $pattern = '/^' . preg_quote(HTTP_URL, '/') . '(.*)/';
                 $replacement = HTTPS_URL . '\\1';
                 $url = preg_replace($pattern, $replacement, $url);
             } else {
                 $pattern = '/^' . preg_quote(HTTPS_URL, '/') . '(.*)/';
                 $replacement = HTTP_URL . '\\1';
                 $url = preg_replace($pattern, $replacement, $url);
             }
         }
     } else {
         if (!is_bool($useSsl)) {
             $useSsl = SC_Utils_Ex::sfIsHTTPS();
         }
         $netUrl = new Net_URL($useSsl ? HTTPS_URL : HTTP_URL);
         $netUrl->path = dirname($_SERVER['SCRIPT_NAME']) . '/' . $location;
         $url = $netUrl->getUrl();
     }
     $pattern = '/^(' . preg_quote(HTTP_URL, '/') . '|' . preg_quote(HTTPS_URL, '/') . ')/';
     // アプリケーション外へのリダイレクトは扱わない
     if (preg_match($pattern, $url) === 0) {
         trigger_error('', E_USER_ERROR);
     }
     $netUrl = new Net_URL($url);
     if ($inheritQueryString && !empty($_SERVER['QUERY_STRING'])) {
         $arrQueryStringBackup = $netUrl->querystring;
         // XXX メソッド名は add で始まるが、実際には置換を行う
         $netUrl->addRawQueryString($_SERVER['QUERY_STRING']);
         $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryStringBackup);
     }
     $netUrl->querystring = array_merge($netUrl->querystring, $arrQueryString);
     $session = SC_SessionFactory_Ex::getInstance();
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE || $session->useCookie() == false) {
         $netUrl->addQueryString(session_name(), session_id());
     }
     $netUrl->addQueryString(TRANSACTION_ID_NAME, SC_Helper_Session_Ex::getToken());
     $url = $netUrl->getURL();
     header("Location: {$url}");
     exit;
 }
 /**
  * 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');
     }
 }