[SPIP Zone] [Spip-zone-commit] r32010 - in /_galaxie_/programmer.spip.org/plugin_documentation: documentation_pipelines.php plugin.xml

Peut être que ce serait intéressant de l’intégrer d’une manière ou d’une autre dans tickets directement?

Je ne sais pas…

++

kent1

Le 10 octobre 2009 21:46, <marcimat@free.fr> a écrit :

Author: marcimat@free.fr
Date: Sat Oct 10 21:46:00 2009
New Revision: 32010

Log:
Révision de l’antispam des tickets de Programmer

Modified:
galaxie/programmer.spip.org/plugin_documentation/documentation_pipelines.php
galaxie/programmer.spip.org/plugin_documentation/plugin.xml

Modified: galaxie/programmer.spip.org/plugin_documentation/documentation_pipelines.php

galaxie/programmer.spip.org/plugin_documentation/documentation_pipelines.php (original)
+++ galaxie/programmer.spip.org/plugin_documentation/documentation_pipelines.php Sat Oct 10 21:46:00 2009
@@ -22,10 +22,10 @@
// valeurs par defaut sur les nouveaux tickets
function documentation_formulaire_charger($flux){
if ($flux[‹ args ›][‹ form ›] == ‹ editer_ticket ›

  • and !$flux[‹ args ›][‹ args ›][0]
  • and (!$flux[‹ args ›][‹ args ›][0] OR $flux[‹ args ›][‹ args ›][0] == ‹ oui ›) // nouveau ticket
    and !$flux[‹ data ›][‹ type ›]) {
    $flux[‹ data ›][‹ type ›] = 2;
  • $flux[‹ data ›][‹ severite ›] = 4;
  • $flux[‹ data ›][‹ severite ›] = 3;
    }
    return $flux;
    }
    @@ -46,13 +47,37 @@
    }

+// verifier qu’un ticket identique n’a pas ete publie il y a peu
+function test_doublon_ticket($champs, $table=‹ spip_tickets ›){

  • $champs = « maj>DATE_SUB(NOW(),INTERVAL 1 hour) »;
  • return sql_countsel($table, $champs);
    +}

+// verifier que cette ip n’en est pas a son N-ieme post en peu de temps
+// plus de 5 messages en 5 minutes c’est suspect …
+function test_ticket_ip_furieuse(){

  • $champs = array();
  • $champs = ‹ ip= › . sql_quote($GLOBALS[‹ ip ›]);
  • $champs = « maj>DATE_SUB(NOW(),INTERVAL 10 minute) »;
  • $nb1 = sql_countsel(‹ spip_tickets ›,$champs);
  • $nb2 = sql_countsel(‹ spip_tickets_forum ›,$champs);
  • if (($nb1 + $nb2) > 5) {
  • return true;
  • }
  • return false;
    +}

// ne pas accepter ce qu’on peut appeler du spam
function documentation_formulaire_verifier($flux){

  • if ($flux[‹ args ›][‹ form ›] == ‹ editer_ticket ›) {
  • $info_plugin = chercher_filtre(‹ info_plugin ›);
  • if ($info_plugin(‹ nospam ›, ‹ est_actif ›)) {
  • include_spip(‹ inc/nospam ›);
  • $testsA = $testsB = $testsC = array(
  • if ($flux[‹ args ›][‹ form ›] == ‹ editer_ticket ›
  • OR $flux[‹ args ›][‹ form ›] == ‹ forum_ticket ›) {
  • if (include_spip(‹ inc/nospam ›)) {
  • $is_commentaire = ($flux[‹ args ›][‹ form ›] == ‹ forum_ticket ›);
  • $testsA = $testsB = $testsC = $testM = array(
    array(‹ caracteres_texte_lien_min ›, ‹ < ›, 4),
    array(‹ nombre_liens ›, ‹ > ›, 3),
    array(‹ caracteres_utiles ›, ‹ < ›, 10),
    @@ -60,24 +85,27 @@
    $testsB[1][2] = 0; // nombre_liens > 0
    $testsC[1][2] = 1; // nombre_liens > 1
    $testsC[2][2] = 3; // caracteres_utiles < 3
  • $testsM[2][2] = 5; // caracteres_utiles < 5
  • if (!$is_commentaire) { // ticket
    if (doc_nospam_tester_spam(_request(‹ texte ›), $testsA)
    or doc_nospam_tester_spam(_request(‹ titre ›), $testsB)
    or doc_nospam_tester_spam(_request(‹ exemple ›), $testsC)) {
    $flux[‹ data ›][‹ message_erreur ›] .= _T(‹ nospam:erreur_spam ›);
    }
  • } else { // commentaire
  • if (doc_nospam_tester_spam(_request(‹ texte ›), $testsM)) {
  • $flux[‹ data ›][‹ message_erreur ›] .= _T(‹ nospam:erreur_spam ›);
    }
    }
  • if ($flux[‹ args ›][‹ form ›] == ‹ forum_ticket ›) {
  • $info_plugin = chercher_filtre(‹ info_plugin ›);
  • if ($info_plugin(‹ nospam ›, ‹ est_actif ›)) {
  • include_spip(‹ inc/nospam ›);
  • $tests = array(
  • array(‹ caracteres_texte_lien_min ›, ‹ < ›, 4),
  • array(‹ nombre_liens ›, ‹ > ›, 3),
  • array(‹ caracteres_utiles ›, ‹ < ›, 5),
  • );
  • if (doc_nospam_tester_spam(_request(‹ texte ›), $tests)) {
  • $flux[‹ data ›][‹ message_erreur ›] .= _T(‹ nospam:erreur_spam ›);
  • // doublons
  • $table = $is_commentaire ? ‹ spip_tickets_forum › : ‹ spip_tickets ›;
  • if (test_doublon_ticket(array(‹ texte= ›. sql_quote(_request(‹ texte ›))), $table)) {
  • $flux[‹ data ›][‹ message_erreur ›] .= _T(‹ nospam:erreur_spam_doublon ›);
  • }
  • // ip vilaine
  • if (test_ticket_ip_furieuse()) {
  • $flux[‹ data ›][‹ message_erreur ›] .= _T(‹ nospam:erreur_spam_ip ›);
    }
    }
    }

Modified: galaxie/programmer.spip.org/plugin_documentation/plugin.xml

galaxie/programmer.spip.org/plugin_documentation/plugin.xml (original)
+++ galaxie/programmer.spip.org/plugin_documentation/plugin.xml Sat Oct 10 21:46:00 2009
@@ -4,7 +4,7 @@
_ © 2009 - Distribué sous licence GPL

  • 1.1.5
  • 1.1.6
    test

    Squelette {{Documentation}}
    @@ -46,7 +46,7 @@



Spip-zone-commit@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone-commit