1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2012 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/admin/LC_Page_Admin_Ex.php'; |
---|
26 | |
---|
27 | /** |
---|
28 | * オーナーズストア:認証キー設定 のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_Admin_OwnersStore_Settings extends LC_Page_Admin_Ex { |
---|
35 | |
---|
36 | /** SC_FormParamのインスタンス */ |
---|
37 | var $objForm; |
---|
38 | |
---|
39 | /** リクエストパラメーターを格納する連想配列 */ |
---|
40 | var $arrForm; |
---|
41 | |
---|
42 | /** バリデーションエラー情報を格納する連想配列 */ |
---|
43 | var $arrErr; |
---|
44 | |
---|
45 | // }}} |
---|
46 | // {{{ functions |
---|
47 | |
---|
48 | /** |
---|
49 | * Page を初期化する. |
---|
50 | * |
---|
51 | * @return void |
---|
52 | */ |
---|
53 | function init() { |
---|
54 | parent::init(); |
---|
55 | |
---|
56 | $this->tpl_mainpage = 'ownersstore/settings.tpl'; |
---|
57 | $this->tpl_mainno = 'ownersstore'; |
---|
58 | $this->tpl_subno = 'settings'; |
---|
59 | $this->tpl_maintitle = 'オーナーズストア'; |
---|
60 | $this->tpl_subtitle = '認証キー設定'; |
---|
61 | $this->httpCacheControl('nocache'); |
---|
62 | } |
---|
63 | |
---|
64 | /** |
---|
65 | * Page のプロセス. |
---|
66 | * |
---|
67 | * @return void |
---|
68 | */ |
---|
69 | function process() { |
---|
70 | $this->action(); |
---|
71 | $this->sendResponse(); |
---|
72 | } |
---|
73 | |
---|
74 | /** |
---|
75 | * Page のアクション. |
---|
76 | * |
---|
77 | * @return void |
---|
78 | */ |
---|
79 | function action() { |
---|
80 | switch ($this->getMode()) { |
---|
81 | // 入力内容をDBへ登録する |
---|
82 | case 'register': |
---|
83 | $this->execRegisterMode(); |
---|
84 | break; |
---|
85 | // 初回表示 |
---|
86 | default: |
---|
87 | $this->execDefaultMode(); |
---|
88 | } |
---|
89 | } |
---|
90 | |
---|
91 | /** |
---|
92 | * デストラクタ. |
---|
93 | * |
---|
94 | * @return void |
---|
95 | */ |
---|
96 | function destroy() { |
---|
97 | parent::destroy(); |
---|
98 | } |
---|
99 | |
---|
100 | /** |
---|
101 | * registerアクションの実行. |
---|
102 | * 入力内容をDBへ登録する. |
---|
103 | * |
---|
104 | * @param void |
---|
105 | * @return void |
---|
106 | */ |
---|
107 | function execRegisterMode() { |
---|
108 | // パラメーターオブジェクトの初期化 |
---|
109 | $this->initRegisterMode(); |
---|
110 | // POSTされたパラメーターの検証 |
---|
111 | $arrErr = $this->validateRegistermode(); |
---|
112 | |
---|
113 | // エラー時の処理 |
---|
114 | if (!empty($arrErr)) { |
---|
115 | $this->arrErr = $arrErr; |
---|
116 | $this->arrForm = $this->objForm->getHashArray(); |
---|
117 | return; |
---|
118 | } |
---|
119 | |
---|
120 | // エラーがなければDBへ登録 |
---|
121 | $arrForm = $this->objForm->getHashArray(); |
---|
122 | $this->registerOwnersStoreSettings($arrForm); |
---|
123 | |
---|
124 | $this->arrForm = $arrForm; |
---|
125 | |
---|
126 | $this->tpl_onload = "alert('登録しました。')"; |
---|
127 | } |
---|
128 | |
---|
129 | /** |
---|
130 | * registerアクションの初期化. |
---|
131 | * SC_FormParamを初期化しメンバ変数にセットする. |
---|
132 | * |
---|
133 | * @param void |
---|
134 | * @return void |
---|
135 | */ |
---|
136 | function initRegisterMode() { |
---|
137 | // 前後の空白を削除 |
---|
138 | if (isset($_POST['public_key'])) { |
---|
139 | $_POST['public_key'] = trim($_POST['public_key']); |
---|
140 | } |
---|
141 | |
---|
142 | $objForm = new SC_FormParam_Ex(); |
---|
143 | $objForm->addParam('認証キー', 'public_key', LTEXT_LEN, '', array('EXIST_CHECK', 'ALNUM_CHECK', 'MAX_LENGTH_CHECK')); |
---|
144 | $objForm->setParam($_POST); |
---|
145 | |
---|
146 | $this->objForm = $objForm; |
---|
147 | } |
---|
148 | |
---|
149 | /** |
---|
150 | * registerアク |
---|