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 | require_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 | */ |
---|
33 | class 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 | * 仮会員を本会員にUpdateする |
---|
86 | * |
---|
87 | * @param mixed $array |
---|
88 | * @access private |
---|
89 | * @return string $arrRegist['secret_key'] 本登録ID |
---|
90 | */ |
---|
91 | function lfRegistData($array) |
---|
92 | { |
---|
93 | $objQuery = SC_Query_Ex::getSingletonInstance(); |
---|
94 | $arrRegist['secret_key'] = SC_Helper_Customer_Ex::sfGetUniqSecretKey(); //本登録ID発行 |
---|
95 | $arrRegist['status'] = 2; |
---|
96 | $arrRegist['update_date'] = 'CURRENT_TIMESTAMP'; |
---|
97 | |
---|
98 | $objQuery->begin(); |
---|
99 | $objQuery->update('dtb_customer', $arrRegist, 'secret_key = ? AND status = 1', array($array['id'])); |
---|
100 | $objQuery->commit(); |
---|
101 | |
---|
102 | return $arrRegist['secret_key']; |
---|
103 | } |
---|
104 | |
---|
105 | /** |
---|
106 | * 入力エラーチェック |
---|
107 | * |
---|
108 | * @param mixed $array |
---|
109 | * @access private |
---|
110 | * @return array エラーの配列 |
---|
111 | */ |
---|
112 | function lfCheckError($array) |
---|
113 | { |
---|
114 | $objErr = new SC_CheckError_Ex($array); |
---|
115 | |
---|
116 | if (preg_match("/^[[:alnum:]]+$/", $array['id'])) { |
---|
117 | if (!is_numeric(SC_Helper_Customer_Ex::sfGetCustomerId($array['id'], true))) { |
---|
118 | $objErr->arrErr['id'] = '※ 既に会員登録が完了しているか、無効なURLです。<br>'; |
---|
119 | } |
---|
120 | |
---|
121 | } else { |
---|
122 | $objErr->arrErr['id'] = '無効なURLです。メールに記載されている本会員登録用URLを再度ご確認ください。'; |
---|
123 | } |
---|
124 | |
---|
125 | return $objErr->arrErr; |
---|
126 | } |
---|
127 | |
---|
128 | /** |
---|
129 | * 正会員登録完了メール送信 |
---|
130 | * |
---|
131 | * @param mixed $registSecretKey |
---|
132 | * @access private |
---|
133 | * @return void |
---|
134 | */ |
---|
135 | function lfSendRegistMail($registSecretKey) |
---|
136 | { |
---|
137 | $objQuery = SC_Query_Ex::getSingletonInstance(); |
---|
138 | $objCustomer = new SC_Customer_Ex(); |
---|
139 | $objHelperMail = new SC_Helper_Mail_Ex(); |
---|
140 | $objHelperMail->setPage($this); |
---|
141 | $CONF = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
142 | |
---|
143 | //-- 会員データを取得 |
---|
144 | $arrCustomer = $objQuery->select('*', 'dtb_customer', 'secret_key = ?', array($registSecretKey)); |
---|
145 | $data = $arrCustomer[0]; |
---|
146 | $objCustomer->setLogin($data['email']); |
---|
147 | |
---|
148 | //-- メール送信 |
---|
149 | $objMailText = new SC_SiteView_Ex(); |
---|
150 | $objMailText->setPage($this); |
---|
151 | $objMailText->assign('CONF', $CONF); |
---|
152 | $objMailText->assign('name01', $data['name01']); |
---|
153 | $objMailText->assign('name02', $data['name02']); |
---|
154 | $toCustomerMail = $objMailText->fetch('mail_templates/customer_regist_mail.tpl'); |
---|
155 | $subject = $objHelperMail->sfMakesubject('会員登録が完了しました。'); |
---|
156 | $objMail = new SC_SendMail_Ex(); |
---|
157 | |
---|
158 | $objMail->setItem( |
---|
159 | '' // 宛先 |
---|
160 | , $subject // サブジェクト |
---|
161 | , $toCustomerMail // 本文 |
---|
162 | , $CONF['email03'] // 配送元アドレス |
---|
163 | , $CONF['shop_name'] // 配送元 名前 |
---|
164 | , $CONF['email03'] // reply_to |
---|
165 | , $CONF['email04'] // return_path |
---|
166 | , $CONF['email04'] // Errors_to |
---|
167 | ); |
---|
168 | // 宛先の設定 |
---|
169 | $name = $data['name01'] . $data['name02'] .' 様'; |
---|
170 | $objMail->setTo($data['email'], $name); |
---|
171 | $objMail->sendMail(); |
---|
172 | } |
---|
173 | } |
---|