Warning: Can't use blame annotator:
svn blame failed on branches/version-2_13-dev/data/class/pages/entry/LC_Page_Entry.php: バイナリファイル 'file:///home/svn/open/branches/version-2_13-dev/data/class/pages/entry/LC_Page_Entry.php' に対しては blame で各行の最終変更者を計算できません 195004

source: branches/version-2_13-dev/data/class/pages/entry/LC_Page_Entry.php @ 23007

Revision 23007, 11.2 KB checked in by shutta, 11 years ago (diff)

#2311 (規約ページを経由せずに会員登録(入力ページ)が表示できてしまう)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
RevLine 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 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
24require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
25
26/**
27 * 会員登録のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id:LC_Page_Entry.php 15532 2007-08-31 14:39:46Z nanasess $
32 */
33class LC_Page_Entry extends LC_Page_Ex
34{
35    /**
36     * Page を初期化する.
37     * @return void
38     */
39    function init()
40    {
41        parent::init();
42        $masterData         = new SC_DB_MasterData_Ex();
43        $this->arrPref      = $masterData->getMasterData('mtb_pref');
44        $this->arrJob       = $masterData->getMasterData('mtb_job');
45        $this->arrReminder  = $masterData->getMasterData('mtb_reminder');
46        $this->arrCountry   = $masterData->getMasterData('mtb_country');
47
48        // 生年月日選択肢の取得
49        $objDate            = new SC_Date_Ex(BIRTH_YEAR, date('Y',strtotime('now')));
50        $this->arrYear      = $objDate->getYear('', START_BIRTH_YEAR, '');
51        $this->arrMonth     = $objDate->getMonth(true);
52        $this->arrDay       = $objDate->getDay(true);
53
54        $this->httpCacheControl('nocache');
55    }
56
57    /**
58     * Page のプロセス.
59     *
60     * @return void
61     */
62    function process()
63    {
64        parent::process();
65        $this->action();
66        $this->sendResponse();
67    }
68
69    /**
70     * Page のプロセス
71     * @return void
72     */
73    function action()
74    {
75        $objFormParam = new SC_FormParam_Ex();
76
77        SC_Helper_Customer_Ex::sfCustomerEntryParam($objFormParam);
78        $objFormParam->setParam($_POST);
79        $arrForm  = $objFormParam->getHashArray();
80
81        // PC時は規約ページからの遷移でなければエラー画面へ遷移する
82        if ($this->lfCheckReferer($arrForm, $_SERVER['HTTP_REFERER']) === false) {
83            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
84        }
85
86        // mobile用(戻るボタンでの遷移かどうかを判定)
87        if (!empty($arrForm['return'])) {
88            $_POST['mode'] = 'return';
89        }
90
91        switch ($this->getMode()) {
92            case 'confirm':
93                if (isset($_POST['submit_address'])) {
94                    // 入力エラーチェック
95                    $this->arrErr = $this->lfCheckError($_POST);
96                    // 入力エラーの場合は終了
97                    if (count($this->arrErr) == 0) {
98                        // 郵便番号検索文作成
99                        $zipcode = $_POST['zip01'] . $_POST['zip02'];
100
101                        // 郵便番号検索
102                        $arrAdsList = SC_Utils_Ex::sfGetAddress($zipcode);
103
104                        // 郵便番号が発見された場合
105                        if (!empty($arrAdsList)) {
106                            $data['pref'] = $arrAdsList[0]['state'];
107                            $data['addr01'] = $arrAdsList[0]['city']. $arrAdsList[0]['town'];
108                            $objFormParam->setParam($data);
109
110                            // 該当無し
111                        } else {
112                            $this->arrErr['zip01'] = '※該当する住所が見つかりませんでした。<br>';
113                        }
114                    }
115                    $this->arrForm  = $objFormParam->getHashArray();
116                    break;
117                }
118
119                //-- 確認
120                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerEntryErrorCheck($objFormParam);
121                $this->arrForm  = $objFormParam->getHashArray();
122                // 入力エラーなし
123                if (empty($this->arrErr)) {
124                    //パスワード表示
125                    $this->passlen      = SC_Utils_Ex::sfPassLen(strlen($this->arrForm['password']));
126
127                    $this->tpl_mainpage = 'entry/confirm.tpl';
128                    $this->tpl_title    = '会員登録(確認ページ)';
129                }
130                break;
131            case 'complete':
132                //-- 会員登録と完了画面
133                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerEntryErrorCheck($objFormParam);
134                $this->arrForm  = $objFormParam->getHashArray();
135                if (empty($this->arrErr)) {
136                    $uniqid             = $this->lfRegistCustomerData($this->lfMakeSqlVal($objFormParam));
137
138                    $this->lfSendMail($uniqid, $this->arrForm);
139
140                    // 仮会員が無効の場合
141                    if (CUSTOMER_CONFIRM_MAIL == false) {
142                        // ログイン状態にする
143                        $objCustomer = new SC_Customer_Ex();
144                        $objCustomer->setLogin($this->arrForm['email']);
145                    }
146
147                    // 完了ページに移動させる。
148                    SC_Response_Ex::sendRedirect('complete.php', array('ci' => SC_Helper_Customer_Ex::sfGetCustomerId($uniqid)));
149                }
150                break;
151            case 'return':
152                $this->arrForm  = $objFormParam->getHashArray();
153                break;
154            default:
155                break;
156        }
157
158    }
159
160    /**
161     * 会員情報の登録
162     *
163     * @access private
164     * @return uniqid
165     */
166    function lfRegistCustomerData($sqlval)
167    {
168        SC_Helper_Customer_Ex::sfEditCustomerData($sqlval);
169
170        return $sqlval['secret_key'];
171    }
172
173    /**
174     * 会員登録に必要なSQLパラメーターの配列を生成する.
175     *
176     * フォームに入力された情報を元に, SQLパラメーターの配列を生成する.
177     * モバイル端末の場合は, email を email_mobile にコピーし,
178     * mobile_phone_id に携帯端末IDを格納する.
179     *
180     * @param mixed $objFormParam
181     * @access private
182     * @return $arrResults
183     */
184    function lfMakeSqlVal(&$objFormParam)
185    {
186        $arrForm                = $objFormParam->getHashArray();
187        $arrResults             = $objFormParam->getDbArray();
188
189        // 生年月日の作成
190        $arrResults['birth']    = SC_Utils_Ex::sfGetTimestamp($arrForm['year'], $arrForm['month'], $arrForm['day']);
191
192        // 仮会員 1 本会員 2
193        $arrResults['status']   = (CUSTOMER_CONFIRM_MAIL == true) ? '1' : '2';
194
195        /*
196         * secret_keyは、テーブルで重複許可されていない場合があるので、
197         * 本会員登録では利用されないがセットしておく。
198         */
199        $arrResults['secret_key'] = SC_Helper_Customer_Ex::sfGetUniqSecretKey();
200
201        // 入会時ポイント
202        $CONF = SC_Helper_DB_Ex::sfGetBasisData();
203        $arrResults['point'] = $CONF['welcome_point'];
204
205        if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
206            // 携帯メールアドレス
207            $arrResults['email_mobile']     = $arrResults['email'];
208            // PHONE_IDを取り出す
209            $arrResults['mobile_phone_id']  =  SC_MobileUserAgent_Ex::getId();
210        }
211
212        return $arrResults;
213    }
214
215    /**
216     * 会員登録完了メール送信する
217     *
218     * @access private
219     * @return void
220     */
221    function lfSendMail($uniqid, $arrForm)
222    {
223        $CONF           = SC_Helper_DB_Ex::sfGetBasisData();
224
225        $objMailText    = new SC_SiteView_Ex();
226        $objMailText->setPage($this);
227        $objMailText->assign('CONF', $CONF);
228        $objMailText->assign('name01', $arrForm['name01']);
229        $objMailText->assign('name02', $arrForm['name02']);
230        $objMailText->assign('uniqid', $uniqid);
231        $objMailText->assignobj($this);
232
233        $objHelperMail  = new SC_Helper_Mail_Ex();
234        $objHelperMail->setPage($this);
235
236        // 仮会員が有効の場合
237        if (CUSTOMER_CONFIRM_MAIL == true) {
238            $subject        = $objHelperMail->sfMakeSubject('会員登録のご確認');
239            $toCustomerMail = $objMailText->fetch('mail_templates/customer_mail.tpl');
240        } else {
241            $subject        = $objHelperMail->sfMakeSubject('会員登録のご完了');
242            $toCustomerMail = $objMailText->fetch('mail_templates/customer_regist_mail.tpl');
243        }
244
245        $objMail = new SC_SendMail_Ex();
246        $objMail->setItem(
247            ''                    // 宛先
248            , $subject              // サブジェクト
249            , $toCustomerMail       // 本文
250            , $CONF['email03']      // 配送元アドレス
251            , $CONF['shop_name']    // 配送元 名前
252            , $CONF['email03']      // reply_to
253            , $CONF['email04']      // return_path
254            , $CONF['email04']      // Errors_to
255            , $CONF['email01']      // Bcc
256        );
257        // 宛先の設定
258        $objMail->setTo($arrForm['email'],
259                        $arrForm['name01'] . $arrForm['name02'] .' 様');
260
261        $objMail->sendMail();
262    }
263
264    /**
265     * kiyaku.php からの遷移の妥当性をチェックする
266     *
267     * 以下の内容をチェックし, 妥当であれば true を返す.
268     * 1. 規約ページからの遷移かどうか
269     * 2. PC及びスマートフォンかどうか
270     * 3. $post に何も含まれていないかどうか
271     *
272     * @access protected
273     * @param array $post $_POST のデータ
274     * @param string $referer $_SERVER['HTTP_REFERER'] のデータ
275     * @return boolean kiyaku.php からの妥当な遷移であれば true
276     */
277    function lfCheckReferer(&$post, $referer)
278    {
279        if (SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE
280            && SC_Utils_Ex::isBlank($post)
281            && (preg_match('/kiyaku.php/', basename($referer)) === 0)) {
282            return false;
283            }
284
285        return true;
286    }
287
288    /**
289     * 入力エラーのチェック.
290     *
291     * @param array $arrRequest リクエスト値($_GET)
292     * @return array $arrErr エラーメッセージ配列
293     */
294    function lfCheckError($arrRequest)
295    {
296        // パラメーター管理クラス
297        $objFormParam = new SC_FormParam_Ex();
298        // パラメーター情報の初期化
299        $objFormParam->addParam('郵便番号1', 'zip01', ZIP01_LEN, 'n', array('EXIST_CHECK', 'NUM_COUNT_CHECK', 'NUM_CHECK'));
300        $objFormParam->addParam('郵便番号2', 'zip02', ZIP02_LEN, 'n', array('EXIST_CHECK', 'NUM_COUNT_CHECK', 'NUM_CHECK'));
301        // // リクエスト値をセット
302        $arrData['zip01'] = $arrRequest['zip01'];
303        $arrData['zip02'] = $arrRequest['zip02'];
304        $objFormParam->setParam($arrData);
305        // エラーチェック
306        $arrErr = $objFormParam->checkError();
307
308        return $arrErr;
309    }
310}
Note: See TracBrowser for help on using the repository browser.