Index: /extensions/Mail_supervisor/admin/mail_black_liste.tpl
===================================================================
--- /extensions/Mail_supervisor/admin/mail_black_liste.tpl	(revision 4219)
+++ /extensions/Mail_supervisor/admin/mail_black_liste.tpl	(revision 4220)
@@ -7,14 +7,11 @@
 </div>
 <form action='' method="post" name="form_black">
-
 <fieldset>
     <legend >{'options'|translate}</legend>
  <table> 
-
-<td><input type="checkbox" name="NO_MAIL_LIST" value="on" {$NO_MAIL_LIST}  />&nbsp;&nbsp;{'no_mail_list'|translate}	</td>
-<td><input type="checkbox" name="NO_CONNECT" value="on" {$NO_CONNECT} />&nbsp;&nbsp;{'no_connect'|translate}</td>
-<td><input type="checkbox" name="SET_AUTO" value="on" {$SET_AUTO} />&nbsp;&nbsp;{'set_auto'|translate}</td>
-
-<tr><td>
+<td><input type="checkbox" name="no_mail_list" value="on" {$no_mail_list}  />&nbsp;&nbsp;{'no_mail_list'|translate}	</td>
+<td><input type="checkbox" name="no_connect" value="on" {$no_connect} />&nbsp;&nbsp;{'no_connect'|translate}</td>
+<td><input type="checkbox" name="set_auto" value="on" {$set_auto} />&nbsp;&nbsp;{'set_auto'|translate}</td>
+<tr><p></p><td>
 <input class="submit" type="submit" name="submit" value={'Valider'|translate} /></td></tr>
  </table>
@@ -22,14 +19,11 @@
 
 	    	<input name="info1" type="hidden" />
-			<input name="ip_black" type="hidden" class="items"  value="{$ip_black}" />
-			
-			
  <fieldset >
     <legend>{'black_liste'|translate}</legend>
 	   <table>
-
-
  		<div> 
-	  		<input name="ip_black_test" id = "ip_black_test" type="text" value="{$ip_black_test}" /> 							          <input   type="submit" name="info" value="{'Test'|translate}"  /> 
+	  	<input name="ip_black" id = "ip_black_test" type="text" value="{$ip_black}"
+		 />
+		  <input   type="submit" name="submit" value="{'Test'|translate}"  /> 
 		{ if $ip_black_len > 0}
 			{if  $IS_SPAM  == true }
@@ -38,18 +32,22 @@
 				 <label class="erreur">	{'not_a_spam'|@translate} </label>
 			{/if}
+<input   type="submit" name="submit" value="{'Ajout'|translate}"  />
+              <input type="image" name="submit"   class='row1' 
+              src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plug_activate.png" 
+	          alt="{'ajout'|@translate}" 
+	          onclick = "
+ if (confirm( document.getElementById('btn_ajout{$ip_black}').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}'))
+  form_black.info1.value='ajout:{$ip_black}' 
+  "
+	          id="btn_ajout{$ip_black}" 
+              title="{'ajout'|@translate} {$ip_black}" />				
 		{ else }
-		{'valider'|@translate}
+		   {'valider'|@translate}
 		{/if}
 			
 
-              <input type="image"   class='row1' 
-              src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plug_activate.png" 
-	          alt="{'ajout'|@translate}" 
-	          onclick = "
- if (confirm( document.getElementById('btn_ajout{$ip_black_test}').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}'))
-  form_black.info1.value='ajout:{$ip_black_test}' 
-  "
-	          id="btn_ajout{$ip_black_test}" 
-              title="{'ajout'|@translate} {$ip_black_test}" />	  
+
+			  
+			    
 	     </div>
 	 </table>  
@@ -97,13 +95,9 @@
         <legend>{'liste_ip'|translate}</legend>
 	 <p class="Style1">
-	   {'IP_adress'|translate} : {$IP}
-	    {'pays'|translate} : {$PAYS}
+	     {'IP_adress'|translate} : {$IP}
+	     {'pays'|translate} : {$PAYS}
 		 {'ville'|translate} : {$VILLE}
-		  {'region'|translate} : {$REGION}
-	   
-	   
- {$pays} 
-
-</p>
+		 {'region'|translate} : {$REGION}
+     </p>
   
 <table class="table2">
Index: /extensions/Mail_supervisor/admin/mail_superv_admin.php
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4219)
+++ /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4220)
@@ -34,19 +34,9 @@
 // +-----------------------------------------------------------------------+
 //check_status(ACCESS_ADMINISTRATOR);
