This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * |
||
4 | * @package Board3 Portal v2.1 |
||
5 | * @copyright (c) 2013 Board3 Group ( www.board3.de ) |
||
6 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
||
7 | * |
||
8 | */ |
||
9 | |||
10 | namespace board3\portal\modules; |
||
11 | |||
12 | /** |
||
13 | * @package Donation |
||
14 | */ |
||
15 | class donation extends module_base |
||
16 | { |
||
17 | /** |
||
18 | * Allowed columns: Just sum up your options (Exp: left + right = 10) |
||
19 | * top 1 |
||
20 | * left 2 |
||
21 | * center 4 |
||
22 | * right 8 |
||
23 | * bottom 16 |
||
24 | */ |
||
25 | public $columns = 31; |
||
26 | |||
27 | /** |
||
28 | * Default modulename |
||
29 | */ |
||
30 | public $name = 'DONATION'; |
||
31 | |||
32 | /** |
||
33 | * Default module-image: |
||
34 | * file must be in "{T_THEME_PATH}/images/portal/" |
||
35 | */ |
||
36 | public $image_src = 'portal_donation.png'; |
||
37 | |||
38 | /** |
||
39 | * module-language file |
||
40 | * file must be in "language/{$user->lang}/mods/portal/" |
||
41 | */ |
||
42 | public $language = 'portal_donation_module'; |
||
43 | |||
44 | /** @var \phpbb\config\config */ |
||
45 | protected $config; |
||
46 | |||
47 | /** @var \phpbb\request\request_interface */ |
||
48 | protected $request; |
||
49 | |||
50 | /** @var \phpbb\template\template */ |
||
51 | protected $template; |
||
52 | |||
53 | /** @var \phpbb\user */ |
||
54 | protected $user; |
||
55 | |||
56 | /** @var \board3\portal\includes\modules_helper */ |
||
57 | protected $helper; |
||
58 | |||
59 | /** @var array List of currencies supported in donations */ |
||
60 | protected $currencies = array( |
||
61 | 'AUD', |
||
62 | 'CAD', |
||
63 | 'CZK', |
||
64 | 'DKK', |
||
65 | 'HKD', |
||
66 | 'HUF', |
||
67 | 'NZD', |
||
68 | 'NOK', |
||
69 | 'PLN', |
||
70 | 'GBP', |
||
71 | 'SGD', |
||
72 | 'SEK', |
||
73 | 'CHF', |
||
74 | 'JPY', |
||
75 | 'USD', |
||
76 | 'EUR', |
||
77 | 'MXN', |
||
78 | 'ILS', |
||
79 | ); |
||
80 | |||
81 | /** |
||
82 | * Construct a donation module object |
||
83 | * |
||
84 | * @param \phpbb\config\config $config phpBB config |
||
85 | * @param \phpbb\request\request_interface $request Request |
||
86 | * @param \phpbb\template\template $template phpBB template |
||
87 | * @param \phpbb\user $user phpBB user object |
||
88 | * @param \board3\portal\includes\modules_helper $helper Board3 Portal modules helper |
||
89 | */ |
||
90 | 43 | public function __construct($config, $request, $template, $user, $helper) |
|
91 | { |
||
92 | 43 | $this->config = $config; |
|
93 | 43 | $this->request = $request; |
|
94 | 43 | $this->template = $template; |
|
95 | 43 | $this->user = $user; |
|
96 | 43 | $this->helper = $helper; |
|
97 | 43 | } |
|
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | View Code Duplication | public function get_template_center($module_id) |
|
103 | { |
||
104 | $this->template->assign_vars(array( |
||
105 | 'PAY_ACC_CENTER' => $this->config['board3_pay_acc_' . $module_id], |
||
106 | 'PAY_CUSTOM_CENTER' => (!empty($this->config['board3_pay_custom_' . $module_id])) ? $this->user->data['username_clean'] : false, |
||
107 | )); |
||
108 | |||
109 | $this->build_currency_select($module_id, 'b3p_donation_currency_center'); |
||
110 | |||
111 | return 'donation_center.html'; |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | View Code Duplication | public function get_template_side($module_id) |
|
118 | { |
||
119 | $this->template->assign_vars(array( |
||
120 | 'PAY_ACC_SIDE' => $this->config['board3_pay_acc_' . $module_id], |
||
121 | 'PAY_CUSTOM_SIDE' => (!empty($this->config['board3_pay_custom_' . $module_id])) ? $this->user->data['username_clean'] : false, |
||
122 | )); |
||
123 | |||
124 | $this->build_currency_select($module_id, 'b3p_donation_currency_side', true); |
||
125 | |||
126 | return 'donation_side.html'; |
||
127 | } |
||
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | public function get_template_acp($module_id) |
||
133 | { |
||
134 | return array( |
||
135 | 'title' => 'ACP_PORTAL_PAYPAL_SETTINGS', |
||
136 | 'vars' => array( |
||
137 | 'legend1' => 'ACP_PORTAL_PAYPAL_SETTINGS', |
||
138 | 'board3_pay_acc_' . $module_id => array('lang' => 'PORTAL_PAY_ACC', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), |
||
139 | 'board3_pay_custom_' . $module_id => array('lang' => 'PORTAL_PAY_CUSTOM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
||
140 | 'board3_pay_default_' . $module_id => array('lang' => 'PORTAL_PAY_DEFAULT', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_currency', 'submit' => 'save_currency', 'explain' => true), |
||
141 | ) |
||
142 | ); |
||
143 | } |
||
144 | |||
145 | /** |
||
146 | * Build currency select for block name |
||
147 | * |
||
148 | * @param int $module_id Module ID |
||
149 | * @param string $block_name Name of template block |
||
150 | * @param bool $short Whether short ISO titles should be used |
||
151 | */ |
||
152 | protected function build_currency_select($module_id, $block_name, $short = false) |
||
153 | { |
||
154 | foreach ($this->currencies as $currency) |
||
155 | { |
||
156 | $this->template->assign_block_vars($block_name, array( |
||
157 | 'VALUE' => $currency, |
||
158 | 'TITLE' => ($short) ? $currency : $this->user->lang($currency), |
||
159 | 'SELECTED' => $currency === $this->config['board3_pay_default_' . $module_id], |
||
160 | )); |
||
161 | } |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * Create select box for attachment filetype |
||
166 | * |
||
167 | * @param mixed $value Value of input |
||
168 | * @param string $key Key name |
||
169 | * @param int $module_id Module ID |
||
170 | * |
||
171 | * @return string Forum select box HTML |
||
172 | */ |
||
173 | public function select_currency($value, $key, $module_id) |
||
0 ignored issues
–
show
|
|||
174 | { |
||
175 | $currencies = $selected = array(); |
||
176 | foreach ($this->currencies as $currency) |
||
177 | { |
||
178 | $currencies[] = array( |
||
179 | 'title' => $this->user->lang($currency), |
||
180 | 'value' => $currency, |
||
181 | ); |
||
182 | |||
183 | if ($currency === $this->config['board3_pay_default_' . $module_id]) |
||
184 | { |
||
185 | $selected[] = $currency; |
||
186 | } |
||
187 | } |
||
188 | |||
189 | return $this->helper->generate_select_box($key, $currencies, $selected); |
||
190 | } |
||
191 | |||
192 | /** |
||
193 | * Save currency setting |
||
194 | * |
||
195 | * @param string $key |
||
196 | * @param int $module_id |
||
197 | */ |
||
198 | public function save_currency($key, $module_id) |
||
199 | { |
||
200 | $this->config->set($key, $this->request->variable('board3_pay_default_' . $module_id, '')); |
||
201 | } |
||
202 | |||
203 | /** |
||
204 | * {@inheritdoc} |
||
205 | */ |
||
206 | 1 | public function install($module_id) |
|
207 | { |
||
208 | 1 | $this->config->set('board3_pay_acc_' . $module_id, '[email protected]'); |
|
209 | 1 | $this->config->set('board3_pay_custom_' . $module_id, true); |
|
210 | 1 | $this->config->set('board3_pay_default_' . $module_id, 'EUR'); |
|
211 | 1 | return true; |
|
212 | } |
||
213 | |||
214 | /** |
||
215 | * {@inheritdoc} |
||
216 | */ |
||
217 | 1 | View Code Duplication | public function uninstall($module_id, $db) |
218 | { |
||
219 | $del_config = array( |
||
220 | 1 | 'board3_pay_acc_' . $module_id, |
|
221 | 1 | 'board3_pay_custom_' . $module_id, |
|
222 | 1 | 'board3_pay_default_' . $module_id, |
|
223 | 1 | ); |
|
224 | 1 | $sql = 'DELETE FROM ' . CONFIG_TABLE . ' |
|
225 | 1 | WHERE ' . $db->sql_in_set('config_name', $del_config); |
|
226 | 1 | return $db->sql_query($sql); |
|
227 | } |
||
228 | } |
||
229 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.