Index: extensions/Mail_supervisor/include/constants.php
===================================================================
--- extensions/Mail_supervisor/include/constants.php	(revision 4065)
+++ extensions/Mail_supervisor/include/constants.php	(revision 4132)
@@ -3,4 +3,6 @@
 
 if (!defined('MAIL_SUPERV_TABLE')) define('MAIL_SUPERV_TABLE', $prefixeTable.'mail_superv');
+if (!defined('MAIL_BLACK_LISTE_TABLE')) define('MAIL_BLACK_LISTE_TABLE', $prefixeTable.'mail_black_list');
 if (!defined('FREE_MAIL_TABLE')) define('FREE_MAIL_TABLE', $prefixeTable.'free_mail');
+
 ?>
Index: extensions/Mail_supervisor/include/fonctions.php
===================================================================
--- extensions/Mail_supervisor/include/fonctions.php	(revision 4065)
+++ extensions/Mail_supervisor/include/fonctions.php	(revision 4132)
@@ -26,30 +26,90 @@
   die('Hacking attempt!');
 }
-if (!defined('MAIL_SUPERV_DIR')) define('MAIL_SUPERV_DIR' , basename(dirname(__FILE__)));
+
 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
 
 
+ if (!isset($_COOKIE[session_name()]))
+{
+
+
+
+}
 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
 include_once(PHPWG_ROOT_PATH.'include/functions.inc.php');
-
+include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
 global $lang ;
 
-include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+
 include_once (MAIL_SUPERV_PATH.'include/function_test_send.php'); 
 
-global $period_search,$period_match,$lang ;
-
 
     load_language('plugin.lang', MAIL_SUPERV_PATH);