-
-global $user, $lang, $conf, $errors,$mails_données;
-global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ;
-
-
 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-
-
-include_once (MAIL_SUPERV_PATH.'include/constants.php'); 
-include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
 include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+
 $my_base_url = get_admin_plugin_menu_link(__FILE__);
-
-
-
  load_language('plugin.lang', MAIL_SUPERV_PATH);
 
@@ -88,9 +78,19 @@
 $error = array();
 
-
+global $user, $lang, $conf, $errors,$mails_données;
+global $args, $conf_mail,$infos_message,$erreur_message,$mails_options ;
+include_once (MAIL_SUPERV_PATH.'include/constants.php'); 
+
+if (isset($conf['mail_superv'])) {
+
+include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
 $mails_options = explode("," , $conf['mail_superv']);
-  
 $mails_données=Get_Datas();
-vérif_base();
+
+
+}else {
+die ("mail");
+}
+
 
 $aff_nb=true;
@@ -112,7 +112,9 @@
 // *************************************************************************
   case 'mail_superv_admin':
-
+	
 //=============================================================
-if ( isset($_POST['refresh']) ) {
+if ( isset($_POST['submit']) ) {
+if ( $_POST['submit'] == l10n('refresh')   ) {
+
    	 	
 	if ($mails_données['nb_mails'] == 0 )  
@@ -127,11 +129,13 @@
 	  $mails_données['date_quarantaine']=time();
 	 }
+	 $infos_message .=  l10n('refresh') .'<br />';
      sauve_données();
- 	$erreur_message .="<DIV  > <input name='' type='checkbox' value='' /> </DIV>" ;
  	$aff_nb = false ;
  
+	
 	}
 
-if ( isset($_POST['raz']) ) {
+if ( $_POST['submit'] == l10n('raz')   ) {
+
 	$mails_données['date_quarantaine']=time();
 	$mails_données['nb_mails'] = 0  ;
@@ -144,11 +148,10 @@
 	
      sauve_données();
-	 $infos_message .=  l10n('save_config') ;
+	 $infos_message .=  l10n('raz') .'<br />'; ;
+	
 	}
 
-if ( isset($_POST['submit']) )
+if ( $_POST['submit'] == l10n('Valider') )  
 {
-//Options
-
 
   $mails_options[0] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ;
@@ -169,7 +172,7 @@
          sauve_données();
 //=======================================================================================================
-		$infos_message .=  l10n('save_config')  ;
+		$infos_message .=  l10n('save_config') . " : " . l10n('Datas') . "<br />" ;
 }
-
+}
 	
 	$mails_données = Get_Datas();
@@ -300,46 +303,53 @@
      case 'mail_black_liste':
    		load_language('help/plugin.lang', MAIL_SUPERV_PATH);	
-	Global $pays,$region,$ville ;	
-
-		kill_list();
+	    global $pays,$region,$ville ;	
+ 	  	$aff_nb=false;
+ //------------------------------------------------------------------------------------
+ 		$pays = (isset($_POST['pays'])) ? $_POST['pays'] : $pays ;
+ 		$ville = (isset($_POST['ville']))   ? $_POST['ville']: $ville ; 
+ 		$region =  isset($_POST['region']) ? $_POST['region'] : $region ;	
+        $ip = ($mails_options[6] == '') ? $_SERVER['REMOTE_ADDR'] : $mails_options[6] ;
 		
-	  	$aff_nb=false;
-	  	$smile_bonjour=MAIL_SUPERV_PATH."smilies/bonjour.gif" ; 
-      	$template->assign(
-  					array(
-					'smile_bonjour' => $smile_bonjour ,
-					)
-			);		
-			$aff_nb = false;
-	 		$liste_bl=array();
-	 		$liste_ip=array();
-
-		$ip_black="";
-		$info_ip ="";
-		 
-
- 		include  (MAIL_SUPERV_PATH.'include/save_info.php'); 
-		$ip_black_test = (isset($_POST['ip_black_test'])) ? $_POST['ip_black_test'] : $ip_black ;
-      	$mails_options[3] = isset($_POST['NO_MAIL_LIST']) ? $_POST['NO_MAIL_LIST'] : $mails_options[3] ;
-      	$mails_options[4] = isset($_POST['NO_CONNECT']) ? $_POST['NO_CONNECT'] : $mails_options[4] ;
-	    $mails_options[5] = isset($_POST['NO_CONNECT']) ? $_POST['NO_CONNECT'] : $mails_options[5] ;		
- 					
-		if ( isset($_POST['submit']) )
+      	$mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[3] ;
+      	$mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[4] ;
+	    $mails_options[5] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[5] ;		
+
+//=======================================================================================	
+    $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 ;
+   
+	
+				
+	if ( isset($_POST['submit']) )
 		{
+		
+			if (  $_POST['submit'] == l10n('Ajout') )
+      		{
+			       $info_ip = trim( $_POST['submit']) ;
+                   $ip_black = trim( $_POST['ip_black']) ;
+			       $infos_message .= l10n('ajout'). '---->'. $ip_black ;   
+			}
 			if (  $_POST['submit'] == l10n('Valider') )
       		{
-				$mails_options[3] = isset($_POST['NO_MAIL_LIST']) ? $_POST['NO_MAIL_LIST'] : "off" ;
-      			$mails_options[4] = isset($_POST['NO_CONNECT']) ? $_POST['NO_CONNECT'] : "off" ;
-      			$mails_options[5] = isset($_POST['SET_AUTO']) ? $_POST['SET_AUTO'] : "off" ;
-      	
+				$mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ;
+      			$mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
+      			$mails_options[5] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
 				sauve_options();
-			   $infos_message .=  l10n('save_config');   
-			   unset ($_POST['submit']);
+			    $infos_message .=  l10n('save_config') . '<br />';   
+			    
 			}
-
-		} 
-		
-
-
+		} 	
+
+include  (MAIL_SUPERV_PATH.'include/save_info.php'); 	   
+
+//=======================================================================================	
 	$f_action  = $my_base_url.'&amp;tab=mail_black_liste' ;
 	$champs_ip=array();
