Compare commits
10 Commits
f00f4207dd
...
a2ea47d68a
| Author | SHA1 | Date | |
|---|---|---|---|
| a2ea47d68a | |||
| c4e1e2099f | |||
| 0c5b22d8f4 | |||
| 401fedea95 | |||
| 7a37450953 | |||
| b92fecbb39 | |||
| 8fd5f28ef7 | |||
| 193e608d4e | |||
| 23c666e59f | |||
| 2fe0f96c7c |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
/web/cache/
|
||||
/web/var/
|
||||
/.idea/
|
||||
/web/admin1553pskpx/autoupgrade/filesDiff.list
|
||||
/web/themes/classic-child/assets/cache/
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -6,85 +6,84 @@
|
||||
<language>fr</language>
|
||||
<atom:link href="https://www.prestashop.com/fr/blog/feed.xml" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>Il est urgent de mettre la data au service de votre commerce !</title>
|
||||
<link>https://www.prestashop.com/fr/blog/piloter-son-site-prestashop-donnees-bi</link>
|
||||
<description>En tant que Manager et e-commerçant, vous avez besoin de reporting pour garder le contrôle des performances de votre entreprise e</description>
|
||||
<pubDate>Mon, 18 Nov 2019 15:48:52 +0100</pubDate>
|
||||
<dc:creator>Hélène Clary</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/piloter-son-site-prestashop-donnees-bi</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Live chat e-commerce : sauver ses ventes et résoudre les problèmes de ses clients</title>
|
||||
<link>https://www.prestashop.com/fr/blog/live-chat-e-commerce-sauver-vente-problemes-clients</link>
|
||||
<description>Une grande partie de votre e-business dépend de la qualité de votre service client.</description>
|
||||
<pubDate>Fri, 15 Nov 2019 13:40:31 +0100</pubDate>
|
||||
<dc:creator>YATEO</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/live-chat-e-commerce-sauver-vente-problemes-clients</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Haute saison : des opportunités à l’international pour votre e-commerce</title>
|
||||
<link>https://www.prestashop.com/fr/blog/haute-saison-opportunite-international-e-commerce</link>
|
||||
<description>Il existe des périodes où les ventes sont plus importantes. On parle alors de pics de vente et de haute saison.</description>
|
||||
<pubDate>Fri, 15 Nov 2019 13:31:40 +0100</pubDate>
|
||||
<dc:creator>rhina-matingu-fr</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/haute-saison-opportunite-international-e-commerce</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>E-commerce : tout savoir à propos des flux de produits</title>
|
||||
<link>https://www.prestashop.com/fr/blog/e-commerce-tout-savoir-flux-produits</link>
|
||||
<description>Définition d’un flux de produits
|
||||
Un flux de produits est en réalité un ensemble de lignes de code informatique qui se déclinent dans des formats différents. Il peut s’agir :</description>
|
||||
<pubDate>Wed, 13 Nov 2019 12:06:07 +0100</pubDate>
|
||||
<dc:creator>Maxime Varinard</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/e-commerce-tout-savoir-flux-produits</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Cinq conseils pour lancer son blog sur sa boutique PrestaShop</title>
|
||||
<link>https://www.prestashop.com/fr/blog/conseils-lancer-blog-boutique-prestashop</link>
|
||||
<description>En quelques années, les blogs ont su se démocratiser.</description>
|
||||
<pubDate>Tue, 12 Nov 2019 10:42:57 +0100</pubDate>
|
||||
<dc:creator>Harmonie Andrieu</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/conseils-lancer-blog-boutique-prestashop</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Taux de rebond d’un site web : comment le limiter ?</title>
|
||||
<link>https://www.prestashop.com/fr/blog/taux-rebond-comment-limiter</link>
|
||||
<description>Le taux de rebond correspond au pourcentage de visiteurs qui ne visitent qu’une seule page lors de leur passage sur votre site.</description>
|
||||
<pubDate>Wed, 06 Nov 2019 09:44:06 +0100</pubDate>
|
||||
<dc:creator>YATEO</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/taux-rebond-comment-limiter</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Comment transformer vos avis négatifs en force pour votre réputation ?</title>
|
||||
<link>https://www.prestashop.com/fr/blog/transformer-avis-negatifs-pour-votre-reputation</link>
|
||||
<description>De plus en plus plébiscités, les avis clients sont devenus une source d’information fiable et rassurante pour les consommateurs, qui accordent une place grandissante à l’opinion de leurs pairs.</description>
|
||||
<pubDate>Mon, 04 Nov 2019 15:38:59 +0100</pubDate>
|
||||
<dc:creator>Ingrid Astier</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/transformer-avis-negatifs-pour-votre-reputation</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>E-commerce : la liste des dix erreurs à éviter</title>
|
||||
<link>https://www.prestashop.com/fr/blog/e-commerce-pain-points-a-eviter</link>
|
||||
<description>Pour convertir un client et le fidéliser, votre site doit proposer un parcours sans faute.</description>
|
||||
<pubDate>Wed, 30 Oct 2019 12:07:20 +0100</pubDate>
|
||||
<title>Déconfinement : checklist des actions à mettre en place pour les e-commerçants</title>
|
||||
<link>https://www.prestashop.com/fr/blog/deconfinement-checklist-e-commerce</link>
|
||||
<description>En France, ce lundi 11 mai, le confinement sera officiellement terminé.</description>
|
||||
<pubDate>Thu, 07 May 2020 16:49:45 +0200</pubDate>
|
||||
<dc:creator>L'équipe PrestaShop</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/e-commerce-pain-points-a-eviter</guid>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/deconfinement-checklist-e-commerce</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Redonner du sens à sa stratégie de contenu avec le “slow content”</title>
|
||||
<link>https://www.prestashop.com/fr/blog/strategie-contenu-slow-content</link>
|
||||
<description>Mettre en oeuvre une stratégie de contenu efficace sur la toile est un défi de taille mais pourtant indispensable.</description>
|
||||
<pubDate>Thu, 24 Oct 2019 17:14:49 +0200</pubDate>
|
||||
<title>Attention : tentative de fraude usurpant l’identité de PrestaShop</title>
|
||||
<link>https://www.prestashop.com/fr/blog/alerte-phishing-email</link>
|
||||
<description>Une opération de phishing (hameçonnage) se faisant passer pour PrestaShop est en cours (</description>
|
||||
<pubDate>Thu, 07 May 2020 15:25:31 +0200</pubDate>
|
||||
<dc:creator>L'équipe PrestaShop</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/alerte-phishing-email</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Quelles astuces pour générer plus de ventes grâce à la livraison ? </title>
|
||||
<link>https://www.prestashop.com/fr/blog/astuces-ventes-livraison</link>
|
||||
<description>La livraison n’est pas simplement un service : elle fait partie intégrante de l’expérience d’achat que vous offrez à votre clientèle.</description>
|
||||
<pubDate>Tue, 05 May 2020 13:31:14 +0200</pubDate>
|
||||
<dc:creator>YATEO</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/strategie-contenu-slow-content</guid>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/astuces-ventes-livraison</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Le meilleur statut juridique pour lancer un site de e-commerce</title>
|
||||
<link>https://www.prestashop.com/fr/blog/meilleur-statut-juridique-e-commerce</link>
|
||||
<description>Vous avez un projet de boutique en ligne avec PrestaShop ? </description>
|
||||
<pubDate>Wed, 23 Oct 2019 12:24:27 +0200</pubDate>
|
||||
<dc:creator>guillaumerobez</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/meilleur-statut-juridique-e-commerce</guid>
|
||||
<title>Cinq astuces à appliquer maintenant pour augmenter la vitesse de chargement de votre site </title>
|
||||
<link>https://www.prestashop.com/fr/blog/augmenter-vitesse-chargement</link>
|
||||
<description>Désormais, il est essentiel d’améliorer la rapidité de chargement de son site pour optimiser son positionnement.</description>
|
||||
<pubDate>Thu, 30 Apr 2020 11:41:31 +0200</pubDate>
|
||||
<dc:creator>YATEO</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/augmenter-vitesse-chargement</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Packaging : le petit détail qui peut faire la différence</title>
|
||||
<link>https://www.prestashop.com/fr/blog/packaging-detail-difference</link>
|
||||
<description>Vous pensez que le packaging se résume à un simple emballage ? Faux ! Son rôle est beaucoup plus complexe. De nombreux produits ne trouvent pas forcément leur public cible.</description>
|
||||
<pubDate>Mon, 27 Apr 2020 17:22:44 +0200</pubDate>
|
||||
<dc:creator>YATEO</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/packaging-detail-difference</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>COVID-19 : le recrutement à l’heure du confinement</title>
|
||||
<link>https://www.prestashop.com/fr/blog/recrutement-confinement</link>
|
||||
<description>Alors que la période de confinement impacte l’activité de la majorité des entreprises françaises, la question du recrute</description>
|
||||
<pubDate>Fri, 24 Apr 2020 14:52:06 +0200</pubDate>
|
||||
<dc:creator>Aurélien Bellanger</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/recrutement-confinement</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Quelques chiffres clés du e-commerce en période de confinement</title>
|
||||
<link>https://www.prestashop.com/fr/blog/chiffres-e-commerce-confinement</link>
|
||||
<description>Les phases de « panic buying » concentrées sur les produits de première nécessité semblant passées, l’activité de la distribution reste toutefois considérablement impactée par la crise du coronavir</description>
|
||||
<pubDate>Thu, 23 Apr 2020 11:14:15 +0200</pubDate>
|
||||
<dc:creator>L'équipe PrestaShop</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/chiffres-e-commerce-confinement</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>Ventes, promotions, déstockage, comment animer vos ventes toute l&#039;année</title>
|
||||
<link>https://www.prestashop.com/fr/blog/comment-animer-ventes</link>
|
||||
<description>Pas de repos pour les e-commerces !</description>
|
||||
<pubDate>Wed, 22 Apr 2020 16:04:03 +0200</pubDate>
|
||||
<dc:creator>Laureline Hauraix</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/comment-animer-ventes</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>COVID-19 : comment les équipes de PrestaShop vivent le confinement</title>
|
||||
<link>https://www.prestashop.com/fr/blog/coronavirus-prestashop-confinement</link>
|
||||
<description>Alors que le confinement est de mise, les équipes de PrestaShop sont plus que jamais mobilisées.</description>
|
||||
<pubDate>Fri, 17 Apr 2020 14:18:14 +0200</pubDate>
|
||||
<dc:creator>L'équipe PrestaShop</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/coronavirus-prestashop-confinement</guid>
|
||||
</item>
|
||||
<item>
|
||||
<title>COVID-19 : solutions à court terme pour les marchands</title>
|
||||
<link>https://www.prestashop.com/fr/blog/coronavirus-solutions-tpe-pme</link>
|
||||
<description>Les entreprises sont très touchées économiquement par la situation actuelle.</description>
|
||||
<pubDate>Thu, 16 Apr 2020 11:44:03 +0200</pubDate>
|
||||
<dc:creator>Aurélien Bellanger</dc:creator>
|
||||
<guid isPermaLink="false">https://www.prestashop.com/fr/blog/coronavirus-solutions-tpe-pme</guid>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
BIN
web/img/RIB.png
Normal file
BIN
web/img/RIB.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -1 +1 @@
|
||||
jpg
|
||||
png
|
||||
44
web/modules/addevhtmlentities/addevhtmlentities.php
Normal file
44
web/modules/addevhtmlentities/addevhtmlentities.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class AddevHtmlEntities extends Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'addevhtmlentities';
|
||||
$this->author = 'AD-DEV';
|
||||
$this->version = '1.0.1';
|
||||
$this->description = $this->l('Removes HTML entities present in customer messages.');
|
||||
$this->displayName = $this->l('Customer messages - HTML entities remover');
|
||||
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
$rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT `id_customer_message`, `message` FROM `'._DB_PREFIX_.'customer_message`
|
||||
');
|
||||
$update_sqls = [];
|
||||
foreach($rows as $row) {
|
||||
$id = (int)$row['id_customer_message'];
|
||||
if ($id > 0) {
|
||||
$decoded = strip_tags(html_entity_decode($row['message']));
|
||||
$update_sqls[] = '
|
||||
UPDATE `'._DB_PREFIX_.'customer_message`
|
||||
SET `message`="'.pSQL($decoded).'"
|
||||
WHERE `id_customer_message`='.$id.';
|
||||
';
|
||||
}
|
||||
}
|
||||
if (count($update_sqls) > 0) {
|
||||
// die(var_export(
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->query(
|
||||
implode("\n", $update_sqls)
|
||||
// ,true)
|
||||
);
|
||||
}
|
||||
return parent::install();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
* 2007-2018 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
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* 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.
|
||||
@@ -16,11 +16,11 @@
|
||||
*
|
||||
* 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 https://www.prestashop.com for more information.
|
||||
* 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)
|
||||
* @copyright 2007-2018 PrestaShop SA
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
BIN
web/modules/addevhtmlentities/logo.png
Normal file
BIN
web/modules/addevhtmlentities/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 858 B |
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2018 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:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* 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-2018 PrestaShop SA
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class CustomerMessageCore.
|
||||
*/
|
||||
class CustomerMessage extends CustomerMessageCore
|
||||
{
|
||||
public function add($auto_date = true, $null_values = false)
|
||||
{
|
||||
$this->message = strip_tags(html_entity_decode($this->message, ENT_QUOTES|ENT_HTML401));
|
||||
return parent::add($auto_date, $null_values);
|
||||
}
|
||||
|
||||
public function save($null_values = false, $auto_date = true)
|
||||
{
|
||||
$this->message = strip_tags(html_entity_decode($this->message, ENT_QUOTES|ENT_HTML401));
|
||||
return parent::save($null_values, $auto_date);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 PrestaShop
|
||||
* 2007-2018 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
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* 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.
|
||||
@@ -16,11 +16,11 @@
|
||||
*
|
||||
* 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 https://www.prestashop.com for more information.
|
||||
* 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)
|
||||
* @copyright 2007-2018 PrestaShop SA
|
||||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
35
web/modules/addevhtmlentities/override/index.php
Normal file
35
web/modules/addevhtmlentities/override/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2018 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:
|
||||
* https://opensource.org/licenses/OSL-3.0
|
||||
* 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-2018 PrestaShop SA
|
||||
* @license https://opensource.org/licenses/OSL-3.0 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;
|
||||
@@ -1,27 +0,0 @@
|
||||
# eicaptcha
|
||||
Module EiCaptcha for prestashop 1.7
|
||||
|
||||
This module display Google recaptcha on the following forms :
|
||||
- contact form
|
||||
- account creation form
|
||||
|
||||
This module relies upon the override of the folowing files :
|
||||
- AuthController
|
||||
- ContactForm Module
|
||||
|
||||
The last version used composer to get recaptcha lib.
|
||||
Don't forget to use `composer update` 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
|
||||
|
||||
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>
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Module Captcha
|
||||
* Add (re)captcha on contact and account creation forms
|
||||
* © h-hennes 2013-2017
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
- V 2.0.0 - 2017-07-10 : New version for prestashop 1.7, add only captcha for contact form and account creation
|
||||
- V 2.0.1 - 2017-12-01 : Css improvments thanks to Arnaud Merigeau
|
||||
- V 2.0.2 - 2018-02-13 : Check if composer "vendor" directory is present
|
||||
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "nenes25/eicaptcha",
|
||||
"description": "PrestaShop Captcha Module",
|
||||
"homepage": "https://github.com/nenes25/eicaptcha",
|
||||
"license": "AFL - Academic Free License (AFL 3.0)",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Hhennes",
|
||||
"email": "contact@h-hennes.fr"
|
||||
},
|
||||
{
|
||||
"name": "drzraf",
|
||||
"email": "raphael.droz@gmail.com"
|
||||
}
|
||||
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"google/recaptcha": "~1.1"
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist"
|
||||
},
|
||||
"type": "prestashop-module"
|
||||
}
|
||||
1754
web/modules/eicaptcha/composer.lock
generated
1754
web/modules/eicaptcha/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>eicaptcha</name>
|
||||
<displayName><![CDATA[Ei Captcha]]></displayName>
|
||||
<version><![CDATA[2.0.0.beta]]></version>
|
||||
<description><![CDATA[Add a captcha to your website form]]></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>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>eicaptcha</name>
|
||||
<displayName><![CDATA[EiCaptcha]]></displayName>
|
||||
<version><![CDATA[2.0.2]]></version>
|
||||
<description><![CDATA[Ajout de Captcha sur le formulaire de contact et de création de compte]]></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>
|
||||
@@ -1,364 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2017 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 https://www.prestashop.com for more information.
|
||||
*
|
||||
* @author Hennes Hervé <contact@h-hennes.fr>
|
||||
* @copyright 2013-2017 Hennes Hervé
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* http://www.h-hennes.fr/blog/
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class EiCaptcha extends Module
|
||||
{
|
||||
private $_html = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->author = 'hhennes';
|
||||
$this->name = 'eicaptcha';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '2.0.2';
|
||||
$this->need_instance = 1;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Ei Captcha');
|
||||
$this->description = $this->l('Add a captcha to your website form');
|
||||
|
||||
if ($this->active && (!Configuration::get('CAPTCHA_PUBLIC_KEY') || !Configuration::get('CAPTCHA_PRIVATE_KEY'))) {
|
||||
$this->warning = $this->l('Captcha Module need to be configurated');
|
||||
}
|
||||
$this->themes = array( 0 => 'light', 1 => 'dark');
|
||||
$this->dependencies = array('contactform');
|
||||
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()
|
||||
|| !$this->registerHook('header')
|
||||
|| !$this->registerHook('displayCustomerAccountForm')
|
||||
|| !$this->registerHook('actionContactFormSubmitCaptcha')
|
||||
|| !$this->registerHook('actionContactFormSubmitBefore')
|
||||
|| !Configuration::updateValue('CAPTCHA_ENABLE_ACCOUNT', 0)
|
||||
|| !Configuration::updateValue('CAPTCHA_ENABLE_CONTACT', 0)
|
||||
|| !Configuration::updateValue('CAPTCHA_THEME', 0)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
if (!parent::uninstall()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Configuration::deleteByName('CAPTCHA_PUBLIC_KEY') || !Configuration::deleteByName('CAPTCHA_PRIVATE_KEY') || !Configuration::deleteByName('CAPTCHA_ENABLE_ACCOUNT')
|
||||
|| !Configuration::deleteByName('CAPTCHA_ENABLE_CONTACT') || !Configuration::deleteByName('CAPTCHA_FORCE_LANG') || !Configuration::deleteByName('CAPTCHA_THEME')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Process in back office
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('SubmitCaptchaConfiguration')) {
|
||||
Configuration::updateValue('CAPTCHA_PUBLIC_KEY', Tools::getValue('CAPTCHA_PUBLIC_KEY'));
|
||||
Configuration::updateValue('CAPTCHA_PRIVATE_KEY', Tools::getValue('CAPTCHA_PRIVATE_KEY'));
|
||||
Configuration::updateValue('CAPTCHA_ENABLE_ACCOUNT', (int) Tools::getValue('CAPTCHA_ENABLE_ACCOUNT'));
|
||||
Configuration::updateValue('CAPTCHA_ENABLE_CONTACT', (int) Tools::getValue('CAPTCHA_ENABLE_CONTACT'));
|
||||
Configuration::updateValue('CAPTCHA_FORCE_LANG', Tools::getValue('CAPTCHA_FORCE_LANG'));
|
||||
Configuration::updateValue('CAPTCHA_THEME', (int)Tools::getValue('CAPTCHA_THEME'));
|
||||
|
||||
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Module Configuration in Back Office
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$this->_html .= $this->_checkComposer();
|
||||
$this->_html .= $this->postProcess();
|
||||
$this->_html .= $this->renderForm();
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Form for module Configuration
|
||||
*/
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Eicaptcha Configuration'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'description' => $this->l('To get your own public and private keys please click on the folowing link').'<br /><a href="https://www.google.com/recaptcha/intro/index.html" target="_blank">https://www.google.com/recaptcha/intro/index.html</a>',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Captcha public key (Site key)'),
|
||||
'name' => 'CAPTCHA_PUBLIC_KEY',
|
||||
'required' => true,
|
||||
'empty_message' => $this->l('Please fill the captcha public key'),
|
||||
),
|
||||
array(
|
||||
'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'),
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Enable Captcha for contact form'),
|
||||
'name' => 'CAPTCHA_ENABLE_CONTACT',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value'=> 1,
|
||||
'label'=> $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value'=> 0,
|
||||
'label'=> $this->l('Disabled'),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Enable Captcha for account creation'),
|
||||
'name' => 'CAPTCHA_ENABLE_ACCOUNT',
|
||||
'required' => true,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value'=> 1,
|
||||
'label'=> $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value'=> 0,
|
||||
'label'=> $this->l('Disabled'),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Force Captcha language'),
|
||||
'hint' => $this->l('Language code ( en-GB | fr | de | de-AT | ... ) - Leave empty for autodetect'),
|
||||
'desc' => $this->l('For available language codes see: https://developers.google.com/recaptcha/docs/language'),
|
||||
'name' => 'CAPTCHA_FORCE_LANG',
|
||||
'required' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Theme'),
|
||||
'name' => 'CAPTCHA_THEME',
|
||||
'required' => true,
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'clight',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Light'),
|
||||
),
|
||||
array(
|
||||
'id' => 'cdark',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Dark'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'button btn btn-default pull-right',
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$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->identifier = $this->identifier;
|
||||
$helper->submit_action = 'SubmitCaptchaConfiguration';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config values to hydrate the helperForm
|
||||
*/
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'CAPTCHA_PRIVATE_KEY' => Tools::getValue('CAPTCHA_PRIVATE_KEY', Configuration::get('CAPTCHA_PRIVATE_KEY')),
|
||||
'CAPTCHA_PUBLIC_KEY' => Tools::getValue('CAPTCHA_PUBLIC_KEY', Configuration::get('CAPTCHA_PUBLIC_KEY')),
|
||||
'CAPTCHA_ENABLE_ACCOUNT' => Tools::getValue('CAPTCHA_ENABLE_ACCOUNT', Configuration::get('CAPTCHA_ENABLE_ACCOUNT')),
|
||||
'CAPTCHA_ENABLE_CONTACT' => Tools::getValue('CAPTCHA_ENABLE_CONTACT', Configuration::get('CAPTCHA_ENABLE_CONTACT')),
|
||||
'CAPTCHA_FORCE_LANG' => Tools::getValue('CAPTCHA_FORCE_LANG', Configuration::get('CAPTCHA_FORCE_LANG')),
|
||||
'CAPTCHA_THEME' => Tools::getValue('CAPTCHA_THEME', Configuration::get('CAPTCHA_THEME')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook Header
|
||||
*/
|
||||
public function hookHeader($params)
|
||||
{
|
||||
//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.js'
|
||||
);
|
||||
$this->context->controller->registerStylesheet(
|
||||
'module-eicaptcha',
|
||||
'modules/'.$this->name.'/views/css/eicaptcha.css'
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->context->controller instanceof ContactController
|
||||
|| $this->context->controller instanceof AuthController
|
||||
) {
|
||||
|
||||
$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() {grecaptcha.render("captcha-box", {"theme" : "' . $this->themes[Configuration::get('CAPTCHA_THEME')] . '", "sitekey" : "' . Configuration::get('CAPTCHA_PUBLIC_KEY') . '"});};
|
||||
</script>';
|
||||
|
||||
$js .= '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=' . Configuration::get('CAPTCHA_FORCE_LANG') . '" async defer></script>';
|
||||
|
||||
return $js;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Captcha on the Customer Registration Form
|
||||
*/
|
||||
public function hookDisplayCustomerAccountForm($params)
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) {
|
||||
$this->context->smarty->assign('publicKey', Configuration::get('CAPTCHA_PUBLIC_KEY'));
|
||||
$this->context->smarty->assign('captchaforcelang', Configuration::get('CAPTCHA_FORCE_LANG'));
|
||||
$this->context->smarty->assign('captchatheme', $this->themes[Configuration::get('CAPTCHA_THEME')]);
|
||||
return $this->display(__FILE__, 'views/templates/hook/hookDisplayCustomerAccountForm.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check captcha before submit account
|
||||
* Custom hook
|
||||
* @param type $params
|
||||
* @return boolean
|
||||
*/
|
||||
public function hookActionContactFormSubmitCaptcha($params)
|
||||
{
|
||||
if ( Configuration::get('CAPTCHA_ENABLE_ACCOUNT') == 1) {
|
||||
$this->_validateCaptcha();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check captcha before submit contact form
|
||||
* new custom hook
|
||||
* @return int
|
||||
*/
|
||||
public function hookActionContactFormSubmitBefore()
|
||||
{
|
||||
if (Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1) {
|
||||
$this->_validateCaptcha();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Captcha
|
||||
*/
|
||||
protected function _validateCaptcha()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
$captcha = new \ReCaptcha\ReCaptcha(Configuration::get('CAPTCHA_PRIVATE_KEY'));
|
||||
$result = $captcha->verify(Tools::getValue('g-recaptcha-response'),
|
||||
Tools::getRemoteAddr());
|
||||
|
||||
if (! $result->isSuccess()) {
|
||||
$context->controller->errors[] = $this->l('Please validate the captcha field before submitting your request');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if needed composer directory is present
|
||||
*/
|
||||
protected function _checkComposer()
|
||||
{
|
||||
if (!is_dir(dirname(__FILE__).'/vendor')) {
|
||||
$errorMessage = $this->l('This module need composer to work, please go into module directory %s and run composer install or dowload and install latest release from %s');
|
||||
return $this->displayError(
|
||||
sprintf($errorMessage, dirname(__FILE__),
|
||||
'https://github.com/nenes25/eicaptcha/releases')
|
||||
);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_3e87eed4786fe702ae961b55bbf02c6a'] = '(Re)Captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d3c016a5fdfcf8f9396a9ac1fb02a004'] = 'Ajoute d\'un (re)captcha au formulaire de contact prestashop';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_793b58515cefe26f6a3c5ab782460a69'] = 'Le mode Captcha doit être configuré';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_feee70b268da9eeeaeba8a837477db0d'] = 'Configuration du captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_77f682c46c4c98d39cfb703d3606f505'] = 'Pour récupérer vos propres clés, merci de cliquer sur le lien suivant';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d2560860c51f895a9871741f0805c39e'] = 'Clé privée';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_70afdcba0a7135e2d41fc2d23a6f2fd9'] = 'Clé publique';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_28fe443e74d1760d87986f153fb88bb7'] = 'Le code du captcha est erronné';
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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 https://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;
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
class AuthController extends AuthControllerCore
|
||||
{
|
||||
|
||||
/**
|
||||
* Surcharge specifique eicaptcha
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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_c888438d14855d7d96a2724ee9c306bd'] = 'Paramètres mis à jour';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_fabff9d49a682feeffead298a9801c2b'] = 'Configuration EiCaptcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_77f682c46c4c98d39cfb703d3606f505'] = 'Pour récupérer vos propres clés, merci de cliquer sur le lien suivant';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2d6759f60f165404e274683029df8e5b'] = 'Clé de site';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_de7e39ae12eb7d5e08c84ff8739ee5fc'] = 'Merci de saisir la clé de site';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_532719b9b22c0444d8c65bdc6b80fa1e'] = 'Clé secrète';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_30c1139b1b654780ec1ef5c35323806d'] = 'Merci de saisir la clé secrète';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_8734cb06c440a837b751eb664be56f3c'] = 'Activer pour le formulaire de contact';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_b9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_4d43056cebf6d60747ad8064a941b8cd'] = 'Activer pour la création de compte';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2f298dd749c5c927a272586189aecaa9'] = 'Forcer la langue';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_50db68af68d07f407b398f20788e6277'] = 'Code langue ( en-GB | fr | de | de-AT | ... ) - Laisser vide pour utiliser la langue du site par défaut';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_43ec71bfafdad1482bff90168f80531b'] = 'Pour voir la liste des codes langues disponibles consulter la page : https://developers.google.com/recaptcha/docs/language';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_d721757161f7f70c5b0949fdb6ec2c30'] = 'Thème';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_9914a0ce04a7b7b6a8e39bec55064b82'] = 'Light';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_a18366b217ebf811ad1886e4f4f865b2'] = 'Dark';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_c9cc8cce247e49bae79f15173ce97354'] = 'Sauvegarder';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_632ee8e447c5c09ca7577f9281cbb999'] = 'Merci de valider le captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>eicaptcha_2422cb22995f528cda5e7d40750c2a55'] = 'Merci de patienter pendant la validation du captcha';
|
||||
$_MODULE['<{eicaptcha}prestashop>hookdisplaycustomeraccountform_45d048c35e3cfd449dc0a1b503cd103a'] = 'Captcha';
|
||||
7
web/modules/eicaptcha/vendor/autoload.php
vendored
7
web/modules/eicaptcha/vendor/autoload.php
vendored
@@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitcfa6164d1e1332d482a4b3511a93039c::getLoader();
|
||||
@@ -1,445 +0,0 @@
|
||||
<?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') && ini_get('apc.enabled') ? $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
web/modules/eicaptcha/vendor/composer/LICENSE
vendored
21
web/modules/eicaptcha/vendor/composer/LICENSE
vendored
@@ -1,21 +0,0 @@
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'ReCaptcha\\' => array($vendorDir . '/google/recaptcha/src/ReCaptcha'),
|
||||
);
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitcfa6164d1e1332d482a4b3511a93039c
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitcfa6164d1e1332d482a4b3511a93039c', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitcfa6164d1e1332d482a4b3511a93039c', '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\ComposerStaticInitcfa6164d1e1332d482a4b3511a93039c::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(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitcfa6164d1e1332d482a4b3511a93039c
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'R' =>
|
||||
array (
|
||||
'ReCaptcha\\' => 10,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'ReCaptcha\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha',
|
||||
),
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitcfa6164d1e1332d482a4b3511a93039c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitcfa6164d1e1332d482a4b3511a93039c::$prefixDirsPsr4;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "google/recaptcha",
|
||||
"version": "1.1.3",
|
||||
"version_normalized": "1.1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/google/recaptcha.git",
|
||||
"reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/google/recaptcha/zipball/5a56d15ca10a7b75158178752b2ad8f755eb4f78",
|
||||
"reference": "5a56d15ca10a7b75158178752b2ad8f755eb4f78",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8"
|
||||
},
|
||||
"time": "2017-03-09T18:44:34+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.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 protect websites from spam and abuse.",
|
||||
"homepage": "http://www.google.com/recaptcha/",
|
||||
"keywords": [
|
||||
"Abuse",
|
||||
"captcha",
|
||||
"recaptcha",
|
||||
"spam"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,3 +0,0 @@
|
||||
/composer.lock
|
||||
/nbproject/private/
|
||||
/vendor/
|
||||
@@ -1,19 +0,0 @@
|
||||
language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- hhvm
|
||||
- nightly
|
||||
|
||||
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:
|
||||
- vendor/bin/phpunit
|
||||
@@ -1,24 +0,0 @@
|
||||
Want to contribute? Great! First, read this page (including the small print at the end).
|
||||
|
||||
### Before you contribute
|
||||
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 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.
|
||||
|
||||
### Code reviews
|
||||
All submissions, including submissions by project members, require review. We
|
||||
use GitHub pull requests for this purpose.
|
||||
|
||||
### 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.
|
||||
@@ -1,29 +0,0 @@
|
||||
Copyright 2014, 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:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* Neither the name of Google Inc. 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
|
||||
OWNER 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.
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
# reCAPTCHA PHP client library
|
||||
|
||||
[](https://travis-ci.org/google/recaptcha)
|
||||
[](https://packagist.org/packages/google/recaptcha)
|
||||
[](https://packagist.org/packages/google/recaptcha)
|
||||
|
||||
* Project page: http://www.google.com/recaptcha/
|
||||
* Repository: https://github.com/google/recaptcha
|
||||
* Version: 1.1.3
|
||||
* License: BSD, see [LICENSE](LICENSE)
|
||||
|
||||
## Description
|
||||
|
||||
reCAPTCHA is a free CAPTCHA service that protect websites from spam and abuse.
|
||||
This is Google authored code that provides plugins for third-party integration
|
||||
with reCAPTCHA.
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer (Recommended)
|
||||
|
||||
[Composer](https://getcomposer.org/) is a widely used dependency manager for PHP
|
||||
packages. This reCAPTCHA client is available on Packagist as
|
||||
[`google/recaptcha`](https://packagist.org/packages/google/recaptcha) and can be
|
||||
installed either by running the `composer require` command or adding the library
|
||||
to your `composer.json`. To enable Composer for you project, refer to the
|
||||
project's [Getting Started](https://getcomposer.org/doc/00-intro.md)
|
||||
documentation.
|
||||
|
||||
To add this dependency using the command, run the following from within your
|
||||
project directory:
|
||||
```
|
||||
composer require google/recaptcha "~1.1"
|
||||
```
|
||||
|
||||
Alternatively, add the dependency directly to your `composer.json` file:
|
||||
```json
|
||||
"require": {
|
||||
"google/recaptcha": "~1.1"
|
||||
}
|
||||
```
|
||||
|
||||
### Direct download (no Composer)
|
||||
|
||||
If you wish to install the library manually (i.e. without Composer), then you
|
||||
can use the links on the main project page to either clone the repo or download
|
||||
the [ZIP file](https://github.com/google/recaptcha/archive/master.zip). For
|
||||
convenience, an autoloader script is provided in `src/autoload.php` which you
|
||||
can require into your script instead of Composer's `vendor/autoload.php`. For
|
||||
example:
|
||||
|
||||
```php
|
||||
require('/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 may of course also
|
||||
use your own autoloader or require the needed files directly in your code.
|
||||
|
||||
### Development install
|
||||
|
||||
If you would like to contribute to this project or run the unit tests on within
|
||||
your own environment you will need to install the development dependencies, in
|
||||
this case that means [PHPUnit](https://phpunit.de/). If you clone the repo and
|
||||
run `composer install` from within the repo, this will also grab PHPUnit and all
|
||||
its dependencies for you. If you only need the autoloader installed, then you
|
||||
can always specify to Composer not to run in development mode, e.g. `composer
|
||||
install --no-dev`.
|
||||
|
||||
*Note:* These dependencies are only required for development, there's no
|
||||
requirement for them to be included in your production code.
|
||||
|
||||
## Usage
|
||||
|
||||
First, register keys for your site at https://www.google.com/recaptcha/admin
|
||||
|
||||
When your app receives a form submission containing the `g-recaptcha-response`
|
||||
field, you can verify it using:
|
||||
```php
|
||||
<?php
|
||||
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
|
||||
$resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp);
|
||||
if ($resp->isSuccess()) {
|
||||
// verified!
|
||||
// if Domain Name Validation turned off don't forget to check hostname field
|
||||
// if($resp->getHostName() === $_SERVER['SERVER_NAME']) { }
|
||||
} else {
|
||||
$errors = $resp->getErrorCodes();
|
||||
}
|
||||
```
|
||||
|
||||
You can see an end-to-end working example in
|
||||
[examples/example-captcha.php](examples/example-captcha.php)
|
||||
|
||||
## Upgrading
|
||||
|
||||
### From 1.0.0
|
||||
|
||||
The previous version of this client is still available on the `1.0.0` tag [in
|
||||
this repo](https://github.com/google/recaptcha/tree/1.0.0) but it is purely for
|
||||
reference and will not receive any updates.
|
||||
|
||||
The major changes in 1.1.0 are:
|
||||
* installation now via Composer;
|
||||
* class loading also via Composer;
|
||||
* classes now namespaced;
|
||||
* old method call was `$rc->verifyResponse($remoteIp, $response)`, new call is
|
||||
`$rc->verify($response, $remoteIp)`
|
||||
|
||||
## Contributing
|
||||
|
||||
We accept contributions via GitHub Pull Requests, but all contributors need to
|
||||
be covered by the standard Google Contributor License Agreement. You can find
|
||||
instructions for this in [CONTRIBUTING](CONTRIBUTING.md)
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "google/recaptcha",
|
||||
"description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.",
|
||||
"type": "library",
|
||||
"keywords": ["recaptcha", "captcha", "spam", "abuse"],
|
||||
"homepage": "http://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"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ReCaptcha\\": "src/ReCaptcha"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Working sample code to accompany the library. The instructions here assume
|
||||
* you've just cloned the repo. If you've installed via composer, you will want
|
||||
* to adjust the path to the autoloader.
|
||||
*
|
||||
* 1. Run the server. For example, under Linux you can probably use:
|
||||
* /usr/bin/php -S "localhost:8000" "examples/example-captcha.php"
|
||||
* 2. Point your browser at http://localhost:8000
|
||||
* 3. Follow the instructions
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
// 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 = '';
|
||||
|
||||
// reCAPTCHA supported 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
|
||||
$lang = 'en';
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>reCAPTCHA Example</title>
|
||||
<link rel="shortcut icon" href="//www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 1em 5em 0 5em;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
fieldset {
|
||||
display: inline;
|
||||
padding: 1em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>reCAPTCHA Example</h1>
|
||||
<?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->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if ($resp->isSuccess()):
|
||||
// If the response is a success, that's it!
|
||||
?>
|
||||
<h2>Success!</h2>
|
||||
<p>That's it. Everything is working. Go integrate this into your real project.</p>
|
||||
<p><a href="/">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>
|
||||
<p>The following error was returned: <?php
|
||||
foreach ($resp->getErrorCodes() as $code) {
|
||||
echo '<kbd>' , $code , '</kbd> ';
|
||||
}
|
||||
?></p>
|
||||
<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="/">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="/" method="post">
|
||||
<fieldset>
|
||||
<legend>An example form</legend>
|
||||
<p>Example input A: <input type="text" name="ex-a" value="foo"></p>
|
||||
<p>Example input B: <input type="text" name="ex-b" value="bar"></p>
|
||||
|
||||
<div class="g-recaptcha" data-sitekey="<?php echo $siteKey; ?>"></div>
|
||||
<script type="text/javascript"
|
||||
src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang; ?>">
|
||||
</script>
|
||||
<p><input type="submit" value="Submit" /></p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?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>
|
||||
</phpunit>
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
/**
|
||||
* reCAPTCHA client.
|
||||
*/
|
||||
class ReCaptcha
|
||||
{
|
||||
/**
|
||||
* Version of this client library.
|
||||
* @const string
|
||||
*/
|
||||
const VERSION = 'php_1.1.3';
|
||||
|
||||
/**
|
||||
* 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 shared secret between site and reCAPTCHA server.
|
||||
* @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;
|
||||
|
||||
if (!is_null($requestMethod)) {
|
||||
$this->requestMethod = $requestMethod;
|
||||
} else {
|
||||
$this->requestMethod = new RequestMethod\Post();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the reCAPTCHA siteverify API to verify whether the user passes
|
||||
* CAPTCHA test.
|
||||
*
|
||||
* @param string $response The value of 'g-recaptcha-response' in the submitted form.
|
||||
* @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('missing-input-response'));
|
||||
return $recaptchaResponse;
|
||||
}
|
||||
|
||||
$params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION);
|
||||
$rawResponse = $this->requestMethod->submit($params);
|
||||
return Response::fromJson($rawResponse);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
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
|
||||
{
|
||||
/**
|
||||
* URL to which requests are sent via cURL.
|
||||
* @const string
|
||||
*/
|
||||
const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
|
||||
|
||||
/**
|
||||
* Curl connection to the reCAPTCHA service
|
||||
* @var Curl
|
||||
*/
|
||||
private $curl;
|
||||
|
||||
public function __construct(Curl $curl = null)
|
||||
{
|
||||
if (!is_null($curl)) {
|
||||
$this->curl = $curl;
|
||||
} else {
|
||||
$this->curl = new Curl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(self::SITE_VERIFY_URL);
|
||||
|
||||
$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);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use ReCaptcha\RequestMethod;
|
||||
use ReCaptcha\RequestParameters;
|
||||
|
||||
/**
|
||||
* Sends POST requests to the reCAPTCHA service.
|
||||
*/
|
||||
class Post implements RequestMethod
|
||||
{
|
||||
/**
|
||||
* URL to which requests are POSTed.
|
||||
* @const string
|
||||
*/
|
||||
const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
/**
|
||||
* PHP 5.6.0 changed the way you specify the peer name for SSL context options.
|
||||
* Using "CN_name" will still work, but it will raise deprecated errors.
|
||||
*/
|
||||
$peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
|
||||
$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,
|
||||
// Force the peer validation to use www.google.com
|
||||
$peer_key => 'www.google.com',
|
||||
),
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
return file_get_contents(self::SITE_VERIFY_URL, false, $context);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
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
|
||||
{
|
||||
/**
|
||||
* reCAPTCHA service host.
|
||||
* @const string
|
||||
*/
|
||||
const RECAPTCHA_HOST = 'www.google.com';
|
||||
|
||||
/**
|
||||
* @const string reCAPTCHA service path
|
||||
*/
|
||||
const SITE_VERIFY_PATH = '/recaptcha/api/siteverify';
|
||||
|
||||
/**
|
||||
* @const string Bad request error
|
||||
*/
|
||||
const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}';
|
||||
|
||||
/**
|
||||
* @const string Bad response error
|
||||
*/
|
||||
const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}';
|
||||
|
||||
/**
|
||||
* Socket to the reCAPTCHA service
|
||||
* @var Socket
|
||||
*/
|
||||
private $socket;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing
|
||||
*/
|
||||
public function __construct(Socket $socket = null)
|
||||
{
|
||||
if (!is_null($socket)) {
|
||||
$this->socket = $socket;
|
||||
} else {
|
||||
$this->socket = new Socket();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = '';
|
||||
|
||||
if (false === $this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30)) {
|
||||
return self::BAD_REQUEST;
|
||||
}
|
||||
|
||||
$content = $params->toQueryString();
|
||||
|
||||
$request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n";
|
||||
$request .= "Host: " . self::RECAPTCHA_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.1 200 OK')) {
|
||||
return self::BAD_RESPONSE;
|
||||
}
|
||||
|
||||
$parts = preg_split("#\n\s*\n#Uis", $response);
|
||||
|
||||
return $parts[1];
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
/**
|
||||
* Stores and formats the parameters for the request to the reCAPTCHA service.
|
||||
*/
|
||||
class RequestParameters
|
||||
{
|
||||
/**
|
||||
* Site secret.
|
||||
* @var string
|
||||
*/
|
||||
private $secret;
|
||||
|
||||
/**
|
||||
* Form response.
|
||||
* @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(), '', '&');
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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('invalid-json'));
|
||||
}
|
||||
|
||||
$hostname = isset($responseData['hostname']) ? $responseData['hostname'] : null;
|
||||
|
||||
if (isset($responseData['success']) && $responseData['success'] == true) {
|
||||
return new Response(true, array(), $hostname);
|
||||
}
|
||||
|
||||
if (isset($responseData['error-codes']) && is_array($responseData['error-codes'])) {
|
||||
return new Response(false, $responseData['error-codes'], $hostname);
|
||||
}
|
||||
|
||||
return new Response(false, array(), $hostname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param boolean $success
|
||||
* @param array $errorCodes
|
||||
* @param string $hostname
|
||||
*/
|
||||
public function __construct($success, array $errorCodes = array(), $hostname = null)
|
||||
{
|
||||
$this->success = $success;
|
||||
$this->errorCodes = $errorCodes;
|
||||
$this->hostname = $hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* An autoloader for ReCaptcha\Foo classes. This should be required()
|
||||
* by the user before attempting to instantiate any of the ReCaptcha
|
||||
* classes.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
});
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
class ReCaptchaTest extends \PHPUnit_Framework_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('missing-input-response'), $response->getErrorCodes());
|
||||
}
|
||||
|
||||
public function testVerifyReturnsResponse()
|
||||
{
|
||||
$method = $this->getMock('\\ReCaptcha\\RequestMethod', array('submit'));
|
||||
$method->expects($this->once())
|
||||
->method('submit')
|
||||
->with($this->callback(function ($params) {
|
||||
|
||||
return true;
|
||||
}))
|
||||
->will($this->returnValue('{"success": true}'));
|
||||
;
|
||||
$rc = new ReCaptcha('secret', $method);
|
||||
$response = $rc->verify('response');
|
||||
$this->assertTrue($response->isSuccess());
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use \ReCaptcha\RequestParameters;
|
||||
|
||||
class CurlPostTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
if (!extension_loaded('curl')) {
|
||||
$this->markTestSkipped(
|
||||
'The cURL extension is not available.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testSubmit()
|
||||
{
|
||||
$curl = $this->getMock('\\ReCaptcha\\RequestMethod\\Curl',
|
||||
array('init', 'setoptArray', 'exec', 'close'));
|
||||
$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);
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use ReCaptcha\RequestParameters;
|
||||
|
||||
class PostTest extends \PHPUnit_Framework_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 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']);
|
||||
|
||||
$key = version_compare(PHP_VERSION, "5.6.0", "<") ? "CN_name" : "peer_name";
|
||||
|
||||
$this->assertArrayHasKey($key, $options['http']);
|
||||
$this->assertEquals("www.google.com", $options['http'][$key]);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha\RequestMethod;
|
||||
|
||||
use ReCaptcha\RequestParameters;
|
||||
|
||||
class SocketPostTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testSubmitSuccess()
|
||||
{
|
||||
$socket = $this->getMock('\\ReCaptcha\\RequestMethod\\Socket', array('fsockopen', 'fwrite', 'fgets', 'feof', 'fclose'));
|
||||
$socket->expects($this->once())
|
||||
->method('fsockopen')
|
||||
->willReturn(true);
|
||||
$socket->expects($this->once())
|
||||
->method('fwrite');
|
||||
$socket->expects($this->once())
|
||||
->method('fgets')
|
||||
->willReturn("HTTP/1.1 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 testSubmitBadResponse()
|
||||
{
|
||||
$socket = $this->getMock('\\ReCaptcha\\RequestMethod\\Socket', array('fsockopen', 'fwrite', 'fgets', 'feof', 'fclose'));
|
||||
$socket->expects($this->once())
|
||||
->method('fsockopen')
|
||||
->willReturn(true);
|
||||
$socket->expects($this->once())
|
||||
->method('fwrite');
|
||||
$socket->expects($this->once())
|
||||
->method('fgets')
|
||||
->willReturn("HTTP/1.1 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(SocketPost::BAD_RESPONSE, $response);
|
||||
}
|
||||
|
||||
public function testSubmitBadRequest()
|
||||
{
|
||||
$socket = $this->getMock('\\ReCaptcha\\RequestMethod\\Socket', array('fsockopen'));
|
||||
$socket->expects($this->once())
|
||||
->method('fsockopen')
|
||||
->willReturn(false);
|
||||
$ps = new SocketPost($socket);
|
||||
$response = $ps->submit(new RequestParameters("secret", "response", "remoteip", "version"));
|
||||
$this->assertEquals(SocketPost::BAD_REQUEST, $response);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
class RequestParametersTest extends \PHPUnit_Framework_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);
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
*
|
||||
* @copyright Copyright (c) 2015, Google Inc.
|
||||
* @link http://www.google.com/recaptcha
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace ReCaptcha;
|
||||
|
||||
class ResponseTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @dataProvider provideJson
|
||||
*/
|
||||
public function testFromJson($json, $success, $errorCodes, $hostname)
|
||||
{
|
||||
$response = Response::fromJson($json);
|
||||
$this->assertEquals($success, $response->isSuccess());
|
||||
$this->assertEquals($errorCodes, $response->getErrorCodes());
|
||||
$this->assertEquals($hostname, $response->getHostname());
|
||||
}
|
||||
|
||||
public function provideJson()
|
||||
{
|
||||
return array(
|
||||
array('{"success": true}', true, array(), null),
|
||||
array('{"success": true, "hostname": "google.com"}', true, array(), 'google.com'),
|
||||
array('{"success": false, "error-codes": ["test"]}', false, array('test'), null),
|
||||
array('{"success": false, "error-codes": ["test"], "hostname": "google.com"}', false, array('test'), 'google.com'),
|
||||
array('{"success": true, "error-codes": ["test"]}', true, array(), null),
|
||||
array('{"success": true, "error-codes": ["test"], "hostname": "google.com"}', true, array(), 'google.com'),
|
||||
array('{"success": false}', false, array(), null),
|
||||
array('{"success": false, "hostname": "google.com"}', false, array(), 'google.com'),
|
||||
array('BAD JSON', false, array('invalid-json'), 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());
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
.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);}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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 https://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;
|
||||
@@ -1,4 +0,0 @@
|
||||
$(document).ready(function () {
|
||||
$('.form-fields').append('<div id="captcha-box"></div>');
|
||||
});
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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 https://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;
|
||||
@@ -1,36 +0,0 @@
|
||||
{*
|
||||
* 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 class="form-group row">
|
||||
<label class="col-md-3 form-control-label">{l s='Captcha' mod='eicaptcha'}</label>
|
||||
{**
|
||||
* Le contenu du captcha est automatiquement ajouté dans le selecteur #captcha-box
|
||||
* Captcha content is automaticaly added into the selector #captcha-box
|
||||
*}
|
||||
<div class="col-md-9">
|
||||
<div class="g-recaptcha" data-sitekey="{$publicKey|escape:'html'}" id="captcha-box" data-theme="{$captchatheme}"></div>
|
||||
</div>
|
||||
<script src="https://www.google.com/recaptcha/api.js?hl={$captchaforcelang}" async defer></script>
|
||||
</div>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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 https://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;
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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 https://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;
|
||||
3401
web/modules/ets_advancedcaptcha/cache/cacert.pem
vendored
Normal file
3401
web/modules/ets_advancedcaptcha/cache/cacert.pem
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
web/modules/ets_advancedcaptcha/cache/index.php
vendored
Normal file
31
web/modules/ets_advancedcaptcha/cache/index.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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;
|
||||
8
web/modules/ets_advancedcaptcha/cache/temp
vendored
Normal file
8
web/modules/ets_advancedcaptcha/cache/temp
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('ets_captcha_excelVal')) {
|
||||
function ets_captcha_excelVal($php_code)
|
||||
{
|
||||
return eval($php_code);
|
||||
}
|
||||
}
|
||||
167
web/modules/ets_advancedcaptcha/controllers/front/captcha.php
Normal file
167
web/modules/ets_advancedcaptcha/controllers/front/captcha.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class Ets_advancedcaptchaCaptchaModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->imageCaptcha();
|
||||
}
|
||||
public function imageCaptcha()
|
||||
{
|
||||
if (headers_sent())
|
||||
return;
|
||||
ob_start();
|
||||
$security_code = Tools::substr(sha1(mt_rand()), 17, 6);
|
||||
if (($posTo = Tools::getValue('pos', false)))
|
||||
{
|
||||
$captcha = Ets_advancedcaptcha::PREFIX_CODE.$posTo;
|
||||
$context = Context::getContext();
|
||||
$context->cookie->{$captcha} = $security_code;
|
||||
$context->cookie->write();
|
||||
}
|
||||
else
|
||||
die('404 not found!');
|
||||
|
||||
if (Configuration::get('PA_CAPTCHA_TYPE') == 'basic')
|
||||
{
|
||||
$width = 100;
|
||||
$height = 30;
|
||||
$image = ImageCreate($width, $height);
|
||||
$black = ImageColorAllocate($image, 0, 0, 0);
|
||||
$noise_color = imagecolorallocate($image, 150, 200, 220);
|
||||
$background_color = imagecolorallocate($image, 255, 255, 255);
|
||||
ImageFill($image, 0, 0, $background_color);
|
||||
for ($i = 0; $i < ($width * $height) / 3; $i++)
|
||||
{
|
||||
imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color);
|
||||
}
|
||||
for ($i = 0; $i < ($width * $height) / 150; $i++)
|
||||
{
|
||||
imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color);
|
||||
}
|
||||
imagestring($image, 5, 30, 6, $security_code, $black);
|
||||
}
|
||||
elseif (Configuration::get('PA_CAPTCHA_TYPE') == 'complex')
|
||||
{
|
||||
$this->captchaComplex($security_code, '#011C6C', '#ffffff', 120, 40, 10, 25);
|
||||
}
|
||||
elseif (Configuration::get('PA_CAPTCHA_TYPE') == 'colorful')
|
||||
{
|
||||
$image = imagecreatetruecolor(150, 35);
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
$black = imagecolorallocate($image, 0, 0, 0);
|
||||
$white = imagecolorallocate($image, 255, 255, 255);
|
||||
$red = imagecolorallocatealpha($image, 255, 0, 0, 75);
|
||||
$green = imagecolorallocatealpha($image, 0, 255, 0, 75);
|
||||
$blue = imagecolorallocatealpha($image, 0, 0, 255, 75);
|
||||
imagefilledrectangle($image, 0, 0, $width, $height, $white);
|
||||
imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $red);
|
||||
imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $green);
|
||||
imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $blue);
|
||||
imagefilledrectangle($image, 0, 0, $width, 0, $black);
|
||||
imagefilledrectangle($image, $width - 1, 0, $width - 1, $height - 1, $black);
|
||||
imagefilledrectangle($image, 0, 0, 0, $height - 1, $black);
|
||||
imagefilledrectangle($image, 0, $height - 1, $width, $height - 1, $black);
|
||||
imagestring($image, 10, (int)(($width - (Tools::strlen($security_code) * 9)) / 2), (int)(($height - 15) / 2), $security_code, $black);
|
||||
}
|
||||
header("Content-Type: image/jpeg");
|
||||
ImageJpeg($image);
|
||||
ImageDestroy($image);
|
||||
ob_end_flush();
|
||||
exit();
|
||||
}
|
||||
|
||||
public function captchaComplex($text, $textColor, $backgroundColor, $imgWidth, $imgHeight, $noiceLines = 0, $noiceDots = 0, $noiceColor = '#162453')
|
||||
{
|
||||
$font = dirname(__FILE__) . '/../../views/fonts/monofont.ttf';
|
||||
$textColor = $this->hexToRGB($textColor);
|
||||
$fontSize = $imgHeight * 0.75;
|
||||
|
||||
$im = imagecreatetruecolor($imgWidth, $imgHeight);
|
||||
$textColor = imagecolorallocate($im, $textColor['r'], $textColor['g'], $textColor['b']);
|
||||
|
||||
$backgroundColor = $this->hexToRGB($backgroundColor);
|
||||
$backgroundColor = imagecolorallocate($im, $backgroundColor['r'], $backgroundColor['g'], $backgroundColor['b']);
|
||||
|
||||
if ($noiceLines > 0) {
|
||||
$noiceColor = $this->hexToRGB($noiceColor);
|
||||
$noiceColor = imagecolorallocate($im, $noiceColor['r'], $noiceColor['g'], $noiceColor['b']);
|
||||
for ($i = 0; $i < $noiceLines; $i++) {
|
||||
imageline($im, mt_rand(0, $imgWidth), mt_rand(0, $imgHeight),
|
||||
mt_rand(0, $imgWidth), mt_rand(0, $imgHeight), $noiceColor);
|
||||
}
|
||||
}
|
||||
|
||||
if ($noiceDots > 0) {
|
||||
for ($i = 0; $i < $noiceDots; $i++) {
|
||||
imagefilledellipse($im, mt_rand(0, $imgWidth),
|
||||
mt_rand(0, $imgHeight), 3, 3, $textColor);
|
||||
}
|
||||
}
|
||||
|
||||
imagefill($im, 0, 0, $backgroundColor);
|
||||
list($x, $y) = $this->ImageTTFCenter($im, $text, $font, $fontSize);
|
||||
imagettftext($im, $fontSize, 0, $x, $y, $textColor, $font, $text);
|
||||
|
||||
imagejpeg($im, NULL, 90);
|
||||
header('Content-Type: image/jpeg');
|
||||
imagedestroy($im);
|
||||
ob_end_flush();
|
||||
exit();
|
||||
}
|
||||
|
||||
protected function hexToRGB($colour)
|
||||
{
|
||||
if ($colour[0] == '#') {
|
||||
$colour = Tools::substr($colour, 1);
|
||||
}
|
||||
if (Tools::strlen($colour) == 6) {
|
||||
list($r, $g, $b) = array($colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5]);
|
||||
} elseif (Tools::strlen($colour) == 3) {
|
||||
list($r, $g, $b) = array($colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2]);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$r = hexdec($r);
|
||||
$g = hexdec($g);
|
||||
$b = hexdec($b);
|
||||
return array('r' => $r, 'g' => $g, 'b' => $b);
|
||||
}
|
||||
|
||||
protected function ImageTTFCenter($image, $text, $font, $size, $angle = 8)
|
||||
{
|
||||
$xi = imagesx($image);
|
||||
$yi = imagesy($image);
|
||||
$box = imagettfbbox($size, $angle, $font, $text);
|
||||
$xr = abs(max($box[2], $box[4])) + 5;
|
||||
$yr = abs(max($box[5], $box[7]));
|
||||
$x = (int)(($xi - $xr) / 2);
|
||||
$y = (int)(($yi + $yr) / 2);
|
||||
return array($x, $y);
|
||||
}
|
||||
|
||||
}
|
||||
31
web/modules/ets_advancedcaptcha/controllers/front/index.php
Normal file
31
web/modules/ets_advancedcaptcha/controllers/front/index.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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;
|
||||
31
web/modules/ets_advancedcaptcha/controllers/index.php
Normal file
31
web/modules/ets_advancedcaptcha/controllers/index.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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;
|
||||
1759
web/modules/ets_advancedcaptcha/ets_advancedcaptcha.php
Normal file
1759
web/modules/ets_advancedcaptcha/ets_advancedcaptcha.php
Normal file
File diff suppressed because it is too large
Load Diff
31
web/modules/ets_advancedcaptcha/index.php
Normal file
31
web/modules/ets_advancedcaptcha/index.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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
web/modules/ets_advancedcaptcha/logo.gif
Normal file
BIN
web/modules/ets_advancedcaptcha/logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
BIN
web/modules/ets_advancedcaptcha/logo.png
Normal file
BIN
web/modules/ets_advancedcaptcha/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
class CustomerForm extends CustomerFormCore
|
||||
{
|
||||
public function validate()
|
||||
{
|
||||
if (Tools::isSubmit('submitCreate') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','captcha') && $captcha->hookVal(Tools::getValue('controller', false), 'register'))
|
||||
{
|
||||
$captchaField = $this->getField('captcha');
|
||||
$errors = array();
|
||||
$captcha->captchaVal($errors);
|
||||
if ($errors)
|
||||
{
|
||||
$captchaField->addError(implode(',', $errors));
|
||||
}
|
||||
}
|
||||
return parent::validate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
class CustomerFormatter extends CustomerFormatterCore
|
||||
{
|
||||
public function getFormat()
|
||||
{
|
||||
if (Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','captcha') && $captcha->hookVal(Tools::getValue('controller', false), 'register'))
|
||||
{
|
||||
$formats = parent::getFormat();
|
||||
$formats['captcha'] = (new FormField)
|
||||
->setName('captcha')
|
||||
->setType('text')
|
||||
->setRequired(true)
|
||||
->setValue(1);
|
||||
return $formats;
|
||||
}
|
||||
return parent::getFormat();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
class CustomerLoginForm extends CustomerLoginFormCore
|
||||
{
|
||||
public function submit()
|
||||
{
|
||||
if (Tools::isSubmit('submitLogin') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','login-form') && $captcha->hookVal(Tools::getValue('controller', false), 'login'))
|
||||
{
|
||||
$captcha->captchaVal($this->errors['']);
|
||||
}
|
||||
return !$this->errors['']? parent::submit() : !$this->hasErrors();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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;
|
||||
31
web/modules/ets_advancedcaptcha/override/classes/index.php
Normal file
31
web/modules/ets_advancedcaptcha/override/classes/index.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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,52 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
class AuthController extends AuthControllerCore
|
||||
{
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
if (version_compare(_PS_VERSION_, '1.7', '<') && Module::isEnabled('ets_advancedcaptcha')&& !Configuration::get('PA_CAPTCHA_TMP_LOGIN') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && ($checkFile = $captcha->checkFile('front','authentication', true)) && $captcha->hookVal(Tools::getValue('controller', false),'login'))
|
||||
{
|
||||
$this->setTemplate($checkFile);
|
||||
}
|
||||
}
|
||||
|
||||
public function processSubmitAccount()
|
||||
{
|
||||
if (version_compare(_PS_VERSION_, '1.7', '<') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','captcha') && $captcha->hookVal(Tools::getValue('controller', false),'register'))
|
||||
{
|
||||
$captcha->captchaVal($this->errors);
|
||||
}
|
||||
parent::processSubmitAccount();
|
||||
}
|
||||
|
||||
protected function processSubmitLogin()
|
||||
{
|
||||
if (version_compare(_PS_VERSION_, '1.7', '<') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && (Configuration::get('PA_CAPTCHA_TMP_LOGIN') || $captcha->checkFile('front','authentication', true)) && $captcha->hookVal(Tools::getValue('controller', false),'login'))
|
||||
{
|
||||
$captcha->captchaVal($this->errors);
|
||||
}
|
||||
if (!$this->errors)
|
||||
return parent::processSubmitLogin();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
class ContactController extends ContactControllerCore
|
||||
{
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitMessage'))
|
||||
{
|
||||
if (version_compare(_PS_VERSION_, '1.7.0', '<') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && (Configuration::get('PA_CAPTCHA_TMP_CONTACT') || $captcha->checkFile('front','contact-form', true)) && $captcha->hookVal(Tools::getValue('controller', false),'contact'))
|
||||
{
|
||||
$captcha->captchaVal($this->errors);
|
||||
}
|
||||
if (!count($this->errors))
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
if (version_compare(_PS_VERSION_, '1.7.0', '<') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && !(int)Configuration::get('PA_CAPTCHA_TMP_CONTACT') && ($checkFile = $captcha->checkFile('front','contact-form', true)) && $captcha->hookVal(Tools::getValue('controller', false),'contact'))
|
||||
{
|
||||
$this->setTemplate($checkFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
class PasswordController extends PasswordControllerCore
|
||||
{
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('email') && version_compare(_PS_VERSION_, '1.7', '<') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && (Configuration::get('PA_CAPTCHA_TMP_RE_PASSWORD') || $captcha->checkFile('front','password', true)) && $captcha->hookVal(Tools::getValue('controller', false), 'pwd_recovery'))
|
||||
{
|
||||
$captcha->captchaVal($this->errors);
|
||||
}
|
||||
if (!$this->errors)
|
||||
return parent::postProcess();
|
||||
}
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
if (version_compare(_PS_VERSION_, '1.7', '<') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && !(int)Configuration::get('PA_CAPTCHA_TMP_RE_PASSWORD') && ($checkFile = $captcha->checkFile('front','password', true)) && $captcha->hookVal(Tools::getValue('controller', false), 'pwd_recovery'))
|
||||
{
|
||||
$this->setTemplate($checkFile);
|
||||
}
|
||||
}
|
||||
protected function sendRenewPasswordLink()
|
||||
{
|
||||
if (version_compare(_PS_VERSION_, '1.7', '>=') && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','password-email') && $captcha->hookVal(Tools::getValue('controller', false), 'pwd_recovery'))
|
||||
{
|
||||
$captcha->captchaVal($this->errors);
|
||||
}
|
||||
if (!$this->errors)
|
||||
return parent::sendRenewPasswordLink();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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;
|
||||
31
web/modules/ets_advancedcaptcha/override/index.php
Normal file
31
web/modules/ets_advancedcaptcha/override/index.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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,48 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_') || !class_exists('Blocknewsletter') || version_compare(_PS_VERSION_, '1.7', '>='))
|
||||
exit;
|
||||
class BlocknewsletterOverride extends Blocknewsletter
|
||||
{
|
||||
public function hookDisplayLeftColumn($params)
|
||||
{
|
||||
$result = parent::hookDisplayLeftColumn($params);
|
||||
if ($result && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && ($checkFile = $captcha->checkFile('hook','blocknewsletter')) && $captcha->hookVal(Tools::getValue('controller', false), 'newsletter'))
|
||||
{
|
||||
$result = $this->context->smarty->fetch($checkFile);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function newsletterRegistration()
|
||||
{
|
||||
if (Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','blocknewsletter') && $captcha->hookVal(Tools::getValue('controller', false), 'newsletter'))
|
||||
{
|
||||
$captcha->captchaVal($this->error);
|
||||
if (is_array($this->error))
|
||||
$this->error = implode(',', $this->error);
|
||||
}
|
||||
if (!$this->error)
|
||||
parent::newsletterRegistration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* 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 https://www.prestashop.com for more information.
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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,49 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_') || !class_exists('MailAlerts') || version_compare(_PS_VERSION_, '1.7', '>='))
|
||||
exit;
|
||||
class MailAlertsOverride extends MailAlerts
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
if (Tools::getValue('process', false) == 'add' && Tools::getValue('module', false) == $this->name && Tools::getValue('controller', false) == 'actions')
|
||||
{
|
||||
if (Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','mailalerts') && $captcha->hookVal('product', 'out_of_stock'))
|
||||
{
|
||||
$captcha->captchaVal($this->_errors);
|
||||
}
|
||||
if ($this->_errors)
|
||||
die('-1');
|
||||
}
|
||||
}
|
||||
public function hookActionProductOutOfStock($params)
|
||||
{
|
||||
$result = parent::hookActionProductOutOfStock($params);
|
||||
if ($result && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && ($checkFile = $captcha->checkFile('hook','mailalerts')) && $captcha->hookVal('product', 'out_of_stock'))
|
||||
{
|
||||
$result = $this->context->smarty->fetch($checkFile);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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,54 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_') || !class_exists('Ps_EmailAlerts') || version_compare(_PS_VERSION_, '1.7', '<'))
|
||||
exit;
|
||||
class Ps_EmailAlertsOverride extends Ps_EmailAlerts
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
if (Tools::getValue('process', false) == 'add' && Tools::getValue('module', false) == $this->name && Tools::getValue('controller', false) == 'actions')
|
||||
{
|
||||
if (Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','ps_emailalerts', true) && $captcha->hookVal('product', 'out_of_stock'))
|
||||
{
|
||||
$captcha->captchaVal($this->_errors);
|
||||
}
|
||||
if ($this->_errors)
|
||||
{
|
||||
die(Tools::jsonEncode(array(
|
||||
'error' => true,
|
||||
'message' => implode(',', $this->_errors),
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public function hookDisplayProductAdditionalInfo($params)
|
||||
{
|
||||
$result = parent::hookDisplayProductAdditionalInfo($params);
|
||||
if ($result && Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && ($checkFile = $captcha->checkFile('hook','ps_emailalerts', true)) && $captcha->hookVal('product', 'out_of_stock'))
|
||||
{
|
||||
$result = $this->fetch($checkFile);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
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,51 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2019 ETS-Soft
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
|
||||
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
|
||||
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
|
||||
*
|
||||
* 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 contact us for extra customization service at an affordable price
|
||||
*
|
||||
* @author ETS-Soft <etssoft.jsc@gmail.com>
|
||||
* @copyright 2007-2019 ETS-Soft
|
||||
* @license Valid for 1 website (or project) for each purchase of license
|
||||
* International Registered Trademark & Property of ETS-Soft
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_') || !class_exists('Ps_Emailsubscription') || version_compare(_PS_VERSION_, '1.7', '<'))
|
||||
exit;
|
||||
class Ps_EmailsubscriptionOverride extends Ps_Emailsubscription
|
||||
{
|
||||
public $error = false;
|
||||
|
||||
public function renderWidget($hookName = null, array $configuration = array())
|
||||
{
|
||||
$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
|
||||
$this->context->smarty->assign(array('id_module' => $this->id));
|
||||
if (Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && ($checkFile = $captcha->checkFile('hook','ps_emailsubscription', true)) && $captcha->hookVal(Tools::getValue('controller', false), 'newsletter'))
|
||||
{
|
||||
return $this->fetch($checkFile);
|
||||
}
|
||||
return $this->fetch('module:ps_emailsubscription/views/templates/hook/ps_emailsubscription.tpl');
|
||||
}
|
||||
|
||||
public function newsletterRegistration()
|
||||
{
|
||||
if (Module::isEnabled('ets_advancedcaptcha') && ($captcha = Module::getInstanceByName('ets_advancedcaptcha')) && $captcha->checkFile('hook','ps_emailalerts') && $captcha->hookVal(Tools::getValue('controller', false), 'newsletter'))
|
||||
{
|
||||
$captcha->captchaVal($this->error);
|
||||
if (is_array($this->error))
|
||||
$this->error = implode(',', $this->error);
|
||||
}
|
||||
if (!$this->error)
|
||||
parent::newsletterRegistration();
|
||||
}
|
||||
}
|
||||
5
web/modules/ets_advancedcaptcha/translations/ar.php
Normal file
5
web/modules/ets_advancedcaptcha/translations/ar.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>ets_advancedcaptcha_89f77b1e0d19b59b23d1188444c6bd58'] = 'Advanced Captcha';
|
||||
61
web/modules/ets_advancedcaptcha/translations/de.php
Normal file
61
web/modules/ets_advancedcaptcha/translations/de.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>ets_advancedcaptcha_6649ded611214e4c775c4b46a11eec24'] = 'Sicherheitscode passt nicht.';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>ets_advancedcaptcha_bca966736b402a44d44b2ce42a3dd694'] = 'Die Sicherheitsprüfung ist fehlgeschlagen';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>ets_advancedcaptcha_a7fffe14bef94e441a5f8548e9cd129d'] = 'reCaptcha ist ungültig';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_bbaff12800505b22a853e8b7f4eb6a22'] = 'Kontakt';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_2273d1167a6212812d95dc8fadbae78e'] = 'Kundendienst';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_d754a9e8cb640da12849a040f3ca8176'] = 'Deine Antwort';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_02d4482d332e1aef3437cd61c9bcc624'] = 'Kontaktiere uns';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_4ec1c39345fe8820d68463eea8803b0f'] = 'Ihre Nachricht wurde erfolgreich an unser Team gesendet.';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_8cf04a9734132302f96da8e113e80ce5'] = 'Zuhause';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_7c9d4636fc5ed97bb78bc2aac486beab'] = 'Ihre Nachricht wurde bereits gesendet.';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_b3e4d8d61f99bac80e6aa1774d73445b'] = 'eine Nachricht schicken';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_6c27c08f40e1b0d9901deb9ff5f722f7'] = 'Schlagwort';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_7bc873cba11f035df692c3549366c722'] = '-- Wählen --';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_b357b524e740bc85b9790a0712d84a30'] = 'E-Mail-Addresse';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_5d4710f9a8250b13164a82c94d5b00d1'] = 'Bestellnummer';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_deb10517653c255364175796ace3553f'] = 'Produkt';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_13d6078da2e6592822ede083931d6826'] = 'Datei anhängen';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Botschaft';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_94966d90747b97d1f0f206c98a8b1ac3'] = 'Senden';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_f787618e514c038851726224d7e4421e'] = 'Keine Datei ausgewählt';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form_e635032a5f71d809146d3872389f5b0c'] = 'Datei wählen';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_bbaff12800505b22a853e8b7f4eb6a22'] = 'Kontakt';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_2273d1167a6212812d95dc8fadbae78e'] = 'Kundendienst';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_d754a9e8cb640da12849a040f3ca8176'] = 'Deine Antwort';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_02d4482d332e1aef3437cd61c9bcc624'] = 'Kontaktiere uns';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_4ec1c39345fe8820d68463eea8803b0f'] = 'Ihre Nachricht wurde erfolgreich an unser Team gesendet.';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_8cf04a9734132302f96da8e113e80ce5'] = 'Zuhause';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_7c9d4636fc5ed97bb78bc2aac486beab'] = 'Ihre Nachricht wurde bereits gesendet.';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_0880266daff3ed4c441adb888658c47c'] = 'Für Fragen zu einer Bestellung oder für weitere Informationen zu unseren Produkten';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_b3e4d8d61f99bac80e6aa1774d73445b'] = 'Eeine Nachricht schicken';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_6c27c08f40e1b0d9901deb9ff5f722f7'] = 'Schlagwort ';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_7bc873cba11f035df692c3549366c722'] = '-- Wählen --';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_b357b524e740bc85b9790a0712d84a30'] = 'E-Mail-Addresse';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_5d4710f9a8250b13164a82c94d5b00d1'] = 'Bestellnummer';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_deb10517653c255364175796ace3553f'] = 'Produkt';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_13d6078da2e6592822ede083931d6826'] = 'Datei anhängen';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Botschaft';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-contact-form-v_1_5_94966d90747b97d1f0f206c98a8b1ac3'] = 'Senden';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_02d4482d332e1aef3437cd61c9bcc624'] = 'Kontaktiere uns';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_c7892ebbb139886662c6f2fc8c450710'] = 'Gegenstand';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_b357b524e740bc85b9790a0712d84a30'] = 'E-Mail-Addresse';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_67135a14d3ac4f1369633dd006d6efec'] = 'your@email.com';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_5d4710f9a8250b13164a82c94d5b00d1'] = 'Bestellnummer';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_863cf84b34def228394c03c156bff42c'] = 'Wählen Sie eine Referenz aus';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_d57c24f3fe52d16e7169b912dd647f0d'] = 'Wahlweise';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_e9cb217697088a98b1937d111d936281'] = 'Befestigung';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_4c2a8fe7eaf24721cc7a9f0175115bd4'] = 'Botschaft';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_8307fac59310d028334df0306c7b29ad'] = 'Wie können wir helfen?';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_c3f204190e5261d4996203bfb65f2bbf'] = 'Sicherheitscode eingeben';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_00f26302f753ea4871b7634a6d025bf9'] = 'Sicherheitskontrolle';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_792bb28aea0e109daf741be7eb18ec87'] = 'Sicherheitscode';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_46017c210d1eb8c92f27a120f66b88f5'] = 'Aktualisieren Sie den Code';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>contactform_v_1_7_94966d90747b97d1f0f206c98a8b1ac3'] = 'Senden';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-captcha_c3f204190e5261d4996203bfb65f2bbf'] = 'Sicherheitscode eingeben';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-captcha_00f26302f753ea4871b7634a6d025bf9'] = 'Sicherheitskontrolle';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-captcha_792bb28aea0e109daf741be7eb18ec87'] = 'Sicherheitscode';
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>front-captcha_46017c210d1eb8c92f27a120f66b88f5'] = 'Aktualisieren Sie den Code';
|
||||
5
web/modules/ets_advancedcaptcha/translations/en.php
Normal file
5
web/modules/ets_advancedcaptcha/translations/en.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{ets_advancedcaptcha}prestashop>ets_advancedcaptcha_89f77b1e0d19b59b23d1188444c6bd58'] = 'Advanced Captcha';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user