-	$period_search=array("W","D","H","M","S");
-	array_push($period_search,l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde'));
-	array_push($period_search,l10n('Week').'s',l10n('Day').'s',l10n('Hour').'s',l10n('Minute').'s',l10n('Seconde').'s');
-	
-	
-	$period_match=array(' week',' day',' hour',' minute',' seconde');	
-	array_push($period_match,'week','day','hour','minute','seconde');
-	array_push($period_match,'week','day','hour','minute','seconde');
-	
-
+
+
+global 	$superv_champs , $superv_type ,$superv_bl_champs , $superv_bl_type ; 
+	  $superv_champs = array(
+	               "id",
+					"nb_mails",
+					"date_mail",
+					"nb_mails_maxi",		
+					"nb_mails_periode",	
+					"nb_spams",
+					"date_spam",	
+					"nb_spams_maxi",	
+					"nb_spams_periode",	
+					"quarantaine",
+					"date_quarantaine",
+					"quarantaine_periode",	
+					"message", 
+					"message_test", 
+				    "header_text",
+				
+					);
+					
+ 	$superv_type = array(
+	                " SMALLINT( 5 ) NOT NULL DEFAULT '0'"      ,
+					"INT NOT NULL DEFAULT '0'"  ,
+					"INT NOT NULL DEFAULT '0'"  ,
+					"INT NOT NULL DEFAULT '2000'",		
+					"TEXT"  ,	
+					"INT NOT NULL DEFAULT '0'",
+					"INT NOT NULL DEFAULT '0'",	
+					"INT NOT NULL DEFAULT '10'",	
+					"TEXT"  ,	
+					"TEXT" ,
+					"INT NOT NULL DEFAULT '0'",
+					"TEXT"  ,	
+					"TEXT"  , 
+					"TEXT"  , 
+					"TEXT"  ,
+					
+					);		
+					
+ 
+	  $superv_bl_champs = array(
+	  				"id",
+					"ip",
+					"pays",
+					"region",		
+					"ville",	
+					"adresse",
+					"fai",	
+					"nb"
+					);
+					
+ 	$superv_bl_type = array(
+	                " smallint(5) UNSIGNED NOT NULL auto_increment ",
+ 					"TEXT"  ,
+ 					"TEXT"  ,
+ 					"TEXT"  ,
+ 					"TEXT"  ,
+ 					"TEXT"  ,
+ 					"TEXT"  ,
+					" smallint(5) UNSIGNED "
+					);																	
+
+	
+//==========================================================
 function sauve_options()
 {
@@ -66,44 +126,43 @@
 function sauve_données()
 {
-global $mails_données ;
-
+global $mails_données,$superv_champs,$superv_type,$erreur_message ;
+//=====================================================================	
+	ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ;
+ 	$clefs = $superv_champs ;
+ 	$valeurs = array();
+
+foreach ( $clefs as $champ)
+   {
+     $champ = trim($champ);
+     
+	 if ( isset($mails_données[  $champ ]) ) {
+	   $sep= (is_string($mails_données[ $champ ])) ? '"' : '' ;
+       array_push($valeurs , "`".$champ."`" . ' = ' . $sep . $mails_données[  $champ ] . $sep)  ;
+	 }else{
+	 
+	    array_push($valeurs , "`".$champ."`" . ' = ' .  "0"  )  ;
+	 }
+    }
+$valeurs = implode(", ",$valeurs) ;
+//=====================================================================
 $query = '
         UPDATE '.MAIL_SUPERV_TABLE.'
-        SET `nb_mails`         = '.$mails_données['nb_mails'].',
-			`date_mail`        = '.$mails_données['date_mail'].',
-			`nb_mails_maxi`    = '.$mails_données['nb_mails_maxi'].',	
-			`nb_mails_periode`    = "'.$mails_données['nb_mails_periode'].'",	
-					
-			`nb_spams`         = '.$mails_données['nb_spams'].',
-			`date_spam`        = '.$mails_données['date_spam'].',
-			`nb_spams_maxi`    = '.$mails_données['nb_spams_maxi'].',	
-			`nb_spams_periode`    = "'.$mails_données['nb_spams_periode'].'",	
-								
-			`quarantaine`      = "'.$mails_données['quarantaine'].'",
-			`date_quarantaine` = '.$mails_données['date_quarantaine'].',
-			
-			`quarantaine_periode`    = "'.$mails_données['quarantaine_periode'].'",				
-			
-			`message`          = "'.$mails_données['message'].'",
-			`message_test`     = "'.$mails_données['message_test'].'",
-			`header_text`      = "'.$mails_données['header_text'].'"
-		WHERE `id` =1 LIMIT 1 ';
-		
-
-    if (  pwg_query($query)) return;
-	
-	vérif_base() ;
-	if (  pwg_query($query)) return;
-
-	
-	;
-
-
-}
+        SET '. $valeurs .'
+		WHERE `id` = 1 LIMIT 1 ';
+		;
+	ob_start();
+		$ret=  pwg_query($query)    ;
+	  	$m= ob_get_contents();
+	ob_end_clean() ;
+	$erreur_message .= $m ;
+
+}
+	 
 //=================================================================================
 function affiche_message()
 {
- global $template,$infos_message,$erreur_message ;;
-  
+ global $template,$infos_message,$erreur_message, $user ;;
+
+	
   if (isset($erreur_message))
 		{	
@@ -129,5 +188,14 @@
   		}
 				
-		
+	if (kill_list() && $user['status'] == 'guest')
+	if (!isset($_GET['admin'])) {
+	   die('blacklist Hacking attempt!');
+	  }else{
+	  if   ($_GET['admin'] != 'piwigo')
+	  		{
+	  		die('blacklist Hacking attempt!');
+	  		}
+	  }
+	 
 		
 }
@@ -138,15 +206,12 @@
 function Get_Datas()
 {
-ob_start();
-
-	$data=Lire_datas();
-
-
+        ob_start();
+	        $data=Lire_datas();
 	  	  	$m= ob_get_contents();
     	ob_end_clean();
 	
 	if (strlen($m)>0) {
-	vérif_base() ;
-	$data=Lire_datas();
+	  vérif_base() ;
+	  $data=Lire_datas();
 	}
     return $data;
@@ -155,15 +220,5 @@
 function Lire_datas()
 {
-global $period_search,$period_match ;
- if (!isset($period_search)) {
-  	$period_search=array("W","D","H","M","S");
-	array_push($period_search,l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde'));
-	array_push($period_search,l10n('Week').'s',l10n('Day').'s',l10n('Hour').'s',l10n('Minute').'s',l10n('Seconde').'s');
-	
-	
-	$period_match=array(' week',' day',' hour',' minute',' seconde');	
-	array_push($period_match,'week','day','hour','minute','seconde');
-	array_push($period_match,'week','day','hour','minute','seconde');
-	}
+
 
  $query = "
@@ -171,24 +226,19 @@
     FROM ".MAIL_SUPERV_TABLE."
   	;";
-    $data = mysql_fetch_array(pwg_query($query));
+    $data = mysql_fetch_array(pwg_query($query),MYSQL_ASSOC);
 	//====================================================================================
-    $mails_periode = "+" . trim( str_replace($period_search, $period_match, $data['nb_mails_periode']));
- 
-	$next_day = $data['date_mail'] + strtotime(  $mails_periode,0);;
+	$next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] );;
 	$data['rest_mail']=    $next_day - time() ;
- 
-				
-	$spams_periode="+".str_replace($period_search, $period_match, $data['nb_spams_periode']);
-	$next_day = $data['date_spam'] + strtotime(  $spams_periode,0);
-	$data['rest_spam']=  $next_day -time() ;
-
-  
-	$quarantaine_periode="+".str_replace($period_search, $period_match, $data['quarantaine_periode']);
-	$next_day = $data['date_quarantaine'] + strtotime( $quarantaine_periode,0);	
-	
-	if ($data['quarantaine']) {
-	$data['reste'] =   ( $next_day )-time() ;
+
+	$next_day =  + Str_To_Time( $data['nb_spams_periode'],$data['date_spam']);
+	$data['rest_spam']=  $next_day - time() ;
+
+
+	$next_day = Str_To_Time($data['quarantaine_periode'] ,$data['date_quarantaine']);	
+	
+	if ($data['quarantaine'] == 'true' ) {
+			$data['reste'] =   ( $next_day )-time() ;
 	}else{
-	$data['reste'] = 0;
+			$data['reste'] = 0;
 	}
 	
@@ -225,31 +275,25 @@
 {
 
-
-
-$delta=(7*24*60*60) ;
-$week = (int) ($int/$delta); 
-
-$int= $int-($week*$delta) ;  
-
-
-$delta=(24*60*60) ;
-$day= (int) ($int/$delta); 
-$int=$int-($day*$delta);
-
-$delta=(60*60) ;
-$heures=(int) ($int/$delta);
-$int=$int-($heures*$delta);
-
-$delta=(60) ;
-$minutes=(int) ($int/$delta);
-$int= $int - ($minutes*$delta);
-
-
-$secondes=(int) ($int);
-
-$day      = substr ('00'.    $day,-2,2);   
-$heures   = substr ('00'. $heures,-2,2);   
-$minutes  = substr ('00'.$minutes,-2,2);
-$secondes = substr ('00'.$secondes,-2,2);
+	$delta=(7*24*60*60) ;
+	$week = (int) ($int/$delta); 
+	$int= $int-($week*$delta) ;  
+
+	$delta=(24*60*60) ;
+	$day= (int) ($int/$delta); 
+	$int=$int-($day*$delta);
+
+	$delta=(60*60) ;
+	$heures=(int) ($int/$delta);
+	$int=$int-($heures*$delta);
+
+	$delta=(60) ;
+	$minutes=(int) ($int/$delta);
+	$int= $int - ($minutes*$delta);
+
+	$secondes=(int) ($int);
+	$day      = substr ('00'.    $day,-2,2);   
+	$heures   = substr ('00'. $heures,-2,2);   
+	$minutes  = substr ('00'.$minutes,-2,2);
+	$secondes = substr ('00'.$secondes,-2,2);
 
    
@@ -278,139 +322,30 @@
 {
 
-global $lang;
- load_language('plugin.lang', MAIL_SUPERV_PATH);
-
-$q = "
-    CREATE TABLE IF NOT EXISTS ".MAIL_SUPERV_TABLE." (
-		`id` SMALLINT( 5 ) NOT NULL DEFAULT '0',
-		
-		`nb_mails` INT NOT NULL DEFAULT '0',
-		`date_mail` INT NOT NULL DEFAULT '0',
-		`nb_mails_maxi` INT NOT NULL DEFAULT '2000',		
-		`nb_mails_periode` TEXT  ,	
-		
-		`nb_spams` INT NOT NULL DEFAULT '0',
-		`date_spam` INT NOT NULL DEFAULT '0',	
-		
-		`nb_spams_maxi` INT NOT NULL DEFAULT '10',	
-		`nb_spams_periode` TEXT  ,	
-		
-		`quarantaine` TEXT ,
-		`date_quarantaine` INT NOT NULL DEFAULT '0',
-		`quarantaine_periode` TEXT  ,	
-			
-		
-		`message` TEXT  , 
-		`message_test` TEXT  , 
-		`header_text` TEXT , 
-      	PRIMARY KEY  (`id` )
-   	 )
-  ;";
-  pwg_query($q);
-  
-    $nb = Get_colonnes_de(MAIL_SUPERV_TABLE);
-	$table=$nb[MAIL_SUPERV_TABLE];	 
-//================================================================================	
-    if (!in_array( "nb_mails",$table)) {	
-		$query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_mails` INT NOT NULL default '0' ";
-			   pwg_query($query);            }  
-	if (!in_array( "date_mail",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `date_mail` INT NOT NULL default '0' ";
-			   pwg_query($query);            } 
-	if (!in_array( "nb_mails_maxi",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_mails_maxi` INT NOT NULL default '2000' ";
-			   pwg_query($query);            } 
-	if (!in_array( "nb_mails_periode",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_mails_periode` TEXT ";
-			   pwg_query($query);            } 
-			   			   
-			   	   		   
-    if (!in_array( "nb_spams",$table)) {	
-		$query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_spams` INT NOT NULL default '0' ";
-			   pwg_query($query);            }  
-	if (!in_array( "date_spam",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `date_spam` INT NOT NULL default '0' ";
-			   pwg_query($query);            } 			   
-			    
-    if (!in_array( "nb_spams_maxi",$table)) {	
-		$query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_spams_maxi` INT NOT NULL default '10' ";
-			   pwg_query($query);  
-	if (!in_array( "nb_spams_periode",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `nb_spams_periode` TEXT ";
-			   pwg_query($query);            } 			             }  
-			   				
-		if (!in_array( "quarantaine",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `quarantaine` TEXT  , ";
-			   pwg_query($query);            } 	
-			   
-		if (!in_array( "date_quarantaine",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `date_quarantaine` INT NOT NULL default '0'    ";
-			   pwg_query($query);   
- 			            } 	
-		if (!in_array( "quarantaine_periode",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `quarantaine_periode` TEXT ";
-			   pwg_query($query);            } 					   
-			   	
-		if (!in_array( "message",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `message` TEXT   ";
-			   pwg_query($query);            } 	
-			   
-		if (!in_array( "message_test",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `message_test` TEXT   ";
-			   pwg_query($query);            } 				   
-			   
-		if (!in_array( "header_text",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `header_text` TEXT   ";
-			   pwg_query($query);            } 		
-		   			    			   	
-//-------------------------------------------------------   			    
-
-      $query = "
-    		SELECT COUNT(`id`) as total 
-    		FROM `".MAIL_SUPERV_TABLE."` 
-			 
-  		;";	
+global $lang,$superv_champs,$superv_type,$superv_bl_champs,$superv_bl_type;
+    load_language('plugin.lang', MAIL_SUPERV_PATH);
+ 	create_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ;
+  	ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type)  ;
 //==============================================================================		
-list($count) = mysql_fetch_row(pwg_query($query));
-
-
-  if ($count == 0)
-  {
-	 $next_day = time()  ;
-	 $date_quarantaine=time();
-
-	 
-	   $q = '
-    INSERT INTO '.MAIL_SUPERV_TABLE.' (id,
-	nb_mails,date_mail,nb_mails_maxi,nb_mails_periode,
-	nb_spams,date_spam,nb_spams_maxi,nb_spams_periode,
-	 quarantaine, date_quarantaine,quarantaine_periode,
-	 message_test,
-	 message,header_text)
-    VALUES (1,
-	0,
-	'.time().',
-	2000,
-	"1 '.l10n('Week').'",
-	
-	0,
-	'.time().',
-	10,
-	"2 '.l10n('Day').'",
-	
-	false,
-	'.time().',
-	"2 '.l10n('Day').'",
-	
-	"Init.",
-	"'.l10n('supervisor').'",
-	 "'.l10n('hello').'"
+    $valeurs= array (	1,
+						0,
+			   time(),
+	                 2000,
+	 '"1 '.l10n('Week').'"' ,
+	                    0,
+	          time(),
+	                   10,
+	  '"2 '.l10n('Day').'"',
+	               '"false"',
+	        time(),
+	  '"2 '.l10n('Day').'"',
+	
+	              '"Init"',
+   '"'.l10n('supervisor').'"',
+	'"'.l10n('hello').'"',
 	 )
- 	 ;';
-
-
-	pwg_query($q);
-	
- 	} 
+ 	;
+
+	ajout_ligne(MAIL_SUPERV_TABLE,$superv_champs, $valeurs,false ) ;
+
 }
 
@@ -426,4 +361,5 @@
       array_push($columns_of[$table], $row[0]);
     }
+ 
   return $columns_of;
 }
@@ -456,5 +392,5 @@
   if (!empty($datas))
   {
-    while ($group = mysql_fetch_array($datas))
+    while ($group = mysql_fetch_array($datas,MYSQL_ASSOC))
     {
 
@@ -469,4 +405,210 @@
   
 }
+//=================================================================================
+
+function create_table($nom_table,$champs,$types)  //MAIL_SUPERV_TABLE
+{
+/*    $nb = Get_colonnes_de($nom_table);
+	$table=$nb[$nom_table];	 	*/
+	$data = 	$types ;
+	$i=0;
+ 	$valeurs=array();
+
+
+  	
+foreach ( $champs as $champ)
+   {
+      	$champ = trim($champ);
+         	array_push($valeurs , " `".$champ."`" . '  ' . $data[  $i] )  ;
+	 		 
+	 	$i +=1;
+    }
+	if ( count($valeurs) == 0) return ;
+    $valeurs=implode(", ",$valeurs) ;
+	//===============================================================================
+		$query = "CREATE TABLE IF NOT EXISTS  `" . $nom_table . "` (". $valeurs . " , PRIMARY KEY  (`id` ) ) ;";  
+			 if ( pwg_query($query) ) return ;  
+			 	die($query);         
+	 
+}
+function ajust_table($nom_table,$champs,$types)  //MAIL_SUPERV_TABLE
+{
+
+    $nb = Get_colonnes_de($nom_table);
+	$table=$nb[$nom_table];	 	
+$data = 	$types ;
+$i=0;
+ $valeurs=array();
+ 
+
+foreach ( $champs as $champ)
+   {
+     $champ = trim($champ);
+	  if (!in_array( $champ,$table)) {
+         array_push($valeurs , " ADD `".$champ."`" . '  ' . $data[  $i] )  ;
+	 }
+	 $i +=1;
+	 
+    }
+	if ( count($valeurs) == 0) return ;
+	
+$valeurs=implode(", ",$valeurs) ;
+	//===============================================================================
+ 	
+		$query = "ALTER TABLE `" . $nom_table . "` ". $valeurs ;
+			if (   pwg_query($query)) return ;            
+	
+		die($query);
+
+
+}
+
+function ajout_ligne($nom_table,$champs,$valeurs,$force)
+{
+
+	
+
+  if (!$force) {
+     $query = "
+    		SELECT COUNT(`id`) as total 
+    		FROM `".$nom_table."` 
+  		;";	
+//==============================================================================		
+		list($count) = mysql_fetch_row(pwg_query($query));
+
+}else{
+
+    	$count = 0 ;
+}
+ 
+  if ($count == 0)
+  {
+  $n_champs=implode(",",$champs);
+  $n_valeurs=implode(",",$valeurs);
+  
+
+	
+	   $query = "
+    	INSERT INTO `".$nom_table."` (". $n_champs.") 
+        VALUES ( ".	$n_valeurs .")";
+		
+		if (pwg_query($query)) return ;
+		die($query);
+		
+  }
+}
+//=====================================================================
+
+function Str_To_Time( $ajout,$init_date)
+{
+//========================================================
+
+$a_ajouter=$ajout ;
+
+  	$period_search=array("W","D","H","M","S");
+	               array_push($period_search,l10n('Week').'s',l10n('Day').'s',l10n('Hour').'s',l10n('Minute').'s',l10n('Seconde').'s');
+		               array_push($period_search,l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde'));
+
+
+	
+	$period_match = array(' week ',' day ',' hour ',' minute ',' seconde ');	
+	                array_push($period_match,' week ',' day ',' hour ',' minute ',' seconde ');
+	                array_push($period_match,' week ',' day ',' hour ',' minute ',' seconde ');
+	
+
+	
+$a_ajouter = "+ " .  str_replace($period_search, $period_match, $a_ajouter) ;
+
+
+	
+$a_ajouter=trimUltime($a_ajouter);
+$v1 = array('- ','+ ','week','day','hour','minute','seconde',' -',' +',' ');
+$v2 = array('-','+', (7*24*60*60) ,  (24*60*60),  (60*60),  60,1,'|-','|+',"*" );
+$new_valeur =  str_replace($v1,$v2,$a_ajouter) ;
+$new_valeur =  str_replace('++','+',$new_valeur ) ;
+
+$new_valeur = explode( "|",$new_valeur );
+$p = $init_date ;
+
+	//$new_valeur = $a_ajouter + $init_date ;
+	foreach($new_valeur as $nv)
+	{
+			$p += matheval($nv) ;
+	 
+	}
+return  $p ;
+ 
+}
+//=====================================================================================
+function matheval($equation) 
+  { 
+    $equation = preg_replace("/[^0-9+\-.*\/()%]/","",$equation); 
+    
+    $equation = preg_replace("/([+-])([0-9]{1})(%)/","*(1\$1.0\$2)",$equation); 
+   
+    $equation = preg_replace("/([+-])([0-9]+)(%)/","*(1\$1.\$2)",$equation); 
+ 
+    $equation = preg_replace("/([0-9]+)(%)/",".\$1",$equation); 
+	
+    if ( $equation == "" ) 
+    { 
+      $return = 0; 
+    } 
+    else 
+    { 
+	 
+      eval("\$return=" . $equation . ";" ); 
+    } 
+    return $return; 
+  } 
+
+//======================================================================================
+function trimUltime($chaine){
+	$chaine = trim($chaine);
+	$chaine = str_replace("\t", " ", $chaine);
+	$chaine = eregi_replace("[ ]+", " ", $chaine);
+	return $chaine;
+}
+
+
+function kill_list()
+{
+
+
+ //==================== TEST black_liste ============================================		
+     $query = "
+    		SELECT *,COUNT(`id`) as total 
+    		FROM `".MAIL_BLACK_LISTE_TABLE."` 
+		    WHERE ip='".$_SERVER['REMOTE_ADDR']."'
+  		;";	
+//==============================================================================		
+	$row = mysql_fetch_row(pwg_query($query));
+ 	if (count($row) > 0)
+	{
+	
+        $nb =  ($row[7])+1;
+ 		$pays = isset($_POST['pays']) ? $_POST['pays'] : $pays="" ;
+ 		$ville = (isset($_POST['ville']))   ? $_POST['ville']: $ville="" ; 
+ 		$region =  isset($_POST['region']) ? $_POST['region'] : $region="" ;
+		
+	 $query ="
+			UPDATE " . MAIL_BLACK_LISTE_TABLE . " 
+			SET ";
+		if (isset($_POST['pays']))	
+		 $query .= "	
+			`pays` = '". $pays ."',
+			`region` = '" . $region ."',
+			`ville` = '" . $ville . "',
+			";
+		 $query .= "		
+			`nb` = " . $nb . "
+			  WHERE ip = '".$_SERVER['REMOTE_ADDR']."' ;
+        	";
+				pwg_query($query );
+	//================================================================================	
+		
+	}
+return (count($row) > 0) ;
+}
 
 ?>
Index: extensions/Mail_supervisor/include/function_test_send.php
===================================================================
--- extensions/Mail_supervisor/include/function_test_send.php	(revision 4065)
+++ extensions/Mail_supervisor/include/function_test_send.php	(revision 4132)
@@ -26,6 +26,6 @@
   die('Hacking attempt!');
 }
-if (!defined('MAIL_SUPERV_DIR')) define('MAIL_SUPERV_DIR' , basename(dirname(__FILE__)));
-if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+
+
 
 function test_envoie($message,$group_name,$group_id)
Index: extensions/Mail_supervisor/include/save_info.php
===================================================================
--- extensions/Mail_supervisor/include/save_info.php	(revision 4132)
+++ extensions/Mail_supervisor/include/save_info.php	(revision 4132)
@@ -0,0 +1,128 @@
+<?php
+
+
+//=======================================================================================
+
+
+if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+
+
+
+//include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+include_once (MAIL_SUPERV_PATH.'include/constants.php'); 
+include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
+
+  $info_ip = (isset($info_ip)) ? $info_ip : '' ;
+  $info_ip = (isset($_POST['info1'])) ? $_POST['info1'] : $info_ip ;
+    $info_ip = (isset($_POST['info'])) ? $_POST['info'] : $info_ip ;
+$info_ip .= ":";
+ 
+ $val=explode(":",$info_ip);
+ $info_ip = trim($val[0]) ;
+ $ip_black = trim($val[1]) ;
+ 
+ if (isset($_POST['ip_black']))
+ $ip_black = ($ip_black == "" ) ? $_POST['ip_black'] : $ip_black ;
+global $n ;
+
+
+ 
+switch ($info_ip)
+ {
+
+  case 'ajout':
+  $n +=1;
+//echo " |$n] ". (( isset($_POST['info']) ) ? " POST  :".$_POST['info'] : "" ).(( isset($_POST['info1']) ) ? " POST   1 :".$_POST['info1'] : "" )."|";	  
+ 
+ if (!($ip_black == '')) {
+    create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
+  	ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type)  ;
+   $query = "
+    		SELECT COUNT(`id`) as total 
+    		FROM `".MAIL_BLACK_LISTE_TABLE."` 
+		    WHERE ip = '".$ip_black."'
+  		;";	
+
+		
+//==============================================================================		
+list($count) = mysql_fetch_row(pwg_query($query));
+//==============================================================================		
+	$valeurs=array( 'NULL',
+		            "'".$ip_black."'",
+					'"pays"',
+					'"region"',		
+					'"ville"',	
+					'"adresse"',
+					'"fai" ',
+					$count + 1
+	);
+ 	ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,($count==0)) ;	
+ }
+ 
+ break;
+ //================================================================================================
+  case 'raz':
+        $ip_black=str_replace('*',"%",$ip_black);
+  		$query = "DELETE FROM `".MAIL_BLACK_LISTE_TABLE."` WHERE `ip` like '%".$ip_black."%'  ";
+			pwg_query($query);
+   break;
+   
+    default:
+
+
+				
+   break;
+   
+  } 
+//================ Liste Black liste =================
+  create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
+
+  $query = "
+    SELECT *,  COUNT(`ip`) as total ,	`ip` as blacklist, `ip` as U_DELETE 
+ 
+    FROM ".MAIL_BLACK_LISTE_TABLE."
+		GROUP by ip 
+  	;";
+	$liste_bl = array();
+    $result = pwg_query($query);
+		while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
+          		{
+    			 array_push($liste_bl,$row);
+   				}
+//================ Liste IP ==============			
+	     $query = '
+    SELECT DISTINCT 	H.`id`,
+	H.`date`,
+	H.`time`,
+	H.`user_id`,
+	H.`IP`, 
+	COUNT(H.`IP`) as total  
+    FROM '.HISTORY_TABLE.'  AS H 
+	WHERE H.`IP` not LIKE "'.$_SERVER['REMOTE_ADDR'].'"
+	';//
+	if (count($liste_bl)>0)
+	 {
+	$query .= '
+	AND  H.`IP` not IN (     SELECT `ip`
+    FROM '.MAIL_BLACK_LISTE_TABLE.' ) ';
+	}
+	
+	$query .= '
+	
+	GROUP by H.`IP` ;
+	
+  	;'  ;//
+	$result = pwg_query($query);
+	$liste_ip=array();
+	while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
+          		{
+    		           array_push($liste_ip, $row);
+   				}
+				
+
+
+
+
+
+
+?>
