Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Entry.php

Documentation is available at LC_Page_Entry.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once CLASS_EX_REALDIR 'page_extends/LC_Page_Ex.php';
  26.  
  27. /**
  28.  * 会員登録のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id:LC_Page_Entry.php 15532 2007-08-31 14:39:46Z nanasess $
  33.  */
  34. class LC_Page_Entry extends LC_Page_Ex {
  35.  
  36.     // {{{ properties
  37.  
  38.     // }}}
  39.     // {{{ functions
  40.  
  41.     /**
  42.      * Page を初期化する.
  43.      * @return void 
  44.      */
  45.     function init({
  46.         parent::init();
  47.         $masterData         new SC_DB_MasterData_Ex();
  48.         $this->arrPref      $masterData->getMasterData('mtb_pref');
  49.         $this->arrJob       $masterData->getMasterData("mtb_job");
  50.         $this->arrReminder  $masterData->getMasterData("mtb_reminder");
  51.  
  52.         // 生年月日選択肢の取得
  53.         $objDate            new SC_Date_Ex(BIRTH_YEARdate('Y',strtotime('now')));
  54.         $this->arrYear      $objDate->getYear(''START_BIRTH_YEAR'');
  55.         $this->arrMonth     $objDate->getMonth(true);
  56.         $this->arrDay       $objDate->getDay(true);
  57.  
  58.         $this->httpCacheControl('nocache');
  59.     }
  60.  
  61.     /**
  62.      * Page のプロセス.
  63.      *
  64.      * @return void 
  65.      */
  66.     function process({
  67.         $this->action();
  68.         $this->sendResponse();
  69.     }
  70.  
  71.     /**
  72.      * Page のプロセス
  73.      * @return void 
  74.      */
  75.     function action({
  76.         $objFormParam new SC_FormParam_Ex();
  77.  
  78.         SC_Helper_Customer_Ex::sfCustomerEntryParam($objFormParam);
  79.         $objFormParam->setParam($_POST);
  80.         $arrForm  $objFormParam->getHashArray();
  81.  
  82.         // PC時は規約ページからの遷移でなければエラー画面へ遷移する
  83.         if ($this->lfCheckReferer($arrForm$_SERVER['HTTP_REFERER']=== false{
  84.             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR""true);
  85.         }
  86.  
  87.         // mobile用(戻るボタンでの遷移かどうかを判定)
  88.         if (!empty($arrForm['return'])) {
  89.             $_POST['mode''return';
  90.         }
  91.  
  92.         switch ($this->getMode()) {
  93.         case 'confirm':
  94.             //-- 確認
  95.             $this->arrErr SC_Helper_Customer_Ex::sfCustomerEntryErrorCheck($objFormParam);
  96.             $this->arrForm  $objFormParam->getHashArray();
  97.             // 入力エラーなし
  98.             if(empty($this->arrErr)) {
  99.                 //パスワード表示
  100.                 $this->passlen      SC_Utils_Ex::sfPassLen(strlen($this->arrForm['password']));
  101.  
  102.                 $this->tpl_mainpage 'entry/confirm.tpl';
  103.                 $this->tpl_title    '会員登録(確認ページ)';
  104.             }
  105.             break;
  106.         case 'complete':
  107.             //-- 会員登録と完了画面
  108.             $this->arrErr SC_Helper_Customer_Ex::sfCustomerEntryErrorCheck($objFormParam);
  109.             $this->arrForm  $objFormParam->getHashArray();
  110.             if(empty($this->arrErr)) {
  111.  
  112.                 $uniqid             $this->lfRegistCustomerData($this->lfMakeSqlVal($objFormParam));
  113.  
  114.                 $this->tpl_mainpage 'entry/complete.tpl';
  115.                 $this->tpl_title    '会員登録(完了ページ)';
  116.                 $this->lfSendMail($uniqid$this->arrForm);
  117.  
  118.                 // 仮会員が無効の場合
  119.                 if(CUSTOMER_CONFIRM_MAIL == false{
  120.                     // ログイン状態にする
  121.                     $objCustomer new SC_Customer_Ex();
  122.                     $objCustomer->setLogin($this->arrForm['email']);
  123.                 }
  124.  
  125.                 // 完了ページに移動させる。
  126.                 SC_Response_Ex::sendRedirect('complete.php'array('ci' => SC_Helper_Customer_Ex::sfGetCustomerId($uniqid)));
  127.             }
  128.             break;
  129.         case 'return':
  130.             $this->arrForm  $objFormParam->getHashArray();
  131.             break;
  132.         default:
  133.             break;
  134.         }
  135.     }
  136.  
  137.     /**
  138.      * デストラクタ.
  139.      *
  140.      * @return void 
  141.      */
  142.     function destroy({
  143.         parent::destroy();
  144.     }
  145.  
  146.     // }}}
  147.     // {{{ protected functions
  148.     /**
  149.      * 会員情報の登録
  150.      *
  151.      * @access private
  152.      * @return uniqid 
  153.      */
  154.     function lfRegistCustomerData($sqlval{
  155.         SC_Helper_Customer_Ex::sfEditCustomerData($sqlval);
  156.         return $sqlval["secret_key"];
  157.     }
  158.  
  159.     /**
  160.      * 会員登録に必要なSQLパラメーターの配列を生成する.
  161.      *
  162.      * フォームに入力された情報を元に, SQLパラメーターの配列を生成する.
  163.      * モバイル端末の場合は, email を email_mobile にコピーし,
  164.      * mobile_phone_id に携帯端末IDを格納する.
  165.      *
  166.      * @param mixed $objFormParam 
  167.      * @access private
  168.      * @return $arrResults 
  169.      */
  170.     function lfMakeSqlVal(&$objFormParam{
  171.         $arrForm                $objFormParam->getHashArray();
  172.         $arrResults             $objFormParam->getDbArray();
  173.  
  174.         // 生年月日の作成
  175.         $arrResults['birth']    SC_Utils_Ex::sfGetTimestamp($arrForm['year']$arrForm['month']$arrForm['day']);
  176.  
  177.         // 仮会員 1 本会員 2
  178.         $arrResults['status']   (CUSTOMER_CONFIRM_MAIL == true"1" "2";
  179.  
  180.         /*
  181.          * secret_keyは、テーブルで重複許可されていない場合があるので、
  182.          * 本会員登録では利用されないがセットしておく。
  183.          */
  184.         $arrResults["secret_key"SC_Helper_Customer_Ex::sfGetUniqSecretKey();
  185.  
  186.         // 入会時ポイント
  187.         $CONF SC_Helper_DB_Ex::sfGetBasisData();
  188.         $arrResults['point'$CONF["welcome_point"];
  189.  
  190.         if (SC_Display_Ex::detectDevice(== DEVICE_TYPE_MOBILE{
  191.             // 携帯メールアドレス
  192.             $arrResults['email_mobile']     $arrResults['email'];
  193.             // PHONE_IDを取り出す
  194.             $arrResults['mobile_phone_id']  =  SC_MobileUserAgent_Ex::getId();
  195.         }
  196.         return $arrResults;
  197.     }
  198.  
  199.     /**
  200.      * 会員登録完了メール送信する
  201.      *
  202.      * @access private
  203.      * @return void 
  204.      */
  205.     function lfSendMail($uniqid$arrForm){
  206.         $CONF           SC_Helper_DB_Ex::sfGetBasisData();
  207.  
  208.         $objMailText    new SC_SiteView_Ex();
  209.         $objMailText->assign('CONF'$CONF);
  210.         $objMailText->assign("name01"$arrForm['name01']);
  211.         $objMailText->assign("name02"$arrForm['name02']);
  212.         $objMailText->assign('uniqid'$uniqid);
  213.         $objMailText->assignobj($this);
  214.  
  215.         $objHelperMail  new SC_Helper_Mail_Ex();
  216.  
  217.         // 仮会員が有効の場合
  218.         if(CUSTOMER_CONFIRM_MAIL == true{
  219.             $subject        $objHelperMail->sfMakeSubject('会員登録のご確認');
  220.             $toCustomerMail $objMailText->fetch("mail_templates/customer_mail.tpl");
  221.         else {
  222.             $subject        $objHelperMail->sfMakeSubject('会員登録のご完了');
  223.             $toCustomerMail $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
  224.         }
  225.  
  226.         $objMail new SC_SendMail();
  227.         $objMail->setItem(
  228.             ''                    // 宛先
  229.             $subject              // サブジェクト
  230.             $toCustomerMail       // 本文
  231.             $CONF["email03"]      // 配送元アドレス
  232.             $CONF["shop_name"]    // 配送元 名前
  233.             $CONF["email03"]      // reply_to
  234.             $CONF["email04"]      // return_path
  235.             $CONF["email04"]      // Errors_to
  236.             $CONF["email01"]      // Bcc
  237.         );
  238.         // 宛先の設定
  239.         $objMail->setTo($arrForm['email'],
  240.                         $arrForm["name01"$arrForm["name02"." 様");
  241.  
  242.         $objMail->sendMail();
  243.     }
  244.  
  245.     /**
  246.      * kiyaku.php からの遷移の妥当性をチェックする
  247.      *
  248.      * 以下の内容をチェックし, 妥当であれば true を返す.
  249.      * 1. 規約ページからの遷移かどうか
  250.      * 2. PC及びスマートフォンかどうか
  251.      * 3. $post に何も含まれていないかどうか
  252.      *
  253.      * @access protected
  254.      * @param array $post $_POST のデータ
  255.      * @param string $referer $_SERVER['HTTP_REFERER'] のデータ
  256.      * @return boolean kiyaku.php からの妥当な遷移であれば true
  257.      */
  258.     function lfCheckReferer(&$post$referer){
  259.  
  260.         if (SC_Display_Ex::detectDevice(!== DEVICE_TYPE_MOBILE
  261.             && empty($post)
  262.             && (preg_match('/kiyaku.php/'basename($referer)) === 0)) {
  263.             return false;
  264.             }
  265.         return true;
  266.     }
  267. }

Documentation generated on Fri, 24 Feb 2012 14:01:55 +0900 by Seasoft