Index: /extensions/Mail_supervisor/admin/mail_superv_admin.php
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4028)
+++ /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4029)
@@ -1,5 +1,31 @@
 <?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-load_language('plugin.lang', MAIL_SUPERV_PATH);
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if ( !defined('PHPWG_ROOT_PATH')) 
+{
+  die('Hacking attempt!');
+}
+
+
 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
 
@@ -10,7 +36,10 @@
 $mails_données=Get_Datas();
 
-	$search=array("D","H","M","S","W");
-	$replace=array(" day"," Hour"," minute"," second"," week");		
+	
+
 		
+	$list_period=array('week','day','hour','minute','seconde');
+	$list_period_label=array(l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde'));
+	
 
 if ( isset($_POST['test_envoie']) ) {
@@ -27,27 +56,10 @@
 	$mails_données['date_mail'] = time();
 	$mails_données['date_spam'] = time();
+	
 	$mails_données['reste'] = 0;
 	
-	 $query = '
-        UPDATE '.MAIL_SUPERV_TABLE.'
-        SET `nb_mails`         = 0,
-			`date_mail`        = '.time().',
-			`nb_mails_maxi`    = '.$mails_données['nb_mails_maxi'].',	
-			`nb_mails_periode`    = "'.$mails_données['nb_mails_periode'].'",	
-					
-			`nb_spams`         = 0,
-			`date_spam`        = '.time().',
-			`nb_spams_maxi`    = '.$mails_données['nb_spams_maxi'].',
-			`nb_spams_periode`    = "'.$mails_données['nb_spams_periode'].'",		
-								
-			`quarantaine`      = "false",
-			`date_quarantaine` = '.time().',
-			
-			`message`          = "'.$mails_données['message'].'",
-			`header_text`      = "'.$mails_données['header_text'].'"
-		WHERE `id` =1 LIMIT 1 ';
-		
-
-      pwg_query($query);
+	$mails_données['quarantaine']=false;
+	
+     sauve_données();
 	
 	array_push($page['infos'], l10n('save_config'));
@@ -70,37 +82,13 @@
 $mails_données['nb_spams_maxi'] = isset($_POST['nb_spams_maxi']) ? $_POST['nb_spams_maxi'] :  $mails_données['nb_spams_maxi']  ;
 $mails_données['nb_spams_periode'] = isset($_POST['nb_spams_periode']) ? $_POST['nb_spams_periode'] :  $mails_données['nb_spams_periode']  ;
+$mails_données['quarantaine_periode'] = isset($_POST['quarantaine_periode']) ? $_POST['quarantaine_periode'] :  $mails_données['quarantaine_periode']  ;
 
 $mails_données['message'] = isset($_POST['content']) ? $_POST['content'] :  $mails_données['message']  ;
 $mails_données['header_text'] = isset($_POST['header_text']) ? $_POST['header_text'] :  $mails_données['header_text']  ;
   //===========================================================================================================
-	$query = '
-    UPDATE '.CONFIG_TABLE.'
-    SET value="'.$mails_options[0]. ',' .$mails_options[1]. ',' .$mails_options[2].',' .$mails_options[3]. ',' .$mails_options[4]. '"
-    WHERE param="mail_superv"
-    LIMIT 1';
-	 pwg_query($query);
+         sauve_options();
 
-
-         $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'].',
-			
-			`message`          = "'.$mails_données['message'].'",
-			`header_text`      = "'.$mails_données['header_text'].'"
-		WHERE `id` =1 LIMIT 1 ';
-		
-
-      pwg_query($query);
+//==============================================================================================
+         sauve_données();
 	  
    //===========================================================================================================
@@ -110,10 +98,13 @@
 }
 
+$mails_données = Get_Datas() ;
+
+	$rest_mail= $mails_données['rest_mail'];  	
+ 	$rest_spam= $mails_données['rest_spam'];  	
+    $reste= $mails_données['reste'];  	
+
+$quarantaine= $mails_données['quarantaine'];  	
+
 	
-	$rest_mail=  $mails_données['date_mail']-time() ; 
-	$rest_mail= "'".int_to_heure($rest_mail)."'";  	
-				
-	$rest_spam=  $mails_données['date_spam']-time() ;
-	$rest_spam= "'".int_to_heure($rest_spam)."'";  	
 
 $template->assign(
@@ -126,20 +117,26 @@
    
    	'nb_mails' => $mails_données['nb_mails'] ,
-   	'date_mail' => "'".date('Y-M-d H:m:s',$mails_données['date_mail'])."'" ,
+   	'date_mail' => "'".date(l10n('formatdate'),$mails_données['date_mail'])."'" ,
    	'nb_mails_maxi' => $mails_données['nb_mails_maxi'] ,	
 	'nb_mails_periode' => "'".$mails_données['nb_mails_periode']."'" ,	
- 	'time_mails_reste' => ( $rest_mail ) ,	
+ 	'time_mails_reste' => "'".int_to_heure( $rest_mail )."'" ,	
 	
   	'nb_spams' => $mails_données['nb_spams'] ,
-	'date_spam' => "'".date('Y-M-d H:m:s',$mails_données['date_spam'])."'" ,
+	'date_spam' => "'".date(l10n('formatdate'),$mails_données['date_spam'])."'" ,
 	'nb_spams_maxi' => $mails_données['nb_spams_maxi'] ,	
 	 'nb_spams_periode' => "'".$mails_données['nb_spams_periode']."'" ,
-	 'time_spams_reste' => ($rest_spam) ,	
+	 'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,	
 	 
-  	'date_quarantaine' => "'".date('Y-M-d H:m:s',$mails_données['date_quarantaine'])."'" ,
-  'reste' => int_to_heure($mails_données['reste']),
+	 'quarantaine' => $mails_données['quarantaine'] ,
+  	'date_quarantaine' => "'".date(l10n('formatdate'),$mails_données['date_quarantaine'])."'" ,
+	'quarantaine_periode' => "'".$mails_données['quarantaine_periode']."'" ,
+     'reste' => "'".int_to_heure($reste)."'",
  
     'message' => $mails_données['message'] ,
 	'header_text' => "'".$mails_données['header_text']."'" ,
+	
+	'list_period' => $list_period ,
+	'list_period_label' => $list_period_label ,
+	
 		 				)
 				);	
