853b4d316c977540784da483ae0148c38e29ecc9
5 * (c) 2008 Cedric Morin Yterium.net
10 if (!defined("_ECRIRE_INC_VERSION")) return;
13 * Verification supplementaire antispam sur le formulaire_forum
18 function nospam_verifier_formulaire_forum_dist($flux){
19 $form = $flux['args']['form'];
20 if (!isset($flux['data']['texte'])
21 AND $GLOBALS['meta']['forums_texte'] == 'oui'){
23 $texte = _request('texte');
24 include_spip("inc/nospam");
25 // regarder si il y a du contenu en dehors des liens !
26 $caracteres = compter_caracteres_utiles($texte);
27 $min_length = (defined('_FORUM_LONGUEUR_MINI') ? _FORUM_LONGUEUR_MINI
: 10);
28 if ($caracteres < $min_length){
29 $flux['data']['texte'] = _T('forum_attention_dix_caracteres');
32 // regarder si il y a du contenu cache
33 if (!isset($flux['data']['texte'])){
34 $infos = analyser_spams($texte);
35 if (isset($infos['contenu_cache']) AND $infos['contenu_cache']){
36 $flux['data']['texte'] = _T('nospam:erreur_attributs_html_interdits');
40 // regarder si il y a des liens deja references par des spammeurs
41 if (!isset($flux['data']['texte'])
42 AND isset($infos['liens'])
43 AND count($infos['liens'])){
46 if ($h = rechercher_presence_liens_spammes($infos['liens'],_SPAM_URL_MAX_OCCURENCES
,'spip_forum',array('texte'))){
47 spip_log("Refus message de forum qui contient un lien vers $h","nospam");
48 $flux['data']['texte'] = _T('nospam:erreur_url_deja_spammee');
52 // on prend en compte la checkbox de confirmation
53 // si le flag en session est bien leve
54 if (_request('notabuse')){
56 if ($_SESSION['notabuse_check']){
57 unset($_SESSION['notabuse_check']);
58 $_SESSION['notabuse_checked'] = true;
59 // on leve une globale pour la fin de ce hit, a toute fin utile (puisque plus rien en $_SESSION)
60 $GLOBALS['notabuse_checked'] = true;
63 if (!count($flux['data'])){
64 if (nospam_check_ip_status($GLOBALS['ip'])!=='ok'){
66 if ($_SESSION['notabuse_checked']){
67 // ok on retire de la session le check qui ne sert qu'une fois
68 unset($_SESSION['notabuse_checked']);
69 // et on laisse passer
72 $flux['data']['texte'] = _T('nospam:info_ip_suspecte')."<br />
74 <input type='checkbox' name='notabuse' value='1' id='notabuse'/> <label for='notabuse'>"
75 ._T('nospam:label_message_licite')."</label>
77 $_SESSION['notabuse_check'] = true;
78 spip_log("notabuse_check sur IP ".$GLOBALS['ip'],"nospam");
84 if (isset($flux['data']['texte']))
85 unset($flux['data']['previsu']);