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

Revision 22796, 5.9 KB checked in by h_yoshimoto, 11 years ago (diff)

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

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