diff --git a/formulaires/gamucontact.php b/formulaires/gamucontact.php
index 6b0a970..f62162b 100644
--- a/formulaires/gamucontact.php
+++ b/formulaires/gamucontact.php
@@ -23,6 +23,41 @@ function formulaires_gamucontact_verifier_dist($id_auteur = 0, $redirect = '') {
$erreurs['nobot'] = _T('contact:message_erreur_robot');
}
+ include_spip('inc/texte');
+ // si nospam est present on traite les spams
+ if (include_spip('inc/nospam')) {
+
+ $texte = _request('texte');
+ $caracteres = nospam_compter_caracteres_utiles($texte);
+ // moins de 10 caracteres sans les liens = spam !
+ if ($caracteres < 10){
+ $erreurs['texte'] = _T('forum_attention_dix_caracteres');
+ }
+
+ // on analyse le sujet
+ $sujet = _request('objet');
+ $infos_sujet = nospam_analyser_spams($sujet);
+ // si un lien dans le sujet = spam !
+ if ($infos_sujet['nombre_liens'] > 0)
+ $erreurs['objet'] = _T('nospam:erreur_spam');
+
+ // on analyse le texte
+ $infos_texte = nospam_analyser_spams($texte);
+ if ($infos_texte['nombre_liens'] > 0) {
+ // si un lien a un titre de moins de 3 caracteres = spam !
+ if ($infos_texte['caracteres_texte_lien_min'] < 3) {
+ $erreurs['texte'] = _T('nospam:erreur_spam');
+ }
+ // si le texte contient plus de trois lien = spam !
+ if ($infos_texte['nombre_liens'] >= 3)
+ $erreurs['texte'] = _T('nospam:erreur_spam');
+ }
+ }
+
+ if (count($erreurs)) {
+ return $erreurs;
+ }
+
$saisies = $GLOBALS['gamucontact'];
//champs obligatoire
foreach ($saisies as $s) {
@@ -32,6 +67,7 @@ function formulaires_gamucontact_verifier_dist($id_auteur = 0, $redirect = '') {
}
}
+
return $erreurs;
}
diff --git a/gamucontact_options.php b/gamucontact_options.php
index cc921d4..4eb2f31 100644
--- a/gamucontact_options.php
+++ b/gamucontact_options.php
@@ -13,6 +13,8 @@ if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
+$GLOBALS['formulaires_no_spam'][] = 'gamucontact';
+
$GLOBALS['gamucontact'] = [
[
diff --git a/paquet.xml b/paquet.xml
index 8ca308b..02650e1 100644
--- a/paquet.xml
+++ b/paquet.xml
@@ -15,6 +15,7 @@
GNU/GPL
+