Changeset 4861


Ignore:
Timestamp:
Feb 9, 2010, 10:52:34 AM (14 years ago)
Author:
cljosse
Message:

[mail_supervisor] Deletion of the test anti-spam on the user name

Location:
extensions/Mail_supervisor
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mail_supervisor/admin/mail_superv_admin.php

    r4721 r4861  
    8989               
    9090$mails_options = explode("," , $conf['mail_superv']);
    91         if (!isset($mails_options[7])) $mails_options[7] = 'off' ; //set_id
    92                 if (!isset($mails_options[6])) $mails_options[6] = $ip   ;
    93                 if (!isset($mails_options[5])) $mails_options[5] = 'off' ;
    94                 if (!isset($mails_options[4])) $mails_options[4] = 'off' ;
    95                 if (!isset($mails_options[3])) $mails_options[3] = 'off' ;
     91        if (!isset($mails_options[set_id])) $mails_options[set_id] = 'off' ;  // 7
     92                if (!isset($mails_options[ip])) $mails_options[ip] = $ip   ;  //6
     93                if (!isset($mails_options[set_auto])) $mails_options[set_auto] = 'off' ;  //5
     94                if (!isset($mails_options[no_connect])) $mails_options[no_connect] = 'off' ;  //4
     95                if (!isset($mails_options[no_mail_list])) $mails_options[no_mail_list] = 'off' ;  //3
    9696               
    97                 if (!isset($mails_options[2])) $mails_options[2] = 'off' ;
    98                 if (!isset($mails_options[1])) $mails_options[1] = 'off' ;
    99                 if (!isset($mails_options[0])) $mails_options[0] = 'off' ;
     97                if (!isset($mails_options[check_header_text])) $mails_options[check_header_text] = 'off' ;  //2
     98                if (!isset($mails_options[check_header_carbon])) $mails_options[check_header_carbon] = 'off' ;  //1
     99                if (!isset($mails_options[check_mailto])) $mails_options[check_mailto] = 'off' ;  //0
    100100               
    101101$mails_données = Get_Datas();
     
    124124        }
    125125$version= $versions['version'];
     126                if (!isset($ip)) {
     127                       if (getenv("HTTP_CLIENT_IP"))
     128                                            {    $ip=getenv("HTTP_CLIENT_IP");  }
     129                                        else{   $ip=getenv("REMOTE_ADDR");      }
     130                           }
    126131//================================================================================
    127132switch ($page['tab'])
     
    175180{
    176181
    177   $mails_options[0] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ;
    178   $mails_options[1] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ;
    179   $mails_options[2] = isset($_POST['check_header_text']) ? $_POST['check_header_text'] : 'off' ;
     182  $mails_options[check_mailto] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ;               
     183  $mails_options[check_header_carbon] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ;
     184  $mails_options[check_header_text] = isset($_POST['check_header_text']) ? $_POST['check_header_text'] : 'off' ;     
    180185 
    181186//données 
     
    210215$template->assign(
    211216                                        array(
    212    'check_mailto' => ($mails_options[0] == 'on') ? 'checked="checked"' : '' ,
    213    'check_header_carbons' => ($mails_options[1] == 'on') ? 'checked="checked"' : '' ,
    214    'check_header_text' => ($mails_options[2] == 'on') ? 'checked="checked"' : '' ,
     217   'check_mailto' => ($mails_options[check_mailto] == 'on') ? 'checked="checked"' : '' ,
     218   'check_header_carbons' => ($mails_options[check_header_carbon] == 'on') ? 'checked="checked"' : '' ,
     219   'check_header_text' => ($mails_options[check_header_text] == 'on') ? 'checked="checked"' : '' ,
    215220
    216221   
     
    328333                $aff_nb=false;
    329334 //------------------------------------------------------------------------------------
    330 
    331         $mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[3] ;
    332         $mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[4] ;
    333             $mails_options[5] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[5] ;               
     335        $mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[no_mail_list] ;
     336        $mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ;
     337            $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ;             
    334338
    335339//=======================================================================================       
     
    363367                        if (  $_POST['submit'] == l10n('Valider') )
    364368                {
    365                                 $mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ;
    366                         $mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
    367                         $mails_options[5] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
    368                                 $mails_options[7] = isset($_POST['set_auto']) ? $_POST['set_id'] : "off" ;
     369                                $mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ;
     370                        $mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
     371                        $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
     372                                $mails_options[set_id] = isset($_POST['set_id']) ? $_POST['set_id'] : "off" ;
    369373                                sauve_options();
    370374                            $infos_message .=  l10n('save_config') . '<br />';   
     
    400404                                                'F_ACTION' => $f_action ,
    401405                                               
    402                                                 'no_mail_list' => ($mails_options[3] == 'on') ? 'checked="checked"' : '' ,
    403                         'no_connect' => ($mails_options[4] == 'on') ? 'checked="checked"' : '' ,
    404                                                 'set_auto' => ($mails_options[5] == 'on') ? 'checked="checked"' : '' ,
    405                                                 'set_id' => ($mails_options[7] == 'on') ? 'checked="checked"' : '' ,
     406                                                'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' ,
     407                        'no_connect' => ($mails_options[no_connect] == 'on') ? 'checked="checked"' : '' ,
     408                                                'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' ,
     409                                                'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' ,
    406410                                                'IP' =>  $ip ,                                         
    407411                                                'PAYS' =>  $pays  ,
  • extensions/Mail_supervisor/include/fonctions.php

    r4721 r4861  
    2929if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    3030
    31 
     31    define ("check_mailto", 0); define ("check_header_carbon",1); define ("check_header_text",2);
     32    define ("no_mail_list", 3); define ("no_connect",4); define ("set_auto",5);
     33    define ("ip",6); define ("set_id",7);
     34 
     35 
    3236 if (!isset($_COOKIE[session_name()]))
    3337{
     
    107111function affiche_message()
    108112{
    109  global $template,$infos_message,$erreur_message, $user ;;
     113 global $template,$infos_message,$erreur_message, $user ,$ip;
    110114
    111115global $mails_options,$conf,$lang ;
    112116
    113117$mails_options = explode("," , $conf['mail_superv']);
    114 
    115  if ( count($_POST)==5 || count($_POST)==0 ) {
    116  $action_spam = pwg_get_session_var('action_spam') ;
    117         if  (!$action_spam)
    118         { 
    119           pwg_set_session_var('action_spam', "true");
    120           if (kill_list())
    121                  {
     118                if (!isset($ip)) {
     119                       if (getenv("HTTP_CLIENT_IP"))
     120                                            {    $ip=getenv("HTTP_CLIENT_IP");  }
     121                                        else{   $ip=getenv("REMOTE_ADDR");      }
     122                           }
     123//  unset ($_SESSION['pwg_'.'action_spam']);
     124     $action_spam = pwg_get_session_var('action_spam') ;
     125    if  ($action_spam == null) { $action_spam = kill_list();  }
     126       
     127        if (is_bool($action_spam)) $action_spam =($action_spam == true) ? "true" : "false" ;
     128          if ($action_spam == "true" )
     129                 { 
     130                  $erreur_message = $ip . " "  . $action_spam  ;
    122131                  pwg_set_session_var('action_spam', "true");
    123                  
    124132                  $erreur_message .= "<BR />".l10n('is_a_spam') ;
    125                  if ($mails_options[4] == 'on' ){
    126                
    127 //[status] => guest
    128 //[status] => normal
    129 //[status] => webmaster
    130                  
     133                 if ($mails_options[no_connect] == 'on' ){
     134                        //[status] => guest
     135                        //[status] => normal
     136                        //[status] => webmaster
    131137                        if ($user['status'] != 'webmaster'  )
    132138                                if (!isset($_GET['admin'])) {
     
    136142                                                 die('blacklist Hacking attempt!');
    137143                                        }
     144                                unset ($_SESSION['pwg_'.'action_spam']);
    138145           }
    139        
    140        
    141146             }else{
    142147                   pwg_set_session_var('action_spam', "false");
    143148                 }
    144         }
    145  }       
     149       
     150 
     151// }     
    146152
    147153 //==============================================================
     
    180186         //===================================================================================
    181187        $info_geo = pwg_get_session_var('info_geo');
    182        
     188        print_r($info_geo );
    183189        if (count($info_geo) > 0) 
    184190        {
     
    208214
    209215            $result="";
    210             $src =  "http://j.maxmind.com/app/geoip.js" ;
    211         if ( !clj_fetchRemote($src , $result,1))
    212                 {
    213 ?>
    214 <script language="JavaScript" type="text/javascript">
    215             var pays     =  "EARTH";
    216                         var ville     =  "NOWHERE";
    217                         var region    =  "UNIVERS";
    218                         var latitude  =  '0';
    219                         var longitude =  '0';
    220 </script>
    221 <?php     
    222        
    223                 }else{
    224                
    225        
    226216?>
    227217<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js" type="text/javascript" >
     
    235225                       
    236226</script>
    237 <?php
    238                 }
    239        
    240 ?>             
    241227<form action="" method="post" name="form_connexion" id="form_connexion" style="visibility:hidden">
    242228<script language="JavaScript" type="text/javascript">                   
     
    304290                if ( count($args[$Carbonne]) > 0 )
    305291                {
    306                  if ($mails_options[1] == 'on') {
     292                 if ($mails_options[check_header_carbon] == 'on') {
    307293                        $list_mail  = str_replace(","," ,",get_strict_email_list(implode(',', $args[$Carbonne])))." \n" ;
    308294                        $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$list_mail, $headers);
     
    654640//=======================================================================       
    655641
    656 if ($mails_options[5] == 'on')
     642if ($mails_options[set_auto] == 'on')
    657643{
    658644 // $ip="94.102.63.13"; ' Spammeurs
     
    700686                                pwg_query($query );     
    701687        }
    702           $erreur_message .=  $mails_options[6] ." ".$user['username']." ".$user['email'] . ' -----> ' . l10n('black_list') ;
     688          $erreur_message .=  $mails_options[ip] ." ".$user['username']." ".$user['email'] . ' -----> ' . l10n('black_list') ;
    703689        // die($nb." ".$ip." ".$user['username']." ".$user['email']); 
    704690        return true ;   
     
    708694}
    709695 //==============================================================================
    710  if ( $mails_options[6] == $ip ) return ($nb > 0) ;     
    711    $mails_options[6] =   $ip ; 
     696 if ( $mails_options[ip] == $ip ) return ($nb > 0) ;   
     697   $mails_options[ip] =   $ip ; 
    712698   sauve_options();
    713699 
     
    799785//=============================================================================
    800786}
     787
    801788$user_name=str_replace(" ","%20",trim($user_name));
    802789if ($user_name==l10n('guest')) $user_name="";
    803 
     790$user_name="";  // ne plus tester sur le login.
    804791$mail_adresse =str_replace(" ","%20",trim($mail_adresse));
    805792
  • extensions/Mail_supervisor/main.inc.php

    r4715 r4861  
    22/*
    33Plugin Name: Mail supervisor
    4 Version: 1.3.1
     4Version: 1.3.3
    55Description: Mail supervisor surveille l'envoie des mails.
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315
     
    8080
    8181 global $conf ;
    82  
     82
     83 
    8384add_event_handler('send_mail', 'clj_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 1 , 6);
    8485
     
    8889        // lecture config table -------------
    8990        include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
    90  load_language('plugin.lang', MAIL_SUPERV_PATH);
    91  
    92         $mails_options = explode("," , $conf['mail_superv']);
    93 
    94         if ($mails_options[3]=='on' || $mails_options[4] == 'on' )
     91     load_language('plugin.lang', MAIL_SUPERV_PATH);
     92         $mails_options = explode("," , $conf['mail_superv']);
     93//======== vérification si envoie de mail ou blocage connexion =====================
     94        if ($mails_options[no_mail_list]=='on' || $mails_options[no_connect] == 'on' )
    9595        {
    9696                if (kill_list())
    9797                 {
    9898                  $erreur_message .= "<BR />".l10n('is_a_spam') ;
    99                  if ($mails_options[4] == 'on' ){
    100                         if ($user['status'] != 'webmaster'  )
    101                                 if (!isset($_GET['admin'])) {
     99                 if ($mails_options[no_connect] == 'on' ){
     100                  if ($user['status'] == 'webmaster'  )
     101                        { 
     102                          //---------- continuer si web master ----------
     103                        }else{
     104                                  if (!isset($_GET['admin'])) {
    102105                                                 die('Blacklist : <br />' .$erreur_message. '<br /> Hacking attempt!');
    103                                 }elseif   ($_GET['admin'] != 'piwigo')
    104                                         {
     106                                       }elseif   ($_GET['admin'] != 'piwigo')
     107                                               {
    105108                                                 die('blacklist Hacking attempt!');
    106109                                        }
    107                   }
    108                         return true;
     110                      return true;
     111                          }
     112                         
     113                        }
     114                       
    109115                 }
    110116        }
     
    151157                 
    152158  $nb_destinataires=0;
    153                 if ($mails_options[0] == 'on') {
     159                if ($mails_options[check_mailto] == 'on') {
    154160                        if ($mailto == "" )     $mailto = $conf_mail['email_webmaster'];
    155161                }   
     
    189195                        }
    190196//=============================================================================                 
    191 if ($mails_options[2]=='on')   {
     197if ($mails_options[check_header_text]=='on')   {
    192198
    193199        $texte = "This is a multi-part message in MIME format.\n";
     
    347353   
    348354}
    349 
     355    include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
    350356        $mails_options = explode("," , $conf['mail_superv']);
    351357         
    352358//==========================================================================================
    353 if ($mails_options[7]=='on'  ) {
     359if ($mails_options[set_id]=='on'  ) {
    354360 add_event_handler('register_user_check', 'Test_spam_g', EVENT_HANDLER_PRIORITY_NEUTRAL +2  , 2);
    355361 }
     
    368374        $user_name = $user['username'];
    369375}
    370 $user_name ="";
     376$user_name =""; // suppression du test sur user name.
    371377 $ip='0';
    372378                if (test_spam($ip,$user_name ,$mail ))
Note: See TracChangeset for help on using the changeset viewer.