@@ -357,18 +367,15 @@
                  		'conf_admin_layout' => $conf['admin_layout'] ,
 						'ip_black' => $ip_black ,
-						'IS_SPAM' => test_spam(  $ip_black_test  ),
-						'ip_black_test' => (isset($_POST['ip_black_test']) ) ? $_POST['ip_black_test'] : $ip_black ,
+						'IS_SPAM' => test_spam(  $ip_black),
+						'ip_black_len' =>  strlen($ip_black)  ,
+						'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
+
+						'F_ACTION' => $f_action ,
 						
-						'ip_black_len' =>  strlen($ip_black_test)  ,
-						'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
-
-						'F_ACTION' => $f_action ,
-
-
+						'no_mail_list' => ($mails_options[3] == 'on') ? 'checked="checked"' : '' ,
+                        'no_connect' => ($mails_options[4] == 'on') ? 'checked="checked"' : '' ,
+						'set_auto' => ($mails_options[5] == 'on') ? 'checked="checked"' : '' ,
 						
-						'NO_MAIL_LIST' => $mails_options[3] == 'on' ? 'checked="checked"' : '' ,
-                        'NO_CONNECT' => $mails_options[4] == 'on' ? 'checked="checked"' : '' ,
-						 'SET_AUTO' => $mails_options[5] == 'on' ? 'checked="checked"' : '' ,
-						'IP' => $_SERVER['REMOTE_ADDR'],						
+						'IP' =>  $ip ,						
 						'PAYS' =>  $pays  ,
  		                'VILLE' =>  $ville ,
@@ -378,5 +385,6 @@
 				);			 
 	 //===============================================================	
-	 		 
+	 	
+				 
 	 	$template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_black_liste.tpl')));
 		$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
Index: /extensions/Mail_supervisor/admin/mail_superv_admin.tpl
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 4219)
+++ /extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 4220)
@@ -9,5 +9,5 @@
 	  <fieldset>
     <legend>{'options'|translate}</legend>
