Ignore:
Timestamp:
Mar 15, 2011, 3:39:19 PM (13 years ago)
Author:
cljosse
Message:

[Mail supervisor] add class.

Location:
extensions/Mail_supervisor/include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mail_supervisor/include/Scripts.js

    r8917 r9702  
    1 function blockToggleDisplay(headerId, contentId){
    2         var revHeader = document.getElementById(headerId);
    3         var revContent = document.getElementById(contentId);
     1function blockToggleDisplay(headerId, contentId) {
     2 var revHeader = document.getElementById(headerId);
     3 var revContent = document.getElementById(contentId);
    44
    5         if (revContent.style.display == 'none')
    6         {
    7                 revContent.style.display = 'block';
    8                 revHeader.className = 'instructionBlockHeaderExpanded';
    9         }
    10         else
    11         {
    12                 revContent.style.display = 'none';
    13                 revHeader.className = 'instructionBlockHeaderCollapsed';
    14         }
     5 if (revContent.style.display == 'none') {
     6  revContent.style.display = 'block';
     7  revHeader.className = 'instructionBlockHeaderExpanded';
     8 }
     9 else {
     10  revContent.style.display = 'none';
     11  revHeader.className = 'instructionBlockHeaderCollapsed';
     12 }
    1513}
     14/*******************************************
     15* get_script_geo()
     16********************************************/
     17function get_script_geo() {
     18 try {
     19  if (typeof pays == "undefined") {
     20   pays = geoip_country_name();
     21   ville = geoip_city();
     22   region = geoip_region_name();
     23   latitude = geoip_latitude();
     24   longitude = geoip_longitude();
     25  }
     26  jQuery("#pays").val(pays);
     27  jQuery("#ville").val(ville);
     28  jQuery("#region").val(region);
     29  jQuery("#latitude").val(latitude);
     30  jQuery("#longitude").val(longitude);
     31
     32 } catch (e) {
     33  url = "http://j.maxmind.com/app/geoip.js";
     34  jQuery.getScript(url, function () {
     35   try {
     36    pays = geoip_country_name();
     37    ville = geoip_city();
     38    region = geoip_region_name();
     39    latitude = geoip_latitude();
     40    longitude = geoip_longitude();
     41    jQuery("#pays").val(pays);
     42    jQuery("#ville").val(ville);
     43    jQuery("#region").val(region);
     44    jQuery("#latitude").val(latitude);
     45    jQuery("#longitude").val(longitude);
     46   } catch (e) {
     47
     48   }
     49  });
     50 }
     51
     52}
     53jQuery(document).ready(
     54     function (jQuery) {
     55       jQuery(window).load(function () {
     56         // get_script_geo();
     57         jQuery('.cluetip').cluetip({ width: 350, splitTitle: '|' });
     58
     59         spam = jQuery("#action_spam").val();
     60         if (spam == "true") get_script_geo();
     61         if (jQuery(".infos").length > 0)
     62           if (spam == "true") {
     63             jQuery(".infos").css("color", "red");           
     64
     65           }
     66
     67         jQuery(".bp").click(function () {
     68           if (confirm(this.alt + '\n\n' + confirm_message)) form_black.info1.value = this.rel;
     69
     70         });
     71
     72
     73         function ajout_action(titre, message, valeur) {
     74           alert("");
     75
     76
     77         }
     78
     79
     80       });
     81     });
  • extensions/Mail_supervisor/include/constants.php

    r4888 r9702  
    22global $prefixeTable;
    33
    4 if (!defined('MAIL_SUPERV_TABLE')) define('MAIL_SUPERV_TABLE', $prefixeTable.'mail_superv');
     4if (!defined('mail_superv_TABLE')) define('mail_superv_TABLE', $prefixeTable.'mail_superv');
    55if (!defined('MAIL_BLACK_LISTE_TABLE')) define('MAIL_BLACK_LISTE_TABLE', $prefixeTable.'mail_black_list');
    66if (!defined('Sv_MAIL_TABLE')) define('Sv_MAIL_TABLE', $prefixeTable.'Sv_mail');
    7 
    8 
    9 
    107global  $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ;
    11 
    12 
    13           $superv_champs = array(
    14                        "id",
    15                                         "nb_mails",
    16                                         "date_mail",
    17                                         "nb_mails_maxi",               
    18                                         "nb_mails_periode",     
    19                                         "nb_spams",
    20                                         "date_spam",   
    21                                         "nb_spams_maxi",       
    22                                         "nb_spams_periode",     
    23                                         "quarantaine",
    24                                         "date_quarantaine",
    25                                         "quarantaine_periode", 
    26                                         "message",
    27                                         "message_test",
    28                                     "header_text",
    29                                
    30                                         );     
     8$superv_champs = array(
     9  "id",
     10  "nb_mails",
     11  "date_mail",
     12  "nb_mails_maxi",             
     13  "nb_mails_periode",   
     14  "nb_spams",
     15  "date_spam", 
     16  "nb_spams_maxi",     
     17  "nb_spams_periode",   
     18  "quarantaine",
     19  "date_quarantaine",
     20  "quarantaine_periode",       
     21  "message",
     22  "message_test",
     23  "header_text",                               
     24                );     
    3125                                                                       
    3226        $superv_type = array(
  • extensions/Mail_supervisor/include/fonctions.php

    r8917 r9702  
    2222// +-----------------------------------------------------------------------+
    2323
    24 if (!defined('PHPWG_ROOT_PATH'))
    25 {
    26   die('Hacking attempt!');
    27 }
    28 
     24if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    2925if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    3026
    31     define ("check_mailto", 0);
    32         define ("check_header_carbon",1);
    33         define ("check_header_text",2);
    34     define ("no_mail_list", 3);
    35         define ("no_connect",4);        // empeche l'ip de se connecter au site.
    36         define ("set_auto",5);          // Test a l'ouverture et enregistrement
    37     define ("ip",6);                    // dernirre adresse IP
    38         define ("set_id",7);            // enregistrment nouvel
    39  
    40  
    41  if (!isset($_COOKIE[session_name()]))
    42 {
    43 
    44 
    45 
    46 }
    47 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    48 include_once(PHPWG_ROOT_PATH.'include/functions.inc.php');
    49 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     27global  $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ;
     28// if (!isset($_COOKIE[session_name()])){}
     29
    5030global $lang ;
    51 
    52 include_once (MAIL_SUPERV_PATH.'include/function_test_send.php');
    53     load_language('plugin.lang', MAIL_SUPERV_PATH);
    54 global  $superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ;
    55          
    56 //==========================================================
    57 function sauve_options()
    58 {
    59 global $mails_options ;
    60  if ( isset($mails_options) )
    61         {
    62          
    63          while ( count($mails_options) < 10 )
    64            {
    65          
    66               $mails_options[]='?';
    67            }
    68            
    69                 $valeurs = implode( ',',$mails_options);
    70  
    71                
    72                 $query = '
    73                 UPDATE '.CONFIG_TABLE.'
    74                 SET value="'. $valeurs . '"
    75                 WHERE param = "mail_superv"
    76                 LIMIT 1';
    77                         pwg_query($query);
    78          
    79         }
    80 }
    81 //=================================================================================
    82 function sauve_donnees()
    83 {
    84 
    85 global $mails_donnees,$superv_champs,$superv_type,$erreur_message ;
    86 //=====================================================================
    87         $clefs = $superv_champs ;
    88         $valeurs = array();
    89 
    90 foreach ( $clefs as $champ)
    91    {
    92      $champ = trim($champ);
    93      
    94          if ( isset($mails_donnees[  $champ ]) ) {
    95            $sep= (is_string($mails_donnees[ $champ ])) ? '"' : '' ;
    96        array_push($valeurs , "`".$champ."`" . ' = ' . $sep . $mails_donnees[  $champ ] . $sep)  ;
    97          }else{
    98          
    99             array_push($valeurs , "`".$champ."`" . ' = ' .  "0"  )  ;
    100          }
    101          
    102     }
    103 $valeurs = implode(", ",$valeurs) ;
    104 //=====================================================================
    105 $query = '
    106         UPDATE '.MAIL_SUPERV_TABLE.'
    107         SET '. $valeurs .'
    108                 WHERE `id` = 1 LIMIT 1 ';
    109                 ;
    110         ob_start();
    111                 $ret=  pwg_query($query)    ;
    112                 $m= ob_get_contents();
    113         ob_end_clean() ;
    114         $erreur_message .= $m ;
    115 
    116 }
    117          
    118 //=================================================================================
    119 function affiche_message()
    120 {
    121  global $template,$infos_message,$erreur_message, $user ,$ip;
    122 
    123 global $mails_options,$conf,$lang ;
    124 
    125 $mails_options = explode("," , $conf['mail_superv']);
    126                 if (!isset($ip)) {
    127                        if (getenv("HTTP_CLIENT_IP"))
    128                                             {    $ip=getenv("HTTP_CLIENT_IP");  }
    129                                         else{   $ip=getenv("REMOTE_ADDR");      }
    130                            }
    131 //  unset ($_SESSION['pwg_'.'action_spam']);
    132      $action_spam = pwg_get_session_var('action_spam') ;
    133     if  ($action_spam == null) { $action_spam = kill_list();  }
    134        
    135         if (is_bool($action_spam)) $action_spam =($action_spam == true) ? "true" : "false" ;
    136           if ($action_spam == "true" )
    137                  { 
    138                   $erreur_message = $ip . " "  . $action_spam  ;
    139                   pwg_set_session_var('action_spam', "true");
    140                   $erreur_message .= "<BR />".l10n('Sv_is_a_spam') ;
    141                  if ($mails_options[no_connect] == 'on' ){
    142                         //[status] => guest
    143                         //[status] => normal
    144                         //[status] => webmaster
    145                         if ($user['status'] != 'webmaster'  )
    146                                 if (!isset($_GET['admin'])) {
    147                                                  die('Blacklist : <br />' .$erreur_message. '<br /> Hacking attempt!');
    148                                 }elseif   ($_GET['admin'] != 'piwigo')
    149                                         {
    150                                                  die('blacklist Hacking attempt!');
    151                                         }
    152                                 unset ($_SESSION['pwg_'.'action_spam']);
    153            }
    154              }else{
    155                    pwg_set_session_var('action_spam', "false");
    156                  }
    157        
    158  
    159 // }     
    160 
    161  //==============================================================
    162   if (isset($erreur_message))
    163                 {       
    164  
    165                 if ($erreur_message <> "")
    166                         {
    167                             $erreur_message = str_replace("\n",'<br />',$erreur_message) ;
    168                                 $template->assign('errors',$erreur_message);
    169                                 $erreur_message = "";
    170                         }
    171                 }
    172                
    173        
    174   if (isset($infos_message))
    175                 {       
    176                
    177                 if ($infos_message <> "")
    178                         {
    179                                 $infos_message = str_replace("\n",'<br />',$infos_message) ;
    180                                 $template->assign('infos',$infos_message);
    181                                 $infos_message = "";
    182                         }
    183                 }
    184                 //=============================================================
    185        
    186        
    187 return;         
    188                
    189 }
    190 
    191 function Get_geo()
    192 {
    193 global $ip,$pays,$region,$ville, $latitude ,$longitude,$mails_options;
    194          //===================================================================================
    195         $info_geo = pwg_get_session_var('info_geo');
    196         print_r($info_geo );
    197         if (count($info_geo) > 0) 
    198         {
    199                
    200                 $pays  = $info_geo[0];
    201                 $region  = $info_geo[1];
    202                 $ville  = $info_geo[2];
    203                 $latitude = $info_geo[3];
    204                 $longitude = $info_geo[4];
    205                 $ip = $info_geo[5];
    206                 return true;
    207         }
    208 //=======================================================================
    209 
    210  if (isset($_POST['pays'])) {
    211                         $pays = isset($_POST['pays']) ? $_POST['pays'] : "";
    212                         $region =  isset($_POST['region']) ? $_POST['region'] :"";                             
    213                         $ville = (isset($_POST['ville']))   ? $_POST['ville']: "";
    214                         $latitude =  isset($_POST['latitude']) ? $_POST['latitude'] : "";       
    215                         $longitude =  isset($_POST['longitude']) ? $_POST['longitude'] : "";
    216                                
    217                         $info_geo = array(   $pays ,$region , $ville ,$latitude, $longitude,$_SERVER['REMOTE_ADDR']  );
    218                         pwg_set_session_var('info_geo', $info_geo);
    219                         return true;
    220  
    221  }else{
    222 
    223             $result="";
    224 ?>
    225 <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js" type="text/javascript" >
    226 </script>         
    227 <script language="JavaScript" type="text/javascript">
    228             var pays     =  geoip_country_name();
    229                         var ville     =  geoip_city();
    230                         var region    =  geoip_region_name() ;
    231                         var latitude  =  geoip_latitude() ;
    232                         var longitude =  geoip_longitude() ;
    233                        
    234 </script>
    235 <form action="" method="post" name="form_connexion" id="form_connexion" style="visibility:hidden">
    236 <script language="JavaScript" type="text/javascript">                   
    237                 document.write ("<input name=\"pays\"  type=\"text\" value =  "+ pays + "  id = \"pays\"  > ");
    238                 document.write ("<input name=\"ville\"  type=\"text\" value = "+ ville + "  id = \"ville\"   >  ");
    239                 document.write ("<input name=\"region\"  type=\"text\" value =  "+ region + "   id = \"region\"   > ");
    240                 document.write ("<input name=\"latitude\"  type=\"text\" value =  "+ latitude + " id = \"latitude\"   > ");
    241                 document.write ("<input name=\"longitude\"  type=\"text\" value = "+ longitude + " id = \"longitude\"  >  ");
    242 </script>       
    243 
    244 </form >       
    245 <script language="JavaScript" type="text/javascript">
    246   document.getElementById("form_connexion").submit();
    247 </script>
    248 <?php   
    249    
    250  }
    251 //=====================================================================================         
    252 }
    253 
    254 //=================================================================================
    255 function Get_Datas()
    256 {
    257 global $superv_champs ;
    258 $champs = implode(",",$superv_champs );
    259     $query = "SELECT ".$champs."
    260     FROM ".MAIL_SUPERV_TABLE."
    261         ;";
    262                          $result = @pwg_query($query);
    263  
    264         if (!$result) {
    265                                         verif_base();
    266                                         $result = @pwg_query($query);
    267                                         }
    268 
    269                                        
    270     $data = mysql_fetch_array($result,MYSQL_ASSOC);
    271         //====================================================================================
    272 
    273         $next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] );
    274  $next_day = ($next_day >0) ? $next_day :  (604800  + time()) ;
    275         $data['rest_mail'] =    $next_day - time() ;
    276 
    277         $next_day = Str_To_Time( $data['nb_spams_periode'],$data['date_spam']);
    278         $next_day = ($next_day >0) ? $next_day :  (172800  + time()) ;
    279         $data['rest_spam'] =  $next_day - time() ;
    280 
    281 
    282         $next_day = Str_To_Time($data['quarantaine_periode'] ,$data['date_quarantaine']);       
    283         $next_day = ($next_day >0) ? $next_day :  (172800 + time()) ;
    284        
    285         if ($data['quarantaine'] == 'true' ) {
    286                         $data['reste'] =   ( $next_day )-time() ;
    287         }else{
    288                         $data['reste'] = 0;
    289         }
    290        
    291          return $data;
    292 }
     31global $template ;
    29332//===============================================
    294 
    29533function corrige_header($Carbonne,$headers,$args,$cl_list_mail)
    29634        {
     
    30139                if ( count($args[$Carbonne]) > 0 )
    30240                {
    303                         if ($mails_options[check_header_carbon] == 'on') {
     41                        if ($mails_options['check_header_carbon'] == 'on') {
    30442                                        $cl_list_mail  =  str_replace(","," , ",get_strict_email_list(implode(',', $args[$Carbonne])))." \n"  ;
    30543                                        $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$cl_list_mail, $headers);
     
    36199$retour=str_replace("+0","+",$retour);
    362100//================================================================================================   
    363 
    364 
    365101return $retour;
    366 
    367 }       
    368 
    369 function memo_var($variables)
    370 {
    371                 ob_start();
    372                 echo '<pre>';
    373                 print_r($variables);
    374                 echo '</pre>';
    375                 $m= ob_get_contents();
    376 
    377         ob_end_clean();
    378                 return $m;
    379                
    380 }
    381    
     102}         
    382103
    383104       
    384 function verif_base()
    385 {
    386 
    387 global $lang,$superv_champs,$superv_type,$superv_bl_champs,$superv_bl_type;
    388     load_language('plugin.lang', MAIL_SUPERV_PATH);
    389 //==============================================================================               
    390     create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
    391         ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type)  ;
    392 //==============================================================================               
    393         create_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ;
    394         ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type)  ;
    395 //==============================================================================               
     105function verif_base(){
     106  global $lang,$superv_champs,$superv_type,$superv_bl_champs,$superv_bl_type;
     107  load_language('plugin.lang', MAIL_SUPERV_PATH);
     108  //==============================================================================             
     109  create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
     110  ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type)  ;
     111  //==============================================================================             
     112  create_table(mail_superv_TABLE,$superv_champs,$superv_type) ;
     113  ajust_table(mail_superv_TABLE,$superv_champs,$superv_type)  ;
     114  //==============================================================================             
    396115    $valeurs= array (   1,
    397                                                 0,
    398                            time(),
     116                                                          0,
     117                                   time(),
    399118                         2000,
    400          '"604800"' ,
     119                  '"604800"' ,
    401120                            0,
    402                   time(),
     121                       time(),
    403122                           10,
    404           '"172800"',
    405                        '"false"',
    406                 time(),
    407           '"172800"',
    408           '"Init"',
     123                   '"172800"',
     124                    '"false"',
     125                       time(),
     126                   '"172800"',
     127                     '"Init"',
    409128   '"'.l10n('Sv_supervisor').'"',
    410129        '"'.l10n('hello').'"',
    411          )
    412         ;
    413 //==================================================================================
    414         ajout_ligne(MAIL_SUPERV_TABLE,$superv_champs, $valeurs,false ) ;
    415        
    416 
    417 }
     130         );
     131        ajout_ligne(mail_superv_TABLE,$superv_champs, $valeurs,false ) ;
     132}
     133//=================================================================================
     134
    418135
    419136//=========================================
     
    434151{
    435152global $conf ;
    436 
    437153  $query = '
    438154SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
     
    447163    LEFT JOIN '.USER_GROUP_TABLE.' AS ug
    448164      ON u.'.$conf['user_fields']['id'].' = ug.user_id
    449   WHERE ug.group_id='.$group_id.' ';
    450 
    451 
    452  
     165  WHERE ug.group_id='.$group_id.' ';
    453166 $groups=array();
    454   $datas = pwg_query($query);
    455  
    456  
    457   if (!empty($datas))
    458   {
     167  $datas = pwg_query($query);
     168 
     169  if (!empty($datas)) {
    459170    while ($group = mysql_fetch_array($datas,MYSQL_ASSOC))
    460     {
    461 
    462        
     171    {   
    463172      if (!empty($group['email']))
    464       {
    465         array_push($groups, format_email($group['username'], $group['email'] ));
     173      {         array_push($groups, format_email($group['username'], $group['email'] ));
    466174      }
    467175    }
     
    472180//=================================================================================
    473181
    474 function create_table($nom_table,$champs,$types)  //MAIL_SUPERV_TABLE
     182function create_table($nom_table,$champs,$types)  //mail_superv_TABLE
    475183{
    476184        $i=0;
    477185        $valeurs=array();
    478 foreach ( $champs as $champ)
    479    {
    480         $champ = trim($champ);
    481                 array_push($valeurs , " `".$champ."`" . '  ' . $types[ $i] )  ;
    482                 $i +=1;
     186  foreach ( $champs as $champ) {
     187      $champ = trim($champ);
     188      array_push($valeurs , " `".$champ."`" . '  ' . $types[ $i] )  ;
     189      $i +=1;
    483190    }
    484191
     
    495202         
    496203}
    497 function ajust_table($nom_table,$champs,$types)  //MAIL_SUPERV_TABLE
     204function ajust_table($nom_table,$champs,$types)  //mail_superv_TABLE
    498205{
    499206global $infos_message ;
     
    514221        if ( count($valeurs) == 0) return ;
    515222       
    516   $infos_message .=  "AJUSTE TABLE : ". $nom_table . "<br />" . "NB (col) : ". count($colonnes) . memo_var($valeurs) . "<br />" ;
     223  $infos_message .=  "AJUSTE TABLE : ". $nom_table . "<br />" . "NB (col) : ". count($colonnes) . mail_supervisor::Memo_Var($valeurs) . "<br />" ;
    517224       
    518225     $valeurs=implode(", ",$valeurs) ;
     
    556263global $mails_donnees,$infos_message,$erreur_message,$page;
    557264
    558 if (!is_numeric($mails_donnees['nb_mails_periode']))
    559 {
    560  $periode = Str_To_Time( $mails_donnees['nb_mails_periode'],0);
    561  $mails_donnees['nb_mails_periode']= ($periode > 0) ? $periode : '604800' ;
     265if (!is_numeric($mails_donnees['nb_mails_periode'])){
     266  $periode = Str_To_Time( $mails_donnees['nb_mails_periode'],0);
     267  $mails_donnees['nb_mails_periode']= ($periode > 0) ? $periode : '604800' ;
    562268 }
    563 
    564 if (!is_numeric($mails_donnees['nb_spams_periode']))
    565 {
    566  
    567  $periode=Str_To_Time( $mails_donnees['nb_spams_periode'],0);
    568  $mails_donnees['nb_spams_periode']= ($periode > 0) ? $periode : '172800' ; ;
     269if (!is_numeric($mails_donnees['nb_spams_periode'])){
     270  $periode=Str_To_Time( $mails_donnees['nb_spams_periode'],0);
     271  $mails_donnees['nb_spams_periode']= ($periode > 0) ? $periode : '172800' ; ;
    569272 }
    570 if (!is_numeric($mails_donnees['quarantaine_periode']))
    571 {
    572  $periode=Str_To_Time( $mails_donnees['quarantaine_periode'],0);
    573  $mails_donnees['quarantaine_periode']= ($periode > 0) ? $periode : '172800' ;
     273if (!is_numeric($mails_donnees['quarantaine_periode'])){
     274  $periode=Str_To_Time( $mails_donnees['quarantaine_periode'],0);
     275  $mails_donnees['quarantaine_periode']= ($periode > 0) ? $periode : '172800' ;
    574276 }
    575 
    576         if  ($infos_message != "")  {
    577                    array_push($page['infos'],  $infos_message);
    578                    $infos_message="";
    579                  }
    580                  
    581                 if  ($erreur_message != "")  {
    582                   array_push($page['errors'], $erreur_message);
    583                   $erreur_message ="";
    584                  }     
     277    if  ($infos_message != "")  {
     278        array_push($page['infos'],  $infos_message);
     279        $infos_message="";
     280    }           
     281    if  ($erreur_message != "")  {
     282        array_push($page['errors'], $erreur_message);
     283        $erreur_message ="";
     284    }   
    585285                 
    586286}
     
    730430        $sep=" ";
    731431        $chaine = trim($chaine);
     432    if ($chaine=="") return ;
    732433        $existe = (strpos($sep.$sep,$chaine )===false) ;
    733434         while  ($existe ){
    734435         $str_temp = str_replace($sep.$sep, $sep, $chaine ); 
    735436                if($str_temp == $chaine ) return $chaine ;
    736 //                      $erreur_message .= memo_var($str_temp) ;
     437//                      $erreur_message .= mail_supervisor::Memo_Var($str_temp) ;
    737438                $chaine  = $str_temp;
    738439                        $existe =  (strpos($sep.$sep,$chaine )===false) ;
     
    740441        return $chaine;
    741442}
    742 
    743 
    744 
    745 function kill_list()
    746 {
    747  //==================== TEST black_liste ============================================   
    748  global $pays,$region,$ville,$ip ;
    749  global $erreur_message,$infos_message,$conf;   
    750  global $conf, $user, $page;
    751  global $mails_options ;
    752  global $superv_bl_champs,$superv_bl_type ;
    753  global $nb ;
    754  
    755 if (count($mails_options) < 7 ) return false ;
    756    
    757      $champs=implode(',',$superv_bl_champs);
    758      $query = "
    759                 SELECT ".$champs.",COUNT(`ip`) as total
    760                 FROM `".MAIL_BLACK_LISTE_TABLE."`
    761                     WHERE '".$ip."' LIKE `ip`
    762                         GROUP by `ip`
    763                 ;";     
    764                  $result = @pwg_query($query);
    765         if (!$result) {
    766                                         verif_base();
    767                                         $result = @pwg_query($query);
    768                                 }
    769         $datas = mysql_fetch_array($result,MYSQL_ASSOC);
    770         $nb = $datas['total'];
    771 //=======================================================================       
    772 
    773 if ($mails_options[set_auto] == 'nonoui') // ne plus tester automatiquement .
    774 {
    775  // $ip="94.102.63.13"; ' Spammeurs
    776  // $ip="94.102.63.15";
    777  // $mail=matusowraber93813@gmail.com ;
    778  // $username=fretgpsolodens ;
    779 global $user_name,$mail_adresse;
    780 
    781   if (test_spam($ip,$user['username'] ,$user['email']))
    782   {
    783 
    784   if ($nb==0) {
    785         $valeurs=array( 'NULL',
    786                             "'".$ip."'",
    787                                         "'".$pays."'",
    788                                         "'".$region."'",       
    789                                         "'".$ville."'",
    790                                         "'".$user['email']."'",
    791                                         "'".$user['username']."'",     
    792                                         $nb+1
    793         );
    794           ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,$nb==0) ;     
    795         }else{ 
    796        
    797         $nb +=1;
    798        
    799                  $query ="
    800                         UPDATE " . MAIL_BLACK_LISTE_TABLE . "
    801                         SET ";
    802                     if (isset($_POST['pays'])) 
    803                  $query .= "   
    804                         `pays` = '". $pays ."',
    805                         `region` = '" . $region ."',
    806                         `ville` = '" . $ville . "',
    807                        
    808                         ";
    809                        
    810                  $query .= "
    811                     `adresse` = '".$user['email']."',           
    812                         `fai` = '".$user['username']."',               
    813                         `nb` = " . $nb . "
    814                     WHERE '".$ip."' like `ip`
    815                 ";
    816                
    817                                 pwg_query($query );     
    818         }
    819           $erreur_message .=  $mails_options[ip] ." ".$user['username']." ".$user['email'] . ' -----> ' . l10n('Sv_black_list') ;
    820         // die($nb." ".$ip." ".$user['username']." ".$user['email']); 
    821         return true ;   
    822 
    823     }
    824  
    825 }
     443//==================== TEST black_liste ============================================   
     444function kill_list() {
     445  global $pays,$region,$ville,$ip ;
     446  global $erreur_message,$infos_message,$conf; 
     447  global $conf, $user, $page;
     448  global $mails_options ;
     449  global $superv_bl_champs,$superv_bl_type ;
     450  global $nb ;
     451  if (!isset($ip)) {
     452    if (getenv("HTTP_CLIENT_IP"))   {
     453      $ip=getenv("HTTP_CLIENT_IP");
     454    }else{
     455      $ip=getenv("REMOTE_ADDR");
     456    }
     457  }
     458  $champs=implode(',',$superv_bl_champs);
     459   $query = "SELECT ".$champs.",COUNT(`ip`) as total
     460  FROM `".MAIL_BLACK_LISTE_TABLE."`
     461                WHERE '".$ip."' LIKE `ip`
     462                GROUP by `ip`
     463  ;";   
     464        $result = @pwg_query($query);
     465         if (!$result) {
     466                        verif_base();
     467                        $result = @pwg_query($query);
     468                        }
     469          $datas = mysql_fetch_array($result,MYSQL_ASSOC);
     470        $nb = $datas['total']|0;
     471    //=======================================================================   
     472    if ($mails_options['set_auto'] == 'on') { 
     473      global $user_name,$mail_adresse;
     474
     475       if (isset($nb) && $nb>0) {
     476       //if (test_spam($ip,$user['username'] ,$user['email']))  // ne plus tester automatiquement .
     477            if ($nb==0) {
     478                  $valeurs=array( 'NULL',
     479                           "'".$ip."'",
     480                                                "'".$pays."'",
     481                                                "'".$region."'",       
     482                                                "'".$ville."'",
     483                                                "'".$user['email']."'",
     484                                                "'".$user['username']."'",     
     485                                                $nb+1
     486                    );
     487                  ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,$nb==0) ;     
     488                }else{ 
     489            mail_supervisor::Get_geo();   
     490            $nb +=1;   
     491                         $query ="UPDATE " . MAIL_BLACK_LISTE_TABLE . " SET ";
     492                         if (isset($_POST['pays']))     
     493                         $query .= "`pays` = '". $pays ."',
     494                                `region` = '" . $region ."',
     495                                `ville` = '" . $ville . "',                     
     496                                ";                     
     497                         $query .= "`adresse` = '".$user['email']."',           
     498                                `fai` = '".$user['username']."',               
     499                                `nb` = " . $nb . "
     500                         WHERE '".$ip."' like `ip` ";           
     501                                       pwg_query($query );     
     502                }
     503             $erreur_message .= $pays . $ip ." <br />User Name :".$user['username']."<br />User Mail :".$user['email'] . ' -----> ' . l10n('Sv_black_liste') ;
     504       // die($nb." ".$ip." ".$user['username']." ".$user['email']); 
     505 
     506       return true ;   
     507      } 
     508    }
    826509 //==============================================================================
    827  if ( $mails_options[ip] == $ip ) return ($nb > 0) ;   
    828    $mails_options[ip] =   $ip ; 
    829    sauve_options();
    830  
     510
     511 if ( $mails_options['ip'] == $ip ) return ($nb > 0) ;   
     512   $ip0= $mails_options['ip'] ;
     513   $mails_options['ip'] = $ip ; 
     514   mail_supervisor::sauve_options(); 
    831515        if (  $nb > 0 )
    832516        {
     
    848532            $row  = mysql_fetch_row(pwg_query($query));
    849533            $nb =  ($row[7]);
    850       $erreur_message .= $ip . ' | ' . $pays . ' | ' . $region . ' | ' . $ville . ' ' . $nb . ' ==> '; 
     534        $erreur_message .= $ip0 . ' | ' .$ip . ' | ' . $pays . ' | ' . $region . ' | ' . $ville . ' ' . $nb . ' ==> '; 
    851535 
    852536         if ($nb == 0)
     
    858542                                        "'".$ville."'",
    859543                                        "'".$user['email']."'",         
    860                                "'".$user['username']."'",               
     544                          "'".$user['username']."'",           
    861545                                        1
    862546              );
     
    883567                                pwg_query($query );     
    884568                                }
    885         //================================================================================     
    886                
    887569        }
    888  
    889 
    890 return ($nb > 0) ;
     570 return ($nb > 0) ;
    891571}
    892572//=====================================================================================
    893573function test_spam($ip =0,$user_name ='', $mail_adresse = "")
    894574{
    895         $buffer="";
    896         global $page,$infos_message;
    897 
    898 // fretgpsolodens
    899         $src =  "http://www.stopforumspam.com/api?";
    900         $type=array();
    901         $result="";
    902 if (strlen($ip)>3) {
    903 //==================  Verifie si l'IP est correct  ================================
    904 if (clj_is_ip($ip)){     
     575 $buffer="";
     576 global $page,$infos_message;
     577 $src =  "http://www.stopforumspam.com/api?";
     578 $type=array();
     579 $result="";
     580 $ip= sup_double_espace($ip);
     581 if (strlen($ip)>3) {
     582   //==================  Verifie si l'IP est correct  ================================
     583   if (clj_is_ip($ip)){     
    905584     
    906 } else { 
    907 //==================  Verifie si l'adresse mail est correcte  ================================
    908       if( clj_is_mail($ip) ){ 
    909                           $mail_adresse=$ip ;
     585   } else { 
     586   //==================  Verifie si l'adresse mail est correcte  ================================
     587         if( clj_is_mail($ip) ){ 
     588                         $mail_adresse=$ip ;
     589                 $ip="";
     590            }
     591            else
     592            {
     593   //==================  Login  ================
     594              $user_name=$ip;
    910595              $ip="";
    911          }
    912          else
    913          {
    914 //==================  Login  ================
    915            $user_name=$ip;
    916            $ip="";
    917          }
    918 }   
    919 //=============================================================================
    920 }
    921 
    922 $user_name=str_replace(" ","%20",trim($user_name));
    923 if ($user_name==l10n('Sv_guest')) $user_name="";
    924 $user_name="";  // ne plus tester sur le login.
    925 $mail_adresse =str_replace(" ","%20",trim($mail_adresse));
    926 
    927 if ( strlen($user_name) > 3)      $type[]="username=$user_name" ;
    928 if ( strlen($mail_adresse) > 3)   $type[]="email=".$mail_adresse ;
    929 if ( strlen($ip) > 3)   $type[]="ip=".$ip ;
    930 
    931          foreach  ( $type as $fil )
    932      {   
    933           $resultat="";
    934            if (  clj_fetchRemote($src.$fil , $resultat,1))
    935                   {
    936                     $result .= $resultat.'<br />'  ;
    937                   }  else {
    938                  
    939                   }
    940                  
    941       }
    942 
    943 return !(strpos(  $result ,'yes' ) === false) ;
     596            }
     597   }   
     598   //=============================================================================
     599 }
     600
     601 $user_name=str_replace(" ","%20",trim($user_name));
     602 if ($user_name==l10n('Sv_guest')) $user_name="";
     603 $user_name="";  // ne plus tester sur le login.
     604 $mail_adresse =str_replace(" ","%20",trim($mail_adresse));
     605 if ( strlen($user_name) > 3)     $type[]="username=$user_name" ;
     606 if ( strlen($mail_adresse) > 3)   $type[]="email=".$mail_adresse ;
     607 if ( strlen($ip) > 3)   $type[]="ip=".$ip ;
     608 foreach  ( $type as $fil ) {   
     609  $resultat="";
     610  if (  clj_fetchRemote($src.$fil , $resultat,1))
     611   $result .= $resultat.'<br />'  ;               
     612 }
     613
     614 return !(strpos(  $result ,'yes' ) === false) ;
    944615 
    945616}
     
    1044715}
    1045716
    1046  function Get_Version_plugins($dir)
    1047   {
    1048         $path = $dir;
    1049           $plg_data = implode( '', file($path.'main.inc.php') );
    1050           if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) )
    1051           {
    1052             $plugin['name'] = trim( $val[1] );
    1053           }
    1054           if (preg_match("|Version: (.*)|", $plg_data, $val))
    1055           {
    1056             $plugin['version'] = trim($val[1]);
    1057           }
    1058           if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) )
    1059           {
    1060             $plugin['uri'] = trim($val[1]);
    1061           }
    1062           if ($desc = load_language('description.txt', $path.'/', array('return' => true)))
    1063           {
    1064             $plugin['description'] = trim($desc);
    1065           }
    1066           elseif ( preg_match("|Description: (.*)|", $plg_data, $val) )
    1067           {
    1068             $plugin['description'] = trim($val[1]);
    1069           }
    1070           if ( preg_match("|Author: (.*)|", $plg_data, $val) )
    1071           {
    1072             $plugin['author'] = trim($val[1]);
    1073           }
    1074           if ( preg_match("|Author URI: (.*)|", $plg_data, $val) )
    1075           {
    1076             $plugin['author uri'] = trim($val[1]);
    1077           }
    1078           if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid='))
    1079           {
    1080             list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']);
    1081             if (is_numeric($extension)) $plugin['extension'] = $extension;
    1082           }
    1083           // IMPORTANT SECURITY !
    1084           $plugin = array_map('htmlspecialchars', $plugin);
    1085 
    1086          return $plugin ;
    1087 
    1088   }
    1089 
    1090 
    1091717
    1092718?>
  • extensions/Mail_supervisor/include/function_test_send.php

    r8917 r9702  
    2222// +-----------------------------------------------------------------------+
    2323
    24 if ( !defined('PHPWG_ROOT_PATH'))
    25 {
    26   die('Hacking attempt!');
    27 }
    28 
    29 
    30 
    31 function test_envoie($message,$group_name,$group_id)
    32 {
    33     global $infos_message,$erreur_message ,$conf,$user,$conf_mail,$mail_donnees,$args,$lang ;
    34         $mailto=""; 
    35        
     24if ( !defined('PHPWG_ROOT_PATH'))   die('Hacking attempt!');
     25function test_envoie($message,$group_name,$group_id){   
     26  global $infos_message,$erreur_message ,$conf,$user,$conf_mail,$mail_donnees,$args,$lang ;
     27        $mailto="";     
    3628 load_language('plugin.lang', MAIL_SUPERV_PATH);
    3729 
     
    4739if (!isset($mails_donnees))
    4840        {
    49         $mails_donnees = Get_Datas();
     41        $mails_donnees = mail_supervisor::Get_Datas();
    5042        }               
    5143if (!isset($conf_mail))
     
    5547          if (isset($args))
    5648  {
    57     $infos_message=memo_var($args);
     49    $infos_message=mail_supervisor::Memo_Var($args);
    5850  }else{
    5951        $args = array();
     
    8880        //==================================================================
    8981        $message_html .= "</br>" . $message . "</br>" . $message_texte;
    90 
    91        
    9282 //==========================================================================
    9383
     
    10999               $infos_message .='<br />'.l10n('Sv_no_receiver_available') ;
    110100        }
    111 
    112101}
    113102//===============================================================================================================
    114 function mail_attachement($args)
    115 {
     103function mail_attachement($args){
    116104 global $infos_message,$erreur_message ,$conf,$user,$conf_mail,$mail_donnees,$lang ;
    117105
    118     $mails_donnees = Get_Datas();
     106    $mails_donnees = mail_supervisor::Get_Datas();
    119107          if (!isset($conf_mail))
    120108  {
     
    145133               
    146134 
    147         $message_html =         '<img src="'.PHPWG_ROOT_PATH.'admin/template/goto/theme/roma/images/piwigo_logo_sombre_214x100.png" />';
    148         ob_start();   
     135  $message_html =       '<img src="'.PHPWG_ROOT_PATH.'admin/template/goto/theme/roma/images/piwigo_logo_sombre_214x100.png" />';
     136  ob_start();   
    149137 
    150         echo str_replace("\n","<br />",$message_texte);
     138  echo str_replace("\n","<br />",$message_texte);
    151139       
    152         $message_html .= ob_get_contents()."\n";
    153         //ob_flush();
    154         ob_end_clean();
     140  $message_html .= ob_get_contents()."\n";
     141  //ob_flush();
     142  ob_end_clean();
    155143
    156        $limite=$conf_mail['boundary_key'];   
    157                 $headers =   date("Y-m-d H:i:s") ."\n";
     144  $limite=$conf_mail['boundary_key'];   
     145  $headers =   date("Y-m-d H:i:s") ."\n";
    158146
    159147  //=======================================================================================
    160                 $headers = "From: ".$args['from']."\n";
    161                 $headers.= "Reply-To: ".$args['from']."\n";
    162                 $nb_destinataires=0;
    163 $destinataire = $conf_mail['email_webmaster'];
     148    $headers = "From: ".$args['from']."\n";
     149    $headers.= "Reply-To: ".$args['from']."\n";
     150    $nb_destinataires=0;
     151    $destinataire = $conf_mail['email_webmaster']; 
     152    if (!empty($args['Cc'])){
     153      $nb_destinataires += count($args['Cc']);
     154      $to= explode(',', $args['Cc']);
     155      $headers  .= get_strict_email_list($to) ;             
     156        }
     157    if (!empty($args['Bcc'])){ 
     158      $nb_destinataires += count($args['Bcc']);
     159      $to = implode(',', $args['Bcc']);
     160      $headers  .= 'Bcc :'.get_strict_email_list($to)."\n" ;               
     161    }
    164162
    165  
    166                 if (!empty($args['Cc']))
    167                 {$nb_destinataires += count($args['Cc']);
    168                  $to= explode(',', $args['Cc']);
    169                  $headers       .= get_strict_email_list($to) ;
    170                    
    171                 }
    172                 if (!empty($args['Bcc']))
    173                 {  $nb_destinataires += count($args['Bcc']);
    174             $to = implode(',', $args['Bcc']);
    175             $headers    .= 'Bcc :'.get_strict_email_list($to)."\n" ;
    176                    
    177                 }
    178 
    179   $headers.= 'Content-Type: multipart/alternative;'."\n";
    180   $headers.= '  boundary="---='.$limite.'";'."\n";
    181   $headers.= '  reply-type=original'."\n";
    182   $headers.= 'MIME-Version: 1.0'."\n";
    183   $headers.= 'X-Mailer: Piwigo Mailer'."\n";
    184 
    185   //Le message en texte simple pour les navigateurs qui n'acceptent pas le HTML
    186     $texte = "This is a multi-part message in MIME format.\n";
    187        
    188         $texte .= "-----=".$limite."\n";
    189         $texte .= "Ceci est un message est au format MIME.\n";
    190         $texte .= 'Content-Type: text/plain; charset="UTF-8"'."\n";
    191         $texte .= 'Content-Transfer-Encoding: 8bit'."\n\n"; 
    192         $texte .= $message_texte ;
    193                 $texte .= "\n\n";
    194                
    195                 $texte .= "-----=".$limite."\n";
    196         $texte .= 'Content-Type: text/html; charset="UTF-8"'."\n";
    197         $texte .= 'Content-Transfer-Encoding: 8bit'."\n\n"; 
    198         $texte .= $message_html;
    199         $texte .= "\n\n";
    200          
    201 
    202 
    203                 $attachement = "-----=".$limite."\n";
    204                 $attachement .= "Content-Type: ".$typemime."; name=\"".$nom."\"\n";
    205                 $attachement .= "Content-Transfer-Encoding: base64\n";
    206                 $attachement .= "Content-Disposition: attachment; filename=\"".$nom."\"\n\n";
    207                 $attachement .= $piecejointe;
    208                 $attachement .= "\n\n\n-----=".$limite."\n";
    209 
    210 
    211   $ret=false;
    212 
    213 ob_start();
    214 
     163    $headers.= 'Content-Type: multipart/alternative;'."\n";
     164    $headers.= '  boundary="---='.$limite.'";'."\n";
     165    $headers.= '  reply-type=original'."\n";
     166    $headers.= 'MIME-Version: 1.0'."\n";
     167    $headers.= 'X-Mailer: Piwigo Mailer'."\n";
     168    //Le message en texte simple pour les navigateurs qui n'acceptent pas le HTML
     169    $texte = "This is a multi-part message in MIME format.\n"; 
     170    $texte .= "-----=".$limite."\n";
     171    $texte .= "Ceci est un message est au format MIME.\n";
     172    $texte .= 'Content-Type: text/plain; charset="UTF-8"'."\n";
     173    $texte .= 'Content-Transfer-Encoding: 8bit'."\n\n"; 
     174    $texte .= $message_texte ;
     175    $texte .= "\n\n";           
     176    $texte .= "-----=".$limite."\n";
     177    $texte .= 'Content-Type: text/html; charset="UTF-8"'."\n";
     178    $texte .= 'Content-Transfer-Encoding: 8bit'."\n\n"; 
     179    $texte .= $message_html;
     180    $texte .= "\n\n";
     181    $attachement = "-----=".$limite."\n";
     182    $attachement .= "Content-Type: ".$typemime."; name=\"".$nom."\"\n";
     183    $attachement .= "Content-Transfer-Encoding: base64\n";
     184    $attachement .= "Content-Disposition: attachment; filename=\"".$nom."\"\n\n";
     185    $attachement .= $piecejointe;
     186    $attachement .= "\n\n\n-----=".$limite."\n";
     187    $ret=false;
     188    ob_start();
    215189    $ret= mail( $destinataire, $args['subject'], $texte.$attachement, $headers);
    216    $message =  ob_get_contents() ;
    217         //ob_flush();
    218    ob_end_clean();
    219    if (($message)<>"") {
    220    $erreur_message .=  $message ;
    221    $infos_message =  "-------------------";
    222    }
    223 
    224     return  $ret;
    225  
     190    $message =  ob_get_contents() ;
     191  //ob_flush();
     192  ob_end_clean();
     193  if (($message)<>"") {
     194    $erreur_message .=  $message ;
     195    $infos_message =  "-------------------";
     196  }
     197  return  $ret; 
    226198}
    227 
    228 
    229199?>
  • extensions/Mail_supervisor/include/save_info.php

    r4939 r9702  
    22//=======================================================================================
    33if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    4 
    54switch (strtolower($info_ip))
    65 {
    7   case  'ajout' :
    8  
     6  case  'ajout' : 
    97 $ip_black=str_replace("*","%",$ip_black);
    10  
    11 
    128 if (!($ip_black == '')) {
    139   $query = "
     
    1713                ;";     
    1814        //==============================================================================               
    19         list($count) = mysql_fetch_row(pwg_query($query));
    20         //==============================================================================       
    21         $valeurs=array( 'NULL',
     15  list($count) = mysql_fetch_row(pwg_query($query));
     16  //==============================================================================     
     17  $valeurs=array( 'NULL',
    2218                            "'".$ip_black."'",
    23                                         "'".$pays."'",
    24                                         "'".$region."'",       
    25                                         "'".$ville."'",
    26                                         '"adresse"',
    27                                         '"fai" ',
    28                                         $count + 1
    29         );
     19                                                 "'".$pays."'",
     20                                                 "'".$region."'",       
     21                                                 "'".$ville."'",
     22                                                 '"adresse"',
     23                                                 '"fai" ',
     24                                                 $count + 1
     25                );
    3026        ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,($count==0)) ;   
    3127 }
     
    3430 //================================================================================================
    3531  case 'raz':
    36         $ip_black=str_replace('*',"%",$ip_black);
     32    $ip_black=str_replace('*',"%",$ip_black);
    3733                $query = "DELETE FROM `".MAIL_BLACK_LISTE_TABLE."` WHERE `ip`  like '%".$ip_black."%' ";
    38                         pwg_query($query);
     34                         pwg_query($query);
     35   
     36    unset ($_SESSION['pwg_'.'action_spam']);
    3937   break;
    4038   
    41     default:
    42 
    43 
    44                                
     39    default:                           
    4540   break;
    4641   
     
    4843//================ Liste Black liste =================
    4944  $query = "
    50     SELECT *,  COUNT(`ip`) as total ,   `ip` as blacklist, `ip` as U_DELETE
    51     FROM ".MAIL_BLACK_LISTE_TABLE."
    52                 GROUP by ip
    53         ;";
     45     SELECT *,  COUNT(`ip`) as total ,  `ip` as blacklist, `ip` as U_DELETE
     46     FROM ".MAIL_BLACK_LISTE_TABLE."
     47     GROUP by ip
     48     ;";
    5449        $liste_bl = array();
    55     $result = pwg_query($query);
    56                 while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
    57                         {
     50 $result = pwg_query($query);
     51                while ($row = mysql_fetch_array($result,MYSQL_ASSOC))   {
    5852                         array_push($liste_bl,$row);
    59                                 }
     53                                }         
    6054//================ Liste IP ==============             
    6155$req = mysql_query('SELECT count(distinct(`IP`)) FROM '.HISTORY_TABLE.'    ');
    6256$nbip =  array_pop(mysql_fetch_row($req)) ;
    6357
    64 
    65              $query = '
    66     SELECT DISTINCT     H.`id`,
    67         H.`date`,
    68         H.`time`,
    69         H.`user_id`,
    70         H.`IP`,
    71         COUNT(H.`IP`) as total 
    72     FROM '.HISTORY_TABLE.'  AS H
    73         WHERE  "'.$_SERVER['REMOTE_ADDR'].'"not LIKE H.`IP`
    74         ';//
    75         if (count($liste_bl)>0)
    76          {
    77         $query .= '
    78         AND  H.`IP` not IN (     SELECT `ip`
     58        $query = 'SELECT DISTINCT       H.`id`,
     59            H.`date`,
     60            H.`time`,
     61            H.`user_id`,
     62            H.`IP`,
     63            COUNT(H.`IP`) as total 
     64            FROM '.HISTORY_TABLE.'  AS H
     65            WHERE  "'.$ip.'"not LIKE H.`IP`     ';//
     66        if (count($liste_bl)>0){
     67        $query .= '     AND  H.`IP` not IN ( SELECT `ip`
    7968    FROM '.MAIL_BLACK_LISTE_TABLE.' ) ';
    8069        }
    81        
     70 
    8271        $query .= '     
    8372        GROUP by H.`IP`
    8473        ORDER by `id` DESC
    85         LIMIT '.(int)($params['per_page']*$params['start']).','.(int)$params['per_page'].'
    86        
     74        LIMIT '.(int)($params['per_page']*$params['start']).','.(int)$params['per_page'].'     
    8775        '   ;
     76
    8877        $result = pwg_query($query);
    8978        $liste_ip=array();
    90         while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
    91                         {
    92                            array_push($liste_ip, $row);
     79        while ($row = mysql_fetch_array($result,MYSQL_ASSOC))   {
     80
     81                  array_push($liste_ip, $row);
    9382                                }
    94                                
    9583
    9684?>
Note: See TracChangeset for help on using the changeset viewer.