source: branches/version-2_13-dev/data/class/pages/regist/LC_Page_Regist.php @ 22856

Revision 22856, 5.9 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。もう少し整えたいが、一旦現状コミット。
  • 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
Line 
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$
32 */
33class LC_Page_Regist extends LC_Page_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43    }
44
45    /**
46     * Page のプロセス.
47     *
48     * @return void
49     */
50    function process()
51    {
52        parent::process();
53        $this->action();
54        $this->sendResponse();
55    }
56
57    /**
58     * Page のAction.
59     *
60     * @return void
61     */
62    function action()
63    {
64        switch ($this->getMode()) {
65            case 'regist':
66            //-- 本登録完了のためにメールから接続した場合
67                //-- 入力チェック
68                $this->arrErr       = $this->lfCheckError($_GET);
69                if ($this->arrErr) SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, $this->arrErr['id']);
70
71                $registSecretKey    = $this->lfRegistData($_GET);   //本会員登録(フラグ変更)
72                $this->lfSendRegistMail($registSecretKey);          //本会員登録完了メール送信
73
74                SC_Response_Ex::sendRedirect('complete.php', array('ci' => SC_Helper_Customer_Ex::sfGetCustomerId($registSecretKey)));
75                break;
76            //-- それ以外のアクセスは無効とする
77            default:
78                SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, '無効なアクセスです。');
79                break;
80        }
81
82    }
83
84    /**
85     * デストラクタ.
86     *
87     * @return void
88     */
89    function destroy()
90    {
91        parent::destroy();
92    }
93
94    /**
95     * 仮会員を本会員にUpdateする
96     *
97     * @param mixed $array
98     * @access private
99     * @return string $arrRegist['secret_key'] 本登録ID
100     */
101    function lfRegistData($array)
102    {
103        $objQuery                   = SC_Query_Ex::getSingletonInstance();
104        $arrRegist['secret_key']    = SC_Helper_Customer_Ex::sfGetUniqSecretKey(); //本登録ID発行
105        $arrRegist['status']        = 2;
106        $arrRegist['update_date']   = 'CURRENT_TIMESTAMP';
107
108        $objQuery->begin();
109        $objQuery->update('dtb_customer', $arrRegist, 'secret_key = ? AND status = 1', array($array['id']));
110        $objQuery->commit();
111
112        return $arrRegist['secret_key'];
113    }
114
115    /**
116     * 入力エラーチェック
117     *
118     * @param mixed $array
119     * @access private
120     * @return array エラーの配列
121     */
122    function lfCheckError($array)
123    {
124        $objErr     = new SC_CheckError_Ex($array);
125
126        if (preg_match("/^[[:alnum:]]+$/", $array['id'])) {
127            if (!is_numeric(SC_Helper_Customer_Ex::sfGetCustomerId($array['id'], true))) {
128                $objErr->arrErr['id'] = '※ 既に会員登録が完了しているか、無効なURLです。<br>';
129            }
130
131        } else {
132            $objErr->arrErr['id'] = '無効なURLです。メールに記載されている本会員登録用URLを再度ご確認ください。';
133        }
134
135        return $objErr->arrErr;
136    }
137
138    /**
139     * 正会員登録完了メール送信
140     *
141     * @param mixed $registSecretKey
142     * @access private
143     * @return void
144     */
145    function lfSendRegistMail($registSecretKey)
146    {
147        $objQuery       = SC_Query_Ex::getSingletonInstance();
148        $objCustomer    = new SC_Customer_Ex();
149        $objHelperMail  = new SC_Helper_Mail_Ex();
150        $objHelperMail->setPage($this);
151        $CONF           = SC_Helper_DB_Ex::sfGetBasisData();
152
153        //-- 会員データを取得
154        $arrCustomer    = $objQuery->select('*', 'dtb_customer', 'secret_key = ?', array($registSecretKey));
155        $data           = $arrCustomer[0];
156        $objCustomer->setLogin($data['email']);
157
158        //-- メール送信
159        $objMailText    = new SC_SiteView_Ex();
160        $objMailText->setPage($this);
161        $objMailText->assign('CONF', $CONF);
162        $objMailText->assign('name01', $data['name01']);
163        $objMailText->assign('name02', $data['name02']);
164        $toCustomerMail = $objMailText->fetch('mail_templates/customer_regist_mail.tpl');
165        $subject = $objHelperMail->sfMakesubject('会員登録が完了しました。');
166        $objMail = new SC_SendMail_Ex();
167
168        $objMail->setItem(
169                              ''                                // 宛先
170                            , $subject                  // サブジェクト
171                            , $toCustomerMail           // 本文
172                            , $CONF['email03']          // 配送元アドレス
173                            , $CONF['shop_name']        // 配送元 名前
174                            , $CONF['email03']          // reply_to
175                            , $CONF['email04']          // return_path
176                            , $CONF['email04']          // Errors_to
177        );
178        // 宛先の設定
179        $name = $data['name01'] . $data['name02'] .' 様';
180        $objMail->setTo($data['email'], $name);
181        $objMail->sendMail();
182    }
183}
Note: See TracBrowser for help on using the repository browser.