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 @ 22926

Revision 22926, 11.1 KB checked in by Seasoft, 11 years ago (diff)

#2287 (環境によりデストラクタが正しく動作しないケースがある)
#2288 (リクエスト単位で実行されるべきログ出力がブロックにも適用されている)
#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

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