Index: /extensions/Mail_supervisor/admin/mail_superv_admin.tpl
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 4028)
+++ /extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 4029)
@@ -4,4 +4,5 @@
   <span>{'Howto'|translate}</span>
 <form action="" method="post" name="form">
+
   <fieldset>
     <legend>{'free_admin_titre'|translate}</legend>
@@ -12,5 +13,4 @@
 <td><input type="checkbox" name="check_header_text" value="on" {$check_header_text} />&nbsp;{'check_header_text'|translate}</td>
 <td><input type="text" name="header_text"  value={$header_text} /></td>
-
 
 
@@ -25,5 +25,7 @@
 	   <td><input type="text" name="date_mail"  value={$date_mail} /></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="10%" value={$nb_mails_periode} /></td>
+	    <td><input type="text" name="nb_mails_periode" size="10%" value={$nb_mails_periode} />
+</td>
+			
 		<td><input type="text" name="time_mails_reste" size="50%" value={$time_mails_reste} /></td>  
 		 </tr> 
@@ -42,13 +44,25 @@
 		
 	   <tr>  
-
-	   <td>{'free_quarantaine'|translate}</td>
-	    <td><input type="text" name="reste"  value={$reste} /></td>
-		 <td>{'free_heures'|translate}</td>
-		   
-		 <td><input type="text" name="date_quarantaine"  value={$date_quarantaine} />
+	 
+	  { if  $quarantaine }
+			<td>{'free_quarantaine'|translate}</td>'
+			 <td> </td>
+		 	<td><input type="text" name="date_quarantaine"  value={$date_quarantaine} />
+		 	<td> </td>
+			
+		  <td><input type="text" name="quarantaine_periode" size="10%" value={$quarantaine_periode} /></td>
+		   <td><input type="text" name="reste" size="50%" value={$reste} /></td> 
+		{/if}
+		 { if  !$quarantaine }
+		 <td> </td>
+		 <td> Quarantaine </td>
+		 <td> </td>
+		 <td> </td>
+		 <td><input type="text" name="quarantaine_periode" size="10%" value={$quarantaine_periode} /></td>
 		
-	 <input class="submit" type="submit" name="raz" value="raz" />
-	     </td></tr> 		
+	 {/if}	
+	
+	
+	      </tr> 		
 	   
     </table>
@@ -60,6 +74,7 @@
 		 
            </table>
-		     </fieldset>
+	</fieldset>
       <p><input class="submit" type="submit" name="submit" value="{'Submit'|translate}" />