-	
+
     <table>
 <tr><td><input type="checkbox" name="check_mailto" value="on" {$check_mailto} />&nbsp;{'check_mailto'|translate}</td><td><input type="checkbox" name="check_header_carbon" value="on" {$check_header_carbons} />&nbsp;{'check_header_carbon'|translate}</td>
@@ -31,20 +31,20 @@
 <tr>
 
-  <td><input type="text" name="nb_mails" size='10%' value={$nb_mails} /></td>
+  <td><input type="text" name="nb_mails" size='10%' value={$nb_mails} readonly="true"  class="row2" /></td>
   <td>{'free_mails'|translate}</td>	   
-	   <td><input type="text" name="date_mail"  value={$date_mail} /></td>
+	   <td><input type="text" name="date_mail"  value={$date_mail} readonly="true"  class="row2" /></td>
 	   <td><input type="text" name="nb_mails_maxi" size="10%" value={$nb_mails_maxi} /></td>
 	    <td><input type="text" name="nb_mails_periode" size="30%" value={$nb_mails_periode} /></td>
-		<td><input type="text" name="time_mails_reste" size="50%" value={$time_mails_reste} /></td>  
+		<td><input type="text" name="time_mails_reste" size="50%" value={$time_mails_reste} readonly="true"  class="row2"  /></td>  
     </tr> 
  
 	   <tr>  
-	   <td><input type="text" name="nb_spams"  size='10%'  value={$nb_spams} /></td>
+	   <td><input type="text" name="nb_spams"  size='10%'  value={$nb_spams} readonly="true"  class="row2" /></td>
 	   <td>{'free_spams'|translate}</td>
 
-	   <td><input type="text" name="date_spam"  value={$date_spam} /></td>
+	   <td><input type="text" name="date_spam"  value={$date_spam}readonly="true"  class="row2"  /></td>
 	   <td><input type="text" name="nb_spams_maxi" size="10%" value={$nb_spams_maxi} /></td>
 	    <td><input type="text" name="nb_spams_periode" size="30%" value={$nb_spams_periode} /></td>
-		<td><input type="text" name="time_spams_reste" size="50%" value={$time_spams_reste} /></td>  
+		<td><input type="text" name="time_spams_reste" size="50%" value={$time_spams_reste} readonly="true"  class="row2"  /></td>  
 	    </tr> 
     </table>
@@ -83,7 +83,7 @@
            </table>
 	</fieldset>
-      <p><input class="submit" type="submit" name="submit" value="{'Submit'|translate}" />
-	     <input class="submit" type="submit" name="raz" value="{'raz'|translate}" />
-         <input class="submit" type="submit" name="raffraichir" value="{'refresh'|translate}" />
+	      <p><input class="submit" type="submit" name="submit" value="{'Submit'|translate}" />
+	     <input class="submit" type="submit" name="submit" value="{'raz'|translate}" />
+         <input class="submit" type="submit" name="submit" value="{'refresh'|translate}" />
 	  </p> 
 </fieldset>
Index: /extensions/Mail_supervisor/include/fonctions.php
===================================================================
--- /extensions/Mail_supervisor/include/fonctions.php	(revision 4219)
+++ /extensions/Mail_supervisor/include/fonctions.php	(revision 4220)
@@ -49,67 +49,5 @@
 
 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 "
-					);																	
-
-vérif_base() ;
-	
+	  
 //==========================================================
 function sauve_options()
@@ -136,5 +74,4 @@
 global $mails_données,$superv_champs,$superv_type,$erreur_message ;
 //=====================================================================	
-	ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ;
  	$clefs = $superv_champs ;
  	$valeurs = array();
@@ -176,6 +113,7 @@
 $mails_options = explode("," , $conf['mail_superv']);
 
