Esempio n. 1
0
function spam_filtre_de_test($texte) {
	if (!strlen($texte)) return '';
	$spam = cs_lire_data_outil('spam');
	$test = false;
	return cs_test_spam($spam, $texte, $test)?'ko':'ok';
}
Esempio n. 2
0
	//	un message a un auteur : texte_message_auteur_XX, sujet_message_auteur_XX, email_message_auteur_XX
	//	inscription : nom_inscription, mail_inscription
	//	login : session_*
	$spam_POST_reg = ',^(?:texte|titre|sujet|auteur|nom|e?mail|session),i';
	// on compile $spam_POST en fonction des variables $_POST trouvees
	$spam_POST_compile = array();
	foreach (array_keys($_POST) as $key)
		if (preg_match($spam_POST_reg, $key) && strpos($key, 'password')===false)
			$spam_POST_compile[] = $key;

	include_spip('cout_lancement');
	$spam_mots = cs_lire_data_outil('spam');
	// test IP compatible avec l'outil 'no_IP'
	$test = $spam_mots[3]?preg_match($spam_mots[3], $ip_):false;
	foreach ($spam_POST_compile as $var) if(!$test)
		if(cs_test_spam($spam_mots, $_POST[$var], $test)) $_GET['var'] = $var;
	if($test) $_GET['action'] = "cs_spam";
	// nettoyage
	unset($test, $spam_mots, $spam_POST_reg, $spam_POST_compile);

	function action_cs_spam(){
		include_spip('inc/minipres');
		echo minipres(
			_T('couteau:lutte_spam'),
			'<pre>'.$_POST[$_GET['var']].'</pre><div>'._T('couteau:explique_spam').'</div>'
		);
		exit;
	}
}
unset($ip_);