Index: extensions/Mail_supervisor/maintain.inc.php
===================================================================
--- extensions/Mail_supervisor/maintain.inc.php	(revision 4206)
+++ 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() ;
 
 }