-
- if ( !isset($_POST['submit']) ) {
+ if ( count($_POST)==5 || count($_POST)==0 ) {
+   
+
 	if (kill_list())
 		 {
@@ -227,5 +165,5 @@
 function Get_geo()
 {
-Global $pays,$region,$ville , $erreur_message;
+global $pays,$region,$ville , $erreur_message;
 if (!isset($_POST['submit'])) 
 { 
@@ -263,25 +201,18 @@
 function Get_Datas()
 {
-        ob_start();
-	        $data=Lire_datas();
-	  	  	$m= ob_get_contents();
-    	ob_end_clean();
-	
-	if (strlen($m)>0) {
-	  vérif_base() ;
-	  $data=Lire_datas();
-	}
-    return $data;
-}
-
-function Lire_datas()
-{
-
-
- $query = "
-    SELECT *
+global $superv_champs ;
+$champs = implode(",",$superv_champs );
+    $query = "SELECT ".$champs." 
     FROM ".MAIL_SUPERV_TABLE."
   	;";
-    $data = mysql_fetch_array(pwg_query($query),MYSQL_ASSOC);
+			 $result = @pwg_query($query);
+ 
+	if (!$result) {
+					vérif_base();
+	 				$result = @pwg_query($query);
+					}
+
+					
+    $data = mysql_fetch_array($result,MYSQL_ASSOC);
 	//====================================================================================
 	$next_day = Str_To_Time( $data['nb_mails_periode'], $data['date_mail'] );;
@@ -383,7 +314,9 @@
 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) ;
-
+//==============================================================================		
+    create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
+  	ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type)  ; 
+//==============================================================================		
+	create_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type) ;
   	ajust_table(MAIL_SUPERV_TABLE,$superv_champs,$superv_type)  ;
 //==============================================================================		
@@ -409,18 +342,16 @@
 	ajout_ligne(MAIL_SUPERV_TABLE,$superv_champs, $valeurs,false ) ;
 	
-   create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
-  	ajust_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type)  ;
-}
-
-
+
+}
+
+//=========================================
 function Get_colonnes_de($table)
 {
-  $columns_of = array();
     $query = 'DESC '.$table.';';
     $result = mysql_query($query);
-    $columns_of[$table] = array();
+    $columns_of= array();
     while ($row = mysql_fetch_row($result))
     {
-      array_push($columns_of[$table], $row[0]);
+      array_push($columns_of, $row[0]);
     }
  
@@ -495,29 +426,13 @@
 function ajust_table($nom_table,$champs,$types)  //MAIL_SUPERV_TABLE
 {
-return ;
-     create_table($nom_table,$champs,$types) ;
-	
-	 
-	 $table = mysql_fetch_array(pwg_query('SELECT * FROM '.$nom_table),MYSQL_ASSOC);
-
- $result = mysql_query('SELECT * FROM '.$nom_table);
-
-$row = mysql_fetch_row($result) ;
-	echo $nom_table . "  " . memo_var($row) . count($row) ;
-
-if (count($row)> 1) return ;
-
-
-    $nb = Get_colonnes_de($nom_table);
-	$table=$nb[$nom_table];	 	
-$data = 	$types ;
-$i=0;
- $valeurs=array();
- 
-
+global $infos_message ;
+$colonnes = Get_colonnes_de($nom_table);
+	$data = 	$types ;
+	$i=0;
+ 	$valeurs=array();
 foreach ( $champs as $champ)
    {
      $champ = trim($champ);
-	  if (!in_array( $champ,$table)) {
+	  if (!in_array( $champ,$colonnes)) {
          array_push($valeurs , " ADD `".$champ."`" . '  ' . $data[  $i] )  ;
 	 }
@@ -525,26 +440,26 @@
 	 
     }
+//=============================================================================	
 	if ( count($valeurs) == 0) return ;
 	
-$valeurs=implode(", ",$valeurs) ;
+  $infos_message .=  "AJUSTE TABLE : ". $nom_table . "<BR />" . "NB (col) : ". count($colonnes) . memo_var($valeurs) . "<BR />" ;
+	
+     $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 
+    		SELECT `id` , COUNT(`id`) as total 
     		FROM `".$nom_table."` 
   		;";	
-//==============================================================================		
-		list($count) = mysql_fetch_row(pwg_query($query));
+	  list($count) = mysql_fetch_row(pwg_query($query));
+
+		
 }else{
 
@@ -655,36 +570,39 @@
 {
  //==================== TEST black_liste ============================================	
- Global $pays,$region,$ville,$erreur_message,$infos_message,$conf;	
+ global $pays,$region,$ville,$ip ;
+ global $erreur_message,$infos_message,$conf;	
   global $conf, $user, $page;
   global $mails_options ;
    global $superv_bl_champs,$superv_bl_type ; 
-
- 
-if (count($mails_options) < 6 ) return false ;
- 
-$ip = $_SERVER['REMOTE_ADDR'] ;
- 
- 
-  
+   global $nb ;
+
+
+ 
+if (count($mails_options) < 7 ) return false ;
+
+    $ip = $_SERVER['REMOTE_ADDR'] ;
   	if ( !isset($_POST['pays'])) {
-	
     	if ( !isset($_POST['ip_black_test'])) {    Get_Geo();	 	}
-		 
 		 return ;	
-   		}  else{
- 		  $pays = isset($_POST['pays']) ? $_POST['pays'] : $pays="" ;
- 		  $ville = (isset($_POST['ville']))   ? $_POST['ville']: $ville="" ; 
- 		  $region =  isset($_POST['region']) ? $_POST['region'] : $region="" ;	
-    	  
-	}
- 
-
- 
+   		}  else {
+ 		       $pays = (isset($_POST['pays'])) ? $_POST['pays'] : "" ;
+ 		       $ville = (isset($_POST['ville']))   ? $_POST['ville'] : "" ; 
+ 		       $region = ( isset($_POST['region'])) ? $_POST['region'] : "" ;	
+	}
+ 
+     $champs=implode(',',$superv_bl_champs);
      $query = "
-    		SELECT *,COUNT(`id`) as total 
+    		SELECT ".$champs.",COUNT(`id`) as total 
     		FROM `".MAIL_BLACK_LISTE_TABLE."` 
 		    WHERE `ip` LIKE '".$ip."'
   		;";	
-		 $datas = mysql_fetch_array(pwg_query($query),MYSQL_ASSOC);
+		 $result = @pwg_query($query);
+ 
+	if (!$result) {
+					vérif_base();
+	 				$result = @pwg_query($query);
+					}
+	 $datas = mysql_fetch_array($result,MYSQL_ASSOC);
+
 		 $nb = $datas['total']; 
 if ($mails_options[5] == 'on')
@@ -693,5 +611,4 @@
   if (test_spam($ip))
   {
-  
   	$valeurs=array( 'NULL',
 		            "'".$ip."'",
@@ -703,5 +620,5 @@
 					1
 	);
- 	ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,true) ;	
+ 	  ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,true) ;	
 	  $erreur_message .= $ip.$mails_options[6] . ' -----> ' . l10n('black_list') ;
 	return true ;	
Index: /extensions/Mail_supervisor/include/save_info.php
===================================================================
--- /extensions/Mail_supervisor/include/save_info.php	(revision 4219)
+++ /extensions/Mail_supervisor/include/save_info.php	(revision 4220)
@@ -7,45 +7,23 @@
 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 ;
+   
 
-Global $pays,$region,$ville ;
- 
-switch ($info_ip)
+
+switch (strtolower($info_ip))
  {
 
-  case 'ajout':
-  $n +=1;
-//echo " |$n] ". (( isset($_POST['info']) ) ? " POST  :".$_POST['info'] : "" ).(( isset($_POST['info1']) ) ? " POST   1 :".$_POST['info1'] : "" )."|";	  
+  case  'ajout' :
  
+
  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 
+    		SELECT `ip` 
     		FROM `".MAIL_BLACK_LISTE_TABLE."` 
 		    WHERE ip = '".$ip_black."'
   		;";	
-
-		
 //==============================================================================		
 list($count) = mysql_fetch_row(pwg_query($query));
 //==============================================================================	
-	
 	$valeurs=array( 'NULL',
 		            "'".$ip_black."'",
@@ -76,9 +54,6 @@
   } 
 //================ 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 
@@ -121,8 +96,3 @@
 				
 
-
-
-
-
-
 ?>
Index: /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 4219)
+++ /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 4220)
@@ -18,6 +18,6 @@
 $lang['set_black_list'] = 'Mise sur la liste noire';
 $lang['is_a_spam'] = 'Spammeur détecté!.';
-$lang['cde_ajout'] = 'cliquer sur l\'icône  =>';
-$lang['valider'] = '(Pour vérifier si l\'adresse introduite est suceptible d\' être un Spammer.) ';
+$lang['Ajout'] = 'Ajouter à la liste noire.';
+$lang['valider'] = ' ';
 $lang['IP_adress'] = 'Votre adresse IP';
 $lang['liste_ip']="Liste des IP (historique)";
Index: /extensions/Mail_supervisor/main.inc.php
===================================================================
--- /extensions/Mail_supervisor/main.inc.php	(revision 4219)
+++ /extensions/Mail_supervisor/main.inc.php	(revision 4220)
@@ -14,4 +14,68 @@
 
 /* EVENT_HANDLER_PRIORITY_NEUTRAL  */
+
+
+
+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 "
+					);																	
 
 
Index: /extensions/Mail_supervisor/maintain.inc.php
===================================================================
--- /extensions/Mail_supervisor/maintain.inc.php	(revision 4219)
+++ /extensions/Mail_supervisor/maintain.inc.php	(revision 4220)
@@ -27,61 +27,83 @@
 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
  include_once (MAIL_SUPERV_PATH.'include/constants.php');
