ajout de nospam avec analyse du formulaire plus poussé
This commit is contained in:
parent
e6f2087226
commit
eef3346f6c
3 changed files with 39 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ if (!defined('_ECRIRE_INC_VERSION')) {
|
|||
return;
|
||||
}
|
||||
|
||||
$GLOBALS['formulaires_no_spam'][] = 'gamucontact';
|
||||
|
||||
|
||||
$GLOBALS['gamucontact'] = [
|
||||
[
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
<licence>GNU/GPL</licence>
|
||||
<necessite nom="facteur" compatibilite="[4.1.0;[" />
|
||||
<necessite nom="nospam" compatibilite="[2.2.0;[" />
|
||||
|
||||
|
||||
<pipeline nom="autoriser" inclure="gamucontact_autorisations.php" />
|
||||
|
|
Loading…
Add table
Reference in a new issue