+	   <input class="submit" type="submit" name="raz" value="raz" />
 	  <input class="submit" type="submit" name="test_envoie" value="{'test'|translate}" />
 	  </p> 
Index: /extensions/Mail_supervisor/include/constants.php
===================================================================
--- /extensions/Mail_supervisor/include/constants.php	(revision 4028)
+++ /extensions/Mail_supervisor/include/constants.php	(revision 4029)
@@ -1,4 +1,5 @@
 <?php
 global $prefixeTable;
+
 if (!defined('MAIL_SUPERV_TABLE')) define('MAIL_SUPERV_TABLE', $prefixeTable.'mail_superv');
 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 4028)
+++ /extensions/Mail_supervisor/include/fonctions.php	(revision 4029)
@@ -1,5 +1,39 @@
 <?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+
 load_language('plugin.lang', MAIL_SUPERV_PATH);
 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+global $period_search,$period_match ;
+	$period_search=array("D","H","M","S","W");
+	array_push($period_search,l10n('Week'),l10n('Day'),l10n('Hour'),l10n('Minute'),l10n('Seconde'));
+	
+	$period_match=array(" day"," hour"," minute"," second"," week");	
+	array_push($period_match,'week','day','hour','minute','seconde');
 
 function sauve_options()
@@ -18,23 +52,30 @@
 {
 global $mails_données ;
-        $query = '
+
+$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_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'].'",	
+			`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'].'",
 			`header_text`      = "'.$mails_données['header_text'].'"
 		WHERE `id` =1 LIMIT 1 ';
+		
+
       pwg_query($query);
+
+
 }
 //=================================================================================
@@ -48,6 +89,5 @@
 		if ($erreur_message <> "")
 			{
-			$erreur_message=str_replace("\n",'<br />',$erreur_message) ;
-			$erreur_message=sprintf(l10n('free_message "%s"'), $erreur_message  )	;
+			    $erreur_message=str_replace("\n",'<br />',$erreur_message) ;
    				$template->assign('errors',$erreur_message);
 				$erreur_message="";
@@ -61,5 +101,5 @@
 		if ($infos_message <> "")
 			{
-	$infos_message=str_replace("\n",'<br />',$infos_message) ;
+				$infos_message=str_replace("\n",'<br />',$infos_message) ;
    				$template->assign('infos',$infos_message);
 				$infos_message="";
@@ -76,15 +116,49 @@
 function Get_Datas()
 {
-
-	 $query = "
+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()
+{
+global $period_search,$period_match ;
+ $query = "
     SELECT *
     FROM ".MAIL_SUPERV_TABLE."
   	;";
     $data = mysql_fetch_array(pwg_query($query));
-	$data['reste']=   ($data['date_quarantaine']-time())  ;
-	$data['reste_mail']=   ($data['date_mail']-time())  ;
-	$data['reste_spam']=   ($data['date_spam']-time())  ;
-
-    return $data;
+	//====================================================================================
+	
+
+    $mails_periode="+".str_replace($period_search, $period_match, $data['nb_mails_periode']);
+	$next_day =  strtotime(  $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 =  strtotime(  $spams_periode,$data['date_spam']);
+	$data['rest_spam']=  ( $next_day )-time() ;
+
+  
+	$quarantaine_periode="+".str_replace($period_search, $period_match, $data['quarantaine_periode']);
+	$next_day =  strtotime( $quarantaine_periode,$data['date_quarantaine']);	
+	if ($data['quarantaine']) {
+	$data['reste'] =   ( $next_day )-time() ;
+	}else{
+	$data['reste'] = 0;
+	}
+	
+	 return $data;
 }
 
@@ -147,9 +221,11 @@
 $minutes=substr ('00'.$minutes,-2,2);
 $secondes=substr ('00'.$secondes,-2,2);
+
 if ($week > 0 )
 {
+
 return $week. " " .l10n('Week'). " " .  $day . " " .l10n('Day'). "s ". $heures . " ". l10n('Hour'). "s " . $minutes. " " .l10n('minute'). "s ".  $secondes." " .l10n('seconde')."s";
 }
-return $day . " " .l10n('Day'). "s ". $heures . " ". l10n('Hour'). "s " . $minutes. " " .l10n('minute'). "s ".  $secondes." " .l10n('seconde')."s";
+return $day . " " .l10n('Day'). "s ". $heures . " ". l10n('Hour'). "s " . $minutes. " " .l10n('Minute'). "s ".  $secondes." " .l10n('Seconde')."s";
 
 }	
@@ -168,7 +244,147 @@
 }
 
+function vérif_base()
+{
+
+$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 NOT NULL ,
+		`date_quarantaine` INT NOT NULL DEFAULT '0',
+		`quarantaine_periode` TEXT  ,	
+			
+		
+		`message` TEXT NOT NULL , 
+		`header_text` TEXT NOT NULL , 
+      	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 NOT NULL , ";
+			   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( "header_text",$table)) {	
+	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `header_text` TEXT   ";
+			   pwg_query($query);            } 		
+		   			    			   	
+		   			    
+      $query = "
+    		SELECT COUNT(*)
+    		FROM ".MAIL_SUPERV_TABLE."
+  		;";
+//==============================================================================		
+  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,header_text)
+    VALUES (1,
+	0,
+	'.time().',
+	2000,
+	"1 week",
+	
+	0,
+	'.time().',
+	10,
+	"2 day",
+	
+	false,
+	'.time().',
+	"2 day",
+	
+	"Init.",
+	 "'.l10n('hello').'"
+	 )
+ 	 ;';
+
+
+	pwg_query($q);
+	
+ 	} 
+}
+function Get_colonnes_de($table)
+{
+  $columns_of = array();
+    $query = 'DESC '.$table.';';
+    $result = mysql_query($query);
+    $columns_of[$table] = array();
+    while ($row = mysql_fetch_row($result))
+    {
+      array_push($columns_of[$table], $row[0]);
+    }
+  return $columns_of;
+}
+
 function test_envoie()
 {
 global $infos_message,$erreur_message ,$conf,$user ;
+
+
+$infos_message=memo_var($user);
+
 $admins = array();
   $query = '
@@ -210,13 +426,13 @@
   ob_start();
   	$erreur_message ="";
-  	$infos_message =   memo_var($admins);
+  	$infos_message .=   memo_var($admins);
+	
+
+	  
  //===========================================================
   	$args = array();
-  	
   	$args['Bcc']=$admins;
-	
-  $message_texte="Bonjour.";
-  $message_html="Test";
- 
+  	$message_texte="Bonjour.";
+  	$message_html="Test";
 /*
  	$limite = "_parties_".generate_key(32);; 
@@ -235,11 +451,12 @@
   $attachement .= "\n\n\n-----=".$limite."\n"; 
   */
- 
-//==========================================================================
+ //==========================================================================
 
  $args['subject']="Plugin Piwigo TEST";
  $args['content']="TEST ";
-
-   $infos_message ="TEST ENVOIE [admin].".memo_var($admins);
+ 
+	  $infos_message .="ARGUMENTS.".memo_var($args);
+   $infos_message .="TEST ENVOIE [admin].".memo_var($admins);
+
         $ret= pwg_mail( "", $args); 
   	  	$m= ob_get_contents();
Index: /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 4028)
+++ /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 4029)
@@ -1,3 +1,6 @@
 <?php
+global $lang ;
+
+
 $lang['Howto'] = 'Gestion des parametres de surveillance d\' envoie des mails.';
 $lang['free_admin_titre'] = 'Administration de Free mail';
@@ -12,4 +15,6 @@
 $lang['free_guest'] = 'Exclure le guest des des envoies.';
 
+$lang['periode'] = 'Période';
+
 $lang['free_mails'] = ' mails ';
 $lang['free_depuis_le'] = ' depuis le :';
@@ -17,5 +22,5 @@
 $lang['free_nb'] = ' Nombre ';
 $lang['free_nb_maxi'] = ' Nombre maxi ';
-$lang['free_quarantaine'] = 'Vous êtes en quarantaine pour : ';
+$lang['free_quarantaine'] = 'Vous êtes en quarantaine jusqu\'au : ';
 $lang['free_heures'] = ' Heures ';
 $lang['free_date'] = ' Date : ';
@@ -23,4 +28,38 @@
 $lang['free_message "%s"'] = ' Erreur : <br /> "%s"  <br />!';
 $lang['supervisor'] = 'Superviseur de MAILS';
+//========================================================================
+$lang['To_day_is'] = 'Nous sommes le:'.date('d-M-Y H:i:s') ; 
+ 
 
+$lang['Week'] = 'semaine';
+$lang['Day'] = 'jour';
+$lang['Hour'] = 'heure';
+$lang['Minute'] = 'minute';
+$lang['Seconde'] = 'seconde';
+
+
+$lang['formatdate'] = 'd-M-Y H:i:s';  
+
+$lang['mise_en_quarantaine %s %s %s %s %s'] = '
+							MISE EN QUARANTAINE !<br />'.
+							'Nombre de %s envoyés  : %s  <br />'.
+							'Depuis le             : %s  <br />'.		
+							'Il vous reste encore    %s  avant le déblocage.<br />
+  							 Le        %s <br />' ;
+	
+
+$lang['alerte_mail %s %s'] = "<br />ALERTE !!! DANGER DE MISE EN QUARANTAINE PAR VOTRE FAI <br />
+					Vous avez dépassé le nombre de mails admissibles par période. <br /> <br />
+					Date du premier mail: %s  <br />
+					Encore : %s  <br />" ;
+					
+$lang['debug_message %s %s %s %s %s']=	'<br />---- La fonction mail &agrave; retourn&eacute;e [%s]  ------
+		            -------- MESSAGE erreur : -------------
+		           [ %s ] 
+					mailto:   "%s"
+                    -------- HEADERS -----------------
+					%s
+					-------- Nombre de destinataires ----
+					%s
+					';
 ?>
Index: /extensions/Mail_supervisor/main.inc.php
===================================================================
--- /extensions/Mail_supervisor/main.inc.php	(revision 4028)
+++ /extensions/Mail_supervisor/main.inc.php	(revision 4029)
@@ -1,6 +1,28 @@
 <?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
 /*
 Plugin Name: Mail supervisor
-Version: 1.0.1
+Version: 1.0.2
 Description:  Mail supervisor surveille l'envoie des mails. 
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315
@@ -11,4 +33,5 @@
 
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
 define('mail_superv_DIR' , basename(dirname(__FILE__)));
 define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
@@ -23,12 +46,16 @@
 function clj_mail($result, $mailto, $subject, $content, $headers, $args)
 {
-    global $conf, $user, $lang_info,  $conf_mail,$mails_options,$mails_données , $template,$page ,$erreur_message; 
+    global $conf, $user, $lang_info,  $conf_mail,$mails_options,$mails_données , $template,$page ,$erreur_message,$infos_message; 
 	// lecture config table -------------
 
-
+   
 	$mails_options = explode("," , $conf['mail_superv']);
-	
+	$infos_message="";
+	$message ="";
+	$erreur_messages="";
+
 	// lecture données       -------------
     $mails_données = Get_Datas();
+
 	
 	$nb_mails	  =	$mails_données['nb_mails'] ;
@@ -36,23 +63,29 @@
 	
 	$reste =    $mails_données['reste'] ;
-	$reste_mail =    $mails_données['reste_mail'] ;
-	$reste_spam =    $mails_données['reste_spam'] ;
-	
- $mails_données['quarantaine'] =    ( $mails_données['reste'] >0 ) ? "true" : "false" ;
- 
-
-    $match=array("<",">");
-    $string=array("&lt;","&gt;") ;
-	$search=array("D","H","M","S","W");
-	$replace=array(" day"," Hour"," minute"," second"," week");
-	
-$header_message='<pre>
-Destinataire :'.$mailto.'
-Headers      :
-'.str_replace( $match,$string, $headers).'
-Sujet        :'.$subject.'
-</pre>'; 
-
+	
+	
+	$rest_mail =    $mails_données['rest_mail'] ;
+	if ($rest_mail <=0 || $mails_données['nb_mails'] ==0 ){
+	   $mails_données['nb_mails'] =0 ;
+	   $mails_données['date_mail'] = time();
+	}
+	
+	$rest_spam =    $mails_données['rest_spam'] ;
+ 	if ($rest_spam <=0 || $mails_données['nb_spams'] ==0 ){
+	   $mails_données['nb_spams'] =0 ;
+	   $mails_données['date_spam'] = time();
+	}
+	
+	$alerte =   ( $mails_données['reste'] >0 ) ? true : false ; 
+	
+	$alerte_mail =    ( $mails_données['nb_mails'] >   $mails_données['nb_mails_maxi'] ) ? true : false ;
+	$alerte_spam =    (  $mails_données['nb_spams'] >   $mails_données['nb_spams_maxi'] ) ? true : false ;
+	
+ 
+ if ( ( !$alerte  && !$alerte_spam  && !$alerte_mail ) ) 
+  	{
+	     	 
   $nb_destinataires=0;
+  
  if ($mailto<>"" )  $nb_destinataires +=1; 
    //================= réécriture de l'entête ===============================
@@ -61,17 +94,13 @@
  	if ($mailto=="")	$mailto=$conf_mail['email_webmaster'];
 }
-if ($mails_options[1] == 'on') { 
    		if (!empty($args['Cc']))
-  		{
-		  $nb_destinataires += count($args['Cc']);
-		  $headers= corrige_header('Cc:',$headers);
+  		{$nb_destinataires += count($args['Cc']);
+		 if ($mails_options[1] == 'on') {  $headers= corrige_header('Cc:',$headers);}
   		}
   		if (!empty($args['Bcc']))
-  		{
-		  $nb_destinataires += count($args['Bcc']);
-		  $headers	= corrige_header('Bcc',$headers);
+  		{  $nb_destinataires += count($args['Bcc']); 
+		   if ($mails_options[1] == 'on') {  $headers	= corrige_header('Bcc',$headers);}
 		}
 
-  }
 
 if ($mails_options[2]=='on')   {
@@ -89,126 +118,117 @@
 	  	$content =$texte .$content ;
 }
-
-	
+ 
 $ret=false;
- if (    ($mails_données['quarantaine']=="false") ) 
-  {
- 	//======== Non mise en quarantaine =============
-
+
+	 $infos_message .=$nb_destinataires;
+		
+			
+ 	    //======== Non mise en quarantaine =============
    		ob_start();
-   	  		$ret = mail($mailto, 'Plugin'.$subject, $content, $headers);
- 	  		$message = ob_get_contents();
-    	ob_end_clean();
+		$ret = false;
+		 if ($nb_destinataires > 0) {
+   	  	  	 $ret = mail($mailto, $subject, $content, $headers);
+ 
+			}else{
+			   $message .='Nombre de destinataires = 0';
+			}
+ 	  		$message .= ob_get_contents();
+    	    ob_end_clean();
+			$mails_données['message']=$message;	
+	 		Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto);
 		
-			$mails_données['message']=$message;	
-			$est_un_spam =!(strpos(strtolower($message), 'spam') === false);
-     		if ($est_un_spam == false) {
-	           //--- Non détection de spam ------------------
-    			 if ($mails_données['nb_mails']==0) {
-	       			$date_mail=time();
-					
-					$mails_periode="+".str_replace( $search, $replace, $mails_données['nb_mails_periode']);
-					$next_day =  strtotime($mails_periode,time());
-           			$mails_données['date_mail'] =  $next_day;
-	 			} 	
-	 			$next_day = time() + (0); 
- 				$mails_données['date_quarantaine'] = $next_day ;
+  	
+	
+	} else {
+
+	//================== Est en quarantaine =======================	
+		$erreur_message .= 	l10n('To_day_is')."<br />";
+			if ($alerte_spam ) { 
+		        $type="Spams";
+				$d1=$mails_données['nb_spams'];
+				$d2=$mails_données['date_spam'];
+ 				$d3= $mails_données['rest_spam'];
+				$d4=time()+$d3 ;
+ 			} 
+ 
+			if ($alerte_mail) {
+		        $type="Mails";
+		        
+				$d1=$mails_données['nb_mails'];
+				$d2=$mails_données['date_mail'];
+ 				$d3= $mails_données['rest_mail'];
+				$d4=time()+$d3 ;
+ 			}
+			if ($alerte) {
+		        $type="Spams(Quarantaine)";
+				$d1=$mails_données['nb_spams'];
+				$d2=$mails_données['date_quarantaine'];
+ 				$d3= $mails_données['reste'];
+				$d4=time()+$d3 ;
+ } 
+
+
+$d2=date(l10n('formatdate'),$d2);
+$d3=int_to_heure($d3) ;
+$d4=date(l10n('formatdate'),$d4);
+
+		$erreur_message .='<br />'.sprintf(l10n('mise_en_quarantaine %s %s %s %s %s'),$type,$d1,$d2,$d3,$d4).'<br />';
+ }			
+ sauve_données();
+ return true ;
+}
+//===========================================================================================	
+function Gestion_erreurs($message,$ret,$nb_destinataires,$headers,$mailto)
+{			
+	 global $conf, $user, $lang_info,  $conf_mail,$mails_options,$mails_données , $template,$page ,$infos_message,$erreur_message,$args; 
+    $match=array("<",">");
+    $string=array("&lt;","&gt;") ;	 
+
+	
+	$est_un_spam =!(strpos(strtolower($message), 'spam') === false);
+	$headers=str_replace( $match,$string, $headers); 
+	
+	if ( ($ret==false) || ($est_un_spam==true) || ($nb_destinataires == 0) ) {
+		 ;				// Bad recipient address syntax 
+ 		$pos1 = strpos(strtolower($message), 'bad recipient address syntax');
+		if (  !($pos1 === false) ){
+			$erreur_message .='Détection de : Bad recipient address syntax .';
+ 			$erreur_message .='Vérifiez les destinataires: (Bcc,Cc,To)<br />';
+ 			}	
+	
+	$erreur_message .= sprintf(l10n('debug_message %s %s %s %s %s'),($ret==true)? "true" : "false",$message,$mailto,$headers,$nb_destinataires);
+       //=============== La fonction mail à retournéeune erreur =========================		
+
+				
+				}	
+				
+    	if ($est_un_spam == false) 
+			{
+    			if ($mails_données['nb_mails']==0) {	$mails_données['date_mail'] =  time();	} 	
  	    		$mails_données['nb_mails'] += $nb_destinataires;
-	  // teste limite atteinte :
-	
-	  if (($mails_données['nb_mails'] >= $mails_données['nb_mails_maxi'])) 
-			{
-			$erreur_message .= "ALERTE !!! DANGER DE MISE EN QUARANTAINE PAR VOTRE FAI <br />" ;
-			$erreur_message .=  "Vous avez d&eacute;pass&eacute; le nombre de mails admissibles par semaine. <br /> <br />";
-			$erreur_message .='Date du premier mail: ' . date('d-M-Y H:m:s',$mails_données['date_mail']);
-			$rest_mail=  $mails_données['date_mail']-time() ; 
-			$erreur_message .= '<br />Encore : '. int_to_heure($rest_mail) ;
-			
-				if ( (float) $rest_mail <= 0)
-					{
-					$mails_periode="+".str_replace( $search, $replace, $mails_données['nb_mails_periode']);
-					$next_day =  strtotime($mails_periode,time());
-           			$mails_données['date_mail'] =  $next_day;
-				
-					}
-			
-			
-			}
-			if ($ret==false) { 	
-       			//=============== La fonction mail à retournée false=========================		
-				$erreur_message .= '<br />---- La fonction mail &agrave; retourn&eacute;e [false]  ------<br />';
-					$erreur_message .='-------- MESSAGE erreur : -------------<br />';
-					$erreur_message .=$message ;				// Bad recipient address syntax 
- 				$pos1 = strpos(strtolower($message), 'bad recipient address syntax');
-				if (  !($pos1 === false) ){
-				$erreur_message .='D&eacute;tection de : Bad recipient address syntax .';
- 					$erreur_message .='V&eacuterifiez les destinataires: (Bcc,Cc,To)<br />';
- 					}
-					$erreur_message .='mailto:   "'.$mailto.'"<br />';
-
-					$erreur_message .='--------HEADERS -----------------<br />
-					';
-					$erreur_message .=$headers ;
-					
-
-				}
-			
- 		}else{
-		//--- Détection de spam ------------------
- 			
-			if ($mails_données['nb_spams']==0) {  $mails_données['date_spam']= time(); 	}
-			$mails_données['nb_spams'] += $nb_destinataires;
-			
-			$est_un_spam =!(strpos(strtolower($message), 'trop de spam') === false);
-			
-			if ( $est_un_spam ) { 
-			    $mails_données['quarantaine']=true;
-				 $spams_periode="+".str_replace($search, $replace, $mails_données['nb_spams_periode']);
-				
-					$next_day =  strtotime(  $spams_periode);
-					
-			//	$next_day =  strtotime('+2 day');
-		 		$mails_données['date_quarantaine']= $next_day       ;			
 			}
 			else
 			{
-	 		$mails_données['quarantaine']= ($mails_données['nb_spams'] >= $mails_données['nb_spams_maxi']);
-       		}
-        	//	$next_day = time() + (2 * 24 * 60 * 60);
-			if ($mails_données['quarantaine']) 
-				{
-				$erreur_message .= "ALERTE !!! DANGER DE MISE EN QUARANTAINE  <br />" ;
-				$erreur_message .=  "Vous avez d&eacute;pass&eacute; le nombre de spmas admissibles. <br /> <br />";
-				}
-	    		$erreur_message .="<br> Detection $message <br />".
-				"Nombre de spams d&eacute;tect&eacutes; ".$mails_données['nb_spams'];
+				$mails_données['nb_spams'] += $nb_destinataires;			
+			    //--- Détection de spam ------------------
+				if ($mails_données['nb_spams']==0) {$mails_données['date_spam'] = time(); 	}
+
+				$trop_de_spam =!(strpos(strtolower($message), 'trop de spam') === false);
+				if ( $trop_de_spam ) {
+						$mails_données['nb_spams_maxi']=$mails_données['nb_spams'];
+						$quarantaine_periode="+".str_replace( $period_search, $period_match, $mails_données['quarantaine_periode']);
+						$next_day =  strtotime($quarantaine_periode);  // détection de 'Trop de spam
+						$mails_données['date_quarantaine']= time()  ;	
+						$mails_données['quarantaine']= true    ;	
+						$infos_message=memo_var($mails_données);
+					}
+
  			}
  
-  	}else{
-		//======== Mise en quarantaine       =============
-$erreur_message =  '<br />
-Nous sommes le :       '. date('d-M-Y H:m:s') ."<br />";
-
-		if 	($reste >= 0) {
-$erreur_message .=
-"MISE EN QUARANTAINE !"."<br />".
-"Nombre de spams envoy&eacute;s :". $mails_données['nb_spams']."<br />".
-"Depuis le               :". date('d-M-Y H:m:s',$mails_données['date_spam'])."<br />".		
-"Il vous reste encore ". int_to_heure($mails_données['reste'])  . " avant le d&eacute;blocage par votre FAI<br />
-  qui devrait avoir lieu le ".date('d-M-Y H:m:s',$mails_données['date_quarantaine'])."." ;
-		
-		}
-			
-	  	$erreur_message .=  '</pre>'.
-	   	'
-	  
-	  '.
-	"Dernier message re&ccedil;u.:<br />". $mails_données['message']. "<br /> ";
-	  $ret = "break";
- }
-
-  sauve_données();
+
+ 
+
+ 
  $ret=true;
- 
  return $ret ;
  
Index: /extensions/Mail_supervisor/maintain.inc.php
===================================================================
--- /extensions/Mail_supervisor/maintain.inc.php	(revision 4028)
+++ /extensions/Mail_supervisor/maintain.inc.php	(revision 4029)
@@ -1,3 +1,28 @@
 <?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+if  (!defined('PHPWG_ROOT_PATH'))  
+{
+  die('Hacking attempt!');
+}
 
 if(!defined("MAIL_SUPERV_PATH"))
@@ -10,4 +35,38 @@
 {
 
+// efface free mail
+$q = '
+  SELECT  count(`id`) as total   FROM `'.PLUGINS_TABLE.'` WHERE `id` LIKE "free_mail"   ;';
+     $plugs = mysql_fetch_array(pwg_query($q));
+ $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);
+	
+	
+		
+ }
+
+
+	 
+
+		
+  
   $q = '
     INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
@@ -46,125 +105,4 @@
 
 
-function vérif_base()
-{
 
-$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 NOT NULL ,
-		`date_quarantaine` INT NOT NULL DEFAULT '0',
-			
-		
-		`message` TEXT NOT NULL , 
-		`header_text` TEXT NOT NULL , 
-      	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_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( "quarantaine",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `quarantaine` TEXT NOT NULL , ";
-			   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( "message",$table)) {	
-	  $query = "ALTER TABLE `".MAIL_SUPERV_TABLE."` ADD `message` 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(*)
-    		FROM ".MAIL_SUPERV_TABLE."
-  		;";
-//==============================================================================		
-  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,message,header_text)
-    VALUES (1,
-	0,
-	'.time().',
-	2000,
-	"1W",
-	
-	0,
-	'.time().',
-	10,
-	"2D",
-	
-	false,
-	'.time().',
-	
-	"Init.",
-	 "'.l10n('hello').'"
-	 )
- 	 ;';
-
-
-	pwg_query($q);
-	
- 	} 
-}
-function Get_colonnes_de($table)
-{
-  $columns_of = array();
-    $query = 'DESC '.$table.';';
-    $result = mysql_query($query);
-    $columns_of[$table] = array();
-    while ($row = mysql_fetch_row($result))
-    {
-      array_push($columns_of[$table], $row[0]);
-    }
-  return $columns_of;
-}
 ?>
