first commit
This commit is contained in:
63
modules/eicaptcha/README.md
Normal file
63
modules/eicaptcha/README.md
Normal file
@@ -0,0 +1,63 @@
|
||||
[](https://github.com/nenes25/eicaptcha/stargazers)
|
||||
[](https://github.com/nenes25/eicaptcha/network)
|
||||
[](https://github.com/nenes25/eicaptcha/)
|
||||
[]()
|
||||
[]()
|
||||
|
||||
# eicaptcha
|
||||
Module EiCaptcha for prestashop 1.7
|
||||
|
||||
The module is also available for prestashop version 1.6.x see here : https://github.com/nenes25/eicaptcha/tree/master
|
||||
or download 0.4.x releases ( This version remains available but support and evolutions are stopped )
|
||||
|
||||
This module display Google recaptcha on the following forms :
|
||||
- contact form
|
||||
- account creation form
|
||||
- newsletter subscription ( since 2.1.0)
|
||||
|
||||
The module is compatible with both V2 and V3 recaptcha keys ( since v 2.3.0 )
|
||||
|
||||
This module relies upon the override of the following files :
|
||||
- AuthController
|
||||
- ContactForm Module
|
||||
|
||||
For newsletter subscription implementation it needs module **ps_emailsubscription at least 2.6.0**
|
||||
|
||||
This module use composer to get recaptcha lib.
|
||||
Don't forget to use `composer install` in order to download the necessary recaptcha composer package.
|
||||
|
||||
Otherwise you can go on the github release page https://github.com/nenes25/eicaptcha/releases and download the last 2.0.x version release to get the full package
|
||||
|
||||
`Please do not use the github function "download as zip" which will not works`
|
||||
|
||||
Screenshots
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
Captcha on contact form <br />
|
||||
<img src="https://www.h-hennes.fr/blog/wp-content/uploads/2017/07/eicaptcha-17-contact.jpg" alt="Captcha Contact Form" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Captcha on account creation form <br />
|
||||
<img src="https://www.h-hennes.fr/blog/wp-content/uploads/2017/07/eicaptcha-17-account.jpg" alt="Captcha on account creation form" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
Captcha on newsletter form <br />
|
||||
<img src="https://www.h-hennes.fr/blog/wp-content/uploads/2021/03/captcha-newsletter.png" alt="Captcha on newsletter subscription form" />
|
||||
</p>
|
||||
|
||||
Additionnal informations (French)
|
||||
---
|
||||
|
||||
https://www.h-hennes.fr/blog/module-recaptcha-pour-le-formulaire-de-contact-prestashop/
|
||||
https://www.h-hennes.fr/blog/2017/07/11/module-catpcha-pour-prestashop-1-7/
|
||||
|
||||
Compatibility
|
||||
---
|
||||
|
||||
| Prestashop Version | Compatible |
|
||||
| ------------------ | -----------|
|
||||
| 1.6.1.x and under| :x:use version 0.4.x or 0.5.x instead |
|
||||
| 1.7.0.x to 1.7.7.x | :heavy_check_mark: |
|
||||
28
modules/eicaptcha/changelog.txt
Normal file
28
modules/eicaptcha/changelog.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Module Captcha
|
||||
* Add (re)captcha on contact and account creation forms
|
||||
* © Hervé Hennes 2013-2021
|
||||
* https://github.com/nenes25/eicaptcha
|
||||
* https://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
- V 2.3.1 - 2021-09-29 : #201 Added displayNewsletterRegsitration hook to installation method ( thanks to gdebrion )
|
||||
- V 2.3.0 - 2021-09-06 : #94 Recaptcha v3
|
||||
#188 Compatible with reCaptcha V3 (V2 is not available anymore on Google reCaptcha Entreprise)
|
||||
#113 not compatible with recaptcha V3
|
||||
#195 Improve debug information
|
||||
#196 Improve Code quality : introduce phpcsfixer and phpstan
|
||||
- V 2.2.0 - 2021-08-10 : Code refactoring
|
||||
- V 2.1.1 - 2021-04-16 : #186 Wrong ps_emailsubscription version comparison
|
||||
- V 2.1.0 - 2021-03-15 : Add support for newsletter registration ( in certain conditions )
|
||||
#164 eicaptcha newsletter filtering
|
||||
#179 Better display debug mode in back office
|
||||
#180 Display link to github issues in debug module
|
||||
- V 2.0.7 - 2020-12-22 : Fix prestashop 1.7.7 compatibility
|
||||
- V 2.0.6 - 2020-10-31 : Improve code + fix OPC verification
|
||||
- V 2.0.5 - 2019-04-23 : Small fixes - Not released
|
||||
- V 2.0.4 - 2018-03-09 : Display debug information in back-office
|
||||
- V 2.0.3 - 2018-03-01 : Add debug mode + activate compatibility for PS 1.7.0.x
|
||||
- V 2.0.2 - 2018-02-13 : Check if composer "vendor" directory is present
|
||||
- V 2.0.1 - 2017-12-01 : Css improvments thanks to Arnaud Merigeau
|
||||
- V 2.0.0 - 2017-07-10 : New version for prestashop 1.7, add only captcha for contact form and account creation
|
||||
41
modules/eicaptcha/composer.json
Normal file
41
modules/eicaptcha/composer.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "nenes25/eicaptcha",
|
||||
"description": "PrestaShop Captcha Module",
|
||||
"homepage": "https://github.com/nenes25/eicaptcha",
|
||||
"license": "AFL-3.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Hhennes",
|
||||
"email": "contact@h-hennes.fr"
|
||||
},
|
||||
{
|
||||
"name": "drzraf",
|
||||
"email": "raphael.droz@gmail.com"
|
||||
}
|
||||
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"google/recaptcha": "~1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Eicaptcha\\Module\\": "src/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"prepend-autoloader": false
|
||||
},
|
||||
"type": "prestashop-module",
|
||||
"require-dev": {
|
||||
"prestashop/php-dev-tools": "^4.1"
|
||||
},
|
||||
"scripts": {
|
||||
"phpstan" : [
|
||||
"_PS_ROOT_DIR_=./../ php ~/.config/composer/vendor/bin/phpstan analyze -c ./tests/phpstan/phpstan.neon ./ --debug"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
2309
modules/eicaptcha/composer.lock
generated
Normal file
2309
modules/eicaptcha/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
modules/eicaptcha/config_pl.xml
Normal file
12
modules/eicaptcha/config_pl.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>eicaptcha</name>
|
||||
<displayName><![CDATA[Ei Captcha]]></displayName>
|
||||
<version><![CDATA[2.3.1]]></version>
|
||||
<description><![CDATA[Dodaj Captcha do formularza na stronie]]></description>
|
||||
<author><![CDATA[hhennes]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
404
modules/eicaptcha/eicaptcha.php
Normal file
404
modules/eicaptcha/eicaptcha.php
Normal file
@@ -0,0 +1,404 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2021 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.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2021 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;
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__) . '/vendor/autoload.php';
|
||||
|
||||
use Eicaptcha\Module\ConfigForm;
|
||||
use Eicaptcha\Module\Debugger;
|
||||
use Eicaptcha\Module\Installer;
|
||||
use ReCaptcha\ReCaptcha;
|
||||
|
||||
class EiCaptcha extends Module
|
||||
{
|
||||
/** @var string */
|
||||
private $_html = '';
|
||||
|
||||
/** @var array */
|
||||
protected $themes = [];
|
||||
/**
|
||||
* @var Debugger
|
||||
*/
|
||||
protected $debugger;
|
||||
|
||||
/**
|
||||
* @var Installer
|
||||
*/
|
||||
protected $installer;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->author = 'hhennes';
|
||||
$this->name = 'eicaptcha';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '2.3.1';
|
||||
$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 = [0 => 'light', 1 => 'dark'];
|
||||
$this->dependencies = ['contactform'];
|
||||
$this->ps_versions_compliancy = ['min' => '1.7.0.0', 'max' => _PS_VERSION_];
|
||||
|
||||
$this->debugger = new Debugger($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install Module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()
|
||||
|| !$this->_getInstaller()->install()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall Module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
if (!parent::uninstall()
|
||||
|| !$this->_getInstaller()->uninstall()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Installer
|
||||
*/
|
||||
protected function _getInstaller()
|
||||
{
|
||||
if (null === $this->installer) {
|
||||
$this->installer = new Installer($this);
|
||||
}
|
||||
|
||||
return $this->installer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Debugger
|
||||
*/
|
||||
public function getDebugger()
|
||||
{
|
||||
return $this->debugger;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Context
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module Configuration in Back Office
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$configForm = new ConfigForm($this);
|
||||
$this->_html .= $this->debugger->checkComposer();
|
||||
$this->_html .= $configForm->postProcess();
|
||||
$this->_html .= $configForm->renderForm();
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook Header
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$captchaVersion = Configuration::get('CAPTCHA_VERSION');
|
||||
//Add Content box to contact form page in order to display captcha
|
||||
if ($this->context->controller instanceof ContactController
|
||||
&& Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1
|
||||
) {
|
||||
$this->context->controller->registerJavascript(
|
||||
'modules-eicaptcha-contact-form',
|
||||
'modules/' . $this->name . '/views/js/eicaptcha-contact-form-v' . $captchaVersion . '.js'
|
||||
);
|
||||
}
|
||||
|
||||
if ($captchaVersion == 2) {
|
||||
return $this->renderHeaderV2();
|
||||
} else {
|
||||
return $this->renderHeaderV3();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return content for (re)captcha v2
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
protected function renderHeaderV2()
|
||||
{
|
||||
if (($this->context->controller instanceof AuthController && Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) ||
|
||||
($this->context->controller instanceof ContactController && Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1)
|
||||
) {
|
||||
$this->context->controller->registerStylesheet(
|
||||
'module-eicaptcha',
|
||||
'modules/' . $this->name . '/views/css/eicaptcha.css'
|
||||
);
|
||||
//Dynamic insertion of the content
|
||||
$js = '<script type="text/javascript">
|
||||
//Recaptcha CallBack Function
|
||||
var onloadCallback = function() {
|
||||
//Fix captcha box issue in ps 1.7.7
|
||||
if ( ! document.getElementById("captcha-box")){
|
||||
var container = document.createElement("div");
|
||||
container.setAttribute("id","captcha-box");
|
||||
if ( null !== document.querySelector(".form-fields") ){
|
||||
document.querySelector(".form-fields").appendChild(container);
|
||||
}
|
||||
}
|
||||
if ( document.getElementById("captcha-box")){
|
||||
grecaptcha.render("captcha-box", {"theme" : "' . $this->themes[Configuration::get('CAPTCHA_THEME')] . '", "sitekey" : "' . Configuration::get('CAPTCHA_PUBLIC_KEY') . '"});
|
||||
} else {
|
||||
console.warn("eicaptcha: unable to add captcha-box placeholder to display captcha ( not an error when form is submited sucessfully )");
|
||||
}
|
||||
};
|
||||
</script>';
|
||||
|
||||
if (($this->context->controller instanceof ContactController && Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1)) {
|
||||
$js .= '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=' . Configuration::get('CAPTCHA_FORCE_LANG') . '" async defer></script>';
|
||||
}
|
||||
|
||||
return $js;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return content for recaptcha v3
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function renderHeaderV3()
|
||||
{
|
||||
if (
|
||||
$this->context->controller instanceof ContactController
|
||||
&& Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1
|
||||
) {
|
||||
$publicKey = Configuration::get('CAPTCHA_PUBLIC_KEY');
|
||||
$js = '
|
||||
<script src="https://www.google.com/recaptcha/api.js?render=' . $publicKey . '"></script>
|
||||
<script>
|
||||
grecaptcha.ready(function () {
|
||||
grecaptcha.execute("' . $publicKey . '", {action: "contact"}).then(function (token) {
|
||||
var recaptchaResponse = document.getElementById("captcha-box");
|
||||
recaptchaResponse.value = token;
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
return $js;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Captcha on the Customer Registration Form
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function hookDisplayCustomerAccountForm($params)
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) {
|
||||
$this->context->smarty->assign([
|
||||
'captchaVersion' => Configuration::get('CAPTCHA_VERSION'),
|
||||
'publicKey' => Configuration::get('CAPTCHA_PUBLIC_KEY'),
|
||||
'captchaforcelang' => Configuration::get('CAPTCHA_FORCE_LANG'),
|
||||
'captchatheme' => $this->themes[Configuration::get('CAPTCHA_THEME')],
|
||||
]);
|
||||
|
||||
return $this->display(__FILE__, 'views/templates/hook/hookDisplayCustomerAccountForm.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check captcha before submit account
|
||||
* Custom hook
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return bool|void
|
||||
*/
|
||||
public function hookActionContactFormSubmitCaptcha($params)
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) {
|
||||
return $this->_validateCaptcha();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check captcha before submit contact form
|
||||
* new custom hook
|
||||
*
|
||||
* @return bool|void
|
||||
*/
|
||||
public function hookActionContactFormSubmitBefore()
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1) {
|
||||
return $this->_validateCaptcha();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register media in back office
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function hookActionAdminControllerSetMedia($params)
|
||||
{
|
||||
if (
|
||||
$this->context->controller instanceof AdminModulesController
|
||||
&& Tools::getValue('configure') == $this->name
|
||||
&& Tools::getValue('display_debug') == 1
|
||||
) {
|
||||
$this->context->controller->addJS(
|
||||
$this->_path . 'views/js/admin.js'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* New hook to display content for newsletter registration
|
||||
* ( Need to override theme template for themes/classic/modules/ps_emailsubscription/views/templates/hook/ps_emailsubscription.tpl )
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string|void
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function hookDisplayNewsletterRegistration($params)
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_NEWSLETTER') == 1 && $this->canUseCaptchaOnNewsletter()) {
|
||||
$this->context->smarty->assign([
|
||||
'captchaVersion' => Configuration::get('CAPTCHA_VERSION'),
|
||||
'publicKey' => Configuration::get('CAPTCHA_PUBLIC_KEY'),
|
||||
'captchaforcelang' => Configuration::get('CAPTCHA_FORCE_LANG'),
|
||||
'captchatheme' => $this->themes[Configuration::get('CAPTCHA_THEME')],
|
||||
]);
|
||||
|
||||
return $this->display(__FILE__, 'views/templates/hook/hookDisplayNewsletterRegistration.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* New Hook to validate newsletter registration
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function hookActionNewsletterRegistrationBefore($params)
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_NEWSLETTER') == 1 && $this->canUseCaptchaOnNewsletter()) {
|
||||
if (!$this->_validateCaptcha()) {
|
||||
$params['hookError'] = $this->l('Please validate the captcha field before submitting your request');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Captcha
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _validateCaptcha()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$captcha = new ReCaptcha(Configuration::get('CAPTCHA_PRIVATE_KEY'));
|
||||
$result = $captcha->verify(
|
||||
Tools::getValue('g-recaptcha-response'),
|
||||
Tools::getRemoteAddr()
|
||||
);
|
||||
|
||||
if (!$result->isSuccess()) {
|
||||
$errorMessage = $this->l('Please validate the captcha field before submitting your request');
|
||||
$this->debugger->log($errorMessage);
|
||||
$this->debugger->log(sprintf($this->l('Recaptcha response %s'), print_r($result->getErrorCodes(), true)));
|
||||
$context->controller->errors[] = $errorMessage;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->debugger->log($this->l('Captcha submited with success'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define if captcha can be use on newsletter form
|
||||
* Needs a recent version of ps_emailsubscription which implements new required hooks
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canUseCaptchaOnNewsletter()
|
||||
{
|
||||
if (Module::isInstalled('ps_emailsubscription')) {
|
||||
$emailSubcription = Module::getInstanceByName('ps_emailsubscription');
|
||||
if (version_compare('2.6.0', $emailSubcription->version) <= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
35
modules/eicaptcha/index.php
Normal file
35
modules/eicaptcha/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
BIN
modules/eicaptcha/logo.png
Normal file
BIN
modules/eicaptcha/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
35
modules/eicaptcha/logs/index.php
Normal file
35
modules/eicaptcha/logs/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class AuthController extends AuthControllerCore
|
||||
{
|
||||
public function initContent()
|
||||
{
|
||||
if (Tools::isSubmit('submitCreate')) {
|
||||
Hook::exec('actionContactFormSubmitCaptcha');
|
||||
|
||||
if (!sizeof($this->context->controller->errors)) {
|
||||
parent::initContent();
|
||||
} else {
|
||||
$register_form = $this
|
||||
->makeCustomerForm()
|
||||
->setGuestAllowed(false)
|
||||
->fillWith(Tools::getAllValues());
|
||||
|
||||
FrontController::initContent();
|
||||
|
||||
$this->context->smarty->assign([
|
||||
'register_form' => $register_form->getProxy(),
|
||||
'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'),
|
||||
]);
|
||||
$this->setTemplate('customer/registration');
|
||||
}
|
||||
} else {
|
||||
parent::initContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class OrderController extends OrderControllerCore
|
||||
{
|
||||
public function postProcess()
|
||||
{
|
||||
if (
|
||||
Tools::isSubmit('submitCreate')
|
||||
&& Module::isInstalled('eicaptcha')
|
||||
&& Module::isEnabled('eicaptcha')
|
||||
&& false === Module::getInstanceByName('eicaptcha')->hookActionContactFormSubmitCaptcha([])
|
||||
&& !empty($this->errors)
|
||||
) {
|
||||
unset($_POST['submitCreate']);
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
34
modules/eicaptcha/override/controllers/front/index.php
Normal file
34
modules/eicaptcha/override/controllers/front/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
34
modules/eicaptcha/override/index.php
Normal file
34
modules/eicaptcha/override/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class ContactformOverride extends Contactform
|
||||
{
|
||||
public function sendMessage()
|
||||
{
|
||||
//Module Eicaptcha : Check captcha before submit
|
||||
Hook::exec('actionContactFormSubmitBefore');
|
||||
if (!sizeof($this->context->controller->errors)) {
|
||||
parent::sendMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
modules/eicaptcha/override/modules/index.php
Normal file
34
modules/eicaptcha/override/modules/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
330
modules/eicaptcha/src/ConfigForm.php
Normal file
330
modules/eicaptcha/src/ConfigForm.php
Normal file
@@ -0,0 +1,330 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2021 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.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2021 Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
namespace Eicaptcha\Module;
|
||||
|
||||
use Configuration;
|
||||
use Context;
|
||||
use EiCaptcha;
|
||||
use HelperForm;
|
||||
use Language;
|
||||
use Tools;
|
||||
|
||||
class ConfigForm
|
||||
{
|
||||
/**
|
||||
* @var EiCaptcha
|
||||
*/
|
||||
private $module;
|
||||
|
||||
/**
|
||||
* @var Context
|
||||
*/
|
||||
private $context;
|
||||
|
||||
/**
|
||||
* Installer constructor.
|
||||
*
|
||||
* @param EiCaptcha $module
|
||||
*/
|
||||
public function __construct(EiCaptcha $module)
|
||||
{
|
||||
$this->module = $module;
|
||||
$this->context = $this->module->getContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Form for module Configuration
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \PrestaShopDatabaseException
|
||||
* @throws \PrestaShopException
|
||||
*/
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = [
|
||||
'form' => [
|
||||
'legend' => [
|
||||
'title' => $this->l('Eicaptcha Configuration'),
|
||||
'icon' => 'icon-cogs',
|
||||
],
|
||||
'tabs' => [
|
||||
'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' => [
|
||||
[
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Recaptcha Version'),
|
||||
'name' => 'CAPTCHA_VERSION',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'values' => [
|
||||
[
|
||||
'id' => 'v2',
|
||||
'value' => 2,
|
||||
'label' => $this->l('V2'),
|
||||
],
|
||||
[
|
||||
'id' => 'v3',
|
||||
'value' => 3,
|
||||
'label' => $this->l('V3'),
|
||||
],
|
||||
],
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Captcha public key (Site key)'),
|
||||
'name' => 'CAPTCHA_PUBLIC_KEY',
|
||||
'required' => true,
|
||||
'empty_message' => $this->l('Please fill the captcha public key'),
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Captcha private key (Secret key)'),
|
||||
'name' => 'CAPTCHA_PRIVATE_KEY',
|
||||
'required' => true,
|
||||
'empty_message' => $this->l('Please fill the captcha private key'),
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Enable Captcha for contact form'),
|
||||
'name' => 'CAPTCHA_ENABLE_CONTACT',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => [
|
||||
[
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
],
|
||||
[
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
],
|
||||
],
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Enable Captcha for account creation'),
|
||||
'name' => 'CAPTCHA_ENABLE_ACCOUNT',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => [
|
||||
[
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
],
|
||||
[
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
],
|
||||
],
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Enable Captcha for newsletter registration'),
|
||||
'hint' => $this->l('Only availaibles in certain conditions*'),
|
||||
'name' => 'CAPTCHA_ENABLE_NEWSLETTER',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => [
|
||||
[
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
],
|
||||
[
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
],
|
||||
],
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Force Captcha language'),
|
||||
'hint' => $this->l('Language code ( en-GB | fr | de | de-AT | ... ) - Leave empty for autodetect'),
|
||||
'desc' => $this->l('For available language codes see: https://developers.google.com/recaptcha/docs/language'),
|
||||
'name' => 'CAPTCHA_FORCE_LANG',
|
||||
'required' => false,
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Theme'),
|
||||
'name' => 'CAPTCHA_THEME',
|
||||
'required' => true,
|
||||
'is_bool' => true,
|
||||
'values' => [
|
||||
[
|
||||
'id' => 'clight',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Light'),
|
||||
],
|
||||
[
|
||||
'id' => 'cdark',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Dark'),
|
||||
],
|
||||
],
|
||||
'tab' => 'general',
|
||||
],
|
||||
[
|
||||
'type' => 'switch',
|
||||
'name' => 'CAPTCHA_DEBUG',
|
||||
'label' => $this->l('Enable Debug'),
|
||||
'hint' => $this->l('Use only for debug'),
|
||||
'desc' => sprintf(
|
||||
$this->l('Enable loging for debuging module, see file %s'),
|
||||
dirname(__FILE__) . '/logs/debug.log'
|
||||
),
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => [
|
||||
[
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
],
|
||||
[
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
],
|
||||
],
|
||||
'tab' => 'advanced',
|
||||
],
|
||||
[
|
||||
'type' => 'html',
|
||||
'label' => $this->l('Check module installation'),
|
||||
'name' => 'enable_debug_html',
|
||||
'html_content' => '<a href="' . $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->module->name . '&tab_module=' . $this->module->tab . '&module_name=' . $this->module->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' => [
|
||||
'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'][] = [
|
||||
'type' => 'html',
|
||||
'name' => 'debug_html',
|
||||
'html_content' => $this->module->getDebugger()->debugModuleInstall(),
|
||||
'tab' => 'advanced',
|
||||
];
|
||||
}
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$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;
|
||||
$helper->id = 'eicaptcha';
|
||||
$helper->submit_action = 'SubmitCaptchaConfiguration';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)
|
||||
. '&configure=' . $this->module->name . '&tab_module=' . $this->module->tab . '&module_name=' . $this->module->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = [
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id,
|
||||
];
|
||||
|
||||
return $helper->generateForm([$fields_form]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Process in back office
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('SubmitCaptchaConfiguration')) {
|
||||
Configuration::updateValue('CAPTCHA_VERSION', Tools::getValue('CAPTCHA_VERSION'));
|
||||
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_ENABLE_NEWSLETTER', (int) Tools::getValue('CAPTCHA_ENABLE_NEWSLETTER'));
|
||||
Configuration::updateValue('CAPTCHA_FORCE_LANG', Tools::getValue('CAPTCHA_FORCE_LANG'));
|
||||
Configuration::updateValue('CAPTCHA_THEME', (int) Tools::getValue('CAPTCHA_THEME'));
|
||||
Configuration::updateValue('CAPTCHA_DEBUG', (int) Tools::getValue('CAPTCHA_DEBUG'));
|
||||
|
||||
return $this->module->displayConfirmation($this->l('Settings updated'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config values to hydrate the helperForm
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return [
|
||||
'CAPTCHA_VERSION' => Tools::getValue('CAPTCHA_VERSION', Configuration::get('CAPTCHA_VERSION')),
|
||||
'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_ENABLE_NEWSLETTER' => Tools::getValue('CAPTCHA_ENABLE_NEWSLETTER', Configuration::get('CAPTCHA_ENABLE_NEWSLETTER')),
|
||||
'CAPTCHA_FORCE_LANG' => Tools::getValue('CAPTCHA_FORCE_LANG', Configuration::get('CAPTCHA_FORCE_LANG')),
|
||||
'CAPTCHA_THEME' => Tools::getValue('CAPTCHA_THEME', Configuration::get('CAPTCHA_THEME')),
|
||||
'CAPTCHA_DEBUG' => Tools::getValue('CAPTCHA_DEBUG', Configuration::get('CAPTCHA_DEBUG')),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of l function with specific context
|
||||
*
|
||||
* @param string $trans
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function l($trans)
|
||||
{
|
||||
return $this->module->l($trans, 'configform');
|
||||
}
|
||||
}
|
||||
299
modules/eicaptcha/src/Debugger.php
Normal file
299
modules/eicaptcha/src/Debugger.php
Normal file
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2021 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.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2021 Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
namespace Eicaptcha\Module;
|
||||
|
||||
use Configuration;
|
||||
use EiCaptcha;
|
||||
use Module;
|
||||
|
||||
class Debugger
|
||||
{
|
||||
/**
|
||||
* @var EiCaptcha
|
||||
*/
|
||||
private $module;
|
||||
|
||||
/**
|
||||
* Installer constructor.
|
||||
*
|
||||
* @param EiCaptcha $module
|
||||
*/
|
||||
public function __construct(EiCaptcha $module)
|
||||
{
|
||||
$this->module = $module;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if needed composer directory is present
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function checkComposer()
|
||||
{
|
||||
if (!is_dir(_PS_MODULE_DIR_ . $this->module->name . '/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->module->displayError(
|
||||
sprintf(
|
||||
$errorMessage,
|
||||
_PS_MODULE_DIR_ . $this->module->name,
|
||||
'https://github.com/nenes25/eicaptcha/releases'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if debug mode is enabled
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDebugEnabled()
|
||||
{
|
||||
return (bool) Configuration::get('CAPTCHA_DEBUG');
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug module installation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function debugModuleInstall()
|
||||
{
|
||||
$errors = [];
|
||||
$success = [];
|
||||
|
||||
$modulesChecks = $this->checkModules();
|
||||
$hookChecks = $this->checkModuleHooks();
|
||||
$overridesChecks = $this->checkOverrides();
|
||||
$newsletterChecks = $this->checkNewsletter();
|
||||
|
||||
$errors = array_merge(
|
||||
$errors,
|
||||
$modulesChecks['errors'],
|
||||
$hookChecks['errors'],
|
||||
$overridesChecks['errors'],
|
||||
$newsletterChecks['errors']
|
||||
);
|
||||
|
||||
$success = array_merge(
|
||||
$success,
|
||||
$modulesChecks['success'],
|
||||
$hookChecks['success'],
|
||||
$overridesChecks['success'],
|
||||
$newsletterChecks['success']
|
||||
);
|
||||
|
||||
$this->module->getContext()->smarty->assign([
|
||||
'errors' => $errors,
|
||||
'success' => $success,
|
||||
'recaptchaVersion' => Configuration::get('CAPTCHA_VERSION'),
|
||||
'prestashopVersion' => _PS_VERSION_,
|
||||
'themeName' => _THEME_NAME_,
|
||||
'phpVersion' => phpversion(),
|
||||
]);
|
||||
|
||||
return $this->module->fetch('module:eicaptcha/views/templates/admin/debug.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check modules necessary for the module to work
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function checkModules()
|
||||
{
|
||||
$errors = $success = [];
|
||||
//Check if module version is compatible with current PS version
|
||||
if (!$this->module->checkCompliancy()) {
|
||||
$errors[] = $this->l('the module is not compatible with your version');
|
||||
} else {
|
||||
$success[] = $this->l('the module is compatible with your version');
|
||||
}
|
||||
|
||||
//Check if module contactform is installed
|
||||
if (!Module::isInstalled('contactform')) {
|
||||
$errors[] = $this->l('the module contatcform is not installed');
|
||||
} else {
|
||||
$success[] = $this->l('the module contactform is installed');
|
||||
}
|
||||
|
||||
return [
|
||||
'errors' => $errors,
|
||||
'success' => $success,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module is well hooked on all necessary hooks
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function checkModuleHooks()
|
||||
{
|
||||
$errors = $success = [];
|
||||
$modulesHooks = [
|
||||
'header',
|
||||
'displayCustomerAccountForm',
|
||||
'actionContactFormSubmitCaptcha',
|
||||
'actionContactFormSubmitBefore',
|
||||
];
|
||||
foreach ($modulesHooks as $hook) {
|
||||
if (!$this->module->isRegisteredInHook($hook)) {
|
||||
$errors[] = sprintf(
|
||||
$this->l('the module is not registered in hook %s'),
|
||||
'<strong>' . $hook . '</strong>'
|
||||
);
|
||||
} else {
|
||||
$success[] = sprintf(
|
||||
$this->l('the module well registered in hook %s'),
|
||||
'<strong>' . $hook . '</strong>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'errors' => $errors,
|
||||
'success' => $success,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that all overrides behaviors are good
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function checkOverrides()
|
||||
{
|
||||
$errors = $success = [];
|
||||
|
||||
//Check if override are disabled in configuration
|
||||
if (Configuration::get('PS_DISABLE_OVERRIDES') == 1) {
|
||||
$errors[] = $this->l('Overrides are disabled on your website');
|
||||
} else {
|
||||
$success[] = $this->l('Overrides are enabled on your website');
|
||||
}
|
||||
|
||||
//Check if file overrides exists
|
||||
if (!file_exists(_PS_OVERRIDE_DIR_ . 'controllers/front/AuthController.php')) {
|
||||
$errors[] = $this->l('AuthController.php override does not exists');
|
||||
} else {
|
||||
$success[] = $this->l('AuthController.php override exists');
|
||||
}
|
||||
|
||||
if (!file_exists(_PS_OVERRIDE_DIR_ . 'modules/contactform/contactform.php')) {
|
||||
$errors[] = $this->l('contactform.php override does not exists');
|
||||
} else {
|
||||
$success[] = $this->l('contactform.php override exists');
|
||||
}
|
||||
|
||||
//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['AuthController']['path'] != 'override/controllers/front/AuthController.php') {
|
||||
$errors[] = $this->l('Authcontroller override is not present in class_index.php');
|
||||
} else {
|
||||
$success[] = $this->l('Authcontroller override is present in class_index.php');
|
||||
}
|
||||
} else {
|
||||
$errors[] = $this->l('no class_index.php found');
|
||||
}
|
||||
|
||||
return [
|
||||
'errors' => $errors,
|
||||
'success' => $success,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the newsletter configuration
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function checkNewsletter()
|
||||
{
|
||||
$errors = $success = [];
|
||||
|
||||
//Check if we can display the captcha in the newsletter
|
||||
if (!Module::isInstalled('ps_emailsubscription')) {
|
||||
$errors[] = $this->l('the module ps_emailsubscription is not installed you will not be able to use captcha on newslettter');
|
||||
} else {
|
||||
if ($this->module->canUseCaptchaOnNewsletter()) {
|
||||
$success[] = $this->l('Module ps_emailsubscription version allow to use captcha on newsletter');
|
||||
$newsletterTemplateFile = _PS_THEME_DIR_ . 'modules/ps_emailsubscription/views/templates/hook/ps_emailsubscription.tpl';
|
||||
if (is_file($newsletterTemplateFile)) {
|
||||
$newsletterTemplateContent = file_get_contents($newsletterTemplateFile);
|
||||
if (!preg_match('#displayNewsletterRegistration#', $newsletterTemplateContent)) {
|
||||
$moduleDefaultFile = _PS_MODULE_DIR_ . 'ps_emailsubscription/views/templates/hook/ps_emailsubscription.tpl';
|
||||
$errors[] = sprintf(
|
||||
$this->l(
|
||||
'Missing hook %s in template %s , Please check in original module file to adapt : %s'
|
||||
),
|
||||
'<strong>displayNewsletterRegistration</strong>',
|
||||
'<i>' . $newsletterTemplateFile . '</i>',
|
||||
'<i>' . $moduleDefaultFile . '</i>'
|
||||
);
|
||||
}
|
||||
//@Todo manage multi-shop configuration
|
||||
} else {
|
||||
$errors[] = $this->l('Module ps_emailsubscription version do not allow to use captcha on newsletter');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'errors' => $errors,
|
||||
'success' => $success,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Log debug messages
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function log($message)
|
||||
{
|
||||
if ($this->isDebugEnabled()) {
|
||||
file_put_contents(
|
||||
dirname(__FILE__) . '/logs/debug.log',
|
||||
date('Y-m-d H:i:s') . ': ' . $message . "\n",
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of l function with specific context
|
||||
*
|
||||
* @param string $trans
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function l($trans)
|
||||
{
|
||||
return $this->module->l($trans, 'debugger');
|
||||
}
|
||||
}
|
||||
112
modules/eicaptcha/src/Installer.php
Normal file
112
modules/eicaptcha/src/Installer.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2021 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.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2021 Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
namespace Eicaptcha\Module;
|
||||
|
||||
use Configuration;
|
||||
use EiCaptcha;
|
||||
|
||||
class Installer
|
||||
{
|
||||
/**
|
||||
* @var EiCaptcha
|
||||
*/
|
||||
private $module;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_hooks = [
|
||||
'displayHeader',
|
||||
'displayCustomerAccountForm',
|
||||
'displayNewsletterRegistration',
|
||||
'actionContactFormSubmitCaptcha',
|
||||
'actionContactFormSubmitBefore',
|
||||
'actionNewsletterRegistrationBefore',
|
||||
'actionAdminControllerSetMedia',
|
||||
];
|
||||
|
||||
/**
|
||||
* Installer constructor.
|
||||
*
|
||||
* @param EiCaptcha $module
|
||||
*/
|
||||
public function __construct(EiCaptcha $module)
|
||||
{
|
||||
$this->module = $module;
|
||||
}
|
||||
|
||||
/**
|
||||
* Eicaptcha Installer
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
return $this->installHooks() && $this->installConfigurations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Eicaptcha Uninstaller
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
return $this->uninstallConfigurations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Install Hooks
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function installHooks()
|
||||
{
|
||||
return $this->module->registerHook($this->_hooks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install Configurations
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function installConfigurations()
|
||||
{
|
||||
return Configuration::updateGlobalValue('CAPTCHA_ENABLE_ACCOUNT', 0)
|
||||
&& Configuration::updateValue('CAPTCHA_ENABLE_CONTACT', 0)
|
||||
&& Configuration::updateValue('CAPTCHA_ENABLE_NEWSLETTER', 0)
|
||||
&& Configuration::updateValue('CAPTCHA_THEME', 0)
|
||||
&& Configuration::updateValue('CAPTCHA_DEBUG', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function uninstallConfigurations()
|
||||
{
|
||||
return Configuration::deleteByName('CAPTCHA_ENABLE_ACCOUNT')
|
||||
&& Configuration::deleteByName('CAPTCHA_ENABLE_CONTACT')
|
||||
&& Configuration::deleteByName('CAPTCHA_ENABLE_NEWSLETTER')
|
||||
&& Configuration::deleteByName('CAPTCHA_THEME')
|
||||
&& Configuration::deleteByName('CAPTCHA_DEBUG')
|
||||
&& Configuration::deleteByName('CAPTCHA_VERSION');
|
||||
}
|
||||
}
|
||||
28
modules/eicaptcha/translations/de.php
Normal file
28
modules/eicaptcha/translations/de.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = [];
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = 'Ei Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_76870a3a596aa5fe3b836a20e53c7698'] = 'Ihrer Webseite ein Captcha hinzufügen';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'Einstellungen für das Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c888438d14855d7d96a2724ee9c306bd'] = 'Einstellungen aktualisiert';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_fabff9d49a682feeffead298a9801c2b'] = 'Einstellungen';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_77f682c46c4c98d39cfb703d3606f505'] = 'Um Ihren eigenen Websiteschlüssel und Geheimen Schlüssel zu erzeugen, klicken Sie bitte auf den folgenden Link';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2d6759f60f165404e274683029df8e5b'] = 'Websiteschlüssel ';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_de7e39ae12eb7d5e08c84ff8739ee5fc'] = 'Hier den Websiteschlüssel eingeben';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_532719b9b22c0444d8c65bdc6b80fa1e'] = 'Geheimer Schlüssel';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_30c1139b1b654780ec1ef5c35323806d'] = 'Hier den Geheimen Schlüssel eingeben';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_8734cb06c440a837b751eb664be56f3c'] = 'Captcha im Kontaktformular';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Aktivieren';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_b9f5c797ebbf55adccdd8539a65a0241'] = 'Deaktivieren';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_4d43056cebf6d60747ad8064a941b8cd'] = 'Captcha im Anmeldeformular';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2f298dd749c5c927a272586189aecaa9'] = 'Captcha-Sprache erzwingen';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_50db68af68d07f407b398f20788e6277'] = 'Sprachkürzel (en-GB | fr | de | de-AT | ... ) - frei lassen, um Standardsprache des Templates zu nutzen';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_43ec71bfafdad1482bff90168f80531b'] = 'Mögliche Sprachkürzel finden Sie hier: https://developers.google.com/recaptcha/docs/language';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d721757161f7f70c5b0949fdb6ec2c30'] = 'Erscheinungsbild';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9914a0ce04a7b7b6a8e39bec55064b82'] = 'Hell';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a18366b217ebf811ad1886e4f4f865b2'] = 'Dunkel';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c9cc8cce247e49bae79f15173ce97354'] = 'Speichern';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Bitte bestätigen Sie die Sicherheits-Abfrage';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2422cb22995f528cda5e7d40750c2a55'] = 'Ihre Eingabe wird geprüft ....';
|
||||
$_MODULE['<{eicaptcha}prestashop>hookdisplaycustomeraccountform_45d048c35e3cfd449dc0a1b503cd103a'] = 'Sicherheits-Abfrage';
|
||||
44
modules/eicaptcha/translations/es.php
Normal file
44
modules/eicaptcha/translations/es.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = [];
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = 'EiCaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_76870a3a596aa5fe3b836a20e53c7698'] = 'Añadir Captcha al formulario de registro y de contacto';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'El modo Captcha debe estar configurado';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c888438d14855d7d96a2724ee9c306bd'] = 'Configuración actualizada';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_fabff9d49a682feeffead298a9801c2b'] = 'Configuración EiCaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d2126da975d5b9a5b846efaf57d3fd53'] = 'Configuración general';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a88fa0f6033212151410a58809337c83'] = 'Parámetros avanzados';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_77f682c46c4c98d39cfb703d3606f505'] = 'Para obtener tus propias claves por favor haz click en el siguiente enlace';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2d6759f60f165404e274683029df8e5b'] = 'Clave del sitio';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_de7e39ae12eb7d5e08c84ff8739ee5fc'] = 'Ingrese la clave del sitio';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_532719b9b22c0444d8c65bdc6b80fa1e'] = 'Clave secreta';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_30c1139b1b654780ec1ef5c35323806d'] = 'Ingrese la clave secreta';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_8734cb06c440a837b751eb664be56f3c'] = 'Activar para el formulario de contacto';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activado';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_b9f5c797ebbf55adccdd8539a65a0241'] = 'Desactivado';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_4d43056cebf6d60747ad8064a941b8cd'] = 'Activar para el formulario de registro';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_91af46abe7415b52ee694911d67d5dca'] = 'Activar el captcha para suscribirse al boletín de noticias';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c3919af9a1f91206ed9142b26d0a98ce'] = 'Disponible sólo en ciertas condiciones (utilice la verificación de instalación del módulo para verificar)';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2f298dd749c5c927a272586189aecaa9'] = 'Forzar el idioma';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_10f6ad136e375a00eff3356bb4caa692'] = 'Código de idioma ( en-GB | fr | de | de-AT | ... ) - dejar en blanco para la detección automática';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_43ec71bfafdad1482bff90168f80531b'] = 'Para la lista de códigos de idioma disponibles consultar la página : https://developers.google.com/recaptcha/docs/language';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d721757161f7f70c5b0949fdb6ec2c30'] = 'Tema';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9914a0ce04a7b7b6a8e39bec55064b82'] = 'Claro';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a18366b217ebf811ad1886e4f4f865b2'] = 'Oscuro';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_8819c44e0c4c2f8e4a78d88f8f98de20'] = 'Activar modo depuración';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_8477ce97d6ad94af8e8d6adb6bde19ae'] = 'Utilizar temporalmente sólo para depurar';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_1d0820fdba3c2a97b772aaabaedadf3e'] = 'Activar registro de depuración del módulo, ver archivo %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c4e00009bc799091d7a05f34537f721e'] = 'Verificar la instalación del módulo';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_697a883b69deceeae91ca157b17cbb09'] = 'Verificar si el módulo está bien instalado';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_935300aa46a1fb0c2f1ae2d444608232'] = 'Al hacer click en este enlace se volverá a cargar la página. Debe volver a la pestaña \"Parámetros avanzado\" para ver los resultados';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Validar el captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9ed81dbbae814f9a81cd15927ebd4795'] = 'Respuesta de recaptcha %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_e8a0559d823da2ac04358b8bf1a1dbd1'] = 'Captcha enviado con éxito';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_01447f1863a21f8171b5894cc3e535ac'] = 'Este módulo require que composer funcione correctamente, por favor vaya a la carpeta %s y ejecute el comando \"composer install\" o descargue la última versión de la página %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_5ef0c737746fae2ca90e66c39333f8f6'] = 'Errores';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_505a83f220c02df2f85c3810cd9ceb38'] = 'Éxito';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9b2eeb745a9b009017a8bb78e4801988'] = 'Información adicional';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_5cbde05e64ba2a302aab794031c5b33c'] = 'Abrir un ticket';
|
||||
$_MODULE['<{eicaptcha}prestashop>hookdisplaycustomeraccountform_45d048c35e3cfd449dc0a1b503cd103a'] = 'Captcha';
|
||||
70
modules/eicaptcha/translations/fr.php
Normal file
70
modules/eicaptcha/translations/fr.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = 'EiCaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_76870a3a596aa5fe3b836a20e53c7698'] = 'Ajout de Captcha sur le formulaire de contact et de création de compte';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'Le mode Captcha doit être configuré';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Merci de valider le captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9ed81dbbae814f9a81cd15927ebd4795'] = 'Réponse recaptcha %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_e8a0559d823da2ac04358b8bf1a1dbd1'] = 'Captcha soumis avec succès';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_01447f1863a21f8171b5894cc3e535ac'] = 'Ce module nécessite composer pour fonctionner, merci de vous rendre dans le dossier %s, et de lancer la commande \"composer install\" ou de télécharger la dernière release sur github';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_35d70791f9c315b2bd646de3464b1686'] = 'Le module n\'est pas compatible avec votre version de Prestashop';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7c7c88b27ea59a8fa740a9072d6094a7'] = 'Le module est compatible avec votre version de Prestashop';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_5a7a671d4976d51a192404f8aca116a4'] = 'Le module \"contactform\" n\'est pas installé';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_845db42155fb067452dc6b9e1a06bb80'] = 'Le module \"contactform\" est installé';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_36a0fea9249f5769689e081937155acf'] = 'Le module n\'est pas greffé sur le hook %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_be42d963c50b3279ba39b3261f20bb05'] = 'Le module est bien greffé sur le hook %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_cbf027d328af7a2ceb1ba6bf2707cb9e'] = 'Les surcharges sont désactivées sur votre site';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_940113e97ec1a28269e7d0387cc445d7'] = 'Les surcharges sont activées sur le site';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_52451343272db0b9997e5403912c834e'] = 'La surcharge du fichier AuthController.php n\'existe pas';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_82644a70f651a216e90d7c68f8db8255'] = 'La surcharge du fichier AuthController.php existe';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7765d610aeeff20a6663efcf583377d3'] = 'La surcharge du fichier contactform.php n\'existe pas';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_2a567e126a94f22688e58efbdfe0e8fd'] = 'La surcharge du fichier contactform.php existe';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_ef1a72aa4c1e731504936f3f0a6afe12'] = 'La surcharge du fichier Authcontroller n\'est pas présente dans le fichier class_index.php';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_5459dfe8c7ad16b73f4c1b6b50fc863f'] = 'La surcharge du fichier Authcontroller est présente dans le fichier class_index.php';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_979b59c764d8f68c22c1bb3475a900c7'] = 'Pas de fichier class_index.php trouvé';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_33ae92d2d7db697f973c0989112b6407'] = 'Le module ps_emailsubscription n\'est pas installé, vous ne pourrez pas utiliser le captcha sur la newsletter';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7af0d92d3e354e234063edda127470be'] = 'La version du module ps_emailsubscription vous permets d\'utiliser le captcha sur la newsletter';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7f23d4054a5061b22541b424afedd341'] = 'Le hook %s est manquant dans le template %s, merci de regarder le fichier original pour adapter : %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_d67c59bfd472277a56f1423766b99929'] = 'La version du module ps_emailsubscription ne vous permets pas d\'utiliser le captcha sur la newsletter';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_fabff9d49a682feeffead298a9801c2b'] = 'Configuration EiCaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_d2126da975d5b9a5b846efaf57d3fd53'] = 'Configuration générale';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_a88fa0f6033212151410a58809337c83'] = 'Paramètres avancés';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_77f682c46c4c98d39cfb703d3606f505'] = 'Pour récupérer vos propres clés, merci de cliquer sur le lien suivant';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c25456954fac1e3669128249766ef488'] = 'Version de Recaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_ec765f1adc3b4253f2d3b131a4a8618f'] = 'V2';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_d5b50b8cf96bcc8aba90f306f5e6189c'] = 'V3';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_2d6759f60f165404e274683029df8e5b'] = 'Clé de site';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_de7e39ae12eb7d5e08c84ff8739ee5fc'] = 'Merci de saisir la clé de site';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_532719b9b22c0444d8c65bdc6b80fa1e'] = 'Clé secrète';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_30c1139b1b654780ec1ef5c35323806d'] = 'Merci de saisir la clé secrète';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_8734cb06c440a837b751eb664be56f3c'] = 'Activer pour le formulaire de contact';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_b9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_4d43056cebf6d60747ad8064a941b8cd'] = 'Activer pour la création de compte';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_91af46abe7415b52ee694911d67d5dca'] = 'Activer le captcha sur l\'inscription à la newsletter';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c3919af9a1f91206ed9142b26d0a98ce'] = 'Disponible uniquement dans certaines condition ( utiliser la vérification de l\'installation du module pour vérifier )';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_2f298dd749c5c927a272586189aecaa9'] = 'Forcer la langue';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_10f6ad136e375a00eff3356bb4caa692'] = 'Code langue ( en-GB | fr | de | de-AT | ... ) - laisser vide pour détection automatique';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_43ec71bfafdad1482bff90168f80531b'] = 'Pour voir la liste des codes langues disponibles consulter la page : https://developers.google.com/recaptcha/docs/language';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_d721757161f7f70c5b0949fdb6ec2c30'] = 'Thème';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_9914a0ce04a7b7b6a8e39bec55064b82'] = 'Sombre';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_a18366b217ebf811ad1886e4f4f865b2'] = 'Clair';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_8819c44e0c4c2f8e4a78d88f8f98de20'] = 'Activer le debug';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_8477ce97d6ad94af8e8d6adb6bde19ae'] = 'Utiliser seulement temporairement pour débuguer';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_1d0820fdba3c2a97b772aaabaedadf3e'] = 'Active des logs de debug pour le module, voir dans le fichier %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c4e00009bc799091d7a05f34537f721e'] = 'Vérifier l\'installation du module';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_697a883b69deceeae91ca157b17cbb09'] = 'Vérifier si le module est bien installé';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_935300aa46a1fb0c2f1ae2d444608232'] = 'Cliquer sur ce lien va recharger la page, merci de vos rendre à nouveau dans l\'onglet \"Paramètres avancés\" pour voir les résultats';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c9cc8cce247e49bae79f15173ce97354'] = 'Sauvegarder';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c888438d14855d7d96a2724ee9c306bd'] = 'Paramètres mis à jour';
|
||||
$_MODULE['<{eicaptcha}prestashop>hookdisplaycustomeraccountform_45d048c35e3cfd449dc0a1b503cd103a'] = 'Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_5ef0c737746fae2ca90e66c39333f8f6'] = 'Erreurs';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_505a83f220c02df2f85c3810cd9ceb38'] = 'Succès';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_0f68b904e33d9ac04605aecc958bcf52'] = 'Informations complémentaires';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_0946072de61114cd760b7c508325e682'] = 'Version de recaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_2a43f8406eb6c10f3f76a60f064e67fb'] = 'Version de prestashop';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_d0594793a76c7e694f6bf7d4fea06a99'] = 'Nom du thème';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_9c11060e38fa7c35dc6dc79227b806cc'] = 'Version de php';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_735bde6ec7834d6376ee4d876de4119f'] = 'En cas d\'erreur, merci d\'ouvrir une demande avec les informations demandée à l\'adresse ';
|
||||
36
modules/eicaptcha/translations/it.php
Normal file
36
modules/eicaptcha/translations/it.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = [];
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = 'Ei Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_76870a3a596aa5fe3b836a20e53c7698'] = 'Aggiungi un captcha al tuo web form';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'Il modulo Captcha deve essere configurato';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c888438d14855d7d96a2724ee9c306bd'] = 'Configurazione aggiornata';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_fabff9d49a682feeffead298a9801c2b'] = 'Configurazione di Eicaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d2126da975d5b9a5b846efaf57d3fd53'] = 'Configurazione generale';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a88fa0f6033212151410a58809337c83'] = 'Parametri avanzati';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_77f682c46c4c98d39cfb703d3606f505'] = 'Click sul seguente link per ottenere le tue chiavi (pubblica e privata)';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2d6759f60f165404e274683029df8e5b'] = 'Captcha chiave pubblica (Chiave del sito)';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_de7e39ae12eb7d5e08c84ff8739ee5fc'] = 'Per favore inserisci la chiave pubblica';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_532719b9b22c0444d8c65bdc6b80fa1e'] = 'Captcha chiave privata (Chiave segreta)';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_30c1139b1b654780ec1ef5c35323806d'] = 'Per favore inserisci la chiave privata';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_8734cb06c440a837b751eb664be56f3c'] = 'Abilita Captcha per il form contatti';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Abilitato';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_b9f5c797ebbf55adccdd8539a65a0241'] = 'Disabilitato';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_4d43056cebf6d60747ad8064a941b8cd'] = 'Abilità Captcha per la creazione dell\'account';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2f298dd749c5c927a272586189aecaa9'] = 'Forza il linguaggio per Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_50db68af68d07f407b398f20788e6277'] = 'Codice lingua ( en-GB | fr | de | de-AT | ... ) - Lascia vuoto se il cliente seglie da se la lingua preferita.';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_43ec71bfafdad1482bff90168f80531b'] = 'Per i codici di lingua disponibili guarda al seguente link: https://developers.google.com/recaptcha/docs/language';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d721757161f7f70c5b0949fdb6ec2c30'] = 'Tema';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9914a0ce04a7b7b6a8e39bec55064b82'] = 'Light';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a18366b217ebf811ad1886e4f4f865b2'] = 'Dark';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a7c24565aa1c5b1d6591a3c55f27782b'] = 'Usa con cautela, parametri invalidi possono creare malfunzionamenti del modulo';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_53fd91f30b2ebe9feaeca2c114671c07'] = 'Usa con cautela, parametri invalidi possono creare malfunzionamenti del modulo';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_98cb786afc3502f43a2f156ade6a5167'] = 'Per specifici temi puoi modificare il file css per il bottone di conferma';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c4e00009bc799091d7a05f34537f721e'] = 'Controlla l\'installazione del modulo';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_697a883b69deceeae91ca157b17cbb09'] = 'Controlla se il modulo è ben installato';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_935300aa46a1fb0c2f1ae2d444608232'] = 'Click su questo link per ricaricare la pagina, per favore ancora nella pagina \"parametri avanzati\" per vedere il risultato';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c9cc8cce247e49bae79f15173ce97354'] = 'Salva';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Per favore convalida il campo reCaptcha prima di inviare la richiesta per dimostrare che non sei un robot';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2422cb22995f528cda5e7d40750c2a55'] = 'Per favore attendi durante il controllo';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_01447f1863a21f8171b5894cc3e535ac'] = 'This module need composer to work, please go into module directory %s and run composer install or dowload and install latest release from %s';
|
||||
70
modules/eicaptcha/translations/pl.php
Normal file
70
modules/eicaptcha/translations/pl.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = 'Ei Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_76870a3a596aa5fe3b836a20e53c7698'] = 'Dodaj Captcha do formularza na stronie';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'Konfiguracja Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Proszę zaznaczyć pole Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9ed81dbbae814f9a81cd15927ebd4795'] = 'Odpowiedz Recaptcha %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_e8a0559d823da2ac04358b8bf1a1dbd1'] = 'Captcha przesłano pomyślnie';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_5ef0c737746fae2ca90e66c39333f8f6'] = 'Błędy';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_505a83f220c02df2f85c3810cd9ceb38'] = 'Powodzenie';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_0f68b904e33d9ac04605aecc958bcf52'] = 'Dodatkowe informacje';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_0946072de61114cd760b7c508325e682'] = 'Wersja Recaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_2a43f8406eb6c10f3f76a60f064e67fb'] = 'Wersja Prestashop';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_d0594793a76c7e694f6bf7d4fea06a99'] = 'Nazwa motywu';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_9c11060e38fa7c35dc6dc79227b806cc'] = 'Wersja Php';
|
||||
$_MODULE['<{eicaptcha}prestashop>debug_735bde6ec7834d6376ee4d876de4119f'] = 'W przypadku problemu otwórz zgłoszenie z żądanymi informacjami na temat';
|
||||
$_MODULE['<{eicaptcha}prestashop>hookdisplaycustomeraccountform_45d048c35e3cfd449dc0a1b503cd103a'] = 'Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_01447f1863a21f8171b5894cc3e535ac'] = 'Ten moduł wymaga composera do pracy, przejdź do katalogu modułów %s i uruchom instalację composera lub pobierz i zainstaluj najnowszą wersję z %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_35d70791f9c315b2bd646de3464b1686'] = 'moduł nie jest kompatybilny z twoją wersją';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7c7c88b27ea59a8fa740a9072d6094a7'] = 'moduł jest kompatybilny z twoją wersją';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_5a7a671d4976d51a192404f8aca116a4'] = 'moduł contactform nie jest zainstalowany';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_845db42155fb067452dc6b9e1a06bb80'] = 'modułu contactform jest zainstalowany';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_36a0fea9249f5769689e081937155acf'] = 'moduł nie jest zarejestrowany w kotwicach %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_be42d963c50b3279ba39b3261f20bb05'] = 'moduł dobrze zarejestrowany w kotwicach %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_cbf027d328af7a2ceb1ba6bf2707cb9e'] = 'Zastąpienia są wyłączone w Twojej witrynie';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_940113e97ec1a28269e7d0387cc445d7'] = 'Zastąpienia są włączone w Twojej witrynie';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_52451343272db0b9997e5403912c834e'] = 'Nadpisanie AuthController.php nie istnieje';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_82644a70f651a216e90d7c68f8db8255'] = 'Nadpisanie AuthController.php istnieje';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7765d610aeeff20a6663efcf583377d3'] = 'Nadpisanie contactform.php nie istnieje';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_2a567e126a94f22688e58efbdfe0e8fd'] = 'Nadpisanie contactform.php istnieje';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_ef1a72aa4c1e731504936f3f0a6afe12'] = 'Nadpisanie kontrolera autoryzacji nie jest obecne w class_index.php';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_5459dfe8c7ad16b73f4c1b6b50fc863f'] = 'Nadpisanie kontrolera autoryzacji jest obecne w class_index.php';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_979b59c764d8f68c22c1bb3475a900c7'] = 'nie znaleziono class_index.php';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_33ae92d2d7db697f973c0989112b6407'] = 'moduł ps_emailsubscription nie jest zainstalowany, nie będziesz mógł używać captcha w newsletterze';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7af0d92d3e354e234063edda127470be'] = 'Wersja modułu ps_emailsubskrypcja pozwala na używanie captcha w newsletterze';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_7f23d4054a5061b22541b424afedd341'] = 'Brakująca kotwica %s w szablonie %s , Proszę sprawdzić oryginalny plik modułu w celu dostosowania : %s';
|
||||
$_MODULE['<{eicaptcha}prestashop>debugger_d67c59bfd472277a56f1423766b99929'] = 'Wersja modułu ps_emailsubskrypcja nie pozwala na używanie captcha w newsletterze';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_fabff9d49a682feeffead298a9801c2b'] = 'Konfiguracja Eicaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_d2126da975d5b9a5b846efaf57d3fd53'] = 'Ogólna konfiguracja';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_a88fa0f6033212151410a58809337c83'] = 'Zaawansowane parametry';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_77f682c46c4c98d39cfb703d3606f505'] = 'Aby uzyskać własne klucze publiczne i prywatne, kliknij poniższy link';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c25456954fac1e3669128249766ef488'] = 'Wersja Recaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_ec765f1adc3b4253f2d3b131a4a8618f'] = 'V2';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_d5b50b8cf96bcc8aba90f306f5e6189c'] = 'V3';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_2d6759f60f165404e274683029df8e5b'] = 'Klucz publiczny Captcha (klucz witryny)';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_de7e39ae12eb7d5e08c84ff8739ee5fc'] = 'Proszę wypełnić klucz publiczny captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_532719b9b22c0444d8c65bdc6b80fa1e'] = 'Klucz prywatny Captcha (klucz tajny)';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_30c1139b1b654780ec1ef5c35323806d'] = 'Proszę wypełnić klucz prywatny captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_8734cb06c440a837b751eb664be56f3c'] = 'Włącz Captcha dla formularza kontaktowego';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Włączona';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_b9f5c797ebbf55adccdd8539a65a0241'] = 'Wyłączona';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_4d43056cebf6d60747ad8064a941b8cd'] = 'Włącz Captcha podczas tworzenia konta';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_91af46abe7415b52ee694911d67d5dca'] = 'Włącz Captcha podczas rejestracji newslettera';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c3919af9a1f91206ed9142b26d0a98ce'] = 'Dostępne tylko w określonych warunkach*';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_2f298dd749c5c927a272586189aecaa9'] = 'Wymuś język Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_10f6ad136e375a00eff3356bb4caa692'] = 'Kod języka ( en-GB | fr | de | de-AT | ... ) - pozostaw puste dla automatycznego wykrywania';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_43ec71bfafdad1482bff90168f80531b'] = 'Dostępne kody języków znajdziesz na: https://developers.google.com/recaptcha/docs/language';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_d721757161f7f70c5b0949fdb6ec2c30'] = 'Motyw';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_9914a0ce04a7b7b6a8e39bec55064b82'] = 'Jasny';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_a18366b217ebf811ad1886e4f4f865b2'] = 'Ciemny';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_8819c44e0c4c2f8e4a78d88f8f98de20'] = 'Włącz debugowanie';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_8477ce97d6ad94af8e8d6adb6bde19ae'] = 'Używaj tylko do debugowania';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_1d0820fdba3c2a97b772aaabaedadf3e'] = 'Włącz rejestrowanie modułu debugowania, zobacz pliki';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c4e00009bc799091d7a05f34537f721e'] = 'Sprawdź instalację modułu';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_697a883b69deceeae91ca157b17cbb09'] = 'Sprawdź, czy moduł jest dobrze zainstalowany';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_935300aa46a1fb0c2f1ae2d444608232'] = 'kliknięcie tego linku spowoduje ponowne załadowanie strony, przejdź ponownie do zakładki „parametry zaawansowane”, aby zobaczyć wyniki';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c9cc8cce247e49bae79f15173ce97354'] = 'Zapisz';
|
||||
$_MODULE['<{eicaptcha}prestashop>configform_c888438d14855d7d96a2724ee9c306bd'] = 'Ustawienia zaktualizowane';
|
||||
28
modules/eicaptcha/translations/ro.php
Normal file
28
modules/eicaptcha/translations/ro.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = [];
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = 'Ei Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_76870a3a596aa5fe3b836a20e53c7698'] = 'Adauga un camp de validare Captcha in formularele site-ului tau';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'Modulul EiCaptcha necesita configurare';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c888438d14855d7d96a2724ee9c306bd'] = 'Setarile au fost actualizate';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_fabff9d49a682feeffead298a9801c2b'] = 'Configurare Eicaptcha ';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_77f682c46c4c98d39cfb703d3606f505'] = 'Pentru a obtine propriile tale chei da click pe link-ul de mai jos:';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2d6759f60f165404e274683029df8e5b'] = 'Cheia Captcha publica (Site key)';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_de7e39ae12eb7d5e08c84ff8739ee5fc'] = 'Completeaza cheia publica';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_532719b9b22c0444d8c65bdc6b80fa1e'] = 'Cheia Captcha privata (Secret key)';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_30c1139b1b654780ec1ef5c35323806d'] = 'Completeaza cheia privata';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_8734cb06c440a837b751eb664be56f3c'] = 'Formularul \"Contacteaza-ne\"';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activat';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_b9f5c797ebbf55adccdd8539a65a0241'] = 'Dezactivat';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_4d43056cebf6d60747ad8064a941b8cd'] = 'Formularul de creare cont';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2f298dd749c5c927a272586189aecaa9'] = 'Forteaza limba panoului Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_50db68af68d07f407b398f20788e6277'] = 'Codul limbi (en-GB | fr | de | de-AT | ... ) - Lasati necompletat pentru a folosi limba selectata de clienti in FO.';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_43ec71bfafdad1482bff90168f80531b'] = 'Pentru limbile disponibile accesati: https://developers.google.com/recaptcha/docs/language';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d721757161f7f70c5b0949fdb6ec2c30'] = 'Tema';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9914a0ce04a7b7b6a8e39bec55064b82'] = 'Luminoasa';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a18366b217ebf811ad1886e4f4f865b2'] = 'Intunecata';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c9cc8cce247e49bae79f15173ce97354'] = 'Salveaza';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Inainte de a trimite formularul trebuie sa confirmati campul de Validare Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2422cb22995f528cda5e7d40750c2a55'] = 'Te rugam sa astepti validarea';
|
||||
$_MODULE['<{eicaptcha}prestashop>hookdisplaycustomeraccountform_45d048c35e3cfd449dc0a1b503cd103a'] = 'Validare Captcha';
|
||||
35
modules/eicaptcha/upgrade/index.php
Normal file
35
modules/eicaptcha/upgrade/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
38
modules/eicaptcha/upgrade/upgrade-2.1.0.php
Normal file
38
modules/eicaptcha/upgrade/upgrade-2.1.0.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2021 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.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2021 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update module in version 0.2.1
|
||||
*
|
||||
* @param EiCaptcha $module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_2_1_0($module)
|
||||
{
|
||||
return $module->registerHook([
|
||||
'displayNewsletterRegistration',
|
||||
'actionNewsletterRegistrationBefore',
|
||||
'actionAdminControllerSetMedia',
|
||||
]);
|
||||
}
|
||||
35
modules/eicaptcha/upgrade/upgrade-2.3.0.php
Normal file
35
modules/eicaptcha/upgrade/upgrade-2.3.0.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2021 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.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2021 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update module in version 2.3.0
|
||||
*
|
||||
* @param EiCaptcha $module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_2_3_0($module)
|
||||
{
|
||||
//Intialialize a configuration with recaptcha v2 ( as key was not existing and v3 was not implemented before )
|
||||
return Configuration::updateGlobalValue('CAPTCHA_VERSION', 2);
|
||||
}
|
||||
10
modules/eicaptcha/vendor/.htaccess
vendored
Normal file
10
modules/eicaptcha/vendor/.htaccess
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# Apache 2.2
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</IfModule>
|
||||
|
||||
# Apache 2.4
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
7
modules/eicaptcha/vendor/autoload.php
vendored
Normal file
7
modules/eicaptcha/vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit4a050d2b2f6ae74c2ba00e4fa474c3f6::getLoader();
|
||||
445
modules/eicaptcha/vendor/composer/ClassLoader.php
vendored
Normal file
445
modules/eicaptcha/vendor/composer/ClassLoader.php
vendored
Normal file
@@ -0,0 +1,445 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see http://www.php-fig.org/psr/psr-0/
|
||||
* @see http://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
||||
21
modules/eicaptcha/vendor/composer/LICENSE
vendored
Normal file
21
modules/eicaptcha/vendor/composer/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
9
modules/eicaptcha/vendor/composer/autoload_classmap.php
vendored
Normal file
9
modules/eicaptcha/vendor/composer/autoload_classmap.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
9
modules/eicaptcha/vendor/composer/autoload_namespaces.php
vendored
Normal file
9
modules/eicaptcha/vendor/composer/autoload_namespaces.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
11
modules/eicaptcha/vendor/composer/autoload_psr4.php
vendored
Normal file
11
modules/eicaptcha/vendor/composer/autoload_psr4.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'ReCaptcha\\' => array($vendorDir . '/google/recaptcha/src/ReCaptcha'),
|
||||
'Eicaptcha\\Module\\' => array($baseDir . '/src'),
|
||||
);
|
||||
55
modules/eicaptcha/vendor/composer/autoload_real.php
vendored
Normal file
55
modules/eicaptcha/vendor/composer/autoload_real.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit4a050d2b2f6ae74c2ba00e4fa474c3f6
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit4a050d2b2f6ae74c2ba00e4fa474c3f6', 'loadClassLoader'), true, false);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit4a050d2b2f6ae74c2ba00e4fa474c3f6', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit4a050d2b2f6ae74c2ba00e4fa474c3f6::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(false);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
39
modules/eicaptcha/vendor/composer/autoload_static.php
vendored
Normal file
39
modules/eicaptcha/vendor/composer/autoload_static.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit4a050d2b2f6ae74c2ba00e4fa474c3f6
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'R' =>
|
||||
array (
|
||||
'ReCaptcha\\' => 10,
|
||||
),
|
||||
'E' =>
|
||||
array (
|
||||
'Eicaptcha\\Module\\' => 17,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'ReCaptcha\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha',
|
||||
),
|
||||
'Eicaptcha\\Module\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/src',
|
||||
),
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit4a050d2b2f6ae74c2ba00e4fa474c3f6::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit4a050d2b2f6ae74c2ba00e4fa474c3f6::$prefixDirsPsr4;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
51
modules/eicaptcha/vendor/composer/installed.json
vendored
Normal file
51
modules/eicaptcha/vendor/composer/installed.json
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
[
|
||||
{
|
||||
"name": "google/recaptcha",
|
||||
"version": "1.2.4",
|
||||
"version_normalized": "1.2.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/google/recaptcha.git",
|
||||
"reference": "614f25a9038be4f3f2da7cbfd778dc5b357d2419"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/google/recaptcha/zipball/614f25a9038be4f3f2da7cbfd778dc5b357d2419",
|
||||
"reference": "614f25a9038be4f3f2da7cbfd778dc5b357d2419",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.2.20|^2.15",
|
||||
"php-coveralls/php-coveralls": "^2.1",
|
||||
"phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11"
|
||||
},
|
||||
"time": "2020-03-31T17:50:54+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ReCaptcha\\": "src/ReCaptcha"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.",
|
||||
"homepage": "https://www.google.com/recaptcha/",
|
||||
"keywords": [
|
||||
"Abuse",
|
||||
"captcha",
|
||||
"recaptcha",
|
||||
"spam"
|
||||
]
|
||||
}
|
||||
]
|
||||
28
modules/eicaptcha/vendor/google/recaptcha/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
28
modules/eicaptcha/vendor/google/recaptcha/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: PHP client issue
|
||||
about: Report an issue with the PHP client library
|
||||
|
||||
---
|
||||
|
||||
**Issue description**
|
||||
<!-- One or two sentences describing the problem -->
|
||||
|
||||
**Environment**
|
||||
<!-- The server or development environment where you're seeing the problem -->
|
||||
|
||||
* OS name and version:
|
||||
* PHP version:
|
||||
* Web server name and version:
|
||||
* `google/recaptcha` version:
|
||||
* Browser name and version:
|
||||
|
||||
**Reproducing the issue**
|
||||
<!-- Where possible link to a URL where the problem can be seen or show code that causes it -->
|
||||
|
||||
* URL (optional): <!-- if your integration is already deployed and the issue is visible -->
|
||||
* Code (optional): <!-- share a link to the code you're using or an example in a Gist -->
|
||||
|
||||
***User steps***
|
||||
<!-- Detail the necessary steps to reproduce the issue. Include the output of any error messages. -->
|
||||
|
||||
1. Visit page...
|
||||
7
modules/eicaptcha/vendor/google/recaptcha/.gitignore
vendored
Normal file
7
modules/eicaptcha/vendor/google/recaptcha/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/.php_cs.cache
|
||||
/.phpunit.result.cache
|
||||
/build
|
||||
/composer.lock
|
||||
/examples/config.php
|
||||
/nbproject/private/
|
||||
/vendor/
|
||||
33
modules/eicaptcha/vendor/google/recaptcha/.travis.yml
vendored
Normal file
33
modules/eicaptcha/vendor/google/recaptcha/.travis.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
dist: trusty
|
||||
|
||||
language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- '7.2'
|
||||
- '7.3'
|
||||
|
||||
before_script:
|
||||
- composer install
|
||||
- phpenv version-name | grep ^5.[34] && echo "extension=apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; true
|
||||
- phpenv version-name | grep ^5.[34] && echo "apc.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; true
|
||||
|
||||
script:
|
||||
- mkdir -p build/logs
|
||||
- composer run-script lint
|
||||
- composer run-script test
|
||||
|
||||
after_success:
|
||||
- travis_retry php vendor/bin/php-coveralls
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.composer/cache/files"
|
||||
|
||||
git:
|
||||
depth: 5
|
||||
64
modules/eicaptcha/vendor/google/recaptcha/ARCHITECTURE.md
vendored
Normal file
64
modules/eicaptcha/vendor/google/recaptcha/ARCHITECTURE.md
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Architecture
|
||||
|
||||
The general pattern of usage is to instantiate the `ReCaptcha` class with your
|
||||
secret key, specify any additional validation rules, and then call `verify()`
|
||||
with the reCAPTCHA response and user's IP address. For example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
$resp = $recaptcha->setExpectedHostname('recaptcha-demo.appspot.com')
|
||||
->verify($gRecaptchaResponse, $remoteIp);
|
||||
if ($resp->isSuccess()) {
|
||||
// Verified!
|
||||
} else {
|
||||
$errors = $resp->getErrorCodes();
|
||||
}
|
||||
```
|
||||
|
||||
By default, this will use the
|
||||
[`stream_context_create()`](https://secure.php.net/stream_context_create) and
|
||||
[`file_get_contents()`](https://secure.php.net/file_get_contents) to make a POST
|
||||
request to the reCAPTCHA service. This is handled by the
|
||||
[`RequestMethod\Post`](./src/ReCaptcha/RequestMethod/Post.php) class.
|
||||
|
||||
## Alternate request methods
|
||||
|
||||
You may need to use other methods for making requests in your environment. The
|
||||
[`ReCaptcha`](./src/ReCaptcha/ReCaptcha.php) class allows an optional
|
||||
[`RequestMethod`](./src/ReCaptcha/RequestMethod.php) instance to configure this.
|
||||
For example, if you want to use [cURL](https://secure.php.net/curl) instead you
|
||||
can do this:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\CurlPost());
|
||||
```
|
||||
|
||||
Alternatively, you can also use a [socket](https://secure.php.net/fsockopen):
|
||||
|
||||
```php
|
||||
<?php
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
|
||||
```
|
||||
|
||||
## Adding new request methods
|
||||
|
||||
Create a class that implements the
|
||||
[`RequestMethod`](./src/ReCaptcha/RequestMethod.php) interface. The convention
|
||||
is to name this class `RequestMethod\`_MethodType_`Post` and create a separate
|
||||
`RequestMethod\`_MethodType_ class that wraps just the calls to the network
|
||||
calls themselves. This means that the `RequestMethod\`_MethodType_`Post` can be
|
||||
unit tested by passing in a mock. Take a look at
|
||||
[`RequestMethod\CurlPost`](./src/ReCaptcha/RequestMethod/CurlPost.php) and
|
||||
[`RequestMethod\Curl`](./src/ReCaptcha/RequestMethod/Curl.php) with the matching
|
||||
[`RequestMethod/CurlPostTest`](./tests/ReCaptcha/RequestMethod/CurlPostTest.php)
|
||||
to see this pattern in action.
|
||||
|
||||
### Error conventions
|
||||
|
||||
The client returns the response as provided by the reCAPTCHA services augmented
|
||||
with additional error codes based on the client's checks. When adding a new
|
||||
[`RequestMethod`](./src/ReCaptcha/RequestMethod.php) ensure that it returns the
|
||||
`ReCaptcha::E_CONNECTION_FAILED` and `ReCaptcha::E_BAD_RESPONSE` where
|
||||
appropriate.
|
||||
49
modules/eicaptcha/vendor/google/recaptcha/CONTRIBUTING.md
vendored
Normal file
49
modules/eicaptcha/vendor/google/recaptcha/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# Contributing
|
||||
|
||||
Want to contribute? Great! First, read this page (including the small print at
|
||||
the end).
|
||||
|
||||
## Contributor License Agreement
|
||||
|
||||
Before we can use your code, you must sign the [Google Individual Contributor
|
||||
License
|
||||
Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
|
||||
(CLA), which you can do online. The CLA is necessary mainly because you own the
|
||||
copyright to your changes, even after your contribution becomes part of our
|
||||
codebase, so we need your permission to use and distribute your code. We also
|
||||
need to be sure of various other things—for instance that you'll tell us if you
|
||||
know that your code infringes on other people's patents. You don't have to sign
|
||||
the CLA until after you've submitted your code for review (a link will be
|
||||
automatically added to your Pull Request) and a member has approved it, but you
|
||||
must do it before we can put your code into our codebase. Before you start
|
||||
working on a larger contribution, you should get in touch with us first through
|
||||
the issue tracker with your idea so that we can help out and possibly guide you.
|
||||
Coordinating up front makes it much easier to avoid frustration later on.
|
||||
|
||||
## Linting and testing
|
||||
|
||||
We use PHP Coding Standards Fixer to maintain coding standards and PHPUnit to
|
||||
run our tests. For convenience, there are Composer scripts to run each of these:
|
||||
|
||||
```sh
|
||||
composer run-script lint
|
||||
composer run-script test
|
||||
```
|
||||
|
||||
These are run automatically by [Travis
|
||||
CI](https://travis-ci.org/google/recaptcha) against your Pull Request, but it's
|
||||
a good idea to run them locally before submission to avoid getting things
|
||||
bounced back. That said, tests can be a little daunting so feel free to submit
|
||||
your PR and ask for help.
|
||||
|
||||
## Code reviews
|
||||
|
||||
All submissions, including submissions by project members, require review.
|
||||
Reviews are conducted on the Pull Requests. The reviews are there to ensure and
|
||||
improve code quality, so treat them like a discussion and opportunity to learn.
|
||||
Don't get disheartened if your Pull Request isn't just automatically approved.
|
||||
|
||||
### The small print
|
||||
|
||||
Contributions made by corporations are covered by a different agreement than the
|
||||
one above, the Software Grant and Corporate Contributor License Agreement.
|
||||
29
modules/eicaptcha/vendor/google/recaptcha/LICENSE
vendored
Normal file
29
modules/eicaptcha/vendor/google/recaptcha/LICENSE
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2019, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
140
modules/eicaptcha/vendor/google/recaptcha/README.md
vendored
Normal file
140
modules/eicaptcha/vendor/google/recaptcha/README.md
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
# reCAPTCHA PHP client library
|
||||
|
||||
[](https://travis-ci.org/google/recaptcha)
|
||||
[](https://coveralls.io/github/google/recaptcha)
|
||||
[](https://packagist.org/packages/google/recaptcha)
|
||||
[](https://packagist.org/packages/google/recaptcha)
|
||||
|
||||
reCAPTCHA is a free CAPTCHA service that protects websites from spam and abuse.
|
||||
This is a PHP library that wraps up the server-side verification step required
|
||||
to process responses from the reCAPTCHA service. This client supports both v2
|
||||
and v3.
|
||||
|
||||
- reCAPTCHA: https://www.google.com/recaptcha
|
||||
- This repo: https://github.com/google/recaptcha
|
||||
- Hosted demo: https://recaptcha-demo.appspot.com/
|
||||
- Version: 1.2.4
|
||||
- License: BSD, see [LICENSE](LICENSE)
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer (recommended)
|
||||
|
||||
Use [Composer](https://getcomposer.org) to install this library from Packagist:
|
||||
[`google/recaptcha`](https://packagist.org/packages/google/recaptcha)
|
||||
|
||||
Run the following command from your project directory to add the dependency:
|
||||
|
||||
```sh
|
||||
composer require google/recaptcha "^1.2"
|
||||
```
|
||||
|
||||
Alternatively, add the dependency directly to your `composer.json` file:
|
||||
|
||||
```json
|
||||
"require": {
|
||||
"google/recaptcha": "^1.2"
|
||||
}
|
||||
```
|
||||
|
||||
### Direct download
|
||||
|
||||
Download the [ZIP file](https://github.com/google/recaptcha/archive/master.zip)
|
||||
and extract into your project. An autoloader script is provided in
|
||||
`src/autoload.php` which you can require into your script. For example:
|
||||
|
||||
```php
|
||||
require_once '/path/to/recaptcha/src/autoload.php';
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
```
|
||||
|
||||
The classes in the project are structured according to the
|
||||
[PSR-4](http://www.php-fig.org/psr/psr-4/) standard, so you can also use your
|
||||
own autoloader or require the needed files directly in your code.
|
||||
|
||||
## Usage
|
||||
|
||||
First obtain the appropriate keys for the type of reCAPTCHA you wish to
|
||||
integrate for v2 at https://www.google.com/recaptcha/admin or v3 at
|
||||
https://g.co/recaptcha/v3.
|
||||
|
||||
Then follow the [integration guide on the developer
|
||||
site](https://developers.google.com/recaptcha/intro) to add the reCAPTCHA
|
||||
functionality into your frontend.
|
||||
|
||||
This library comes in when you need to verify the user's response. On the PHP
|
||||
side you need the response from the reCAPTCHA service and secret key from your
|
||||
credentials. Instantiate the `ReCaptcha` class with your secret key, specify any
|
||||
additional validation rules, and then call `verify()` with the reCAPTCHA
|
||||
response and user's IP address. For example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
$resp = $recaptcha->setExpectedHostname('recaptcha-demo.appspot.com')
|
||||
->verify($gRecaptchaResponse, $remoteIp);
|
||||
if ($resp->isSuccess()) {
|
||||
// Verified!
|
||||
} else {
|
||||
$errors = $resp->getErrorCodes();
|
||||
}
|
||||
```
|
||||
|
||||
The following methods are available:
|
||||
|
||||
- `setExpectedHostname($hostname)`: ensures the hostname matches. You must do
|
||||
this if you have disabled "Domain/Package Name Validation" for your
|
||||
credentials.
|
||||
- `setExpectedApkPackageName($apkPackageName)`: if you're verifying a response
|
||||
from an Android app. Again, you must do this if you have disabled
|
||||
"Domain/Package Name Validation" for your credentials.
|
||||
- `setExpectedAction($action)`: ensures the action matches for the v3 API.
|
||||
- `setScoreThreshold($threshold)`: set a score threshold for responses from the
|
||||
v3 API
|
||||
- `setChallengeTimeout($timeoutSeconds)`: set a timeout between the user passing
|
||||
the reCAPTCHA and your server processing it.
|
||||
|
||||
Each of the `set`\*`()` methods return the `ReCaptcha` instance so you can chain
|
||||
them together. For example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
$resp = $recaptcha->setExpectedHostname('recaptcha-demo.appspot.com')
|
||||
->setExpectedAction('homepage')
|
||||
->setScoreThreshold(0.5)
|
||||
->verify($gRecaptchaResponse, $remoteIp);
|
||||
|
||||
if ($resp->isSuccess()) {
|
||||
// Verified!
|
||||
} else {
|
||||
$errors = $resp->getErrorCodes();
|
||||
}
|
||||
```
|
||||
|
||||
You can find the constants for the libraries error codes in the `ReCaptcha`
|
||||
class constants, e.g. `ReCaptcha::E_HOSTNAME_MISMATCH`
|
||||
|
||||
For more details on usage and structure, see [ARCHITECTURE](ARCHITECTURE.md).
|
||||
|
||||
### Examples
|
||||
|
||||
You can see examples of each reCAPTCHA type in [examples/](examples/). You can
|
||||
run the examples locally by using the Composer script:
|
||||
|
||||
```sh
|
||||
composer run-script serve-examples
|
||||
```
|
||||
|
||||
This makes use of the in-built PHP dev server to host the examples at
|
||||
http://localhost:8080/
|
||||
|
||||
These are also hosted on Google AppEngine Flexible environment at
|
||||
https://recaptcha-demo.appspot.com/. This is configured by
|
||||
[`app.yaml`](./app.yaml) which you can also use to [deploy to your own AppEngine
|
||||
project](https://cloud.google.com/appengine/docs/flexible/php/download).
|
||||
|
||||
## Contributing
|
||||
|
||||
No one ever has enough engineers, so we're very happy to accept contributions
|
||||
via Pull Requests. For details, see [CONTRIBUTING](CONTRIBUTING.md)
|
||||
8
modules/eicaptcha/vendor/google/recaptcha/app.yaml
vendored
Normal file
8
modules/eicaptcha/vendor/google/recaptcha/app.yaml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
runtime: php
|
||||
env: flex
|
||||
|
||||
skip_files:
|
||||
- tests
|
||||
|
||||
runtime_config:
|
||||
document_root: examples
|
||||
39
modules/eicaptcha/vendor/google/recaptcha/composer.json
vendored
Normal file
39
modules/eicaptcha/vendor/google/recaptcha/composer.json
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "google/recaptcha",
|
||||
"description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.",
|
||||
"type": "library",
|
||||
"keywords": ["recaptcha", "captcha", "spam", "abuse"],
|
||||
"homepage": "https://www.google.com/recaptcha/",
|
||||
"license": "BSD-3-Clause",
|
||||
"support": {
|
||||
"forum": "https://groups.google.com/forum/#!forum/recaptcha",
|
||||
"source": "https://github.com/google/recaptcha"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11",
|
||||
"friendsofphp/php-cs-fixer": "^2.2.20|^2.15",
|
||||
"php-coveralls/php-coveralls": "^2.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ReCaptcha\\": "src/ReCaptcha"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "vendor/bin/php-cs-fixer -vvv fix --using-cache=no --dry-run .",
|
||||
"lint-fix": "vendor/bin/php-cs-fixer -vvv fix --using-cache=no .",
|
||||
"test": "vendor/bin/phpunit --colors=always",
|
||||
"serve-examples": "@php -S localhost:8080 -t examples"
|
||||
},
|
||||
"config": {
|
||||
"process-timeout": 0
|
||||
}
|
||||
}
|
||||
42
modules/eicaptcha/vendor/google/recaptcha/examples/appengine-https.php
vendored
Normal file
42
modules/eicaptcha/vendor/google/recaptcha/examples/appengine-https.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Redirect to HTTPS by default (for AppEngine)
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'http') {
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Location: https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
|
||||
exit(0);
|
||||
} else {
|
||||
header('Strict-Transport-Security: max-age=63072000; includeSubDomains; preload');
|
||||
}
|
||||
}
|
||||
46
modules/eicaptcha/vendor/google/recaptcha/examples/config.php.dist
vendored
Normal file
46
modules/eicaptcha/vendor/google/recaptcha/examples/config.php.dist
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
return [
|
||||
'v2-standard' => [
|
||||
'site' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
'v2-invisible' => [
|
||||
'site' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
'v3' => [
|
||||
'site' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
];
|
||||
37
modules/eicaptcha/vendor/google/recaptcha/examples/examples.css
vendored
Normal file
37
modules/eicaptcha/vendor/google/recaptcha/examples/examples.css
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
p {
|
||||
margin: 0;
|
||||
padding: 0.5rem 0 0 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
color: #222244;
|
||||
}
|
||||
|
||||
header {
|
||||
padding: 0.5rem 2rem 0.5rem 2rem;
|
||||
background: #f0f0f4;
|
||||
border-bottom: 1px solid #aaaabb;
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 0.5rem 2rem 0.5rem 2rem;
|
||||
}
|
||||
|
||||
.form-field {
|
||||
display: block;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
1
modules/eicaptcha/vendor/google/recaptcha/examples/google0afd8760fd68f119.html
vendored
Normal file
1
modules/eicaptcha/vendor/google/recaptcha/examples/google0afd8760fd68f119.html
vendored
Normal file
@@ -0,0 +1 @@
|
||||
google-site-verification: google0afd8760fd68f119.html
|
||||
79
modules/eicaptcha/vendor/google/recaptcha/examples/index.php
vendored
Normal file
79
modules/eicaptcha/vendor/google/recaptcha/examples/index.php
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo", "url": "http://recaptcha-demo.appspot.com/" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo" />
|
||||
<meta property="og:description" content="Examples of the reCAPTCHA client." />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1>
|
||||
</header>
|
||||
<main>
|
||||
<p>Try out the various forms of <a href="https://www.google.com/recaptcha/">reCAPTCHA</a>.</p>
|
||||
<p>You can find the source code for these examples on GitHub in <kbd><a href="https://github.com/google/recaptcha">google/recaptcha</a></kbd>.</p>
|
||||
<ul>
|
||||
<li><h2>reCAPTCHA v2</h2>
|
||||
<ul>
|
||||
<li><a href="/recaptcha-v2-checkbox.php">"I'm not a robot" checkbox</a></li>
|
||||
<li><a href="/recaptcha-v2-checkbox-explicit.php">"I'm not a robot" checkbox - Explicit render</a></li>
|
||||
<li><a href="/recaptcha-v2-invisible.php">Invisible</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h2>reCAPTCHA v3</h2>
|
||||
<ul>
|
||||
<li><a href="/recaptcha-v3-request-scores.php">Request scores</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h2>General</h2>
|
||||
<ul>
|
||||
<li><a href="/recaptcha-content-security-policy.php">Content Security Policy</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
152
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-content-security-policy.php
vendored
Normal file
152
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-content-security-policy.php
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// This example shows the use of a Content Security Policy
|
||||
// https://developers.google.com/web/fundamentals/security/csp/
|
||||
|
||||
// First we generate a pseudorandom nonce for each included or inline script
|
||||
$nonce = base64_encode(openssl_random_pseudo_bytes(16));
|
||||
|
||||
// Send the CSP header
|
||||
// Try commenting out the various lines to see what effect it has
|
||||
|
||||
// NOTE: Always test your policy Content-Security-Policy-Report-Only first to
|
||||
// ensure you're not blocking any critical functionality. CSP is an important
|
||||
// security feature but you can break entire sections of your site if you
|
||||
// implement it incorrectly.
|
||||
header(
|
||||
"Content-Security-Policy: "
|
||||
."default-src 'none'; " // By default we will deny everything
|
||||
|
||||
."script-src 'nonce-".$nonce."' 'strict-dynamic'; " // nonce allowing the reCAPTCHA library and other third-party scripts to be included
|
||||
|
||||
."img-src https://www.gstatic.com/recaptcha/ https://www.google-analytics.com; " // allow images from these URLS
|
||||
."frame-src https://www.google.com/; " // allow frames from this URL
|
||||
|
||||
."style-src 'self'; " // allow style from our own origin
|
||||
."connect-src 'self'; " // allow the fetch calls to our own origin
|
||||
);
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v3']['site'];
|
||||
$secret = $config['v3']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
|
||||
// The v3 API lets you provide some context for the check by specifying an action.
|
||||
// See: https://developers.google.com/recaptcha/docs/v3
|
||||
$pageAction = 'examples/csp';
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-content-security-policy.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - Content Security Policy", "url": "https://recaptcha-demo.appspot.com/recaptcha-content-security-policy.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - Content Security Policy" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-content-security-policy.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - Content Security Policy" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - Content Security Policy" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - Content Security Policy</title>
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>Content Security Policy</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<p>This example is sending the <kbd>Content-Security-Policy</kbd> header. Look at the source and inspect the network tab for this request to see what's happening. The reCAPTCHA v3 API is being called here, however you can use the same approach for the v2 API calls as well.</p>
|
||||
<p><strong>NOTE:</strong>This is a sample implementation, the score returned here is not a reflection on your Google account or type of traffic. In production, refer to the distribution of scores shown in <a href="https://www.google.com/recaptcha/admin" target="_blank">your admin interface</a> and adjust your own threshold accordingly. <strong>Do not raise issues regarding the score you see here.</strong></p>
|
||||
<ol id="recaptcha-steps">
|
||||
<li class="step0">reCAPTCHA script loading</li>
|
||||
<li class="step1 hidden"><kbd>grecaptcha.ready()</kbd> fired, calling <pre>grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'})'</pre></li>
|
||||
<li class="step2 hidden">Received token from reCAPTCHA service, sending to our backend with:
|
||||
<pre class="token">fetch('/recaptcha-v3-verify.php?token=abc123</pre></li>
|
||||
<li class="step3 hidden">Received response from our backend: <pre class="response">{"json": "from-backend"}</pre></li>
|
||||
</ol>
|
||||
<p><a href="/recaptcha-content-security-policy.php">⤴️ Try again</a></p>
|
||||
|
||||
<!-- Add the nonce for our inline script to this tag -->
|
||||
<script nonce="<?php echo $nonce; ?>">
|
||||
var onloadCallback = function() {
|
||||
const steps = document.getElementById('recaptcha-steps');
|
||||
grecaptcha.ready(function() {
|
||||
document.querySelector('.step1').classList.remove('hidden');
|
||||
grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'}).then(function(token) {
|
||||
document.querySelector('.token').innerHTML = 'fetch(\'/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token=\'' + token;
|
||||
document.querySelector('.step2').classList.remove('hidden');
|
||||
|
||||
fetch('/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token='+token).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
document.querySelector('.response').innerHTML = JSON.stringify(data, null, 2);
|
||||
document.querySelector('.step3').classList.remove('hidden');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<!-- Add the nonce value for the reCAPTCHA library to its script tag -->
|
||||
<script async defer src="https://www.google.com/recaptcha/api.js?render=<?php echo $siteKey; ?>&onload=onloadCallback" nonce="<?php echo $nonce; ?>"></script>
|
||||
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - adding nonces here for the library and the inline code -->
|
||||
<script async defer src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1" nonce="<?php echo $nonce; ?>"></script>
|
||||
<script async nonce="<?php echo $nonce; ?>">window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
148
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v2-checkbox-explicit.php
vendored
Normal file
148
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v2-checkbox-explicit.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v2-standard']['site'];
|
||||
$secret = $config['v2-standard']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox-explicit.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - \"I'm not a robot\" checkbox - Explicit render", "url": "https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox-explicit.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox-explicit.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - "I'm not a robot" checkbox - Explicit render</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>"I'm not a robot" checkbox - Explicit render</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in the <kbd>config.php</kbd> file or directly to <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
elseif (isset($_POST['g-recaptcha-response'])):
|
||||
// The POST data here is unfiltered because this is an example.
|
||||
// In production, *always* sanitise and validate your input'
|
||||
?>
|
||||
<h2><kbd>POST</kbd> data</h2>
|
||||
<kbd><pre><?php var_export($_POST);?></pre></kbd>
|
||||
<?php
|
||||
// If the form submission includes the "g-captcha-response" field
|
||||
// Create an instance of the service using your secret
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
|
||||
// If file_get_contents() is locked down on your PHP installation to disallow
|
||||
// its use with URLs, then you can use the alternative request method instead.
|
||||
// This makes use of fsockopen() instead.
|
||||
// $recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
|
||||
// Make the call to verify the response and also pass the user's IP address
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if ($resp->isSuccess()):
|
||||
// If the response is a success, that's it!
|
||||
?>
|
||||
<h2>Success!</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>That's it. Everything is working. Go integrate this into your real project.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox-explicit.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
else:
|
||||
// If it's not successful, then one or more error codes will be returned.
|
||||
?>
|
||||
<h2>Something went wrong</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>Check the error code reference at <kbd><a href="https://developers.google.com/recaptcha/docs/verify#error-code-reference">https://developers.google.com/recaptcha/docs/verify#error-code-reference</a></kbd>.
|
||||
<p><strong>Note:</strong> Error code <kbd>missing-input-response</kbd> may mean the user just didn't complete the reCAPTCHA.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox-explicit.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
endif;
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>Complete the reCAPTCHA then submit the form.</p>
|
||||
<form action="/recaptcha-v2-checkbox-explicit.php" method="post">
|
||||
<fieldset>
|
||||
<legend>An example form</legend>
|
||||
<label class="form-field">Example input A: <input type="text" name="ex-a" value="foo"></label>
|
||||
<label class="form-field">Example input B: <input type="text" name="ex-b" value="bar"></label>
|
||||
<!-- Set up a container to render the widget -->
|
||||
<div class="g-recaptcha form-field"></div>
|
||||
<!-- Disable the button by default, will enable when the widget loads -->
|
||||
<button class="form-field" type="submit" disabled>Submit ↦</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var onloadCallback = function() {
|
||||
var captchaContainer = document.querySelector('.g-recaptcha');
|
||||
grecaptcha.render(captchaContainer, {
|
||||
'sitekey' : '<?php echo $siteKey; ?>'
|
||||
});
|
||||
document.querySelector('button[type="submit"]').disabled = false;
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>&onload=onloadCallback&render=explicit" async defer></script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
139
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v2-checkbox.php
vendored
Normal file
139
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v2-checkbox.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v2-standard']['site'];
|
||||
$secret = $config['v2-standard']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - \"I'm not a robot\" checkbox", "url": "https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - "I'm not a robot" checkbox" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - "I'm not a robot" checkbox" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - "I'm not a robot" checkbox" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - "I'm not a robot" checkbox</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>"I'm not a robot" checkbox</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in the <kbd>config.php</kbd> file or directly to <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
elseif (isset($_POST['g-recaptcha-response'])):
|
||||
// The POST data here is unfiltered because this is an example.
|
||||
// In production, *always* sanitise and validate your input'
|
||||
?>
|
||||
<h2><kbd>POST</kbd> data</h2>
|
||||
<kbd><pre><?php var_export($_POST);?></pre></kbd>
|
||||
<?php
|
||||
// If the form submission includes the "g-captcha-response" field
|
||||
// Create an instance of the service using your secret
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
|
||||
// If file_get_contents() is locked down on your PHP installation to disallow
|
||||
// its use with URLs, then you can use the alternative request method instead.
|
||||
// This makes use of fsockopen() instead.
|
||||
// $recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
|
||||
|
||||
// Make the call to verify the response and also pass the user's IP address
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
if ($resp->isSuccess()):
|
||||
// If the response is a success, that's it!
|
||||
?>
|
||||
<h2>Success!</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>That's it. Everything is working. Go integrate this into your real project.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
else:
|
||||
// If it's not successful, then one or more error codes will be returned.
|
||||
?>
|
||||
<h2>Something went wrong</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>Check the error code reference at <kbd><a href="https://developers.google.com/recaptcha/docs/verify#error-code-reference">https://developers.google.com/recaptcha/docs/verify#error-code-reference</a></kbd>.
|
||||
<p><strong>Note:</strong> Error code <kbd>missing-input-response</kbd> may mean the user just didn't complete the reCAPTCHA.</p>
|
||||
<p><a href="/recaptcha-v2-checkbox.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
endif;
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>Complete the reCAPTCHA then submit the form.</p>
|
||||
<form action="/recaptcha-v2-checkbox.php" method="post">
|
||||
<fieldset>
|
||||
<legend>An example form</legend>
|
||||
<label class="form-field">Example input A: <input type="text" name="ex-a" value="foo"></label>
|
||||
<label class="form-field">Example input B: <input type="text" name="ex-b" value="bar"></label>
|
||||
<!-- Default behaviour looks for the g-recaptcha class with a data-sitekey attribute -->
|
||||
<div class="g-recaptcha form-field" data-sitekey="<?php echo $siteKey; ?>"></div>
|
||||
<!-- Submitting before the widget loads will result in a missing-input-response error so you need to verify server side -->
|
||||
<button class="form-field" type="submit">Submit ↦</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>"></script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
141
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v2-invisible.php
vendored
Normal file
141
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v2-invisible.php
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v2-invisible']['site'];
|
||||
$secret = $config['v2-invisible']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - Invisible", "url": "https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - Invisible" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v2-invisible.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - Invisible" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - Invisible" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - Invisible</title>
|
||||
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>Invisible</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
elseif (isset($_POST['g-recaptcha-response'])):
|
||||
// The POST data here is unfiltered because this is an example.
|
||||
// In production, *always* sanitise and validate your input'
|
||||
?>
|
||||
<h2><kbd>POST</kbd> data</h2>
|
||||
<kbd><pre><?php var_export($_POST);?></pre></kbd>
|
||||
<?php
|
||||
// If the form submission includes the "g-captcha-response" field
|
||||
// Create an instance of the service using your secret
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
|
||||
// If file_get_contents() is locked down on your PHP installation to disallow
|
||||
// its use with URLs, then you can use the alternative request method instead.
|
||||
// This makes use of fsockopen() instead.
|
||||
// $recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
|
||||
|
||||
// Make the call to verify the response and also pass the user's IP address
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
if ($resp->isSuccess()):
|
||||
// If the response is a success, that's it!
|
||||
?>
|
||||
<h2>Success!</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>That's it. Everything is working. Go integrate this into your real project.</p>
|
||||
<p><a href="/recaptcha-v2-invisible.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
else:
|
||||
// If it's not successful, then one or more error codes will be returned.
|
||||
?>
|
||||
<h2>Something went wrong</h2>
|
||||
<kbd><pre><?php var_export($resp);?></pre></kbd>
|
||||
<p>Check the error code reference at <kbd><a href="https://developers.google.com/recaptcha/docs/verify#error-code-reference">https://developers.google.com/recaptcha/docs/verify#error-code-reference</a></kbd>.
|
||||
<p><strong>Note:</strong> Error code <kbd>missing-input-response</kbd> may mean the user just didn't complete the reCAPTCHA.</p>
|
||||
<p><a href="/recaptcha-v2-invisible.php">⤴️ Try again</a></p>
|
||||
<?php
|
||||
endif;
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>Submit the form and reCAPTCHA will run automatically.</p>
|
||||
<form action="/recaptcha-v2-invisible.php" method="post" id="demo-form">
|
||||
<fieldset>
|
||||
<legend>An example form</legend>
|
||||
<label class="form-field">Example input A: <input type="text" name="ex-a" value="foo"></label>
|
||||
<label class="form-field">Example input B: <input type="text" name="ex-b" value="bar"></label>
|
||||
<button class="g-recaptcha form-field" data-sitekey="<?php echo $siteKey; ?>" data-callback='onSubmit'>Submit ↦</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>" async defer></script>
|
||||
<script type="text/javascript">
|
||||
function onSubmit(token) {
|
||||
document.getElementById("demo-form").submit();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
120
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v3-request-scores.php
vendored
Normal file
120
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v3-request-scores.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v3']['site'];
|
||||
$secret = $config['v3']['secret'];
|
||||
}
|
||||
|
||||
// reCAPTCHA supports 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
|
||||
// The v3 API lets you provide some context for the check by specifying an action.
|
||||
// See: https://developers.google.com/recaptcha/docs/v3
|
||||
$pageAction = 'examples/v3scores';
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height,minimum-scale=1">
|
||||
<link rel="shortcut icon" href="https://www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="canonical" href="https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php">
|
||||
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebSite", "name": "reCAPTCHA demo - Request scores", "url": "https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php" }</script>
|
||||
<meta name="description" content="reCAPTCHA demo - Request scores" />
|
||||
<meta property="og:url" content="https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="reCAPTCHA demo - Request scores" />
|
||||
<meta property="og:description" content="reCAPTCHA demo - Request scores" />
|
||||
<link rel="stylesheet" type="text/css" href="/examples.css">
|
||||
<title>reCAPTCHA demo - Request scores</title>
|
||||
<header>
|
||||
<h1>reCAPTCHA demo</h1><h2>Request scores</h2>
|
||||
<p><a href="/">↩️ Home</a></p>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
if ($siteKey === '' || $secret === ''):
|
||||
?>
|
||||
<h2>Add your keys</h2>
|
||||
<p>If you do not have keys already then visit <kbd> <a href = "https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></kbd> to generate them. Edit this file and set the respective keys in <kbd>$siteKey</kbd> and <kbd>$secret</kbd>. Reload the page after this.</p>
|
||||
<?php
|
||||
else:
|
||||
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
|
||||
?>
|
||||
<p>The reCAPTCHA v3 API provides a confidence score for each request.</p>
|
||||
<p><strong>NOTE:</strong>This is a sample implementation, the score returned here is not a reflection on your Google account or type of traffic. In production, refer to the distribution of scores shown in <a href="https://www.google.com/recaptcha/admin" target="_blank">your admin interface</a> and adjust your own threshold accordingly. <strong>Do not raise issues regarding the score you see here.</strong></p>
|
||||
<ol id="recaptcha-steps">
|
||||
<li class="step0">reCAPTCHA script loading</li>
|
||||
<li class="step1 hidden"><kbd>grecaptcha.ready()</kbd> fired, calling <pre>grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'})'</pre></li>
|
||||
<li class="step2 hidden">Received token from reCAPTCHA service, sending to our backend with:
|
||||
<pre class="token">fetch('/recaptcha-v3-verify.php?token=abc123</pre></li>
|
||||
<li class="step3 hidden">Received response from our backend: <pre class="response">{"json": "from-backend"}</pre></li>
|
||||
</ol>
|
||||
<p><a href="/recaptcha-v3-request-scores.php">⤴️ Try again</a></p>
|
||||
<script src="https://www.google.com/recaptcha/api.js?render=<?php echo $siteKey; ?>"></script>
|
||||
<script>
|
||||
const steps = document.getElementById('recaptcha-steps');
|
||||
grecaptcha.ready(function() {
|
||||
document.querySelector('.step1').classList.remove('hidden');
|
||||
grecaptcha.execute('<?php echo $siteKey; ?>', {action: '<?php echo $pageAction; ?>'}).then(function(token) {
|
||||
document.querySelector('.token').innerHTML = 'fetch(\'/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token=\'' + token;
|
||||
document.querySelector('.step2').classList.remove('hidden');
|
||||
|
||||
fetch('/recaptcha-v3-verify.php?action=<?php echo $pageAction; ?>&token='+token).then(function(response) {
|
||||
response.json().then(function(data) {
|
||||
document.querySelector('.response').innerHTML = JSON.stringify(data, null, 2);
|
||||
document.querySelector('.step3').classList.remove('hidden');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
endif;?>
|
||||
</main>
|
||||
<!-- Google Analytics - just ignore this -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123057962-1"></script>
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-123057962-1');</script>
|
||||
59
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v3-verify.php
vendored
Normal file
59
modules/eicaptcha/vendor/google/recaptcha/examples/recaptcha-v3-verify.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/appengine-https.php';
|
||||
|
||||
// Initiate the autoloader. The file should be generated by Composer.
|
||||
// You will provide your own autoloader or require the files directly if you did
|
||||
// not install via Composer.
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// Register API keys at https://www.google.com/recaptcha/admin
|
||||
$siteKey = '';
|
||||
$secret = '';
|
||||
|
||||
// Copy the config.php.dist file to config.php and update it with your keys to run the examples
|
||||
if ($siteKey == '' && is_readable(__DIR__ . '/config.php')) {
|
||||
$config = include __DIR__ . '/config.php';
|
||||
$siteKey = $config['v3']['site'];
|
||||
$secret = $config['v3']['secret'];
|
||||
}
|
||||
|
||||
// Effectively we're providing an API endpoint here that will accept the token, verify it, and return the action / score to the page
|
||||
// In production, always sanitize and validate the input you retrieve from the request.
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
$resp = $recaptcha->setExpectedHostname($_SERVER['SERVER_NAME'])
|
||||
->setExpectedAction($_GET['action'])
|
||||
->setScoreThreshold(0.5)
|
||||
->verify($_GET['token'], $_SERVER['REMOTE_ADDR']);
|
||||
header('Content-type:application/json');
|
||||
echo json_encode($resp->toArray());
|
||||
2
modules/eicaptcha/vendor/google/recaptcha/examples/robots.txt
vendored
Normal file
2
modules/eicaptcha/vendor/google/recaptcha/examples/robots.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
20
modules/eicaptcha/vendor/google/recaptcha/phpunit.xml.dist
vendored
Normal file
20
modules/eicaptcha/vendor/google/recaptcha/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.4/phpunit.xsd"
|
||||
colors="true"
|
||||
verbose="true"
|
||||
bootstrap="src/autoload.php">
|
||||
<testsuites>
|
||||
<testsuite name="reCAPTCHA Test Suite">
|
||||
<directory>tests/ReCaptcha/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">src/ReCaptcha/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<logging>
|
||||
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
||||
</logging>
|
||||
</phpunit>
|
||||
269
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php
vendored
Normal file
269
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
/**
|
||||
* reCAPTCHA client.
|
||||
*/
|
||||
class ReCaptcha
|
||||
{
|
||||
/**
|
||||
* Version of this client library.
|
||||
* @const string
|
||||
*/
|
||||
const VERSION = 'php_1.2.4';
|
||||
|
||||
/**
|
||||
* URL for reCAPTCHA siteverify API
|
||||
* @const string
|
||||
*/
|
||||
const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
|
||||
|
||||
/**
|
||||
* Invalid JSON received
|
||||
* @const string
|
||||
*/
|
||||
const E_INVALID_JSON = 'invalid-json';
|
||||
|
||||
/**
|
||||
* Could not connect to service
|
||||
* @const string
|
||||
*/
|
||||
const E_CONNECTION_FAILED = 'connection-failed';
|
||||
|
||||
/**
|
||||
* Did not receive a 200 from the service
|
||||
* @const string
|
||||
*/
|
||||
const E_BAD_RESPONSE = 'bad-response';
|
||||
|
||||
/**
|
||||
* Not a success, but no error codes received!
|
||||
* @const string
|
||||
*/
|
||||
const E_UNKNOWN_ERROR = 'unknown-error';
|
||||
|
||||
/**
|
||||
* ReCAPTCHA response not provided
|
||||
* @const string
|
||||
*/
|
||||
const E_MISSING_INPUT_RESPONSE = 'missing-input-response';
|
||||
|
||||
/**
|
||||
* Expected hostname did not match
|
||||
* @const string
|
||||
*/
|
||||
const E_HOSTNAME_MISMATCH = 'hostname-mismatch';
|
||||
|
||||
/**
|
||||
* Expected APK package name did not match
|
||||
* @const string
|
||||
*/
|
||||
const E_APK_PACKAGE_NAME_MISMATCH = 'apk_package_name-mismatch';
|
||||
|
||||
/**
|
||||
* Expected action did not match
|
||||
* @const string
|
||||
*/
|
||||
const E_ACTION_MISMATCH = 'action-mismatch';
|
||||
|
||||
/**
|
||||
* Score threshold not met
|
||||
* @const string
|
||||
*/
|
||||
const E_SCORE_THRESHOLD_NOT_MET = 'score-threshold-not-met';
|
||||
|
||||
/**
|
||||
* Challenge timeout
|
||||
* @const string
|
||||
*/
|
||||
const E_CHALLENGE_TIMEOUT = 'challenge-timeout';
|
||||
|
||||
/**
|
||||
* Shared secret for the site.
|
||||
* @var string
|
||||
*/
|
||||
private $secret;
|
||||
|
||||
/**
|
||||
* Method used to communicate with service. Defaults to POST request.
|
||||
* @var RequestMethod
|
||||
*/
|
||||
private $requestMethod;
|
||||
|
||||
/**
|
||||
* Create a configured instance to use the reCAPTCHA service.
|
||||
*
|
||||
* @param string $secret The shared key between your site and reCAPTCHA.
|
||||
* @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
|
||||
* @throws \RuntimeException if $secret is invalid
|
||||
*/
|
||||
public function __construct($secret, RequestMethod $requestMethod = null)
|
||||
{
|
||||
if (empty($secret)) {
|
||||
throw new \RuntimeException('No secret provided');
|
||||
}
|
||||
|
||||
if (!is_string($secret)) {
|
||||
throw new \RuntimeException('The provided secret must be a string');
|
||||
}
|
||||
|
||||
$this->secret = $secret;
|
||||
$this->requestMethod = (is_null($requestMethod)) ? new RequestMethod\Post() : $requestMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the reCAPTCHA siteverify API to verify whether the user passes
|
||||
* CAPTCHA test and additionally runs any specified additional checks
|
||||
*
|
||||
* @param string $response The user response token provided by reCAPTCHA, verifying the user on your site.
|
||||
* @param string $remoteIp The end user's IP address.
|
||||
* @return Response Response from the service.
|
||||
*/
|
||||
public function verify($response, $remoteIp = null)
|
||||
{
|
||||
// Discard empty solution submissions
|
||||
if (empty($response)) {
|
||||
$recaptchaResponse = new Response(false, array(self::E_MISSING_INPUT_RESPONSE));
|
||||
return $recaptchaResponse;
|
||||
}
|
||||
|
||||
$params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION);
|
||||
$rawResponse = $this->requestMethod->submit($params);
|
||||
$initialResponse = Response::fromJson($rawResponse);
|
||||
$validationErrors = array();
|
||||
|
||||
if (isset($this->hostname) && strcasecmp($this->hostname, $initialResponse->getHostname()) !== 0) {
|
||||
$validationErrors[] = self::E_HOSTNAME_MISMATCH;
|
||||
}
|
||||
|
||||
if (isset($this->apkPackageName) && strcasecmp($this->apkPackageName, $initialResponse->getApkPackageName()) !== 0) {
|
||||
$validationErrors[] = self::E_APK_PACKAGE_NAME_MISMATCH;
|
||||
}
|
||||
|
||||
if (isset($this->action) && strcasecmp($this->action, $initialResponse->getAction()) !== 0) {
|
||||
$validationErrors[] = self::E_ACTION_MISMATCH;
|
||||
}
|
||||
|
||||
if (isset($this->threshold) && $this->threshold > $initialResponse->getScore()) {
|
||||
$validationErrors[] = self::E_SCORE_THRESHOLD_NOT_MET;
|
||||
}
|
||||
|
||||
if (isset($this->timeoutSeconds)) {
|
||||
$challengeTs = strtotime($initialResponse->getChallengeTs());
|
||||
|
||||
if ($challengeTs > 0 && time() - $challengeTs > $this->timeoutSeconds) {
|
||||
$validationErrors[] = self::E_CHALLENGE_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($validationErrors)) {
|
||||
return $initialResponse;
|
||||
}
|
||||
|
||||
return new Response(
|
||||
false,
|
||||
array_merge($initialResponse->getErrorCodes(), $validationErrors),
|
||||
$initialResponse->getHostname(),
|
||||
$initialResponse->getChallengeTs(),
|
||||
$initialResponse->getApkPackageName(),
|
||||
$initialResponse->getScore(),
|
||||
$initialResponse->getAction()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a hostname to match against in verify()
|
||||
* This should be without a protocol or trailing slash, e.g. www.google.com
|
||||
*
|
||||
* @param string $hostname Expected hostname
|
||||
* @return ReCaptcha Current instance for fluent interface
|
||||
*/
|
||||
public function setExpectedHostname($hostname)
|
||||
{
|
||||
$this->hostname = $hostname;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide an APK package name to match against in verify()
|
||||
*
|
||||
* @param string $apkPackageName Expected APK package name
|
||||
* @return ReCaptcha Current instance for fluent interface
|
||||
*/
|
||||
public function setExpectedApkPackageName($apkPackageName)
|
||||
{
|
||||
$this->apkPackageName = $apkPackageName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide an action to match against in verify()
|
||||
* This should be set per page.
|
||||
*
|
||||
* @param string $action Expected action
|
||||
* @return ReCaptcha Current instance for fluent interface
|
||||
*/
|
||||
public function setExpectedAction($action)
|
||||
{
|
||||
$this->action = $action;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a threshold to meet or exceed in verify()
|
||||
* Threshold should be a float between 0 and 1 which will be tested as response >= threshold.
|
||||
*
|
||||
* @param float $threshold Expected threshold
|
||||
* @return ReCaptcha Current instance for fluent interface
|
||||
*/
|
||||
public function setScoreThreshold($threshold)
|
||||
{
|
||||
$this->threshold = floatval($threshold);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a timeout in seconds to test against the challenge timestamp in verify()
|
||||
*
|
||||
* @param int $timeoutSeconds Expected hostname
|
||||
* @return ReCaptcha Current instance for fluent interface
|
||||
*/
|
||||
public function setChallengeTimeout($timeoutSeconds)
|
||||
{
|
||||
$this->timeoutSeconds = $timeoutSeconds;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
50
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php
vendored
Normal file
50
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
/**
|
||||
* Method used to send the request to the service.
|
||||
*/
|
||||
interface RequestMethod
|
||||
{
|
||||
|
||||
/**
|
||||
* Submit the request with the specified parameters.
|
||||
*
|
||||
* @param RequestParameters $params Request parameters
|
||||
* @return string Body of the reCAPTCHA response
|
||||
*/
|
||||
public function submit(RequestParameters $params);
|
||||
}
|
||||
82
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php
vendored
Normal file
82
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
/**
|
||||
* Convenience wrapper around the cURL functions to allow mocking.
|
||||
*/
|
||||
class Curl
|
||||
{
|
||||
|
||||
/**
|
||||
* @see http://php.net/curl_init
|
||||
* @param string $url
|
||||
* @return resource cURL handle
|
||||
*/
|
||||
public function init($url = null)
|
||||
{
|
||||
return curl_init($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://php.net/curl_setopt_array
|
||||
* @param resource $ch
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function setoptArray($ch, array $options)
|
||||
{
|
||||
return curl_setopt_array($ch, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://php.net/curl_exec
|
||||
* @param resource $ch
|
||||
* @return mixed
|
||||
*/
|
||||
public function exec($ch)
|
||||
{
|
||||
return curl_exec($ch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://php.net/curl_close
|
||||
* @param resource $ch
|
||||
*/
|
||||
public function close($ch)
|
||||
{
|
||||
curl_close($ch);
|
||||
}
|
||||
}
|
||||
104
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php
vendored
Normal file
104
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use ReCaptcha\ReCaptcha;
|
||||
use ReCaptcha\RequestMethod;
|
||||
use ReCaptcha\RequestParameters;
|
||||
|
||||
/**
|
||||
* Sends cURL request to the reCAPTCHA service.
|
||||
* Note: this requires the cURL extension to be enabled in PHP
|
||||
* @see http://php.net/manual/en/book.curl.php
|
||||
*/
|
||||
class CurlPost implements RequestMethod
|
||||
{
|
||||
/**
|
||||
* Curl connection to the reCAPTCHA service
|
||||
* @var Curl
|
||||
*/
|
||||
private $curl;
|
||||
|
||||
/**
|
||||
* URL for reCAPTCHA siteverify API
|
||||
* @var string
|
||||
*/
|
||||
private $siteVerifyUrl;
|
||||
|
||||
/**
|
||||
* Only needed if you want to override the defaults
|
||||
*
|
||||
* @param Curl $curl Curl resource
|
||||
* @param string $siteVerifyUrl URL for reCAPTCHA siteverify API
|
||||
*/
|
||||
public function __construct(Curl $curl = null, $siteVerifyUrl = null)
|
||||
{
|
||||
$this->curl = (is_null($curl)) ? new Curl() : $curl;
|
||||
$this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the cURL request with the specified parameters.
|
||||
*
|
||||
* @param RequestParameters $params Request parameters
|
||||
* @return string Body of the reCAPTCHA response
|
||||
*/
|
||||
public function submit(RequestParameters $params)
|
||||
{
|
||||
$handle = $this->curl->init($this->siteVerifyUrl);
|
||||
|
||||
$options = array(
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $params->toQueryString(),
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/x-www-form-urlencoded'
|
||||
),
|
||||
CURLINFO_HEADER_OUT => false,
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => true
|
||||
);
|
||||
$this->curl->setoptArray($handle, $options);
|
||||
|
||||
$response = $this->curl->exec($handle);
|
||||
$this->curl->close($handle);
|
||||
|
||||
if ($response !== false) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
|
||||
}
|
||||
}
|
||||
88
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php
vendored
Normal file
88
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use ReCaptcha\ReCaptcha;
|
||||
use ReCaptcha\RequestMethod;
|
||||
use ReCaptcha\RequestParameters;
|
||||
|
||||
/**
|
||||
* Sends POST requests to the reCAPTCHA service.
|
||||
*/
|
||||
class Post implements RequestMethod
|
||||
{
|
||||
/**
|
||||
* URL for reCAPTCHA siteverify API
|
||||
* @var string
|
||||
*/
|
||||
private $siteVerifyUrl;
|
||||
|
||||
/**
|
||||
* Only needed if you want to override the defaults
|
||||
*
|
||||
* @param string $siteVerifyUrl URL for reCAPTCHA siteverify API
|
||||
*/
|
||||
public function __construct($siteVerifyUrl = null)
|
||||
{
|
||||
$this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the POST request with the specified parameters.
|
||||
*
|
||||
* @param RequestParameters $params Request parameters
|
||||
* @return string Body of the reCAPTCHA response
|
||||
*/
|
||||
public function submit(RequestParameters $params)
|
||||
{
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => $params->toQueryString(),
|
||||
// Force the peer to validate (not needed in 5.6.0+, but still works)
|
||||
'verify_peer' => true,
|
||||
),
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$response = file_get_contents($this->siteVerifyUrl, false, $context);
|
||||
|
||||
if ($response !== false) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
|
||||
}
|
||||
}
|
||||
112
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php
vendored
Normal file
112
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
/**
|
||||
* Convenience wrapper around native socket and file functions to allow for
|
||||
* mocking.
|
||||
*/
|
||||
class Socket
|
||||
{
|
||||
private $handle = null;
|
||||
|
||||
/**
|
||||
* fsockopen
|
||||
*
|
||||
* @see http://php.net/fsockopen
|
||||
* @param string $hostname
|
||||
* @param int $port
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param float $timeout
|
||||
* @return resource
|
||||
*/
|
||||
public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
|
||||
{
|
||||
$this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));
|
||||
|
||||
if ($this->handle != false && $errno === 0 && $errstr === '') {
|
||||
return $this->handle;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* fwrite
|
||||
*
|
||||
* @see http://php.net/fwrite
|
||||
* @param string $string
|
||||
* @param int $length
|
||||
* @return int | bool
|
||||
*/
|
||||
public function fwrite($string, $length = null)
|
||||
{
|
||||
return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
|
||||
}
|
||||
|
||||
/**
|
||||
* fgets
|
||||
*
|
||||
* @see http://php.net/fgets
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
public function fgets($length = null)
|
||||
{
|
||||
return fgets($this->handle, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* feof
|
||||
*
|
||||
* @see http://php.net/feof
|
||||
* @return bool
|
||||
*/
|
||||
public function feof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* fclose
|
||||
*
|
||||
* @see http://php.net/fclose
|
||||
* @return bool
|
||||
*/
|
||||
public function fclose()
|
||||
{
|
||||
return fclose($this->handle);
|
||||
}
|
||||
}
|
||||
108
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php
vendored
Normal file
108
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use ReCaptcha\ReCaptcha;
|
||||
use ReCaptcha\RequestMethod;
|
||||
use ReCaptcha\RequestParameters;
|
||||
|
||||
/**
|
||||
* Sends a POST request to the reCAPTCHA service, but makes use of fsockopen()
|
||||
* instead of get_file_contents(). This is to account for people who may be on
|
||||
* servers where allow_url_open is disabled.
|
||||
*/
|
||||
class SocketPost implements RequestMethod
|
||||
{
|
||||
/**
|
||||
* Socket to the reCAPTCHA service
|
||||
* @var Socket
|
||||
*/
|
||||
private $socket;
|
||||
|
||||
/**
|
||||
* Only needed if you want to override the defaults
|
||||
*
|
||||
* @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing
|
||||
* @param string $siteVerifyUrl URL for reCAPTCHA siteverify API
|
||||
*/
|
||||
public function __construct(Socket $socket = null, $siteVerifyUrl = null)
|
||||
{
|
||||
$this->socket = (is_null($socket)) ? new Socket() : $socket;
|
||||
$this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the POST request with the specified parameters.
|
||||
*
|
||||
* @param RequestParameters $params Request parameters
|
||||
* @return string Body of the reCAPTCHA response
|
||||
*/
|
||||
public function submit(RequestParameters $params)
|
||||
{
|
||||
$errno = 0;
|
||||
$errstr = '';
|
||||
$urlParsed = parse_url($this->siteVerifyUrl);
|
||||
|
||||
if (false === $this->socket->fsockopen('ssl://' . $urlParsed['host'], 443, $errno, $errstr, 30)) {
|
||||
return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
|
||||
}
|
||||
|
||||
$content = $params->toQueryString();
|
||||
|
||||
$request = "POST " . $urlParsed['path'] . " HTTP/1.0\r\n";
|
||||
$request .= "Host: " . $urlParsed['host'] . "\r\n";
|
||||
$request .= "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
$request .= "Content-length: " . strlen($content) . "\r\n";
|
||||
$request .= "Connection: close\r\n\r\n";
|
||||
$request .= $content . "\r\n\r\n";
|
||||
|
||||
$this->socket->fwrite($request);
|
||||
$response = '';
|
||||
|
||||
while (!$this->socket->feof()) {
|
||||
$response .= $this->socket->fgets(4096);
|
||||
}
|
||||
|
||||
$this->socket->fclose();
|
||||
|
||||
if (0 !== strpos($response, 'HTTP/1.0 200 OK')) {
|
||||
return '{"success": false, "error-codes": ["'.ReCaptcha::E_BAD_RESPONSE.'"]}';
|
||||
}
|
||||
|
||||
$parts = preg_split("#\n\s*\n#Uis", $response);
|
||||
|
||||
return $parts[1];
|
||||
}
|
||||
}
|
||||
111
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php
vendored
Normal file
111
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
/**
|
||||
* Stores and formats the parameters for the request to the reCAPTCHA service.
|
||||
*/
|
||||
class RequestParameters
|
||||
{
|
||||
/**
|
||||
* The shared key between your site and reCAPTCHA.
|
||||
* @var string
|
||||
*/
|
||||
private $secret;
|
||||
|
||||
/**
|
||||
* The user response token provided by reCAPTCHA, verifying the user on your site.
|
||||
* @var string
|
||||
*/
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* Remote user's IP address.
|
||||
* @var string
|
||||
*/
|
||||
private $remoteIp;
|
||||
|
||||
/**
|
||||
* Client version.
|
||||
* @var string
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* Initialise parameters.
|
||||
*
|
||||
* @param string $secret Site secret.
|
||||
* @param string $response Value from g-captcha-response form field.
|
||||
* @param string $remoteIp User's IP address.
|
||||
* @param string $version Version of this client library.
|
||||
*/
|
||||
public function __construct($secret, $response, $remoteIp = null, $version = null)
|
||||
{
|
||||
$this->secret = $secret;
|
||||
$this->response = $response;
|
||||
$this->remoteIp = $remoteIp;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array representation.
|
||||
*
|
||||
* @return array Array formatted parameters.
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
$params = array('secret' => $this->secret, 'response' => $this->response);
|
||||
|
||||
if (!is_null($this->remoteIp)) {
|
||||
$params['remoteip'] = $this->remoteIp;
|
||||
}
|
||||
|
||||
if (!is_null($this->version)) {
|
||||
$params['version'] = $this->version;
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query string representation for HTTP request.
|
||||
*
|
||||
* @return string Query string formatted parameters.
|
||||
*/
|
||||
public function toQueryString()
|
||||
{
|
||||
return http_build_query($this->toArray(), '', '&');
|
||||
}
|
||||
}
|
||||
218
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/Response.php
vendored
Normal file
218
modules/eicaptcha/vendor/google/recaptcha/src/ReCaptcha/Response.php
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
/**
|
||||
* The response returned from the service.
|
||||
*/
|
||||
class Response
|
||||
{
|
||||
/**
|
||||
* Success or failure.
|
||||
* @var boolean
|
||||
*/
|
||||
private $success = false;
|
||||
|
||||
/**
|
||||
* Error code strings.
|
||||
* @var array
|
||||
*/
|
||||
private $errorCodes = array();
|
||||
|
||||
/**
|
||||
* The hostname of the site where the reCAPTCHA was solved.
|
||||
* @var string
|
||||
*/
|
||||
private $hostname;
|
||||
|
||||
/**
|
||||
* Timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
|
||||
* @var string
|
||||
*/
|
||||
private $challengeTs;
|
||||
|
||||
/**
|
||||
* APK package name
|
||||
* @var string
|
||||
*/
|
||||
private $apkPackageName;
|
||||
|
||||
/**
|
||||
* Score assigned to the request
|
||||
* @var float
|
||||
*/
|
||||
private $score;
|
||||
|
||||
/**
|
||||
* Action as specified by the page
|
||||
* @var string
|
||||
*/
|
||||
private $action;
|
||||
|
||||
/**
|
||||
* Build the response from the expected JSON returned by the service.
|
||||
*
|
||||
* @param string $json
|
||||
* @return \ReCaptcha\Response
|
||||
*/
|
||||
public static function fromJson($json)
|
||||
{
|
||||
$responseData = json_decode($json, true);
|
||||
|
||||
if (!$responseData) {
|
||||
return new Response(false, array(ReCaptcha::E_INVALID_JSON));
|
||||
}
|
||||
|
||||
$hostname = isset($responseData['hostname']) ? $responseData['hostname'] : null;
|
||||
$challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : null;
|
||||
$apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : null;
|
||||
$score = isset($responseData['score']) ? floatval($responseData['score']) : null;
|
||||
$action = isset($responseData['action']) ? $responseData['action'] : null;
|
||||
|
||||
if (isset($responseData['success']) && $responseData['success'] == true) {
|
||||
return new Response(true, array(), $hostname, $challengeTs, $apkPackageName, $score, $action);
|
||||
}
|
||||
|
||||
if (isset($responseData['error-codes']) && is_array($responseData['error-codes'])) {
|
||||
return new Response(false, $responseData['error-codes'], $hostname, $challengeTs, $apkPackageName, $score, $action);
|
||||
}
|
||||
|
||||
return new Response(false, array(ReCaptcha::E_UNKNOWN_ERROR), $hostname, $challengeTs, $apkPackageName, $score, $action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param boolean $success
|
||||
* @param string $hostname
|
||||
* @param string $challengeTs
|
||||
* @param string $apkPackageName
|
||||
* @param float $score
|
||||
* @param string $action
|
||||
* @param array $errorCodes
|
||||
*/
|
||||
public function __construct($success, array $errorCodes = array(), $hostname = null, $challengeTs = null, $apkPackageName = null, $score = null, $action = null)
|
||||
{
|
||||
$this->success = $success;
|
||||
$this->hostname = $hostname;
|
||||
$this->challengeTs = $challengeTs;
|
||||
$this->apkPackageName = $apkPackageName;
|
||||
$this->score = $score;
|
||||
$this->action = $action;
|
||||
$this->errorCodes = $errorCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is success?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSuccess()
|
||||
{
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get error codes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrorCodes()
|
||||
{
|
||||
return $this->errorCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hostname.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHostname()
|
||||
{
|
||||
return $this->hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get challenge timestamp
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChallengeTs()
|
||||
{
|
||||
return $this->challengeTs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get APK package name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApkPackageName()
|
||||
{
|
||||
return $this->apkPackageName;
|
||||
}
|
||||
/**
|
||||
* Get score
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getScore()
|
||||
{
|
||||
return $this->score;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get action
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
return array(
|
||||
'success' => $this->isSuccess(),
|
||||
'hostname' => $this->getHostname(),
|
||||
'challenge_ts' => $this->getChallengeTs(),
|
||||
'apk_package_name' => $this->getApkPackageName(),
|
||||
'score' => $this->getScore(),
|
||||
'action' => $this->getAction(),
|
||||
'error-codes' => $this->getErrorCodes(),
|
||||
);
|
||||
}
|
||||
}
|
||||
69
modules/eicaptcha/vendor/google/recaptcha/src/autoload.php
vendored
Normal file
69
modules/eicaptcha/vendor/google/recaptcha/src/autoload.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/* An autoloader for ReCaptcha\Foo classes. This should be required()
|
||||
* by the user before attempting to instantiate any of the ReCaptcha
|
||||
* classes.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
if (substr($class, 0, 10) !== 'ReCaptcha\\') {
|
||||
/* If the class does not lie under the "ReCaptcha" namespace,
|
||||
* then we can exit immediately.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/* All of the classes have names like "ReCaptcha\Foo", so we need
|
||||
* to replace the backslashes with frontslashes if we want the
|
||||
* name to map directly to a location in the filesystem.
|
||||
*/
|
||||
$class = str_replace('\\', '/', $class);
|
||||
|
||||
/* First, check under the current directory. It is important that
|
||||
* we look here first, so that we don't waste time searching for
|
||||
* test classes in the common case.
|
||||
*/
|
||||
$path = dirname(__FILE__).'/'.$class.'.php';
|
||||
if (is_readable($path)) {
|
||||
require_once $path;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we didn't find what we're looking for already, maybe it's
|
||||
* a test class?
|
||||
*/
|
||||
$path = dirname(__FILE__).'/../tests/'.$class.'.php';
|
||||
if (is_readable($path)) {
|
||||
require_once $path;
|
||||
}
|
||||
});
|
||||
198
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/ReCaptchaTest.php
vendored
Normal file
198
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/ReCaptchaTest.php
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ReCaptchaTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @dataProvider invalidSecretProvider
|
||||
*/
|
||||
public function testExceptionThrownOnInvalidSecret($invalid)
|
||||
{
|
||||
$rc = new ReCaptcha($invalid);
|
||||
}
|
||||
|
||||
public function invalidSecretProvider()
|
||||
{
|
||||
return array(
|
||||
array(''),
|
||||
array(null),
|
||||
array(0),
|
||||
array(new \stdClass()),
|
||||
array(array()),
|
||||
);
|
||||
}
|
||||
|
||||
public function testVerifyReturnsErrorOnMissingResponse()
|
||||
{
|
||||
$rc = new ReCaptcha('secret');
|
||||
$response = $rc->verify('');
|
||||
$this->assertFalse($response->isSuccess());
|
||||
$this->assertEquals(array(Recaptcha::E_MISSING_INPUT_RESPONSE), $response->getErrorCodes());
|
||||
}
|
||||
|
||||
private function getMockRequestMethod($responseJson)
|
||||
{
|
||||
$method = $this->getMockBuilder(\ReCaptcha\RequestMethod::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('submit'))
|
||||
->getMock();
|
||||
$method->expects($this->any())
|
||||
->method('submit')
|
||||
->with($this->callback(function ($params) {
|
||||
return true;
|
||||
}))
|
||||
->will($this->returnValue($responseJson));
|
||||
return $method;
|
||||
}
|
||||
|
||||
public function testVerifyReturnsResponse()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->verify('response');
|
||||
$this->assertTrue($response->isSuccess());
|
||||
}
|
||||
|
||||
public function testVerifyReturnsInitialResponseWithoutAdditionalChecks()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$initialResponse = $rc->verify('response');
|
||||
$this->assertEquals($initialResponse, $rc->verify('response'));
|
||||
}
|
||||
|
||||
public function testVerifyHostnameMatch()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "hostname": "host.name"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setExpectedHostname('host.name')->verify('response');
|
||||
$this->assertTrue($response->isSuccess());
|
||||
}
|
||||
|
||||
public function testVerifyHostnameMisMatch()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "hostname": "host.NOTname"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setExpectedHostname('host.name')->verify('response');
|
||||
$this->assertFalse($response->isSuccess());
|
||||
$this->assertEquals(array(ReCaptcha::E_HOSTNAME_MISMATCH), $response->getErrorCodes());
|
||||
}
|
||||
|
||||
public function testVerifyApkPackageNameMatch()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "apk_package_name": "apk.name"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setExpectedApkPackageName('apk.name')->verify('response');
|
||||
$this->assertTrue($response->isSuccess());
|
||||
}
|
||||
|
||||
public function testVerifyApkPackageNameMisMatch()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "apk_package_name": "apk.NOTname"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setExpectedApkPackageName('apk.name')->verify('response');
|
||||
$this->assertFalse($response->isSuccess());
|
||||
$this->assertEquals(array(ReCaptcha::E_APK_PACKAGE_NAME_MISMATCH), $response->getErrorCodes());
|
||||
}
|
||||
|
||||
public function testVerifyActionMatch()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "action": "action/name"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setExpectedAction('action/name')->verify('response');
|
||||
$this->assertTrue($response->isSuccess());
|
||||
}
|
||||
|
||||
public function testVerifyActionMisMatch()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "action": "action/NOTname"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setExpectedAction('action/name')->verify('response');
|
||||
$this->assertFalse($response->isSuccess());
|
||||
$this->assertEquals(array(ReCaptcha::E_ACTION_MISMATCH), $response->getErrorCodes());
|
||||
}
|
||||
|
||||
public function testVerifyAboveThreshold()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "score": "0.9"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setScoreThreshold('0.5')->verify('response');
|
||||
$this->assertTrue($response->isSuccess());
|
||||
}
|
||||
|
||||
public function testVerifyBelowThreshold()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": true, "score": "0.1"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setScoreThreshold('0.5')->verify('response');
|
||||
$this->assertFalse($response->isSuccess());
|
||||
$this->assertEquals(array(ReCaptcha::E_SCORE_THRESHOLD_NOT_MET), $response->getErrorCodes());
|
||||
}
|
||||
|
||||
public function testVerifyWithinTimeout()
|
||||
{
|
||||
// Responses come back like 2018-07-31T13:48:41Z
|
||||
$challengeTs = date('Y-M-d\TH:i:s\Z', time());
|
||||
$method = $this->getMockRequestMethod('{"success": true, "challenge_ts": "'.$challengeTs.'"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setChallengeTimeout('1000')->verify('response');
|
||||
$this->assertTrue($response->isSuccess());
|
||||
}
|
||||
|
||||
public function testVerifyOverTimeout()
|
||||
{
|
||||
// Responses come back like 2018-07-31T13:48:41Z
|
||||
$challengeTs = date('Y-M-d\TH:i:s\Z', time() - 600);
|
||||
$method = $this->getMockRequestMethod('{"success": true, "challenge_ts": "'.$challengeTs.'"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setChallengeTimeout('60')->verify('response');
|
||||
$this->assertFalse($response->isSuccess());
|
||||
$this->assertEquals(array(ReCaptcha::E_CHALLENGE_TIMEOUT), $response->getErrorCodes());
|
||||
}
|
||||
|
||||
public function testVerifyMergesErrors()
|
||||
{
|
||||
$method = $this->getMockRequestMethod('{"success": false, "error-codes": ["initial-error"], "score": "0.1"}');
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->setScoreThreshold('0.5')->verify('response');
|
||||
$this->assertFalse($response->isSuccess());
|
||||
$this->assertEquals(array('initial-error', ReCaptcha::E_SCORE_THRESHOLD_NOT_MET), $response->getErrorCodes());
|
||||
}
|
||||
}
|
||||
123
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/CurlPostTest.php
vendored
Normal file
123
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/CurlPostTest.php
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use \ReCaptcha\ReCaptcha;
|
||||
use \ReCaptcha\RequestParameters;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CurlPostTest extends TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
if (!extension_loaded('curl')) {
|
||||
$this->markTestSkipped(
|
||||
'The cURL extension is not available.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testSubmit()
|
||||
{
|
||||
$curl = $this->getMockBuilder(\ReCaptcha\RequestMethod\Curl::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('init', 'setoptArray', 'exec', 'close'))
|
||||
->getMock();
|
||||
$curl->expects($this->once())
|
||||
->method('init')
|
||||
->willReturn(new \stdClass);
|
||||
$curl->expects($this->once())
|
||||
->method('setoptArray')
|
||||
->willReturn(true);
|
||||
$curl->expects($this->once())
|
||||
->method('exec')
|
||||
->willReturn('RESPONSEBODY');
|
||||
$curl->expects($this->once())
|
||||
->method('close');
|
||||
|
||||
$pc = new CurlPost($curl);
|
||||
$response = $pc->submit(new RequestParameters("secret", "response"));
|
||||
$this->assertEquals('RESPONSEBODY', $response);
|
||||
}
|
||||
|
||||
public function testOverrideSiteVerifyUrl()
|
||||
{
|
||||
$url = 'OVERRIDE';
|
||||
|
||||
$curl = $this->getMockBuilder(\ReCaptcha\RequestMethod\Curl::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('init', 'setoptArray', 'exec', 'close'))
|
||||
->getMock();
|
||||
$curl->expects($this->once())
|
||||
->method('init')
|
||||
->with($url)
|
||||
->willReturn(new \stdClass);
|
||||
$curl->expects($this->once())
|
||||
->method('setoptArray')
|
||||
->willReturn(true);
|
||||
$curl->expects($this->once())
|
||||
->method('exec')
|
||||
->willReturn('RESPONSEBODY');
|
||||
$curl->expects($this->once())
|
||||
->method('close');
|
||||
|
||||
$pc = new CurlPost($curl, $url);
|
||||
$response = $pc->submit(new RequestParameters("secret", "response"));
|
||||
$this->assertEquals('RESPONSEBODY', $response);
|
||||
}
|
||||
|
||||
public function testConnectionFailureReturnsError()
|
||||
{
|
||||
$curl = $this->getMockBuilder(\ReCaptcha\RequestMethod\Curl::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('init', 'setoptArray', 'exec', 'close'))
|
||||
->getMock();
|
||||
$curl->expects($this->once())
|
||||
->method('init')
|
||||
->willReturn(new \stdClass);
|
||||
$curl->expects($this->once())
|
||||
->method('setoptArray')
|
||||
->willReturn(true);
|
||||
$curl->expects($this->once())
|
||||
->method('exec')
|
||||
->willReturn(false);
|
||||
$curl->expects($this->once())
|
||||
->method('close');
|
||||
|
||||
$pc = new CurlPost($curl);
|
||||
$response = $pc->submit(new RequestParameters("secret", "response"));
|
||||
$this->assertEquals('{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}', $response);
|
||||
}
|
||||
}
|
||||
149
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/PostTest.php
vendored
Normal file
149
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/PostTest.php
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use \ReCaptcha\ReCaptcha;
|
||||
use ReCaptcha\RequestParameters;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PostTest extends TestCase
|
||||
{
|
||||
public static $assert = null;
|
||||
protected $parameters = null;
|
||||
protected $runcount = 0;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->parameters = new RequestParameters('secret', 'response', 'remoteip', 'version');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
self::$assert = null;
|
||||
}
|
||||
|
||||
public function testHTTPContextOptions()
|
||||
{
|
||||
$req = new Post();
|
||||
self::$assert = array($this, 'httpContextOptionsCallback');
|
||||
$req->submit($this->parameters);
|
||||
$this->assertEquals(1, $this->runcount, 'The assertion was ran');
|
||||
}
|
||||
|
||||
public function testSSLContextOptions()
|
||||
{
|
||||
$req = new Post();
|
||||
self::$assert = array($this, 'sslContextOptionsCallback');
|
||||
$req->submit($this->parameters);
|
||||
$this->assertEquals(1, $this->runcount, 'The assertion was ran');
|
||||
}
|
||||
|
||||
public function testOverrideVerifyUrl()
|
||||
{
|
||||
$req = new Post('https://over.ride/some/path');
|
||||
self::$assert = array($this, 'overrideUrlOptions');
|
||||
$req->submit($this->parameters);
|
||||
$this->assertEquals(1, $this->runcount, 'The assertion was ran');
|
||||
}
|
||||
|
||||
public function testConnectionFailureReturnsError()
|
||||
{
|
||||
$req = new Post('https://bad.connection/');
|
||||
self::$assert = array($this, 'connectionFailureResponse');
|
||||
$response = $req->submit($this->parameters);
|
||||
$this->assertEquals('{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}', $response);
|
||||
}
|
||||
|
||||
public function connectionFailureResponse()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function overrideUrlOptions(array $args)
|
||||
{
|
||||
$this->runcount++;
|
||||
$this->assertEquals('https://over.ride/some/path', $args[0]);
|
||||
}
|
||||
|
||||
public function httpContextOptionsCallback(array $args)
|
||||
{
|
||||
$this->runcount++;
|
||||
$this->assertCommonOptions($args);
|
||||
|
||||
$options = stream_context_get_options($args[2]);
|
||||
$this->assertArrayHasKey('http', $options);
|
||||
|
||||
$this->assertArrayHasKey('method', $options['http']);
|
||||
$this->assertEquals('POST', $options['http']['method']);
|
||||
|
||||
$this->assertArrayHasKey('content', $options['http']);
|
||||
$this->assertEquals($this->parameters->toQueryString(), $options['http']['content']);
|
||||
|
||||
$this->assertArrayHasKey('header', $options['http']);
|
||||
$headers = array(
|
||||
'Content-type: application/x-www-form-urlencoded',
|
||||
);
|
||||
foreach ($headers as $header) {
|
||||
$this->assertContains($header, $options['http']['header']);
|
||||
}
|
||||
}
|
||||
|
||||
public function sslContextOptionsCallback(array $args)
|
||||
{
|
||||
$this->runcount++;
|
||||
$this->assertCommonOptions($args);
|
||||
|
||||
$options = stream_context_get_options($args[2]);
|
||||
$this->assertArrayHasKey('http', $options);
|
||||
$this->assertArrayHasKey('verify_peer', $options['http']);
|
||||
$this->assertTrue($options['http']['verify_peer']);
|
||||
}
|
||||
|
||||
protected function assertCommonOptions(array $args)
|
||||
{
|
||||
$this->assertCount(3, $args);
|
||||
$this->assertStringStartsWith('https://www.google.com/', $args[0]);
|
||||
$this->assertFalse($args[1]);
|
||||
$this->assertTrue(is_resource($args[2]), 'The context options should be a resource');
|
||||
}
|
||||
}
|
||||
|
||||
function file_get_contents()
|
||||
{
|
||||
if (PostTest::$assert) {
|
||||
return call_user_func(PostTest::$assert, func_get_args());
|
||||
}
|
||||
// Since we can't represent maxlen in userland...
|
||||
return call_user_func_array('file_get_contents', func_get_args());
|
||||
}
|
||||
136
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/SocketPostTest.php
vendored
Normal file
136
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestMethod/SocketPostTest.php
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use ReCaptcha\ReCaptcha;
|
||||
use ReCaptcha\RequestParameters;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SocketPostTest extends TestCase
|
||||
{
|
||||
public function testSubmitSuccess()
|
||||
{
|
||||
$socket = $this->getMockBuilder(\ReCaptcha\RequestMethod\Socket::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('fsockopen', 'fwrite', 'fgets', 'feof', 'fclose'))
|
||||
->getMock();
|
||||
$socket->expects($this->once())
|
||||
->method('fsockopen')
|
||||
->willReturn(true);
|
||||
$socket->expects($this->once())
|
||||
->method('fwrite');
|
||||
$socket->expects($this->once())
|
||||
->method('fgets')
|
||||
->willReturn("HTTP/1.0 200 OK\n\nRESPONSEBODY");
|
||||
$socket->expects($this->exactly(2))
|
||||
->method('feof')
|
||||
->will($this->onConsecutiveCalls(false, true));
|
||||
$socket->expects($this->once())
|
||||
->method('fclose')
|
||||
->willReturn(true);
|
||||
|
||||
$ps = new SocketPost($socket);
|
||||
$response = $ps->submit(new RequestParameters("secret", "response", "remoteip", "version"));
|
||||
$this->assertEquals('RESPONSEBODY', $response);
|
||||
}
|
||||
|
||||
public function testOverrideSiteVerifyUrl()
|
||||
{
|
||||
$socket = $this->getMockBuilder(\ReCaptcha\RequestMethod\Socket::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('fsockopen', 'fwrite', 'fgets', 'feof', 'fclose'))
|
||||
->getMock();
|
||||
$socket->expects($this->once())
|
||||
->method('fsockopen')
|
||||
->with('ssl://over.ride', 443, 0, '', 30)
|
||||
->willReturn(true);
|
||||
$socket->expects($this->once())
|
||||
->method('fwrite')
|
||||
->with($this->matchesRegularExpression('/^POST \/some\/path.*Host: over\.ride/s'));
|
||||
$socket->expects($this->once())
|
||||
->method('fgets')
|
||||
->willReturn("HTTP/1.0 200 OK\n\nRESPONSEBODY");
|
||||
$socket->expects($this->exactly(2))
|
||||
->method('feof')
|
||||
->will($this->onConsecutiveCalls(false, true));
|
||||
$socket->expects($this->once())
|
||||
->method('fclose')
|
||||
->willReturn(true);
|
||||
|
||||
$ps = new SocketPost($socket, 'https://over.ride/some/path');
|
||||
$response = $ps->submit(new RequestParameters("secret", "response", "remoteip", "version"));
|
||||
$this->assertEquals('RESPONSEBODY', $response);
|
||||
}
|
||||
|
||||
public function testSubmitBadResponse()
|
||||
{
|
||||
$socket = $this->getMockBuilder(\ReCaptcha\RequestMethod\Socket::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('fsockopen', 'fwrite', 'fgets', 'feof', 'fclose'))
|
||||
->getMock();
|
||||
$socket->expects($this->once())
|
||||
->method('fsockopen')
|
||||
->willReturn(true);
|
||||
$socket->expects($this->once())
|
||||
->method('fwrite');
|
||||
$socket->expects($this->once())
|
||||
->method('fgets')
|
||||
->willReturn("HTTP/1.0 500 NOPEn\\nBOBBINS");
|
||||
$socket->expects($this->exactly(2))
|
||||
->method('feof')
|
||||
->will($this->onConsecutiveCalls(false, true));
|
||||
$socket->expects($this->once())
|
||||
->method('fclose')
|
||||
->willReturn(true);
|
||||
|
||||
$ps = new SocketPost($socket);
|
||||
$response = $ps->submit(new RequestParameters("secret", "response", "remoteip", "version"));
|
||||
$this->assertEquals('{"success": false, "error-codes": ["'.ReCaptcha::E_BAD_RESPONSE.'"]}', $response);
|
||||
}
|
||||
|
||||
public function testConnectionFailureReturnsError()
|
||||
{
|
||||
$socket = $this->getMockBuilder(\ReCaptcha\RequestMethod\Socket::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('fsockopen'))
|
||||
->getMock();
|
||||
$socket->expects($this->once())
|
||||
->method('fsockopen')
|
||||
->willReturn(false);
|
||||
$ps = new SocketPost($socket);
|
||||
$response = $ps->submit(new RequestParameters("secret", "response", "remoteip", "version"));
|
||||
$this->assertEquals('{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}', $response);
|
||||
}
|
||||
}
|
||||
70
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestParametersTest.php
vendored
Normal file
70
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/RequestParametersTest.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RequestParametersTest extends Testcase
|
||||
{
|
||||
public function provideValidData()
|
||||
{
|
||||
return array(
|
||||
array('SECRET', 'RESPONSE', 'REMOTEIP', 'VERSION',
|
||||
array('secret' => 'SECRET', 'response' => 'RESPONSE', 'remoteip' => 'REMOTEIP', 'version' => 'VERSION'),
|
||||
'secret=SECRET&response=RESPONSE&remoteip=REMOTEIP&version=VERSION'),
|
||||
array('SECRET', 'RESPONSE', null, null,
|
||||
array('secret' => 'SECRET', 'response' => 'RESPONSE'),
|
||||
'secret=SECRET&response=RESPONSE'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
*/
|
||||
public function testToArray($secret, $response, $remoteIp, $version, $expectedArray, $expectedQuery)
|
||||
{
|
||||
$params = new RequestParameters($secret, $response, $remoteIp, $version);
|
||||
$this->assertEquals($params->toArray(), $expectedArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
*/
|
||||
public function testToQueryString($secret, $response, $remoteIp, $version, $expectedArray, $expectedQuery)
|
||||
{
|
||||
$params = new RequestParameters($secret, $response, $remoteIp, $version);
|
||||
$this->assertEquals($params->toQueryString(), $expectedQuery);
|
||||
}
|
||||
}
|
||||
173
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/ResponseTest.php
vendored
Normal file
173
modules/eicaptcha/vendor/google/recaptcha/tests/ReCaptcha/ResponseTest.php
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
* @copyright (c) 2019, Google Inc.
|
||||
* @link https://www.google.com/recaptcha
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ResponseTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @dataProvider provideJson
|
||||
*/
|
||||
public function testFromJson($json, $success, $errorCodes, $hostname, $challengeTs, $apkPackageName, $score, $action)
|
||||
{
|
||||
$response = Response::fromJson($json);
|
||||
$this->assertEquals($success, $response->isSuccess());
|
||||
$this->assertEquals($errorCodes, $response->getErrorCodes());
|
||||
$this->assertEquals($hostname, $response->getHostname());
|
||||
$this->assertEquals($challengeTs, $response->getChallengeTs());
|
||||
$this->assertEquals($apkPackageName, $response->getApkPackageName());
|
||||
$this->assertEquals($score, $response->getScore());
|
||||
$this->assertEquals($action, $response->getAction());
|
||||
}
|
||||
|
||||
public function provideJson()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'{"success": true}',
|
||||
true, array(), null, null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'{"success": true, "hostname": "google.com"}',
|
||||
true, array(), 'google.com', null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'{"success": false, "error-codes": ["test"]}',
|
||||
false, array('test'), null, null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'{"success": false, "error-codes": ["test"], "hostname": "google.com"}',
|
||||
false, array('test'), 'google.com', null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'{"success": false, "error-codes": ["test"], "hostname": "google.com", "challenge_ts": "timestamp", "apk_package_name": "apk", "score": "0.5", "action": "action"}',
|
||||
false, array('test'), 'google.com', 'timestamp', 'apk', 0.5, 'action',
|
||||
),
|
||||
array(
|
||||
'{"success": true, "error-codes": ["test"]}',
|
||||
true, array(), null, null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'{"success": true, "error-codes": ["test"], "hostname": "google.com"}',
|
||||
true, array(), 'google.com', null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'{"success": false}',
|
||||
false, array(ReCaptcha::E_UNKNOWN_ERROR), null, null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'{"success": false, "hostname": "google.com"}',
|
||||
false, array(ReCaptcha::E_UNKNOWN_ERROR), 'google.com', null, null, null, null,
|
||||
),
|
||||
array(
|
||||
'BAD JSON',
|
||||
false, array(ReCaptcha::E_INVALID_JSON), null, null, null, null, null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testIsSuccess()
|
||||
{
|
||||
$response = new Response(true);
|
||||
$this->assertTrue($response->isSuccess());
|
||||
|
||||
$response = new Response(false);
|
||||
$this->assertFalse($response->isSuccess());
|
||||
|
||||
$response = new Response(true, array(), 'example.com');
|
||||
$this->assertEquals('example.com', $response->getHostName());
|
||||
}
|
||||
|
||||
public function testGetErrorCodes()
|
||||
{
|
||||
$errorCodes = array('test');
|
||||
$response = new Response(true, $errorCodes);
|
||||
$this->assertEquals($errorCodes, $response->getErrorCodes());
|
||||
}
|
||||
|
||||
public function testGetHostname()
|
||||
{
|
||||
$hostname = 'google.com';
|
||||
$errorCodes = array();
|
||||
$response = new Response(true, $errorCodes, $hostname);
|
||||
$this->assertEquals($hostname, $response->getHostname());
|
||||
}
|
||||
|
||||
public function testGetChallengeTs()
|
||||
{
|
||||
$timestamp = 'timestamp';
|
||||
$errorCodes = array();
|
||||
$response = new Response(true, array(), 'hostname', $timestamp);
|
||||
$this->assertEquals($timestamp, $response->getChallengeTs());
|
||||
}
|
||||
|
||||
public function TestGetApkPackageName()
|
||||
{
|
||||
$apk = 'apk';
|
||||
$response = new Response(true, array(), 'hostname', 'timestamp', 'apk');
|
||||
$this->assertEquals($apk, $response->getApkPackageName());
|
||||
}
|
||||
|
||||
public function testGetScore()
|
||||
{
|
||||
$score = 0.5;
|
||||
$response = new Response(true, array(), 'hostname', 'timestamp', 'apk', $score);
|
||||
$this->assertEquals($score, $response->getScore());
|
||||
}
|
||||
|
||||
public function testGetAction()
|
||||
{
|
||||
$action = 'homepage';
|
||||
$response = new Response(true, array(), 'hostname', 'timestamp', 'apk', '0.5', 'homepage');
|
||||
$this->assertEquals($action, $response->getAction());
|
||||
}
|
||||
|
||||
public function testToArray()
|
||||
{
|
||||
$response = new Response(true, array(), 'hostname', 'timestamp', 'apk', '0.5', 'homepage');
|
||||
$expected = array(
|
||||
'success' => true,
|
||||
'error-codes' => array(),
|
||||
'hostname' => 'hostname',
|
||||
'challenge_ts' => 'timestamp',
|
||||
'apk_package_name' => 'apk',
|
||||
'score' => 0.5,
|
||||
'action' => 'homepage',
|
||||
);
|
||||
$this->assertEquals($expected, $response->toArray());
|
||||
}
|
||||
}
|
||||
12
modules/eicaptcha/views/css/eicaptcha.css
Normal file
12
modules/eicaptcha/views/css/eicaptcha.css
Normal file
@@ -0,0 +1,12 @@
|
||||
.contact-form form .form-fields #captcha-box > div{float: right;}
|
||||
.contact-form form .form-footer{clear: both;padding-top: 1rem;}
|
||||
@media screen and (max-width: 767px){
|
||||
#contact #left-column,
|
||||
#contact #content-wrapper{padding-left: 0!important;padding-right: 0!important;width: 100%;}
|
||||
.contact-form form .form-fields #captcha-box{position: relative;min-height: 78px;}
|
||||
.contact-form form .form-fields #captcha-box > div{float: none;position: absolute;left: 50%;top: 0;transform: translate(-50%,0);}
|
||||
}
|
||||
@media screen and (max-width: 379px){
|
||||
.register-form form .form-group .g-recaptcha{position: relative;min-height: 78px;}
|
||||
.register-form form .form-group .g-recaptcha > div{float: none;position: absolute;left: 50%;top: 0;transform: translate(-50%,0);}
|
||||
}
|
||||
35
modules/eicaptcha/views/index.php
Normal file
35
modules/eicaptcha/views/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
5
modules/eicaptcha/views/js/admin.js
Normal file
5
modules/eicaptcha/views/js/admin.js
Normal file
@@ -0,0 +1,5 @@
|
||||
$(document).ready(function(){
|
||||
//Force click to display debug tab when parameter is defined in url
|
||||
//This file is only loaded in this case
|
||||
$('a[href="#advanced"]').click();
|
||||
});
|
||||
12
modules/eicaptcha/views/js/eicaptcha-contact-form-v2.js
Normal file
12
modules/eicaptcha/views/js/eicaptcha-contact-form-v2.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
*
|
||||
* Recaptcha V2 Only
|
||||
*
|
||||
* This script add dynamically a new div at the end of the contact form
|
||||
* The captcha is render inside this div by Recaptcha V2
|
||||
* If needed you can change the selector by overriding this file in your theme
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$('.form-fields').append('<div id="captcha-box"></div>');
|
||||
});
|
||||
|
||||
11
modules/eicaptcha/views/js/eicaptcha-contact-form-v3.js
Normal file
11
modules/eicaptcha/views/js/eicaptcha-contact-form-v3.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
*
|
||||
* Recaptcha V3 Only
|
||||
*
|
||||
* This script add dynamically a new input hidden at the end of the contact form
|
||||
* The captcha is render inside this div by Recaptcha V3
|
||||
* If needed you can change the selector by overriding this file in your theme
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$('.form-fields').append('<input type="hidden" id="captcha-box" value="" name="g-recaptcha-response">');
|
||||
});
|
||||
35
modules/eicaptcha/views/js/index.php
Normal file
35
modules/eicaptcha/views/js/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
33
modules/eicaptcha/views/templates/admin/debug.tpl
Normal file
33
modules/eicaptcha/views/templates/admin/debug.tpl
Normal file
@@ -0,0 +1,33 @@
|
||||
{if $errors|@count}
|
||||
<div class="alert alert-warning">
|
||||
<h4>{l s='Errors' mod='eicaptcha'}</h4>
|
||||
<ul>
|
||||
{foreach from=$errors item=error}
|
||||
<li>{$error|html_entity_decode}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $success|@count}
|
||||
<div class="alert alert-success">
|
||||
<h4>{l s='Success' mod='eicaptcha'}</h4>
|
||||
<ul>
|
||||
{foreach from=$success item=msg}
|
||||
<li>{$msg}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="alert alert-info">
|
||||
<h4>{l s='Additional information' mod='eicaptcha'}</h4>
|
||||
<ul>
|
||||
<li>{l s='Recaptcha version' mod='eicaptcha'} : {$recaptchaVersion}</li>
|
||||
<li>{l s='Prestashop version' mod='eicaptcha'} : {$prestashopVersion}</li>
|
||||
<li>{l s='Theme name' mod='eicaptcha'} : {$themeName}</li>
|
||||
<li>{l s='Php version' mod='eicaptcha'} : {$phpVersion}</li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
<p>{l s='In case of problem please open an issue with the asked information on' mod='eicaptcha'} : <a href="https://github.com/nenes25/eicaptcha/issues" target="_blank">github</a></p>
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
{*
|
||||
* 2007-2016 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 Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*}
|
||||
|
||||
<div id="captcha-row" class="form-group row">
|
||||
{if $captchaVersion == 2}
|
||||
{* <label class="col-md-3 form-control-label">{l s='Captcha' mod='eicaptcha'}</label> *}
|
||||
<div class="col-md-9">
|
||||
{**
|
||||
* Le contenu du captcha est automatiquement ajouté dans le selecteur #captcha-box
|
||||
* Captcha content is automaticaly added into the selector #captcha-box
|
||||
*}
|
||||
<div class="g-recaptcha" data-sitekey="{$publicKey|escape:'html'}" id="captcha-box"
|
||||
data-theme="{$captchatheme}"></div>
|
||||
<script src="https://www.google.com/recaptcha/api.js{if isset($captchaforcelang)}?hl={$captchaforcelang}{/if}"
|
||||
async defer></script>
|
||||
</div>
|
||||
{else}
|
||||
<input type="hidden" id="captcha-box" name="g-recaptcha-response"/>
|
||||
<script src="https://www.google.com/recaptcha/api.js?render={$publicKey|escape:'html'}"></script>
|
||||
<script>
|
||||
grecaptcha.ready(function () {ldelim}
|
||||
grecaptcha.execute('{$publicKey|escape:'html'}', {ldelim}action: 'contact'{rdelim}).then(function (token) {ldelim}
|
||||
var recaptchaResponse = document.getElementById('captcha-box');
|
||||
recaptchaResponse.value = token;
|
||||
{rdelim});
|
||||
{rdelim});
|
||||
</script>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,42 @@
|
||||
{*
|
||||
* 2007-2021 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 Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*}
|
||||
|
||||
<div class="col-xs-12 pull-right">
|
||||
{if $captchaVersion == 2}
|
||||
<div class="g-recaptcha" data-sitekey="{$publicKey|escape:'html'}" id="captcha-box-newsletter" data-theme="{$captchatheme}"></div>
|
||||
<script src="https://www.google.com/recaptcha/api.js{if isset($captchaforcelang)}?hl={$captchaforcelang}{/if}" async defer></script>
|
||||
{else}
|
||||
<input type="hidden" id="captcha-box-newsletter" name="g-recaptcha-response"/>
|
||||
<script src="https://www.google.com/recaptcha/api.js?render={$publicKey|escape:'html'}"></script>
|
||||
<script>
|
||||
grecaptcha.ready(function () {ldelim}
|
||||
grecaptcha.execute('{$publicKey|escape:'html'}', {ldelim}action: 'contact'{rdelim}).then(function (token) {ldelim}
|
||||
var recaptchaResponse = document.getElementById('captcha-box-newsletter');
|
||||
recaptchaResponse.value = token;
|
||||
{rdelim});
|
||||
{rdelim});
|
||||
</script>
|
||||
{/if}
|
||||
</div>
|
||||
35
modules/eicaptcha/views/templates/hook/index.php
Normal file
35
modules/eicaptcha/views/templates/hook/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
35
modules/eicaptcha/views/templates/index.php
Normal file
35
modules/eicaptcha/views/templates/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 2 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user