1 | <?php |
||
2 | |||
3 | /* Divine CMS - Open source CMS for widespread use. |
||
4 | Copyright (c) 2019 Mykola Burakov ([email protected]) |
||
5 | |||
6 | See SOURCE.txt for other and additional information. |
||
7 | |||
8 | This file is part of Divine CMS. |
||
9 | |||
10 | This program is free software: you can redistribute it and/or modify |
||
11 | it under the terms of the GNU General Public License as published by |
||
12 | the Free Software Foundation, either version 3 of the License, or |
||
13 | (at your option) any later version. |
||
14 | |||
15 | This program is distributed in the hope that it will be useful, |
||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
18 | GNU General Public License for more details. |
||
19 | |||
20 | You should have received a copy of the GNU General Public License |
||
21 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
||
22 | |||
23 | class ControllerSettingSetting extends \Divine\Engine\Core\Controller |
||
0 ignored issues
–
show
|
|||
24 | { |
||
25 | private $error = array(); |
||
26 | |||
27 | public function index() |
||
0 ignored issues
–
show
|
|||
28 | { |
||
29 | $this->load->language('setting/setting'); |
||
30 | |||
31 | $this->document->setTitle($this->language->get('heading_title')); |
||
32 | |||
33 | $this->load->model('setting/setting'); |
||
34 | |||
35 | if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { |
||
36 | $this->model_setting_setting->editSetting('config', $this->request->post); |
||
37 | |||
38 | if ($this->config->get('config_currency_auto')) { |
||
39 | $this->load->model('localisation/currency'); |
||
40 | |||
41 | $this->model_localisation_currency->refresh(); |
||
42 | } |
||
43 | |||
44 | $this->session->data['success'] = $this->language->get('text_success'); |
||
45 | |||
46 | $this->response->redirect($this->url->link('setting/setting', 'token=' . $this->session->data['token'], true)); |
||
47 | } |
||
48 | |||
49 | $data['heading_title'] = $this->language->get('heading_title'); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
50 | |||
51 | $data['text_edit'] = $this->language->get('text_edit'); |
||
52 | $data['text_enabled'] = $this->language->get('text_enabled'); |
||
53 | $data['text_disabled'] = $this->language->get('text_disabled'); |
||
54 | $data['text_select'] = $this->language->get('text_select'); |
||
55 | $data['text_none'] = $this->language->get('text_none'); |
||
56 | $data['text_yes'] = $this->language->get('text_yes'); |
||
57 | $data['text_no'] = $this->language->get('text_no'); |
||
58 | $data['text_product'] = $this->language->get('text_product'); |
||
59 | $data['text_review'] = $this->language->get('text_review'); |
||
60 | $data['text_account'] = $this->language->get('text_account'); |
||
61 | $data['text_checkout'] = $this->language->get('text_checkout'); |
||
62 | $data['text_stock'] = $this->language->get('text_stock'); |
||
63 | $data['text_register'] = $this->language->get('text_register'); |
||
64 | $data['text_shipping'] = $this->language->get('text_shipping'); |
||
65 | $data['text_payment'] = $this->language->get('text_payment'); |
||
66 | $data['text_mail'] = $this->language->get('text_mail'); |
||
67 | $data['text_smtp'] = $this->language->get('text_smtp'); |
||
68 | $data['text_mail_alert'] = $this->language->get('text_mail_alert'); |
||
69 | $data['text_mail_account'] = $this->language->get('text_mail_account'); |
||
70 | $data['text_mail_order'] = $this->language->get('text_mail_order'); |
||
71 | $data['text_mail_review'] = $this->language->get('text_mail_review'); |
||
72 | $data['text_general'] = $this->language->get('text_general'); |
||
73 | $data['text_security'] = $this->language->get('text_security'); |
||
74 | $data['text_upload'] = $this->language->get('text_upload'); |
||
75 | $data['text_error'] = $this->language->get('text_error'); |
||
76 | |||
77 | $data['entry_name'] = $this->language->get('entry_name'); |
||
78 | $data['entry_owner'] = $this->language->get('entry_owner'); |
||
79 | $data['entry_address'] = $this->language->get('entry_address'); |
||
80 | $data['entry_geocode'] = $this->language->get('entry_geocode'); |
||
81 | $data['entry_email'] = $this->language->get('entry_email'); |
||
82 | $data['entry_telephone'] = $this->language->get('entry_telephone'); |
||
83 | $data['entry_fax'] = $this->language->get('entry_fax'); |
||
84 | $data['entry_image'] = $this->language->get('entry_image'); |
||
85 | $data['entry_open'] = $this->language->get('entry_open'); |
||
86 | $data['entry_comment'] = $this->language->get('entry_comment'); |
||
87 | $data['entry_location'] = $this->language->get('entry_location'); |
||
88 | $data['entry_meta_title'] = $this->language->get('entry_meta_title'); |
||
89 | $data['entry_meta_description'] = $this->language->get('entry_meta_description'); |
||
90 | $data['entry_theme'] = $this->language->get('entry_theme'); |
||
91 | $data['entry_layout'] = $this->language->get('entry_layout'); |
||
92 | $data['entry_country'] = $this->language->get('entry_country'); |
||
93 | $data['entry_zone'] = $this->language->get('entry_zone'); |
||
94 | $data['entry_language'] = $this->language->get('entry_language'); |
||
95 | $data['entry_admin_language'] = $this->language->get('entry_admin_language'); |
||
96 | $data['entry_currency'] = $this->language->get('entry_currency'); |
||
97 | $data['entry_currency_auto'] = $this->language->get('entry_currency_auto'); |
||
98 | $data['entry_limit_admin'] = $this->language->get('entry_limit_admin'); |
||
99 | $data['entry_limit_store'] = $this->language->get('entry_limit_store'); |
||
100 | $data['entry_product_count'] = $this->language->get('entry_product_count'); |
||
101 | $data['entry_review'] = $this->language->get('entry_review'); |
||
102 | $data['entry_review_guest'] = $this->language->get('entry_review_guest'); |
||
103 | |||
104 | $data['entry_customer_group'] = $this->language->get('entry_customer_group'); |
||
105 | $data['entry_customer_group_display'] = $this->language->get('entry_customer_group_display'); |
||
106 | $data['entry_customer_price'] = $this->language->get('entry_customer_price'); |
||
107 | $data['entry_login_attempts'] = $this->language->get('entry_login_attempts'); |
||
108 | $data['entry_account'] = $this->language->get('entry_account'); |
||
109 | $data['entry_invoice_prefix'] = $this->language->get('entry_invoice_prefix'); |
||
110 | $data['entry_checkout_guest'] = $this->language->get('entry_checkout_guest'); |
||
111 | $data['entry_checkout'] = $this->language->get('entry_checkout'); |
||
112 | $data['entry_order_status'] = $this->language->get('entry_order_status'); |
||
113 | $data['entry_processing_status'] = $this->language->get('entry_processing_status'); |
||
114 | $data['entry_complete_status'] = $this->language->get('entry_complete_status'); |
||
115 | $data['entry_stock_display'] = $this->language->get('entry_stock_display'); |
||
116 | $data['entry_stock_warning'] = $this->language->get('entry_stock_warning'); |
||
117 | $data['entry_stock_checkout'] = $this->language->get('entry_stock_checkout'); |
||
118 | $data['entry_logo'] = $this->language->get('entry_logo'); |
||
119 | |||
120 | $data['entry_mail_protocol'] = $this->language->get('entry_mail_protocol'); |
||
121 | $data['entry_mail_parameter'] = $this->language->get('entry_mail_parameter'); |
||
122 | $data['entry_mail_smtp_hostname'] = $this->language->get('entry_mail_smtp_hostname'); |
||
123 | $data['entry_mail_smtp_username'] = $this->language->get('entry_mail_smtp_username'); |
||
124 | $data['entry_mail_smtp_password'] = $this->language->get('entry_mail_smtp_password'); |
||
125 | $data['entry_mail_smtp_port'] = $this->language->get('entry_mail_smtp_port'); |
||
126 | $data['entry_mail_smtp_timeout'] = $this->language->get('entry_mail_smtp_timeout'); |
||
127 | $data['entry_mail_alert'] = $this->language->get('entry_mail_alert'); |
||
128 | $data['entry_mail_alert_email'] = $this->language->get('entry_mail_alert_email'); |
||
129 | $data['entry_alert_email'] = $this->language->get('entry_alert_email'); |
||
130 | $data['entry_secure'] = $this->language->get('entry_secure'); |
||
131 | $data['entry_shared'] = $this->language->get('entry_shared'); |
||
132 | $data['entry_robots'] = $this->language->get('entry_robots'); |
||
133 | $data['entry_file_max_size'] = $this->language->get('entry_file_max_size'); |
||
134 | $data['entry_file_ext_allowed'] = $this->language->get('entry_file_ext_allowed'); |
||
135 | $data['entry_file_mime_allowed'] = $this->language->get('entry_file_mime_allowed'); |
||
136 | $data['entry_password'] = $this->language->get('entry_password'); |
||
137 | $data['entry_encryption'] = $this->language->get('entry_encryption'); |
||
138 | $data['entry_seo_url'] = $this->language->get('entry_seo_url'); |
||
139 | $data['entry_seo_url_include_path'] = $this->language->get('entry_seo_url_include_path'); |
||
140 | $data['entry_seo_url_postfix'] = $this->language->get('entry_seo_url_postfix'); |
||
141 | $data['entry_error_display'] = $this->language->get('entry_error_display'); |
||
142 | $data['entry_error_filename'] = $this->language->get('entry_error_filename'); |
||
143 | $data['entry_status'] = $this->language->get('entry_status'); |
||
144 | |||
145 | $data['help_geocode'] = $this->language->get('help_geocode'); |
||
146 | $data['help_open'] = $this->language->get('help_open'); |
||
147 | $data['help_comment'] = $this->language->get('help_comment'); |
||
148 | $data['help_location'] = $this->language->get('help_location'); |
||
149 | $data['help_currency'] = $this->language->get('help_currency'); |
||
150 | $data['help_currency_auto'] = $this->language->get('help_currency_auto'); |
||
151 | $data['help_limit_admin'] = $this->language->get('help_limit_admin'); |
||
152 | $data['help_limit_store'] = $this->language->get('help_limit_store'); |
||
153 | $data['help_product_count'] = $this->language->get('help_product_count'); |
||
154 | $data['help_review'] = $this->language->get('help_review'); |
||
155 | $data['help_review_guest'] = $this->language->get('help_review_guest'); |
||
156 | $data['help_customer_group'] = $this->language->get('help_customer_group'); |
||
157 | $data['help_customer_group_display'] = $this->language->get('help_customer_group_display'); |
||
158 | $data['help_customer_price'] = $this->language->get('help_customer_price'); |
||
159 | $data['help_login_attempts'] = $this->language->get('help_login_attempts'); |
||
160 | $data['help_account'] = $this->language->get('help_account'); |
||
161 | $data['help_checkout_guest'] = $this->language->get('help_checkout_guest'); |
||
162 | $data['help_checkout'] = $this->language->get('help_checkout'); |
||
163 | $data['help_invoice_prefix'] = $this->language->get('help_invoice_prefix'); |
||
164 | $data['help_order_status'] = $this->language->get('help_order_status'); |
||
165 | $data['help_processing_status'] = $this->language->get('help_processing_status'); |
||
166 | $data['help_complete_status'] = $this->language->get('help_complete_status'); |
||
167 | $data['help_stock_display'] = $this->language->get('help_stock_display'); |
||
168 | $data['help_stock_warning'] = $this->language->get('help_stock_warning'); |
||
169 | $data['help_stock_checkout'] = $this->language->get('help_stock_checkout'); |
||
170 | $data['help_commission'] = $this->language->get('help_commission'); |
||
171 | $data['help_ftp_root'] = $this->language->get('help_ftp_root'); |
||
172 | $data['help_mail_protocol'] = $this->language->get('help_mail_protocol'); |
||
173 | $data['help_mail_parameter'] = $this->language->get('help_mail_parameter'); |
||
174 | $data['help_mail_smtp_hostname'] = $this->language->get('help_mail_smtp_hostname'); |
||
175 | $data['help_mail_smtp_password'] = $this->language->get('help_mail_smtp_password'); |
||
176 | $data['help_mail_alert'] = $this->language->get('help_mail_alert'); |
||
177 | $data['help_mail_alert_email'] = $this->language->get('help_mail_alert_email'); |
||
178 | $data['help_secure'] = $this->language->get('help_secure'); |
||
179 | $data['help_shared'] = $this->language->get('help_shared'); |
||
180 | $data['help_robots'] = $this->language->get('help_robots'); |
||
181 | $data['help_seo_url'] = $this->language->get('help_seo_url'); |
||
182 | $data['help_seo_url_include_path'] = $this->language->get('help_seo_url_include_path'); |
||
183 | $data['help_seo_url_postfix'] = $this->language->get('help_seo_url_postfix'); |
||
184 | $data['help_file_max_size'] = $this->language->get('help_file_max_size'); |
||
185 | $data['help_file_ext_allowed'] = $this->language->get('help_file_ext_allowed'); |
||
186 | $data['help_file_mime_allowed'] = $this->language->get('help_file_mime_allowed'); |
||
187 | $data['help_password'] = $this->language->get('help_password'); |
||
188 | $data['help_encryption'] = $this->language->get('help_encryption'); |
||
189 | |||
190 | $data['button_save'] = $this->language->get('button_save'); |
||
191 | $data['button_cancel'] = $this->language->get('button_cancel'); |
||
192 | |||
193 | $data['tab_general'] = $this->language->get('tab_general'); |
||
194 | $data['tab_store'] = $this->language->get('tab_store'); |
||
195 | $data['tab_local'] = $this->language->get('tab_local'); |
||
196 | $data['tab_option'] = $this->language->get('tab_option'); |
||
197 | $data['tab_image'] = $this->language->get('tab_image'); |
||
198 | $data['tab_ftp'] = $this->language->get('tab_ftp'); |
||
199 | $data['tab_mail'] = $this->language->get('tab_mail'); |
||
200 | $data['tab_server'] = $this->language->get('tab_server'); |
||
201 | |||
202 | if (isset($this->error['warning'])) { |
||
203 | $data['error_warning'] = $this->error['warning']; |
||
204 | } else { |
||
205 | $data['error_warning'] = ''; |
||
206 | } |
||
207 | |||
208 | if (isset($this->error['name'])) { |
||
209 | $data['error_name'] = $this->error['name']; |
||
210 | } else { |
||
211 | $data['error_name'] = ''; |
||
212 | } |
||
213 | |||
214 | if (isset($this->error['owner'])) { |
||
215 | $data['error_owner'] = $this->error['owner']; |
||
216 | } else { |
||
217 | $data['error_owner'] = ''; |
||
218 | } |
||
219 | |||
220 | if (isset($this->error['address'])) { |
||
221 | $data['error_address'] = $this->error['address']; |
||
222 | } else { |
||
223 | $data['error_address'] = ''; |
||
224 | } |
||
225 | |||
226 | if (isset($this->error['email'])) { |
||
227 | $data['error_email'] = $this->error['email']; |
||
228 | } else { |
||
229 | $data['error_email'] = ''; |
||
230 | } |
||
231 | |||
232 | if (isset($this->error['telephone'])) { |
||
233 | $data['error_telephone'] = $this->error['telephone']; |
||
234 | } else { |
||
235 | $data['error_telephone'] = ''; |
||
236 | } |
||
237 | |||
238 | if (isset($this->error['meta_title'])) { |
||
239 | $data['error_meta_title'] = $this->error['meta_title']; |
||
240 | } else { |
||
241 | $data['error_meta_title'] = ''; |
||
242 | } |
||
243 | |||
244 | if (isset($this->error['country'])) { |
||
245 | $data['error_country'] = $this->error['country']; |
||
246 | } else { |
||
247 | $data['error_country'] = ''; |
||
248 | } |
||
249 | |||
250 | if (isset($this->error['zone'])) { |
||
251 | $data['error_zone'] = $this->error['zone']; |
||
252 | } else { |
||
253 | $data['error_zone'] = ''; |
||
254 | } |
||
255 | |||
256 | if (isset($this->error['customer_group_display'])) { |
||
257 | $data['error_customer_group_display'] = $this->error['customer_group_display']; |
||
258 | } else { |
||
259 | $data['error_customer_group_display'] = ''; |
||
260 | } |
||
261 | |||
262 | if (isset($this->error['login_attempts'])) { |
||
263 | $data['error_login_attempts'] = $this->error['login_attempts']; |
||
264 | } else { |
||
265 | $data['error_login_attempts'] = ''; |
||
266 | } |
||
267 | |||
268 | if (isset($this->error['processing_status'])) { |
||
269 | $data['error_processing_status'] = $this->error['processing_status']; |
||
270 | } else { |
||
271 | $data['error_processing_status'] = ''; |
||
272 | } |
||
273 | |||
274 | if (isset($this->error['complete_status'])) { |
||
275 | $data['error_complete_status'] = $this->error['complete_status']; |
||
276 | } else { |
||
277 | $data['error_complete_status'] = ''; |
||
278 | } |
||
279 | |||
280 | if (isset($this->error['error_filename'])) { |
||
281 | $data['error_error_filename'] = $this->error['error_filename']; |
||
282 | } else { |
||
283 | $data['error_error_filename'] = ''; |
||
284 | } |
||
285 | |||
286 | if (isset($this->error['limit_admin'])) { |
||
287 | $data['error_limit_admin'] = $this->error['limit_admin']; |
||
288 | } else { |
||
289 | $data['error_limit_admin'] = ''; |
||
290 | } |
||
291 | |||
292 | if (isset($this->error['limit_store'])) { |
||
293 | $data['error_limit_store'] = $this->error['limit_store']; |
||
294 | } else { |
||
295 | $data['error_limit_store'] = ''; |
||
296 | } |
||
297 | |||
298 | if (isset($this->error['encryption'])) { |
||
299 | $data['error_encryption'] = $this->error['encryption']; |
||
300 | } else { |
||
301 | $data['error_encryption'] = ''; |
||
302 | } |
||
303 | |||
304 | $data['breadcrumbs'] = array(); |
||
305 | |||
306 | $data['breadcrumbs'][] = array( |
||
307 | 'text' => $this->language->get('text_home'), |
||
308 | 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true) |
||
309 | ); |
||
310 | |||
311 | $data['breadcrumbs'][] = array( |
||
312 | 'text' => $this->language->get('heading_title'), |
||
313 | 'href' => $this->url->link('setting/setting', 'token=' . $this->session->data['token'], true) |
||
314 | ); |
||
315 | |||
316 | if (isset($this->session->data['success'])) { |
||
317 | $data['success'] = $this->session->data['success']; |
||
318 | |||
319 | unset($this->session->data['success']); |
||
320 | } else { |
||
321 | $data['success'] = ''; |
||
322 | } |
||
323 | |||
324 | $data['action'] = $this->url->link('setting/setting', 'token=' . $this->session->data['token'], true); |
||
325 | |||
326 | $data['cancel'] = $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true); |
||
327 | |||
328 | $data['token'] = $this->session->data['token']; |
||
329 | |||
330 | if (isset($this->request->post['config_meta_title'])) { |
||
331 | $data['config_meta_title'] = $this->request->post['config_meta_title']; |
||
332 | } else { |
||
333 | $data['config_meta_title'] = $this->config->get('config_meta_title'); |
||
334 | } |
||
335 | |||
336 | if (isset($this->request->post['config_meta_description'])) { |
||
337 | $data['config_meta_description'] = $this->request->post['config_meta_description']; |
||
338 | } else { |
||
339 | $data['config_meta_description'] = $this->config->get('config_meta_description'); |
||
340 | } |
||
341 | |||
342 | $data['store_url'] = '/'; |
||
343 | |||
344 | if (isset($this->request->post['config_layout_id'])) { |
||
345 | $data['config_layout_id'] = $this->request->post['config_layout_id']; |
||
346 | } else { |
||
347 | $data['config_layout_id'] = $this->config->get('config_layout_id'); |
||
348 | } |
||
349 | |||
350 | $this->load->model('design/layout'); |
||
351 | |||
352 | $data['layouts'] = $this->model_design_layout->getLayouts(); |
||
353 | |||
354 | if (isset($this->request->post['config_name'])) { |
||
355 | $data['config_name'] = $this->request->post['config_name']; |
||
356 | } else { |
||
357 | $data['config_name'] = $this->config->get('config_name'); |
||
358 | } |
||
359 | |||
360 | if (isset($this->request->post['config_owner'])) { |
||
361 | $data['config_owner'] = $this->request->post['config_owner']; |
||
362 | } else { |
||
363 | $data['config_owner'] = $this->config->get('config_owner'); |
||
364 | } |
||
365 | |||
366 | if (isset($this->request->post['config_address'])) { |
||
367 | $data['config_address'] = $this->request->post['config_address']; |
||
368 | } else { |
||
369 | $data['config_address'] = $this->config->get('config_address'); |
||
370 | } |
||
371 | |||
372 | if (isset($this->request->post['config_geocode'])) { |
||
373 | $data['config_geocode'] = $this->request->post['config_geocode']; |
||
374 | } else { |
||
375 | $data['config_geocode'] = $this->config->get('config_geocode'); |
||
376 | } |
||
377 | |||
378 | if (isset($this->request->post['config_email'])) { |
||
379 | $data['config_email'] = $this->request->post['config_email']; |
||
380 | } else { |
||
381 | $data['config_email'] = $this->config->get('config_email'); |
||
382 | } |
||
383 | |||
384 | if (isset($this->request->post['config_telephone'])) { |
||
385 | $data['config_telephone'] = $this->request->post['config_telephone']; |
||
386 | } else { |
||
387 | $data['config_telephone'] = $this->config->get('config_telephone'); |
||
388 | } |
||
389 | |||
390 | if (isset($this->request->post['config_fax'])) { |
||
391 | $data['config_fax'] = $this->request->post['config_fax']; |
||
392 | } else { |
||
393 | $data['config_fax'] = $this->config->get('config_fax'); |
||
394 | } |
||
395 | |||
396 | if (isset($this->request->post['config_image'])) { |
||
397 | $data['config_image'] = $this->request->post['config_image']; |
||
398 | } else { |
||
399 | $data['config_image'] = $this->config->get('config_image'); |
||
400 | } |
||
401 | |||
402 | if (isset($this->request->post['config_image']) && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $this->request->post['config_image'])) { |
||
403 | $data['thumb'] = '/public_html/assets/images/' . $this->request->post['config_image']; |
||
404 | } elseif ($this->config->get('config_image') && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $this->config->get('config_image'))) { |
||
405 | $data['thumb'] = '/public_html/assets/images/' . $this->config->get('config_image'); |
||
406 | } else { |
||
407 | $data['thumb'] = '/public_html/assets/images/no_image.png'; |
||
408 | } |
||
409 | |||
410 | $data['placeholder'] = '/public_html/assets/images/no_image.png'; |
||
411 | |||
412 | if (isset($this->request->post['config_open'])) { |
||
413 | $data['config_open'] = $this->request->post['config_open']; |
||
414 | } else { |
||
415 | $data['config_open'] = $this->config->get('config_open'); |
||
416 | } |
||
417 | |||
418 | if (isset($this->request->post['config_comment'])) { |
||
419 | $data['config_comment'] = $this->request->post['config_comment']; |
||
420 | } else { |
||
421 | $data['config_comment'] = $this->config->get('config_comment'); |
||
422 | } |
||
423 | |||
424 | $this->load->model('localisation/location'); |
||
425 | |||
426 | $data['locations'] = $this->model_localisation_location->getLocations(); |
||
427 | |||
428 | if (isset($this->request->post['config_location'])) { |
||
429 | $data['config_location'] = $this->request->post['config_location']; |
||
430 | } elseif ($this->config->get('config_location')) { |
||
431 | $data['config_location'] = $this->config->get('config_location'); |
||
432 | } else { |
||
433 | $data['config_location'] = array(); |
||
434 | } |
||
435 | |||
436 | if (isset($this->request->post['config_country_id'])) { |
||
437 | $data['config_country_id'] = $this->request->post['config_country_id']; |
||
438 | } else { |
||
439 | $data['config_country_id'] = $this->config->get('config_country_id'); |
||
440 | } |
||
441 | |||
442 | $this->load->model('localisation/country'); |
||
443 | |||
444 | $data['countries'] = $this->model_localisation_country->getCountries(); |
||
445 | |||
446 | if (isset($this->request->post['config_zone_id'])) { |
||
447 | $data['config_zone_id'] = $this->request->post['config_zone_id']; |
||
448 | } else { |
||
449 | $data['config_zone_id'] = $this->config->get('config_zone_id'); |
||
450 | } |
||
451 | |||
452 | if (isset($this->request->post['config_language'])) { |
||
453 | $data['config_language'] = $this->request->post['config_language']; |
||
454 | } else { |
||
455 | $data['config_language'] = $this->config->get('config_language'); |
||
456 | } |
||
457 | |||
458 | $this->load->model('localisation/language'); |
||
459 | |||
460 | $data['languages'] = $this->model_localisation_language->getLanguages(); |
||
461 | |||
462 | if (isset($this->request->post['config_admin_language'])) { |
||
463 | $data['config_admin_language'] = $this->request->post['config_admin_language']; |
||
464 | } else { |
||
465 | $data['config_admin_language'] = $this->config->get('config_admin_language'); |
||
466 | } |
||
467 | |||
468 | if (isset($this->request->post['config_currency'])) { |
||
469 | $data['config_currency'] = $this->request->post['config_currency']; |
||
470 | } else { |
||
471 | $data['config_currency'] = $this->config->get('config_currency'); |
||
472 | } |
||
473 | |||
474 | if (isset($this->request->post['config_currency_auto'])) { |
||
475 | $data['config_currency_auto'] = $this->request->post['config_currency_auto']; |
||
476 | } else { |
||
477 | $data['config_currency_auto'] = $this->config->get('config_currency_auto'); |
||
478 | } |
||
479 | |||
480 | $this->load->model('localisation/currency'); |
||
481 | |||
482 | $data['currencies'] = $this->model_localisation_currency->getCurrencies(); |
||
483 | |||
484 | if (isset($this->request->post['config_limit_admin'])) { |
||
485 | $data['config_limit_admin'] = $this->request->post['config_limit_admin']; |
||
486 | } else { |
||
487 | $data['config_limit_admin'] = $this->config->get('config_limit_admin'); |
||
488 | } |
||
489 | |||
490 | if (isset($this->request->post['config_limit_store'])) { |
||
491 | $data['config_limit_store'] = $this->request->post['config_limit_store']; |
||
492 | } else { |
||
493 | $data['config_limit_store'] = $this->config->get('config_limit_store'); |
||
494 | } |
||
495 | |||
496 | if (isset($this->request->post['config_product_count'])) { |
||
497 | $data['config_product_count'] = $this->request->post['config_product_count']; |
||
498 | } else { |
||
499 | $data['config_product_count'] = $this->config->get('config_product_count'); |
||
500 | } |
||
501 | |||
502 | if (isset($this->request->post['config_review_status'])) { |
||
503 | $data['config_review_status'] = $this->request->post['config_review_status']; |
||
504 | } else { |
||
505 | $data['config_review_status'] = $this->config->get('config_review_status'); |
||
506 | } |
||
507 | |||
508 | if (isset($this->request->post['config_review_guest'])) { |
||
509 | $data['config_review_guest'] = $this->request->post['config_review_guest']; |
||
510 | } else { |
||
511 | $data['config_review_guest'] = $this->config->get('config_review_guest'); |
||
512 | } |
||
513 | |||
514 | if (isset($this->request->post['config_customer_group_id'])) { |
||
515 | $data['config_customer_group_id'] = $this->request->post['config_customer_group_id']; |
||
516 | } else { |
||
517 | $data['config_customer_group_id'] = $this->config->get('config_customer_group_id'); |
||
518 | } |
||
519 | |||
520 | $this->load->model('customer/customer_group'); |
||
521 | |||
522 | $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups(); |
||
523 | |||
524 | if (isset($this->request->post['config_customer_group_display'])) { |
||
525 | $data['config_customer_group_display'] = $this->request->post['config_customer_group_display']; |
||
526 | } elseif ($this->config->get('config_customer_group_display')) { |
||
527 | $data['config_customer_group_display'] = $this->config->get('config_customer_group_display'); |
||
528 | } else { |
||
529 | $data['config_customer_group_display'] = array(); |
||
530 | } |
||
531 | |||
532 | if (isset($this->request->post['config_customer_price'])) { |
||
533 | $data['config_customer_price'] = $this->request->post['config_customer_price']; |
||
534 | } else { |
||
535 | $data['config_customer_price'] = $this->config->get('config_customer_price'); |
||
536 | } |
||
537 | |||
538 | if (isset($this->request->post['config_login_attempts'])) { |
||
539 | $data['config_login_attempts'] = $this->request->post['config_login_attempts']; |
||
540 | } elseif ($this->config->has('config_login_attempts')) { |
||
541 | $data['config_login_attempts'] = $this->config->get('config_login_attempts'); |
||
542 | } else { |
||
543 | $data['config_login_attempts'] = 5; |
||
544 | } |
||
545 | |||
546 | if (isset($this->request->post['config_account_id'])) { |
||
547 | $data['config_account_id'] = $this->request->post['config_account_id']; |
||
548 | } else { |
||
549 | $data['config_account_id'] = $this->config->get('config_account_id'); |
||
550 | } |
||
551 | |||
552 | $this->load->model('catalog/information'); |
||
553 | |||
554 | $data['informations'] = $this->model_catalog_information->getInformations(); |
||
555 | |||
556 | if (isset($this->request->post['config_checkout_guest'])) { |
||
557 | $data['config_checkout_guest'] = $this->request->post['config_checkout_guest']; |
||
558 | } else { |
||
559 | $data['config_checkout_guest'] = $this->config->get('config_checkout_guest'); |
||
560 | } |
||
561 | |||
562 | if (isset($this->request->post['config_checkout_id'])) { |
||
563 | $data['config_checkout_id'] = $this->request->post['config_checkout_id']; |
||
564 | } else { |
||
565 | $data['config_checkout_id'] = $this->config->get('config_checkout_id'); |
||
566 | } |
||
567 | |||
568 | if (isset($this->request->post['config_invoice_prefix'])) { |
||
569 | $data['config_invoice_prefix'] = $this->request->post['config_invoice_prefix']; |
||
570 | } elseif ($this->config->get('config_invoice_prefix')) { |
||
571 | $data['config_invoice_prefix'] = $this->config->get('config_invoice_prefix'); |
||
572 | } else { |
||
573 | $data['config_invoice_prefix'] = 'INV-' . date('Y') . '-00'; |
||
574 | } |
||
575 | |||
576 | if (isset($this->request->post['config_order_status_id'])) { |
||
577 | $data['config_order_status_id'] = $this->request->post['config_order_status_id']; |
||
578 | } else { |
||
579 | $data['config_order_status_id'] = $this->config->get('config_order_status_id'); |
||
580 | } |
||
581 | |||
582 | if (isset($this->request->post['config_processing_status'])) { |
||
583 | $data['config_processing_status'] = $this->request->post['config_processing_status']; |
||
584 | } elseif ($this->config->get('config_processing_status')) { |
||
585 | $data['config_processing_status'] = $this->config->get('config_processing_status'); |
||
586 | } else { |
||
587 | $data['config_processing_status'] = array(); |
||
588 | } |
||
589 | |||
590 | if (isset($this->request->post['config_complete_status'])) { |
||
591 | $data['config_complete_status'] = $this->request->post['config_complete_status']; |
||
592 | } elseif ($this->config->get('config_complete_status')) { |
||
593 | $data['config_complete_status'] = $this->config->get('config_complete_status'); |
||
594 | } else { |
||
595 | $data['config_complete_status'] = array(); |
||
596 | } |
||
597 | |||
598 | $this->load->model('localisation/order_status'); |
||
599 | |||
600 | $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses(); |
||
601 | |||
602 | if (isset($this->request->post['config_stock_display'])) { |
||
603 | $data['config_stock_display'] = $this->request->post['config_stock_display']; |
||
604 | } else { |
||
605 | $data['config_stock_display'] = $this->config->get('config_stock_display'); |
||
606 | } |
||
607 | |||
608 | if (isset($this->request->post['config_stock_warning'])) { |
||
609 | $data['config_stock_warning'] = $this->request->post['config_stock_warning']; |
||
610 | } else { |
||
611 | $data['config_stock_warning'] = $this->config->get('config_stock_warning'); |
||
612 | } |
||
613 | |||
614 | if (isset($this->request->post['config_stock_checkout'])) { |
||
615 | $data['config_stock_checkout'] = $this->request->post['config_stock_checkout']; |
||
616 | } else { |
||
617 | $data['config_stock_checkout'] = $this->config->get('config_stock_checkout'); |
||
618 | } |
||
619 | |||
620 | // $this->load->model('extension/extension'); |
||
621 | |||
622 | if (isset($this->request->post['config_logo'])) { |
||
623 | $data['config_logo'] = $this->request->post['config_logo']; |
||
624 | } else { |
||
625 | $data['config_logo'] = $this->config->get('config_logo'); |
||
626 | } |
||
627 | |||
628 | if (isset($this->request->post['config_logo']) && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $this->request->post['config_logo'])) { |
||
629 | $data['logo'] = '/public_html/assets/images/' . $this->request->post['config_logo']; |
||
630 | } elseif ($this->config->get('config_logo') && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $this->config->get('config_logo'))) { |
||
631 | $data['logo'] = '/public_html/assets/images/' . $this->config->get('config_logo'); |
||
632 | } else { |
||
633 | $data['logo'] = '/public_html/assets/images/no_image.png'; |
||
634 | } |
||
635 | |||
636 | if (isset($this->request->post['config_mail_protocol'])) { |
||
637 | $data['config_mail_protocol'] = $this->request->post['config_mail_protocol']; |
||
638 | } else { |
||
639 | $data['config_mail_protocol'] = $this->config->get('config_mail_protocol'); |
||
640 | } |
||
641 | |||
642 | if (isset($this->request->post['config_mail_parameter'])) { |
||
643 | $data['config_mail_parameter'] = $this->request->post['config_mail_parameter']; |
||
644 | } else { |
||
645 | $data['config_mail_parameter'] = $this->config->get('config_mail_parameter'); |
||
646 | } |
||
647 | |||
648 | if (isset($this->request->post['config_mail_smtp_hostname'])) { |
||
649 | $data['config_mail_smtp_hostname'] = $this->request->post['config_mail_smtp_hostname']; |
||
650 | } else { |
||
651 | $data['config_mail_smtp_hostname'] = $this->config->get('config_mail_smtp_hostname'); |
||
652 | } |
||
653 | |||
654 | if (isset($this->request->post['config_mail_smtp_username'])) { |
||
655 | $data['config_mail_smtp_username'] = $this->request->post['config_mail_smtp_username']; |
||
656 | } else { |
||
657 | $data['config_mail_smtp_username'] = $this->config->get('config_mail_smtp_username'); |
||
658 | } |
||
659 | |||
660 | if (isset($this->request->post['config_mail_smtp_password'])) { |
||
661 | $data['config_mail_smtp_password'] = $this->request->post['config_mail_smtp_password']; |
||
662 | } else { |
||
663 | $data['config_mail_smtp_password'] = $this->config->get('config_mail_smtp_password'); |
||
664 | } |
||
665 | |||
666 | if (isset($this->request->post['config_mail_smtp_port'])) { |
||
667 | $data['config_mail_smtp_port'] = $this->request->post['config_mail_smtp_port']; |
||
668 | } elseif ($this->config->has('config_mail_smtp_port')) { |
||
669 | $data['config_mail_smtp_port'] = $this->config->get('config_mail_smtp_port'); |
||
670 | } else { |
||
671 | $data['config_mail_smtp_port'] = 25; |
||
672 | } |
||
673 | |||
674 | if (isset($this->request->post['config_mail_smtp_timeout'])) { |
||
675 | $data['config_mail_smtp_timeout'] = $this->request->post['config_mail_smtp_timeout']; |
||
676 | } elseif ($this->config->has('config_mail_smtp_timeout')) { |
||
677 | $data['config_mail_smtp_timeout'] = $this->config->get('config_mail_smtp_timeout'); |
||
678 | } else { |
||
679 | $data['config_mail_smtp_timeout'] = 5; |
||
680 | } |
||
681 | |||
682 | if (isset($this->request->post['config_mail_alert'])) { |
||
683 | $data['config_mail_alert'] = $this->request->post['config_mail_alert']; |
||
684 | } elseif ($this->config->has('config_mail_alert')) { |
||
685 | $data['config_mail_alert'] = $this->config->get('config_mail_alert'); |
||
686 | } else { |
||
687 | $data['config_mail_alert'] = array(); |
||
688 | } |
||
689 | |||
690 | $data['mail_alerts'] = array(); |
||
691 | |||
692 | $data['mail_alerts'][] = array( |
||
693 | 'text' => $this->language->get('text_mail_account'), |
||
694 | 'value' => 'account' |
||
695 | ); |
||
696 | |||
697 | $data['mail_alerts'][] = array( |
||
698 | 'text' => $this->language->get('text_mail_order'), |
||
699 | 'value' => 'order' |
||
700 | ); |
||
701 | |||
702 | $data['mail_alerts'][] = array( |
||
703 | 'text' => $this->language->get('text_mail_review'), |
||
704 | 'value' => 'review' |
||
705 | ); |
||
706 | |||
707 | if (isset($this->request->post['config_alert_email'])) { |
||
708 | $data['config_alert_email'] = $this->request->post['config_alert_email']; |
||
709 | } else { |
||
710 | $data['config_alert_email'] = $this->config->get('config_alert_email'); |
||
711 | } |
||
712 | |||
713 | if (isset($this->request->post['config_secure'])) { |
||
714 | $data['config_secure'] = $this->request->post['config_secure']; |
||
715 | } else { |
||
716 | $data['config_secure'] = $this->config->get('config_secure'); |
||
717 | } |
||
718 | |||
719 | if (isset($this->request->post['config_shared'])) { |
||
720 | $data['config_shared'] = $this->request->post['config_shared']; |
||
721 | } else { |
||
722 | $data['config_shared'] = $this->config->get('config_shared'); |
||
723 | } |
||
724 | |||
725 | if (isset($this->request->post['config_robots'])) { |
||
726 | $data['config_robots'] = $this->request->post['config_robots']; |
||
727 | } else { |
||
728 | $data['config_robots'] = $this->config->get('config_robots'); |
||
729 | } |
||
730 | |||
731 | if (isset($this->request->post['config_seo_url'])) { |
||
732 | $data['config_seo_url'] = $this->request->post['config_seo_url']; |
||
733 | } else { |
||
734 | $data['config_seo_url'] = $this->config->get('config_seo_url'); |
||
735 | } |
||
736 | |||
737 | if (isset($this->request->post['config_seo_url_include_path'])) { |
||
738 | $data['config_seo_url_include_path'] = $this->request->post['config_seo_url_include_path']; |
||
739 | } else { |
||
740 | $data['config_seo_url_include_path'] = $this->config->get('config_seo_url_include_path'); |
||
741 | } |
||
742 | |||
743 | if (isset($this->request->post['config_seo_url_postfix'])) { |
||
744 | $data['config_seo_url_postfix'] = $this->request->post['config_seo_url_postfix']; |
||
745 | } else { |
||
746 | $data['config_seo_url_postfix'] = $this->config->get('config_seo_url_postfix'); |
||
747 | } |
||
748 | |||
749 | if (isset($this->request->post['config_file_max_size'])) { |
||
750 | $data['config_file_max_size'] = $this->request->post['config_file_max_size']; |
||
751 | } elseif ($this->config->get('config_file_max_size')) { |
||
752 | $data['config_file_max_size'] = $this->config->get('config_file_max_size'); |
||
753 | } else { |
||
754 | $data['config_file_max_size'] = 300000; |
||
755 | } |
||
756 | |||
757 | if (isset($this->request->post['config_file_ext_allowed'])) { |
||
758 | $data['config_file_ext_allowed'] = $this->request->post['config_file_ext_allowed']; |
||
759 | } else { |
||
760 | $data['config_file_ext_allowed'] = $this->config->get('config_file_ext_allowed'); |
||
761 | } |
||
762 | |||
763 | if (isset($this->request->post['config_file_mime_allowed'])) { |
||
764 | $data['config_file_mime_allowed'] = $this->request->post['config_file_mime_allowed']; |
||
765 | } else { |
||
766 | $data['config_file_mime_allowed'] = $this->config->get('config_file_mime_allowed'); |
||
767 | } |
||
768 | |||
769 | if (isset($this->request->post['config_password'])) { |
||
770 | $data['config_password'] = $this->request->post['config_password']; |
||
771 | } else { |
||
772 | $data['config_password'] = $this->config->get('config_password'); |
||
773 | } |
||
774 | |||
775 | if (isset($this->request->post['config_encryption'])) { |
||
776 | $data['config_encryption'] = $this->request->post['config_encryption']; |
||
777 | } else { |
||
778 | $data['config_encryption'] = $this->config->get('config_encryption'); |
||
779 | } |
||
780 | |||
781 | if (isset($this->request->post['config_error_display'])) { |
||
782 | $data['config_error_display'] = $this->request->post['config_error_display']; |
||
783 | } else { |
||
784 | $data['config_error_display'] = $this->config->get('config_error_display'); |
||
785 | } |
||
786 | |||
787 | if (isset($this->request->post['config_error_filename'])) { |
||
788 | $data['config_error_filename'] = $this->request->post['config_error_filename']; |
||
789 | } else { |
||
790 | $data['config_error_filename'] = $this->config->get('config_error_filename'); |
||
791 | } |
||
792 | |||
793 | $data['header'] = $this->load->controller('common/header'); |
||
794 | $data['column'] = $this->load->controller('common/column_left'); |
||
795 | $data['footer'] = $this->load->controller('common/footer'); |
||
796 | |||
797 | $this->response->setOutput($this->load->view('setting/setting', $data)); |
||
798 | } |
||
799 | |||
800 | protected function validate() |
||
801 | { |
||
802 | if (!$this->user->hasPermission('modify', 'setting/setting')) { |
||
803 | $this->error['warning'] = $this->language->get('error_permission'); |
||
804 | } |
||
805 | |||
806 | if (!$this->request->post['config_meta_title']) { |
||
807 | $this->error['meta_title'] = $this->language->get('error_meta_title'); |
||
808 | } |
||
809 | |||
810 | if (!$this->request->post['config_name']) { |
||
811 | $this->error['name'] = $this->language->get('error_name'); |
||
812 | } |
||
813 | |||
814 | if ((\voku\helper\UTF8::strlen($this->request->post['config_owner']) < 3) || (\voku\helper\UTF8::strlen($this->request->post['config_owner']) > 64)) { |
||
815 | $this->error['owner'] = $this->language->get('error_owner'); |
||
816 | } |
||
817 | |||
818 | if ((\voku\helper\UTF8::strlen($this->request->post['config_address']) < 3) || (\voku\helper\UTF8::strlen($this->request->post['config_address']) > 256)) { |
||
819 | $this->error['address'] = $this->language->get('error_address'); |
||
820 | } |
||
821 | |||
822 | if ((\voku\helper\UTF8::strlen($this->request->post['config_email']) > 96) || !filter_var($this->request->post['config_email'], FILTER_VALIDATE_EMAIL)) { |
||
823 | $this->error['email'] = $this->language->get('error_email'); |
||
824 | } |
||
825 | |||
826 | if ((\voku\helper\UTF8::strlen($this->request->post['config_telephone']) < 3) || (\voku\helper\UTF8::strlen($this->request->post['config_telephone']) > 32)) { |
||
827 | $this->error['telephone'] = $this->language->get('error_telephone'); |
||
828 | } |
||
829 | |||
830 | if (!empty($this->request->post['config_customer_group_display']) && !in_array($this->request->post['config_customer_group_id'], $this->request->post['config_customer_group_display'])) { |
||
831 | $this->error['customer_group_display'] = $this->language->get('error_customer_group_display'); |
||
832 | } |
||
833 | |||
834 | if (!$this->request->post['config_limit_admin']) { |
||
835 | $this->error['limit_admin'] = $this->language->get('error_limit'); |
||
836 | } |
||
837 | |||
838 | if (!$this->request->post['config_limit_store']) { |
||
839 | $this->error['limit_store'] = $this->language->get('error_limit'); |
||
840 | } |
||
841 | |||
842 | if ($this->request->post['config_login_attempts'] < 1) { |
||
843 | $this->error['login_attempts'] = $this->language->get('error_login_attempts'); |
||
844 | } |
||
845 | |||
846 | if (!isset($this->request->post['config_processing_status'])) { |
||
847 | $this->error['processing_status'] = $this->language->get('error_processing_status'); |
||
848 | } |
||
849 | |||
850 | if (!isset($this->request->post['config_complete_status'])) { |
||
851 | $this->error['complete_status'] = $this->language->get('error_complete_status'); |
||
852 | } |
||
853 | |||
854 | if (!$this->request->post['config_error_filename']) { |
||
855 | $this->error['error_filename'] = $this->language->get('error_error_filename'); |
||
856 | } else { |
||
857 | if (preg_match('/\.\.[\/\\\]?/', $this->request->post['config_error_filename'])) { |
||
858 | $this->error['error_filename'] = $this->language->get('error_malformed_filename'); |
||
859 | } |
||
860 | } |
||
861 | |||
862 | if ((\voku\helper\UTF8::strlen($this->request->post['config_encryption']) < 32) || (\voku\helper\UTF8::strlen($this->request->post['config_encryption']) > 1024)) { |
||
863 | $this->error['encryption'] = $this->language->get('error_encryption'); |
||
864 | } |
||
865 | |||
866 | if ($this->error && !isset($this->error['warning'])) { |
||
0 ignored issues
–
show
The expression
$this->error of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent. Consider making the comparison explicit by using ![]() |
|||
867 | $this->error['warning'] = $this->language->get('error_warning'); |
||
868 | } |
||
869 | |||
870 | return !$this->error; |
||
871 | } |
||
872 | } |
||
873 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.