1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2010 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_REALDIR . "pages/LC_Page.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * 退会手続き のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_Mypage_Refusal extends LC_Page { |
---|
35 | |
---|
36 | // }}} |
---|
37 | // {{{ functions |
---|
38 | |
---|
39 | /** |
---|
40 | * Page を初期化する. |
---|
41 | * |
---|
42 | * @return void |
---|
43 | */ |
---|
44 | function init() { |
---|
45 | parent::init(); |
---|
46 | $this->tpl_title = 'MYページ'; |
---|
47 | if ( Net_UserAgent_Mobile::isMobile() === true){ |
---|
48 | $this->tpl_title .= '/退会手続き(入力ページ)'; |
---|
49 | } else { |
---|
50 | $this->tpl_subtitle = '退会手続き(入力ページ)'; |
---|
51 | } |
---|
52 | $this->tpl_navi = TEMPLATE_REALDIR . 'mypage/navi.tpl'; |
---|
53 | $this->tpl_mainno = 'mypage'; |
---|
54 | $this->tpl_mypageno = 'refusal'; |
---|
55 | } |
---|
56 | |
---|
57 | /** |
---|
58 | * Page のプロセス. |
---|
59 | * |
---|
60 | * @return void |
---|
61 | */ |
---|
62 | function process() { |
---|
63 | parent::process(); |
---|
64 | if ( Net_UserAgent_Mobile::isMobile() === true){ |
---|
65 | $this->mobileAction(); |
---|
66 | } else { |
---|
67 | $this->action(); |
---|
68 | } |
---|
69 | $this->sendResponse(); |
---|
70 | } |
---|
71 | |
---|
72 | /** |
---|
73 | * Page のAction. |
---|
74 | * |
---|
75 | * @return void |
---|
76 | */ |
---|
77 | function action() { |
---|
78 | $objSiteSess = new SC_SiteSession(); |
---|
79 | |
---|
80 | // 退会判定用情報の取得 |
---|
81 | $this->tpl_login = $objCustomer->isLoginSuccess(); |
---|
82 | |
---|
83 | $this->lfCheckLogin(); |
---|
84 | |
---|
85 | if (!isset($_POST['mode'])) $_POST['mode'] = ""; |
---|
86 | |
---|
87 | switch ($_POST['mode']){ |
---|
88 | case 'confirm': |
---|
89 | |
---|
90 | $this->tpl_mainpage = TEMPLATE_REALDIR . 'mypage/refusal_confirm.tpl'; |
---|
91 | $this->tpl_subtitle = '退会手続き(確認ページ)'; |
---|
92 | |
---|
93 | // 確認ページを経由したことを登録 |
---|
94 | $objSiteSess->setRegistFlag(); |
---|
95 | // hiddenにuniqidを埋め込む |
---|
96 | $this->tpl_uniqid = $objSiteSess->getUniqId(); |
---|
97 | |
---|
98 | break; |
---|
99 | |
---|
100 | case 'complete': |
---|
101 | // 正しい遷移かどうかをチェック |
---|
102 | $this->lfIsValidMovement($objSiteSess); |
---|
103 | $this->lfDeleteCustomer(); //会員削除 |
---|
104 | } |
---|
105 | |
---|
106 | } |
---|
107 | |
---|
108 | /** |
---|
109 | * Page のAction(モバイル). |
---|
110 | * |
---|
111 | * @return void |
---|
112 | */ |
---|
113 | function mobileAction() { |
---|
114 | |
---|
115 | $objQuery = new SC_Query(); |
---|
116 | |
---|
117 | $this->lfCheckLogin(); |
---|
118 | |
---|
119 | if (isset($_POST['no'])) { |
---|
120 | SC_Response_Ex::sendRedirect(DIR_INDEX_URL); |
---|
121 | exit; |
---|
122 | } elseif (isset($_POST['complete'])){ |
---|
123 | $this->lfDeleteCustomer(); //会員削除 |
---|
124 | } |
---|
125 | |
---|
126 | } |
---|
127 | |
---|
128 | /** |
---|
129 | * デストラクタ. |
---|
130 | * |
---|
131 | * @return void |
---|
132 | */ |
---|
133 | function destroy() { |
---|
134 | parent::destroy(); |
---|
135 | } |
---|
136 | |
---|
137 | // 正しい遷移かどうかをチェック |
---|
138 | function lfIsValidMovement(&$objSiteSess) { |
---|
139 | // 確認ページからの遷移かどうかをチェック |
---|
140 | SC_Utils_Ex::sfIsPrePage($objSiteSess); |
---|
141 | |
---|
142 | // uniqid がPOSTされているかをチェック |
---|
143 | $uniqid = $objSiteSess->getUniqId(); |
---|
144 | if ( !empty($_POST['uniqid']) && ($_POST['uniqid'] === $uniqid) ) { |
---|
145 | return; |
---|
146 | } else { |
---|
147 | SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess); |
---|
148 | } |
---|
149 | } |
---|
150 | |
---|
151 | function lfCheckLogin(){ |
---|
152 | $objCustomer = new SC_Customer(); |
---|
153 | //ログイン判定 |
---|
154 | if (!$objCustomer->isLoginSuccess()){ |
---|
155 | SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); |
---|
156 | }else { |
---|
157 | //マイページトップ顧客情報表示用 |
---|
158 | $this->CustomerName1 = $objCustomer->getvalue('name01'); |
---|
159 | $this->CustomerName2 = $objCustomer->getvalue('name02'); |
---|
160 | $this->CustomerPoint = $objCustomer->getvalue('point'); |
---|
161 | } |
---|
162 | } |
---|
163 | |
---|
164 | function lfDeleteCustomer(){ |
---|
165 | $objQuery = new SC_Query(); |
---|
166 | $objCustomer = new SC_Customer(); |
---|
167 | //会員削除 |
---|
168 | $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id'))); |
---|
169 | |
---|
170 | $objCustomer->EndSession(); |
---|
171 | //完了ページへ |
---|
172 | SC_Response_Ex::sendRedirect('refusal_complete.php'); |
---|
173 | exit; |
---|
174 | } |
---|
175 | |
---|
176 | } |
---|
177 | ?> |
---|