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