1: | <?php
|
2: | namespace Opencart\Admin\Controller\Setting;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Setting extends \Opencart\System\Engine\Controller {
|
9: | |
10: | |
11: | |
12: | |
13: |
|
14: | public function index(): void {
|
15: | $this->load->language('setting/setting');
|
16: |
|
17: | $this->document->setTitle($this->language->get('heading_title'));
|
18: |
|
19: | $data['breadcrumbs'] = [];
|
20: |
|
21: | $data['breadcrumbs'][] = [
|
22: | 'text' => $this->language->get('text_home'),
|
23: | 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
|
24: | ];
|
25: |
|
26: | $data['breadcrumbs'][] = [
|
27: | 'text' => $this->language->get('text_stores'),
|
28: | 'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token'])
|
29: | ];
|
30: |
|
31: | $data['breadcrumbs'][] = [
|
32: | 'text' => $this->language->get('heading_title'),
|
33: | 'href' => $this->url->link('setting/setting', 'user_token=' . $this->session->data['user_token'])
|
34: | ];
|
35: |
|
36: | $data['save'] = $this->url->link('setting/setting.save', 'user_token=' . $this->session->data['user_token']);
|
37: | $data['back'] = $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token']);
|
38: |
|
39: |
|
40: | $data['config_meta_title'] = $this->config->get('config_meta_title');
|
41: | $data['config_meta_description'] = $this->config->get('config_meta_description');
|
42: | $data['config_meta_keyword'] = $this->config->get('config_meta_keyword');
|
43: |
|
44: | $data['store_url'] = HTTP_CATALOG;
|
45: |
|
46: | $data['themes'] = [];
|
47: |
|
48: | $this->load->model('setting/extension');
|
49: |
|
50: | $extensions = $this->model_setting_extension->getExtensionsByType('theme');
|
51: |
|
52: | foreach ($extensions as $extension) {
|
53: | $this->load->language('extension/' . $extension['extension'] . '/theme/' . $extension['code'], 'extension');
|
54: |
|
55: | $data['themes'][] = [
|
56: | 'text' => $this->language->get('extension_heading_title'),
|
57: | 'value' => $extension['code']
|
58: | ];
|
59: | }
|
60: |
|
61: | $data['config_theme'] = $this->config->get('config_theme');
|
62: |
|
63: | $this->load->model('design/layout');
|
64: |
|
65: | $data['layouts'] = $this->model_design_layout->getLayouts();
|
66: |
|
67: | $data['config_layout_id'] = $this->config->get('config_layout_id');
|
68: |
|
69: |
|
70: | $data['config_name'] = $this->config->get('config_name');
|
71: | $data['config_owner'] = $this->config->get('config_owner');
|
72: | $data['config_address'] = $this->config->get('config_address');
|
73: | $data['config_geocode'] = $this->config->get('config_geocode');
|
74: | $data['config_email'] = $this->config->get('config_email');
|
75: | $data['config_telephone'] = $this->config->get('config_telephone');
|
76: | $data['config_image'] = $this->config->get('config_image');
|
77: |
|
78: | $this->load->model('tool/image');
|
79: |
|
80: | $data['placeholder'] = $this->model_tool_image->resize('no_image.png', $this->config->get('config_image_default_width'), $this->config->get('config_image_default_height'));
|
81: |
|
82: | if ($data['config_image'] && is_file(DIR_IMAGE . html_entity_decode($data['config_image'], ENT_QUOTES, 'UTF-8'))) {
|
83: | $data['thumb'] = $this->model_tool_image->resize($data['config_image'], $this->config->get('config_image_default_width'), $this->config->get('config_image_default_height'));
|
84: | } else {
|
85: | $data['thumb'] = $data['placeholder'];
|
86: | }
|
87: |
|
88: | $data['config_open'] = $this->config->get('config_open');
|
89: | $data['config_comment'] = $this->config->get('config_comment');
|
90: |
|
91: | $this->load->model('localisation/location');
|
92: |
|
93: | $data['locations'] = $this->model_localisation_location->getLocations();
|
94: |
|
95: | $data['config_location'] = (array)$this->config->get('config_location');
|
96: |
|
97: |
|
98: | $this->load->model('localisation/country');
|
99: |
|
100: | $data['countries'] = $this->model_localisation_country->getCountries();
|
101: |
|
102: | $data['config_country_id'] = $this->config->get('config_country_id');
|
103: | $data['config_zone_id'] = $this->config->get('config_zone_id');
|
104: | $data['config_timezone'] = $this->config->get('config_timezone');
|
105: |
|
106: | $data['timezones'] = [];
|
107: |
|
108: | $timestamp = date_create('now');
|
109: |
|
110: | $timezones = timezone_identifiers_list();
|
111: |
|
112: | foreach ($timezones as $timezone) {
|
113: | date_timezone_set($timestamp, timezone_open($timezone));
|
114: |
|
115: | $hour = ' (' . date_format($timestamp, 'P') . ')';
|
116: |
|
117: | $data['timezones'][] = [
|
118: | 'text' => $timezone . $hour,
|
119: | 'value' => $timezone
|
120: | ];
|
121: | }
|
122: |
|
123: |
|
124: | $this->load->model('localisation/language');
|
125: |
|
126: | $data['languages'] = $this->model_localisation_language->getLanguages();
|
127: |
|
128: | $data['config_language_catalog'] = $this->config->get('config_language_catalog');
|
129: | $data['config_language_admin'] = $this->config->get('config_language_admin');
|
130: |
|
131: |
|
132: | $this->load->model('localisation/currency');
|
133: |
|
134: | $data['currencies'] = $this->model_localisation_currency->getCurrencies();
|
135: |
|
136: | $data['config_currency'] = $this->config->get('config_currency');
|
137: |
|
138: | $data['currency_engines'] = [];
|
139: |
|
140: | $this->load->model('setting/extension');
|
141: |
|
142: | $extensions = $this->model_setting_extension->getExtensionsByType('currency');
|
143: |
|
144: | foreach ($extensions as $extension) {
|
145: | if ($this->config->get('currency_' . $extension['code'] . '_status')) {
|
146: | $this->load->language('extension/' . $extension['extension'] . '/currency/' . $extension['code'], 'extension');
|
147: |
|
148: | $data['currency_engines'][] = [
|
149: | 'text' => $this->language->get('extension_heading_title'),
|
150: | 'value' => $extension['code']
|
151: | ];
|
152: | }
|
153: | }
|
154: |
|
155: | $data['config_currency_engine'] = $this->config->get('config_currency_engine');
|
156: | $data['config_currency_auto'] = $this->config->get('config_currency_auto');
|
157: |
|
158: | $this->load->model('localisation/length_class');
|
159: |
|
160: | $data['length_classes'] = $this->model_localisation_length_class->getLengthClasses();
|
161: |
|
162: | $data['config_length_class_id'] = $this->config->get('config_length_class_id');
|
163: |
|
164: | $this->load->model('localisation/weight_class');
|
165: |
|
166: | $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses();
|
167: |
|
168: | $data['config_weight_class_id'] = $this->config->get('config_weight_class_id');
|
169: |
|
170: |
|
171: | $data['config_product_description_length'] = $this->config->get('config_product_description_length');
|
172: | $data['config_pagination'] = $this->config->get('config_pagination');
|
173: | $data['config_product_count'] = $this->config->get('config_product_count');
|
174: | $data['config_pagination_admin'] = $this->config->get('config_pagination_admin');
|
175: | $data['config_product_report_status'] = $this->config->get('config_product_report_status');
|
176: |
|
177: |
|
178: | $data['config_review_status'] = $this->config->get('config_review_status');
|
179: | $data['config_review_purchased'] = $this->config->get('config_review_purchased');
|
180: | $data['config_review_guest'] = $this->config->get('config_review_guest');
|
181: |
|
182: |
|
183: | $data['config_article_description_length'] = $this->config->get('config_article_description_length');
|
184: | $data['config_comment_status'] = $this->config->get('config_comment_status');
|
185: | $data['config_comment_approve'] = $this->config->get('config_comment_approve');
|
186: | $data['config_comment_interval'] = $this->config->get('config_comment_interval');
|
187: |
|
188: |
|
189: | $data['config_voucher_min'] = $this->config->get('config_voucher_min');
|
190: | $data['config_voucher_max'] = $this->config->get('config_voucher_max');
|
191: |
|
192: |
|
193: | $data['config_cookie_id'] = $this->config->get('config_cookie_id');
|
194: | $data['config_gdpr_id'] = $this->config->get('config_gdpr_id');
|
195: | $data['config_gdpr_limit'] = $this->config->get('config_gdpr_limit');
|
196: |
|
197: |
|
198: | $data['config_tax'] = $this->config->get('config_tax');
|
199: | $data['config_tax_default'] = $this->config->get('config_tax_default');
|
200: | $data['config_tax_customer'] = $this->config->get('config_tax_customer');
|
201: |
|
202: |
|
203: | $data['config_customer_online'] = $this->config->get('config_customer_online');
|
204: | $data['config_customer_online_expire'] = $this->config->get('config_customer_online_expire');
|
205: | $data['config_customer_activity'] = $this->config->get('config_customer_activity');
|
206: | $data['config_customer_search'] = $this->config->get('config_customer_search');
|
207: |
|
208: | $this->load->model('customer/customer_group');
|
209: |
|
210: | $data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
|
211: |
|
212: | $data['config_customer_group_id'] = $this->config->get('config_customer_group_id');
|
213: | $data['config_customer_group_display'] = (array)$this->config->get('config_customer_group_display');
|
214: | $data['config_customer_price'] = $this->config->get('config_customer_price');
|
215: | $data['config_telephone_display'] = $this->config->get('config_telephone_display');
|
216: | $data['config_telephone_required'] = $this->config->get('config_telephone_required');
|
217: | $data['config_customer_2fa'] = $this->config->get('config_customer_2fa');
|
218: | $data['config_login_attempts'] = $this->config->get('config_login_attempts');
|
219: |
|
220: | $this->load->model('catalog/information');
|
221: |
|
222: | $data['informations'] = $this->model_catalog_information->getInformations();
|
223: |
|
224: | $data['config_account_id'] = $this->config->get('config_account_id');
|
225: |
|
226: |
|
227: | $data['config_cart_weight'] = $this->config->get('config_cart_weight');
|
228: | $data['config_checkout_guest'] = $this->config->get('config_checkout_guest');
|
229: | $data['config_checkout_payment_address'] = $this->config->get('config_checkout_payment_address');
|
230: | $data['config_checkout_shipping_address'] = $this->config->get('config_checkout_shipping_address');
|
231: | $data['config_checkout_id'] = $this->config->get('config_checkout_id');
|
232: |
|
233: | if ($this->config->get('config_invoice_prefix')) {
|
234: | $data['config_invoice_prefix'] = $this->config->get('config_invoice_prefix');
|
235: | } else {
|
236: | $data['config_invoice_prefix'] = 'INV-' . date('Y') . '-00';
|
237: | }
|
238: |
|
239: | $this->load->model('localisation/order_status');
|
240: |
|
241: | $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
|
242: |
|
243: | $data['config_order_status_id'] = $this->config->get('config_order_status_id');
|
244: | $data['config_processing_status'] = (array)$this->config->get('config_processing_status');
|
245: | $data['config_complete_status'] = (array)$this->config->get('config_complete_status');
|
246: | $data['config_fraud_status_id'] = $this->config->get('config_fraud_status_id');
|
247: |
|
248: |
|
249: | $this->load->model('localisation/subscription_status');
|
250: |
|
251: | $data['subscription_statuses'] = $this->model_localisation_subscription_status->getSubscriptionStatuses();
|
252: |
|
253: | $data['config_subscription_status_id'] = $this->config->get('config_subscription_status_id');
|
254: | $data['config_subscription_active_status_id'] = $this->config->get('config_subscription_active_status_id');
|
255: | $data['config_subscription_suspended_status_id'] = $this->config->get('config_subscription_suspended_status_id');
|
256: | $data['config_subscription_expired_status_id'] = $this->config->get('config_subscription_expired_status_id');
|
257: | $data['config_subscription_canceled_status_id'] = $this->config->get('config_subscription_canceled_status_id');
|
258: | $data['config_subscription_failed_status_id'] = $this->config->get('config_subscription_failed_status_id');
|
259: | $data['config_subscription_denied_status_id'] = $this->config->get('config_subscription_denied_status_id');
|
260: |
|
261: |
|
262: | $this->load->model('user/api');
|
263: |
|
264: | $data['apis'] = $this->model_user_api->getApis();
|
265: |
|
266: | $data['config_api_id'] = $this->config->get('config_api_id');
|
267: |
|
268: |
|
269: | $data['config_stock_display'] = $this->config->get('config_stock_display');
|
270: | $data['config_stock_warning'] = $this->config->get('config_stock_warning');
|
271: | $data['config_stock_checkout'] = $this->config->get('config_stock_checkout');
|
272: |
|
273: |
|
274: | $data['config_affiliate_status'] = $this->config->get('config_affiliate_status');
|
275: | $data['config_affiliate_group_id'] = $this->config->get('config_affiliate_group_id');
|
276: | $data['config_affiliate_approval'] = $this->config->get('config_affiliate_approval');
|
277: | $data['config_affiliate_auto'] = (bool)$this->config->get('config_affiliate_auto');
|
278: | $data['config_affiliate_commission'] = (float)$this->config->get('config_affiliate_commission');
|
279: | $data['config_affiliate_expire'] = $this->config->get('config_affiliate_expire');
|
280: |
|
281: |
|
282: | $data['config_affiliate_id'] = $this->config->get('config_affiliate_id');
|
283: |
|
284: |
|
285: | $this->load->model('localisation/return_status');
|
286: |
|
287: | $data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
|
288: |
|
289: | $data['config_return_status_id'] = $this->config->get('config_return_status_id');
|
290: |
|
291: |
|
292: | $data['config_return_id'] = $this->config->get('config_return_id');
|
293: |
|
294: |
|
295: | $data['config_captcha'] = $this->config->get('config_captcha');
|
296: |
|
297: | $this->load->model('setting/extension');
|
298: |
|
299: | $data['captchas'] = [];
|
300: |
|
301: |
|
302: | $extensions = $this->model_setting_extension->getExtensionsByType('captcha');
|
303: |
|
304: | foreach ($extensions as $extension) {
|
305: | $this->load->language('extension/' . $extension['extension'] . '/captcha/' . $extension['code'], 'extension');
|
306: |
|
307: | if ($this->config->get('captcha_' . $extension['code'] . '_status')) {
|
308: | $data['captchas'][] = [
|
309: | 'text' => $this->language->get('extension_heading_title'),
|
310: | 'value' => $extension['code']
|
311: | ];
|
312: | }
|
313: | }
|
314: |
|
315: | $data['config_captcha_page'] = (array)$this->config->get('config_captcha_page');
|
316: |
|
317: | $data['captcha_pages'] = [];
|
318: |
|
319: | $data['captcha_pages'][] = [
|
320: | 'text' => $this->language->get('text_register'),
|
321: | 'value' => 'register'
|
322: | ];
|
323: |
|
324: | $data['captcha_pages'][] = [
|
325: | 'text' => $this->language->get('text_guest'),
|
326: | 'value' => 'guest'
|
327: | ];
|
328: |
|
329: | $data['captcha_pages'][] = [
|
330: | 'text' => $this->language->get('text_review'),
|
331: | 'value' => 'review'
|
332: | ];
|
333: |
|
334: | $data['captcha_pages'][] = [
|
335: | 'text' => $this->language->get('text_comment'),
|
336: | 'value' => 'comment'
|
337: | ];
|
338: |
|
339: | $data['captcha_pages'][] = [
|
340: | 'text' => $this->language->get('text_return'),
|
341: | 'value' => 'returns'
|
342: | ];
|
343: |
|
344: | $data['captcha_pages'][] = [
|
345: | 'text' => $this->language->get('text_contact'),
|
346: | 'value' => 'contact'
|
347: | ];
|
348: |
|
349: |
|
350: | $data['config_logo'] = $this->config->get('config_logo');
|
351: |
|
352: | $this->load->model('tool/image');
|
353: |
|
354: | $data['placeholder'] = $this->model_tool_image->resize('no_image.png', $this->config->get('config_image_default_width'), $this->config->get('config_image_default_height'));
|
355: |
|
356: | if ($data['config_logo'] && is_file(DIR_IMAGE . html_entity_decode($data['config_logo'], ENT_QUOTES, 'UTF-8'))) {
|
357: | $data['logo'] = $this->model_tool_image->resize($data['config_logo'], $this->config->get('config_image_default_width'), $this->config->get('config_image_default_height'));
|
358: | } else {
|
359: | $data['logo'] = $data['placeholder'];
|
360: | }
|
361: |
|
362: |
|
363: | $data['config_image_default_width'] = $this->config->get('config_image_default_width');
|
364: | $data['config_image_default_height'] = $this->config->get('config_image_default_height');
|
365: | $data['config_image_category_width'] = $this->config->get('config_image_category_width');
|
366: | $data['config_image_category_height'] = $this->config->get('config_image_category_height');
|
367: | $data['config_image_thumb_width'] = $this->config->get('config_image_thumb_width');
|
368: | $data['config_image_thumb_height'] = $this->config->get('config_image_thumb_height');
|
369: | $data['config_image_popup_width'] = $this->config->get('config_image_popup_width');
|
370: | $data['config_image_popup_height'] = $this->config->get('config_image_popup_height');
|
371: | $data['config_image_product_width'] = $this->config->get('config_image_product_width');
|
372: | $data['config_image_product_height'] = $this->config->get('config_image_product_height');
|
373: | $data['config_image_additional_width'] = $this->config->get('config_image_additional_width');
|
374: | $data['config_image_additional_height'] = $this->config->get('config_image_additional_height');
|
375: | $data['config_image_related_width'] = $this->config->get('config_image_related_width');
|
376: | $data['config_image_related_height'] = $this->config->get('config_image_related_height');
|
377: | $data['config_image_compare_width'] = $this->config->get('config_image_compare_width');
|
378: | $data['config_image_compare_height'] = $this->config->get('config_image_compare_height');
|
379: | $data['config_image_article_width'] = $this->config->get('config_image_article_width');
|
380: | $data['config_image_article_height'] = $this->config->get('config_image_article_height');
|
381: | $data['config_image_topic_width'] = $this->config->get('config_image_topic_width');
|
382: | $data['config_image_topic_height'] = $this->config->get('config_image_topic_height');
|
383: | $data['config_image_wishlist_width'] = $this->config->get('config_image_wishlist_width');
|
384: | $data['config_image_wishlist_height'] = $this->config->get('config_image_wishlist_height');
|
385: | $data['config_image_cart_width'] = $this->config->get('config_image_cart_width');
|
386: | $data['config_image_cart_height'] = $this->config->get('config_image_cart_height');
|
387: | $data['config_image_location_width'] = $this->config->get('config_image_location_width');
|
388: | $data['config_image_location_height'] = $this->config->get('config_image_location_height');
|
389: |
|
390: |
|
391: | $data['config_mail_engine'] = $this->config->get('config_mail_engine');
|
392: | $data['config_mail_parameter'] = $this->config->get('config_mail_parameter');
|
393: | $data['config_mail_smtp_hostname'] = $this->config->get('config_mail_smtp_hostname');
|
394: | $data['config_mail_smtp_username'] = $this->config->get('config_mail_smtp_username');
|
395: | $data['config_mail_smtp_password'] = $this->config->get('config_mail_smtp_password');
|
396: | $data['config_mail_smtp_port'] = $this->config->get('config_mail_smtp_port');
|
397: | $data['config_mail_smtp_timeout'] = $this->config->get('config_mail_smtp_timeout');
|
398: | $data['config_mail_alert'] = (array)$this->config->get('config_mail_alert');
|
399: |
|
400: | $data['mail_alerts'] = [];
|
401: |
|
402: | $data['mail_alerts'][] = [
|
403: | 'text' => $this->language->get('text_mail_account'),
|
404: | 'value' => 'account'
|
405: | ];
|
406: |
|
407: | $data['mail_alerts'][] = [
|
408: | 'text' => $this->language->get('text_mail_affiliate'),
|
409: | 'value' => 'affiliate'
|
410: | ];
|
411: |
|
412: | $data['mail_alerts'][] = [
|
413: | 'text' => $this->language->get('text_mail_order'),
|
414: | 'value' => 'order'
|
415: | ];
|
416: |
|
417: | $data['mail_alerts'][] = [
|
418: | 'text' => $this->language->get('text_mail_review'),
|
419: | 'value' => 'review'
|
420: | ];
|
421: |
|
422: | $data['config_mail_alert_email'] = $this->config->get('config_mail_alert_email');
|
423: |
|
424: |
|
425: | $data['config_maintenance'] = $this->config->get('config_maintenance');
|
426: | $data['config_session_expire'] = $this->config->get('config_session_expire');
|
427: | $data['config_session_samesite'] = $this->config->get('config_session_samesite');
|
428: | $data['config_seo_url'] = $this->config->get('config_seo_url');
|
429: | $data['config_robots'] = $this->config->get('config_robots');
|
430: | $data['config_compression'] = $this->config->get('config_compression');
|
431: |
|
432: |
|
433: | $data['config_user_2fa'] = $this->config->get('config_user_2fa');
|
434: | $data['config_shared'] = $this->config->get('config_shared');
|
435: |
|
436: |
|
437: | $data['config_file_max_size'] = $this->config->get('config_file_max_size');
|
438: | $data['config_file_ext_allowed'] = $this->config->get('config_file_ext_allowed');
|
439: | $data['config_file_mime_allowed'] = $this->config->get('config_file_mime_allowed');
|
440: |
|
441: |
|
442: | $data['config_error_display'] = $this->config->get('config_error_display');
|
443: | $data['config_error_log'] = $this->config->get('config_error_log');
|
444: | $data['config_error_filename'] = $this->config->get('config_error_filename');
|
445: |
|
446: | $data['user_token'] = $this->session->data['user_token'];
|
447: |
|
448: | $data['header'] = $this->load->controller('common/header');
|
449: | $data['column_left'] = $this->load->controller('common/column_left');
|
450: | $data['footer'] = $this->load->controller('common/footer');
|
451: |
|
452: | $this->response->setOutput($this->load->view('setting/setting', $data));
|
453: | }
|
454: |
|
455: | |
456: | |
457: | |
458: | |
459: |
|
460: | public function save(): void {
|
461: | $this->load->language('setting/setting');
|
462: |
|
463: | $json = [];
|
464: |
|
465: | if (!$this->user->hasPermission('modify', 'setting/setting')) {
|
466: | $json['error']['warning'] = $this->language->get('error_permission');
|
467: | }
|
468: |
|
469: | if (!$this->request->post['config_meta_title']) {
|
470: | $json['error']['meta_title'] = $this->language->get('error_meta_title');
|
471: | }
|
472: |
|
473: | if (!$this->request->post['config_name']) {
|
474: | $json['error']['name'] = $this->language->get('error_name');
|
475: | }
|
476: |
|
477: | if ((oc_strlen($this->request->post['config_owner']) < 3) || (oc_strlen($this->request->post['config_owner']) > 64)) {
|
478: | $json['error']['owner'] = $this->language->get('error_owner');
|
479: | }
|
480: |
|
481: | if ((oc_strlen($this->request->post['config_address']) < 3) || (oc_strlen($this->request->post['config_address']) > 256)) {
|
482: | $json['error']['address'] = $this->language->get('error_address');
|
483: | }
|
484: |
|
485: | if ((oc_strlen($this->request->post['config_email']) > 96) || !filter_var($this->request->post['config_email'], FILTER_VALIDATE_EMAIL)) {
|
486: | $json['error']['email'] = $this->language->get('error_email');
|
487: | }
|
488: |
|
489: | if (!$this->request->post['config_product_description_length']) {
|
490: | $json['error']['product_description_length'] = $this->language->get('error_product_description_length');
|
491: | }
|
492: |
|
493: | if (!$this->request->post['config_pagination']) {
|
494: | $json['error']['pagination'] = $this->language->get('error_pagination');
|
495: | }
|
496: |
|
497: | if (!$this->request->post['config_pagination_admin']) {
|
498: | $json['error']['pagination_admin'] = $this->language->get('error_pagination');
|
499: | }
|
500: |
|
501: | if (!$this->request->post['config_article_description_length']) {
|
502: | $json['error']['article_description_length'] = $this->language->get('error_article_description_length');
|
503: | }
|
504: |
|
505: | 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'])) {
|
506: | $json['error']['customer_group_display'] = $this->language->get('error_customer_group_display');
|
507: | }
|
508: |
|
509: | if ($this->request->post['config_login_attempts'] < 1) {
|
510: | $json['error']['login_attempts'] = $this->language->get('error_login_attempts');
|
511: | }
|
512: |
|
513: | if (!$this->request->post['config_customer_online_expire']) {
|
514: | $json['error']['customer_online_expire'] = $this->language->get('error_customer_online_expire');
|
515: | }
|
516: |
|
517: | if (!$this->request->post['config_voucher_min']) {
|
518: | $json['error']['voucher_min'] = $this->language->get('error_voucher_min');
|
519: | }
|
520: |
|
521: | if (!$this->request->post['config_voucher_max']) {
|
522: | $json['error']['voucher_max'] = $this->language->get('error_voucher_max');
|
523: | }
|
524: |
|
525: | if (!isset($this->request->post['config_processing_status'])) {
|
526: | $json['error']['processing_status'] = $this->language->get('error_processing_status');
|
527: | }
|
528: |
|
529: | if (!isset($this->request->post['config_complete_status'])) {
|
530: | $json['error']['complete_status'] = $this->language->get('error_complete_status');
|
531: | }
|
532: |
|
533: | if (!$this->request->post['config_image_default_width'] || !$this->request->post['config_image_default_height']) {
|
534: | $json['error']['image_default'] = $this->language->get('error_image_category');
|
535: | }
|
536: |
|
537: | if (!$this->request->post['config_image_category_width'] || !$this->request->post['config_image_category_height']) {
|
538: | $json['error']['image_category'] = $this->language->get('error_image_category');
|
539: | }
|
540: |
|
541: | if (!$this->request->post['config_image_thumb_width'] || !$this->request->post['config_image_thumb_height']) {
|
542: | $json['error']['image_thumb'] = $this->language->get('error_image_thumb');
|
543: | }
|
544: |
|
545: | if (!$this->request->post['config_image_popup_width'] || !$this->request->post['config_image_popup_height']) {
|
546: | $json['error']['image_popup'] = $this->language->get('error_image_popup');
|
547: | }
|
548: |
|
549: | if (!$this->request->post['config_image_product_width'] || !$this->request->post['config_image_product_height']) {
|
550: | $json['error']['image_product'] = $this->language->get('error_image_product');
|
551: | }
|
552: |
|
553: | if (!$this->request->post['config_image_additional_width'] || !$this->request->post['config_image_additional_height']) {
|
554: | $json['error']['image_additional'] = $this->language->get('error_image_additional');
|
555: | }
|
556: |
|
557: | if (!$this->request->post['config_image_related_width'] || !$this->request->post['config_image_related_height']) {
|
558: | $json['error']['image_related'] = $this->language->get('error_image_related');
|
559: | }
|
560: |
|
561: | if (!$this->request->post['config_image_article_width'] || !$this->request->post['config_image_article_height']) {
|
562: | $json['error']['image_article'] = $this->language->get('error_image_cart');
|
563: | }
|
564: |
|
565: | if (!$this->request->post['config_image_topic_width'] || !$this->request->post['config_image_topic_height']) {
|
566: | $json['error']['image_topic'] = $this->language->get('error_image_cart');
|
567: | }
|
568: |
|
569: | if (!$this->request->post['config_image_compare_width'] || !$this->request->post['config_image_compare_height']) {
|
570: | $json['error']['image_compare'] = $this->language->get('error_image_compare');
|
571: | }
|
572: |
|
573: | if (!$this->request->post['config_image_wishlist_width'] || !$this->request->post['config_image_wishlist_height']) {
|
574: | $json['error']['image_wishlist'] = $this->language->get('error_image_wishlist');
|
575: | }
|
576: |
|
577: | if (!$this->request->post['config_image_cart_width'] || !$this->request->post['config_image_cart_height']) {
|
578: | $json['error']['image_cart'] = $this->language->get('error_image_cart');
|
579: | }
|
580: |
|
581: | if (!$this->request->post['config_image_location_width'] || !$this->request->post['config_image_location_height']) {
|
582: | $json['error']['image_location'] = $this->language->get('error_image_location');
|
583: | }
|
584: |
|
585: | if ($this->request->post['config_user_2fa'] && !$this->request->post['config_mail_engine']) {
|
586: | $json['error']['warning'] = $this->language->get('error_user_2fa');
|
587: | }
|
588: |
|
589: | if (!$this->request->post['config_file_max_size']) {
|
590: | $json['error']['file_max_size'] = $this->language->get('error_file_max_size');
|
591: | }
|
592: |
|
593: | $disallowed = [
|
594: | 'php',
|
595: | 'php4',
|
596: | 'php3'
|
597: | ];
|
598: |
|
599: | $extensions = explode("\n", $this->request->post['config_file_ext_allowed']);
|
600: |
|
601: | foreach ($extensions as $extension) {
|
602: | if (in_array(trim($extension), $disallowed)) {
|
603: | $json['error']['file_ext_allowed'] = $this->language->get('error_extension');
|
604: |
|
605: | break;
|
606: | }
|
607: | }
|
608: |
|
609: | $disallowed = [
|
610: | 'php',
|
611: | 'php4',
|
612: | 'php3'
|
613: | ];
|
614: |
|
615: | $mimes = explode("\n", $this->request->post['config_file_mime_allowed']);
|
616: |
|
617: | foreach ($mimes as $mime) {
|
618: | if (in_array(trim($mime), $disallowed)) {
|
619: | $json['error']['file_mime_allowed'] = $this->language->get('error_mime');
|
620: |
|
621: | break;
|
622: | }
|
623: | }
|
624: |
|
625: | if (!$this->request->post['config_error_filename']) {
|
626: | $json['error']['error_filename'] = $this->language->get('error_log_required');
|
627: | } elseif (preg_match('/\.\.[\/\\\]?/', $this->request->post['config_error_filename'])) {
|
628: | $json['error']['error_filename'] = $this->language->get('error_log_invalid');
|
629: | } elseif (substr($this->request->post['config_error_filename'], strrpos($this->request->post['config_error_filename'], '.')) != '.log') {
|
630: | $json['error']['error_filename'] = $this->language->get('error_log_extension');
|
631: | }
|
632: |
|
633: | if (isset($json['error']) && !isset($json['error']['warning'])) {
|
634: | $json['error']['warning'] = $this->language->get('error_warning');
|
635: | }
|
636: |
|
637: | if (!$json) {
|
638: | $this->load->model('setting/setting');
|
639: |
|
640: | $this->model_setting_setting->editSetting('config', $this->request->post);
|
641: |
|
642: | $json['success'] = $this->language->get('text_success');
|
643: | }
|
644: |
|
645: | $this->response->addHeader('Content-Type: application/json');
|
646: | $this->response->setOutput(json_encode($json));
|
647: | }
|
648: |
|
649: | |
650: | |
651: | |
652: | |
653: |
|
654: | public function theme(): void {
|
655: | if (isset($this->request->get['theme'])) {
|
656: | $theme = basename($this->request->get['theme']);
|
657: | } else {
|
658: | $theme = '';
|
659: | }
|
660: |
|
661: | $this->load->model('setting/extension');
|
662: |
|
663: | $extension_info = $this->model_setting_extension->getExtensionByCode('theme', $theme);
|
664: |
|
665: | if ($extension_info) {
|
666: | $this->response->setOutput(HTTP_CATALOG . 'extension/' . $extension_info['extension'] . '/admin/view/image/' . $extension_info['code'] . '.png');
|
667: | } else {
|
668: | $this->response->setOutput(HTTP_CATALOG . 'image/no_image.png');
|
669: | }
|
670: | }
|
671: | }
|
672: | |