- include_once (MAIL_SUPERV_PATH.'include/fonctions.php');  
+
+
+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 plugin_install()
 {
-
-  
-  global $superv_bl_champs,$superv_bl_type ; 
-  
-// efface free mail
-$q = '
-  SELECT  count(`id`) as total   FROM `'.PLUGINS_TABLE.'` WHERE `id` LIKE "free_mail"   ;';
-     $plugs = mysql_fetch_array(pwg_query($q),MYSQL_ASSOC);
-	 $nb= $plugs['total'];
-
-  if (count($nb)>=1) { 
- 			/*  $q = '
-				UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE `id` LIKE "free_mail"';
-        		pwg_query($q);
-   				pwg_query( $q );*/
-      $q = '
-      DELETE FROM '.PLUGINS_TABLE.'
-      WHERE `id` LIKE "free_mail"
-    ;';
-    pwg_query($q);		
-	$q = 'DROP TABLE IF EXISTS '.FREE_MAIL_TABLE.';';
-		  
-   pwg_query( $q );
-      $q = '
-      DELETE FROM '.CONFIG_TABLE.'
-      WHERE param="free_mail"
-    ;';
-    pwg_query($q);
-	
-	
-		
- }
-
-
-	 
-   pwg_query( $q );
-      $q = '
-      DELETE FROM '.CONFIG_TABLE.'
-      WHERE param="mail_superv"
-    ;';
-    pwg_query($q);
-		
-  
-  $q = '
+global $conf ;
+ if ( !isset($conf['mail_superv']) ) 
+ {
+    plugin_uninstall() ;
+    $query = '
     INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
     VALUES ("mail_superv","off,off,off,off,off,off,127.0.0.1","Parametres du plugin Mail superviseur")
-  ;';
-  pwg_query($q);
- 
-
-  
-  vérif_base();
-  create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
+    ;';
+    pwg_query($query);
+	//==================================================================
+	
+ } 
 
 }
@@ -91,22 +113,15 @@
 function plugin_uninstall()
 {
-  global $conf;
 
-  if (isset($conf['mail_superv']))
-  {
-
-    $q = '
+    $query = '
       DELETE FROM '.CONFIG_TABLE.'
       WHERE param="mail_superv"
     ;';
-
-    pwg_query($q);
-  
-   $q = 'DROP TABLE IF EXISTS  '.MAIL_BLACK_LISTE_TABLE.';';
-   pwg_query( $q );  
-   $q = 'DROP TABLE IF EXISTS  '.MAIL_SUPERV_TABLE.';';
-   pwg_query( $q );
+    pwg_query($query);
+    $query = 'DROP TABLE IF EXISTS  '.MAIL_BLACK_LISTE_TABLE.';';
+    pwg_query( $query );  
+    $query = 'DROP TABLE IF EXISTS  '.MAIL_SUPERV_TABLE.';';
+    pwg_query( $query);
    
- }
   
 }
@@ -114,5 +129,7 @@
 function plugin_activate()
 {
- 
+
+include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 	
+ vérif_base() ;
 
 }
