forked from nenes25/eicaptcha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheicaptcha.php
627 lines (568 loc) · 26.1 KB
/
eicaptcha.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
<?php
/**
* 2007-2019 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author Hennes Hervé <contact@h-hennes.fr>
* @copyright 2013-2019 Hennes Hervé
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* http://www.h-hennes.fr/blog/
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class EiCaptcha extends Module
{
private $_html = '';
public function __construct()
{
$this->author = 'hhennes';
$this->name = 'eicaptcha';
$this->tab = 'front_office_features';
$this->version = '0.5.0';
$this->need_instance = 1;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Ei Captcha');
$this->description = $this->l('Add a captcha to your website form');
if ($this->active && (!Configuration::get('CAPTCHA_PUBLIC_KEY') || !Configuration::get('CAPTCHA_PRIVATE_KEY'))) {
$this->warning = $this->l('Captcha Module need to be configurated');
}
$this->themes = array(0 => 'light', 1 => 'dark');
$this->ps_versions_compliancy = array('min' => '1.5.0', 'max' => '1.7.0');
}
public function install()
{
if (!parent::install()
|| !$this->registerHook('header')
|| !$this->registerHook('displayCustomerAccountForm')
|| !$this->registerHook('contactFormAccess')
|| !$this->registerHook('actionBeforeSubmitAccount')
|| !Configuration::updateValue('CAPTCHA_ENABLE_ACCOUNT', 0)
|| !Configuration::updateValue('CAPTCHA_ENABLE_CONTACT', 0)
|| !Configuration::updateValue('CAPTCHA_THEME', 0)
|| !Configuration::updateValue('CAPTCHA_CONTACTF_BTN_SELECTOR', '#submitMessage')
|| !Configuration::updateValue('CAPTCHA_CONTACTF_INSERT_SELECTOR', '.submit')
) {
return false;
}
return true;
}
public function uninstall()
{
if (!parent::uninstall()) {
return false;
}
if (!Configuration::deleteByName('CAPTCHA_PUBLIC_KEY')
|| !Configuration::deleteByName('CAPTCHA_PRIVATE_KEY')
|| !Configuration::deleteByName('CAPTCHA_ENABLE_ACCOUNT')
|| !Configuration::deleteByName('CAPTCHA_ENABLE_CONTACT')
|| !Configuration::deleteByName('CAPTCHA_FORCE_LANG')
|| !Configuration::deleteByName('CAPTCHA_THEME')
|| !Configuration::deleteByName('CAPTCHA_CONTACTF_INSERT_SELECTOR')
|| !Configuration::deleteByName('CAPTCHA_CONTACTF_BTN_SELECTOR')
) {
return false;
}
return true;
}
/**
* Post Process in back office
*/
public function postProcess()
{
if (Tools::isSubmit('SubmitCaptchaConfiguration')) {
Configuration::updateValue('CAPTCHA_PUBLIC_KEY', Tools::getValue('CAPTCHA_PUBLIC_KEY'));
Configuration::updateValue('CAPTCHA_PRIVATE_KEY', Tools::getValue('CAPTCHA_PRIVATE_KEY'));
Configuration::updateValue('CAPTCHA_ENABLE_ACCOUNT', (int)Tools::getValue('CAPTCHA_ENABLE_ACCOUNT'));
Configuration::updateValue('CAPTCHA_ENABLE_CONTACT', (int)Tools::getValue('CAPTCHA_ENABLE_CONTACT'));
Configuration::updateValue('CAPTCHA_FORCE_LANG', Tools::getValue('CAPTCHA_FORCE_LANG'));
Configuration::updateValue('CAPTCHA_THEME', (int)Tools::getValue('CAPTCHA_THEME'));
Configuration::updateValue('CAPTCHA_CONTACTF_INSERT_SELECTOR', Tools::getValue('CAPTCHA_CONTACTF_INSERT_SELECTOR'));
Configuration::updateValue('CAPTCHA_CONTACTF_BTN_SELECTOR', Tools::getValue('CAPTCHA_CONTACTF_BTN_SELECTOR'));
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
}
}
/**
* Module Configuration in Back Office
*/
public function getContent()
{
$this->_html .= $this->_checkComposer();
$this->_html .= $this->postProcess();
$this->_html .= $this->renderForm();
return $this->_html;
}
/**
* Admin Form for module Configuration
*/
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Eicaptcha Configuration'),
'icon' => 'icon-cogs'
),
'tabs' => array(
'general' => $this->l('General configuration'),
'advanced' => $this->l('Advanded parameters'),
),
'description' => $this->l('To get your own public and private keys please click on the folowing link') . '<br /><a href="https://www.google.com/recaptcha/intro/index.html" target="_blank">https://www.google.com/recaptcha/intro/index.html</a>',
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Captcha public key (Site key)'),
'name' => 'CAPTCHA_PUBLIC_KEY',
'size' => 70,
'required' => true,
'empty_message' => $this->l('Please fill the captcha public key'),
'tab' => 'general',
),
array(
'type' => 'text',
'label' => $this->l('Captcha private key (Secret key)'),
'name' => 'CAPTCHA_PRIVATE_KEY',
'size' => 70,
'required' => true,
'empty_message' => $this->l('Please fill the captcha private key'),
'tab' => 'general',
),
array(
'type' => 'radio',
'label' => $this->l('Enable Captcha for contact form'),
'name' => 'CAPTCHA_ENABLE_CONTACT',
'required' => true,
'class' => 't',
'tab' => 'general',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled'),
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled'),
),
),
),
array(
'type' => 'radio',
'label' => $this->l('Enable Captcha for account creation'),
'name' => 'CAPTCHA_ENABLE_ACCOUNT',
'required' => true,
'class' => 't',
'is_bool' => true,
'tab' => 'general',
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled'),
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled'),
),
),
),
array(
'type' => 'text',
'label' => $this->l('Force Captcha language'),
'hint' => $this->l('Language code ( en-GB | fr | de | de-AT | ... ) - Leave empty for using customers FO language selection'),
'desc' => $this->l('For available language codes see: https://developers.google.com/recaptcha/docs/language'),
'name' => 'CAPTCHA_FORCE_LANG',
'required' => false,
'tab' => 'general',
),
array(
'type' => 'radio',
'label' => $this->l('Theme'),
'name' => 'CAPTCHA_THEME',
'required' => true,
'class' => 't',
'tab' => 'general',
'values' => array(
array(
'id' => 'clight',
'value' => 0,
'label' => $this->l('Light'),
),
array(
'id' => 'cdark',
'value' => 1,
'label' => $this->l('Dark'),
),
),
),
array(
'type' => 'html',
'name' => 'advanced-warning',
'html_content' => '<div class="alert alert-warning">'
. $this->l('Use with caution, invalid parameters may made the module not to works properly, check the blog article before (in french)')
. ': <a href="https://www.h-hennes.fr/blog/2018/02/23/eicaptcha-ajout-dune-configuration-avancees-des-selecteurs" target="_blank">https://www.h-hennes.fr/blog/2018/02/23/eicaptcha-ajout-dune-configuration-avancees-des-selecteurs</a></div>',
'tab' => 'advanced'
),
array(
'type' => 'text',
'label' => $this->l('Contact Form submit button selector'),
'hint' => $this->l('Use with caution, invalid parameters may made the module not to works properly'),
'desc' => $this->l('For specific theme you can edit css selector of the captcha submit button'),
'name' => 'CAPTCHA_CONTACTF_BTN_SELECTOR',
'required' => false,
'tab' => 'advanced',
),
array(
'type' => 'text',
'label' => $this->l('Custom css selection contact form'),
'hint' => $this->l('Use with caution, invalid parameters may made the module not to works properly'),
'desc' => $this->l('For specific theme you can edit css selector where to add captcha container before'),
'name' => 'CAPTCHA_CONTACTF_INSERT_SELECTOR',
'required' => false,
'tab' => 'advanced',
),
array(
'type' => 'html',
'label' => $this->l('Check module installation'),
'name' => 'enable_debug_html',
'html_content' => '<a class="btn btn-info" href="' . $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name . '&display_debug=1&token=' . Tools::getAdminTokenLite('AdminModules') . '">' . $this->l('Check if module is well installed') . '</a>',
'desc' => $this->l('click on this link will reload the page, please go again in tab "advanced parameters" to see the results'),
'tab' => 'advanced'
)
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'button btn btn-default pull-right',
)
),
);
//Display debug data to help detect issues
if (Tools::getValue('display_debug')) {
$fields_form['form']['input'][] = array(
'type' => 'html',
'name' => 'debug_html',
'html_content' => $this->_debugModuleInstall(),
'tab' => 'advanced'
);
}
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$this->fields_form = array();
$helper->id = (int)Tools::getValue('id_carrier');
$helper->identifier = $this->identifier;
$helper->submit_action = 'SubmitCaptchaConfiguration';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array(
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id
);
return $helper->generateForm(array($fields_form));
}
/**
* Get config values to hydrate the helperForm
*/
public function getConfigFieldsValues()
{
return array(
'CAPTCHA_PRIVATE_KEY' => Tools::getValue('CAPTCHA_PRIVATE_KEY', Configuration::get('CAPTCHA_PRIVATE_KEY')),
'CAPTCHA_PUBLIC_KEY' => Tools::getValue('CAPTCHA_PUBLIC_KEY', Configuration::get('CAPTCHA_PUBLIC_KEY')),
'CAPTCHA_ENABLE_ACCOUNT' => Tools::getValue('CAPTCHA_ENABLE_ACCOUNT', Configuration::get('CAPTCHA_ENABLE_ACCOUNT')),
'CAPTCHA_ENABLE_CONTACT' => Tools::getValue('CAPTCHA_ENABLE_CONTACT', Configuration::get('CAPTCHA_ENABLE_CONTACT')),
'CAPTCHA_FORCE_LANG' => Tools::getValue('CAPTCHA_FORCE_LANG', Configuration::get('CAPTCHA_FORCE_LANG')),
'CAPTCHA_THEME' => Tools::getValue('CAPTCHA_THEME', Configuration::get('CAPTCHA_THEME')),
'CAPTCHA_CONTACTF_INSERT_SELECTOR' => Tools::getValue('CAPTCHA_CONTACTF_INSERT_SELECTOR', Configuration::get('CAPTCHA_CONTACTF_INSERT_SELECTOR')),
'CAPTCHA_CONTACTF_BTN_SELECTOR' => Tools::getValue('CAPTCHA_CONTACTF_BTN_SELECTOR', Configuration::get('CAPTCHA_CONTACTF_BTN_SELECTOR')),
);
}
/**
* Get lang settings
* @return string
*/
public function langSettings()
{
if (!Configuration::get('CAPTCHA_FORCE_LANG')) {
return $iso_code = $this->context->language->iso_code;
} else {
return $iso_code = Configuration::get('CAPTCHA_FORCE_LANG');
}
}
/**
* Hook Header
*/
public function hookHeader($params)
{
//Display the captcha on the contact page if it's enabled
if ($this->context->controller instanceof ContactController && Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1) {
return $this->displayCaptchaContactForm();
}
}
/**
* Ajax Actions of the module
* (Error displaying with smarty template)
*/
public function hookAjaxCall()
{
$action = Tools::getValue('action');
if ($action == 'display_captcha_error') {
$this->context->smarty->assign('errors', array($this->l('Please validate the captcha field before submitting your request')));
$error_block = trim(preg_replace("#\n#", '', $this->context->smarty->fetch(_PS_THEME_DIR_ . 'errors.tpl')));
echo $error_block;
}
}
/**
* Add Captcha on the Customer Registration Form
*/
public function hookDisplayCustomerAccountForm($params)
{
$iso_code = $this->langSettings();
if (Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) {
// Do not display on OPC
if ($this->context->controller->php_self == 'order-opc') {
return;
}
$publickey = Configuration::get('CAPTCHA_PUBLIC_KEY');
if (_PS_VERSION_ > '1.6') {
$error_selector = '.alert';
$form_selector = '#account-creation_form';
$prestashop_version = '16';
} else {
$this->context->controller->addCSS($this->_path . '/views/css/eicaptcha.css');
$error_selector = '.error';
$form_selector = '#account-creation_form';
$prestashop_version = '15';
}
$this->context->controller->addJS($this->_path . 'views/js/eicaptcha.js');
$this->context->smarty->assign('publicKey', $publickey);
$this->context->smarty->assign('waiting_message', $this->l('Please wait during captcha check'));
$this->context->smarty->assign('checkCaptchaUrl', _MODULE_DIR_ . $this->name . '/eicaptcha-ajax.php');
$this->context->smarty->assign('errorSelector', $error_selector);
$this->context->smarty->assign('formSelector', $form_selector);
$this->context->smarty->assign('prestashopVersion', $prestashop_version);
$this->context->smarty->assign('captchaforcelang', $iso_code);
$this->context->smarty->assign('captchatheme', $this->themes[Configuration::get('CAPTCHA_THEME')]);
return $this->display(__FILE__, 'hookDisplayCustomerAccountForm.tpl');
}
}
/**
* Check if customer account can be created
* @param $params
*/
public function hookActionBeforeSubmitAccount($params)
{
if (Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1 && Tools::isSubmit('submitAccount')) {
//Disable on OPC
if ($this->isOpcCheckout()) {
return;
}
require_once(__DIR__ . '/vendor/autoload.php');
$captcha = new \ReCaptcha\ReCaptcha(Configuration::get('CAPTCHA_PRIVATE_KEY'));
$result = $captcha->verify(
Tools::getValue('g-recaptcha-response'),
Tools::getRemoteAddr()
);
if (!$result->isSuccess()) {
$this->context->controller->errors[] = $this->l('incorrect response to CAPTCHA challenge. Please try again.');
}
}
}
/**
* Display Captcha on the contact Form Page
*/
private function displayCaptchaContactForm()
{
$iso_code = $this->langSettings();
//Css class depends from Prestashop version
if (_PS_VERSION_ > '1.6') {
$error_class = 'alert';
$form_class = 'contact-form-box';
} else {
$error_class = 'error';
$form_class = 'std';
}
//Dynamic insertion of the content
$js = '<script type="text/javascript">
$(document).ready(function(){
//Add div where the captcha will be displayed
$("' . Configuration::get('CAPTCHA_CONTACTF_INSERT_SELECTOR') . '").before("<div id=\"captcha-box\"></div>");
//Manage form submit
$("' . Configuration::get('CAPTCHA_CONTACTF_BTN_SELECTOR') . '").click(function(){
//If no response we display an error
if ( ! grecaptcha.getResponse() ) {
$.ajax({
method : "POST",
url : "' . _MODULE_DIR_ . $this->name . '/eicaptcha-ajax.php",
data : "action=display_captcha_error",
success : function(msg){
$(".' . $error_class . '").remove();
$("form.' . $form_class . '").before(msg);
}
});
return false;
}
});
});
//Recaptcha CallBack Function
var onloadCallback = function() {grecaptcha.render("captcha-box", {"theme" : "' . $this->themes[Configuration::get('CAPTCHA_THEME')] . '", "sitekey" : "' . Configuration::get('CAPTCHA_PUBLIC_KEY') . '"});};
</script>';
$js .= '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=' . $iso_code . '" async defer></script>';
return $js;
}
/**
* whether to allow access (before postProcess())
* @return int
*/
public function hookContactFormAccess()
{
if (!Tools::isSubmit('submitMessage')) {
// postProcess will take care of this
return 1;
}
// no restriction
if (!Configuration::get('CAPTCHA_ENABLE_CONTACT', 0)) {
return 1;
}
require_once(__DIR__ . '/vendor/autoload.php');
$captcha = new \ReCaptcha\ReCaptcha(Configuration::get('CAPTCHA_PRIVATE_KEY'));
$result = $captcha->verify(
Tools::getValue('g-recaptcha-response'),
Tools::getRemoteAddr()
);
if (!$result->isSuccess()) {
$this->context->controller->errors[] = $this->l('incorrect response to CAPTCHA challenge. Please try again.');
return 0;
}
return 1;
}
/**
* Check if needed composer directory is present
*/
protected function _checkComposer()
{
if (!is_dir(dirname(__FILE__) . '/vendor')) {
$errorMessage = $this->l('This module need composer to work, please go into module directory %s and run composer install or dowload and install latest release from %s');
return $this->displayError(
sprintf($errorMessage, dirname(__FILE__),
'https://github.com/nenes25/eicaptcha/releases')
);
}
return '';
}
/**
* Debug module installation
*/
protected function _debugModuleInstall()
{
$errors = array();
$success = array();
//Check if module version is compatible with current PS version
if (!$this->checkCompliancy()) {
$errors[] = 'the module is not compatible with your version';
} else {
$success[] = 'the module is compatible with your version';
}
//Check if module is well hooked on all necessary hooks
$modulesHooks = array('header', 'displayCustomerAccountForm', 'contactFormAccess', 'actionBeforeSubmitAccount');
foreach ($modulesHooks as $hook) {
if (!$this->isRegisteredInHook($hook)) {
$errors[] = 'the module is not registered in hook ' . $hook;
} else {
$success[] = 'the module is well registered in hook ' . $hook;
}
}
//Check if override are disabled in configuration
if (Configuration::get('PS_DISABLE_OVERRIDES') == 1) {
$errors[] = 'Overrides are disable on your website';
} else {
$success[] = 'Overrides are enabled on your website';
}
//Check if file overrides exists
if (!file_exists(_PS_OVERRIDE_DIR_ . 'controllers/front/ContactController.php')) {
$errors[] = 'ContactController.php override does not exists';
} else {
$success[] = 'ContactController.php override exists';
}
//Warning about OPC
if (Configuration::get("PS_ORDER_PROCESS_TYPE") == 1) {
$errors[] = $this->l('OPC checkout is enable, be aware that the captcha won\'t be displayed on it');
}
//@Todo : check the content of the override file
//Check if file override is written in class_index.php files
if (file_exists(_PS_CACHE_DIR_ . 'class_index.php')) {
$classesArray = (include _PS_CACHE_DIR_ . 'class_index.php');
if ($classesArray['ContactController']['path'] != 'override/controllers/front/ContactController.php') {
$errors[] = 'ContactController.php override is not present in class_index.php <br />'
. 'Please remove file cache/class_index.php in order to fix the issue';
} else {
$success[] = 'ContactController.php override is present in class_index.php';
}
} else {
$errors[] = 'no class_index.php found';
}
//@Todo Check if log file can be filled
//Display errors
if (sizeof($errors)) {
$errorsHtml = '<div class="alert alert-warning"> Errors <br />'
. '<ul>';
foreach ($errors as $error) {
$errorsHtml .= '<li>' . $error . '</li>';
}
$errorsHtml .= '</ul></div>';
}
//Display success
if (sizeof($success)) {
$successHtml = '<div class="alert alert-success"> Success <br />'
. '<ul>';
foreach ($success as $msg) {
$successHtml .= '<li>' . $msg . '</li>';
}
$successHtml .= '</ul></div>';
}
//Additionnal informations
$informations = '<div class="alert alert-info">Aditionnal informations <br />'
. '<ul>';
//PS version
$informations .= '<li>Prestashop version <strong>' . _PS_VERSION_ . '</strong></li>';
//Theme
$informations .= '<li>Theme name <strong>' . _THEME_NAME_ . '</strong></li>';
//Check php version
$informations .= '<li>Php version <strong>' . phpversion() . '</strong></li>';
$informations .= '</ul></div>';
return $errorsHtml . ' ' . $successHtml . ' ' . $informations;
}
/**
* Detect if we are in opc checkout
* @return bool
*/
protected function isOpcCheckout()
{
return
Configuration::get("PS_ORDER_PROCESS_TYPE") == 1
&& Tools::getValue('ajax') !== false
&& Tools::getValue('opc_id_customer') !== false;
}
}