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_PATH . "pages/LC_Page.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * 決済モジュールの呼び出しを行うクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author Kentaro Ohkouchi |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_Shopping_LoadPaymentModule extends LC_Page { |
---|
35 | |
---|
36 | // }}} |
---|
37 | // {{{ functions |
---|
38 | |
---|
39 | /** |
---|
40 | * Page を初期化する. |
---|
41 | * |
---|
42 | * @return void |
---|
43 | */ |
---|
44 | function init() { |
---|
45 | parent::init(); |
---|
46 | } |
---|
47 | |
---|
48 | /** |
---|
49 | * Page のプロセス. |
---|
50 | * |
---|
51 | * @return void |
---|
52 | */ |
---|
53 | function process() { |
---|
54 | $objSiteSess = new SC_SiteSession(); |
---|
55 | $objCartSess = new SC_CartSession(); |
---|
56 | SC_Utils::sfIsPrePage($objSiteSess); |
---|
57 | SC_Utils::sfCheckNormalAccess($objSiteSess, $objCartSess); |
---|
58 | |
---|
59 | $payment_id = $this->getPaymentId(); |
---|
60 | if ($payment_id === false) { |
---|
61 | SC_Utils::sfDispSiteError(PAGE_ERROR, "", true); |
---|
62 | return; |
---|
63 | } |
---|
64 | |
---|
65 | $module_path = $this->getModulePath($payment_id); |
---|
66 | if ($module_path === false) { |
---|
67 | SC_Utils::sfDispSiteError(FREE_ERROR_MSG, "", true, |
---|
68 | "モジュールファイルの取得に失敗しました。<br />この手続きは無効となりました。"); |
---|
69 | return; |
---|
70 | } |
---|
71 | require_once($module_path); |
---|
72 | } |
---|
73 | |
---|
74 | /** |
---|
75 | * モバイルページを初期化する. |
---|
76 | * |
---|
77 | * @return void |
---|
78 | */ |
---|
79 | function mobileInit() { |
---|
80 | $this->init(); |
---|
81 | } |
---|
82 | |
---|
83 | /** |
---|
84 | * Page のプロセス(モバイル). |
---|
85 | * |
---|
86 | * @return void |
---|
87 | */ |
---|
88 | function mobileProcess() { |
---|
89 | $this->process(); |
---|
90 | } |
---|
91 | |
---|
92 | /** |
---|
93 | * デストラクタ. |
---|
94 | * |
---|
95 | * @return void |
---|
96 | */ |
---|
97 | function destroy() { |
---|
98 | parent::destroy(); |
---|
99 | } |
---|
100 | |
---|
101 | /** |
---|
102 | * 支払い方法IDをキーにして, 決済モジュールのパスを取得する. |
---|
103 | * |
---|
104 | * 決済モジュールが取得できた場合は, require 可能な決済モジュールのパスを返す. |
---|
105 | * 支払い方法IDが無効な場合, 取得したパスにファイルが存在しない場合は false |
---|
106 | * |
---|
107 | * @param integer $payment_id 支払い方法ID |
---|
108 | * @return string|boolean 成功した場合は決済モジュールのパス; |
---|
109 | * 失敗した場合 false |
---|
110 | */ |
---|
111 | function getModulePath($payment_id) { |
---|
112 | $objQuery =& SC_Query::getSingletonInstance(); |
---|
113 | $sql = <<< __EOS__ |
---|
114 | SELECT module_path |
---|
115 | FROM dtb_payment |
---|
116 | WHERE payment_id = ? |
---|
117 | __EOS__; |
---|
118 | $module_path = $objQuery->getOne($sql, array($payment_id)); |
---|
119 | if (file_exists($module_path)) { |
---|
120 | return $module_path; |
---|
121 | } |
---|
122 | return false; |
---|
123 | } |
---|
124 | |
---|
125 | /** |
---|
126 | * 支払い方法ID を取得する. |
---|
127 | * |
---|
128 | * 以下の順序で支払い方法IDを取得する. |
---|
129 | * |
---|
130 | * 1. $_SESSION['payment_id'] |
---|
131 | * 2. $_POST['payment_id'] |
---|
132 | * 3. $_GET['payment_id'] |
---|
133 | * |
---|
134 | * 支払い方法IDが取得できない場合は false を返す. |
---|
135 | * |
---|
136 | * @access private |
---|
137 | * @return integer|boolean 支払い方法の取得に成功した場合は支払い方法IDを返す; |
---|
138 | * 失敗した場合は, false を返す. |
---|
139 | */ |
---|
140 | function getPaymentId() { |
---|
141 | if (isset($_SESSION['payment_id']) |
---|
142 | && !SC_Utils_Ex::isBlank($_SESSION['payment_id'])) { |
---|
143 | return $_SESSION['payment_id']; |
---|
144 | } |
---|
145 | |
---|
146 | if (isset($_POST['payment_id']) |
---|
147 | && !SC_Utils_Ex::isBlank($_POST['payment_id'])) { |
---|
148 | return $_POST['payment_id']; |
---|
149 | } |
---|
150 | |
---|
151 | if (isset($_GET['payment_id']) |
---|
152 | && !SC_Utils_Ex::isBlank($_GET['payment_id'])) { |
---|
153 | return $_GET['payment_id']; |
---|
154 | } |
---|
155 | |
---|
156 | return false; |
---|
157 | } |
---|
158 | } |
---|
159 | ?> |
---|