Index: /extensions/Mail_supervisor/admin/mail_black_liste.tpl
===================================================================
--- /extensions/Mail_supervisor/admin/mail_black_liste.tpl	(revision 4132)
+++ /extensions/Mail_supervisor/admin/mail_black_liste.tpl	(revision 4132)
@@ -0,0 +1,161 @@
+
+
+{html_head}<link rel="stylesheet" type="text/css" href="{$MAIL_SUPERV_PATH}admin/theme.css" />{/html_head}
+   
+
+	 
+<div class="titrePage">
+	<h2>{'supervisor'|translate}</h2> 
+</div> 
+<div class="bug" >
+
+</div>
+
+ 
+<form action='' method="post" name="form_black">
+
+ <fieldset >
+    <legend>{'black_liste'|translate}</legend>
+	 <input name="info1" type="hidden"  />
+	 
+	
+	<table>
+	
+      <fieldset >
+    	
+	<input name="ip_black" type="text" class="items"  value="{$ip_black}" />
+	<input class="items"  type="submit" name="info" value="ajout" id='ip_ajout' title="Ajout  {$ip_black}"
+ />
+			<table class="table2" >
+  				<tr class="throw">
+    		
+    			<th>{$champs_bl[1]|@translate}</th>
+				<th>{$champs_bl[2]|@translate}</th>
+				<th>{$champs_bl[3]|@translate}</th>
+				<th>{$champs_bl[4]|@translate}</th>
+				<th>{$champs_bl[7]|@translate}</th>
+    			<th>{'blackliste'|@translate}</th>
+  				</tr>
+  				{if not empty($liste_bl)}
+  					{foreach from=$liste_bl item=group name=group_loop}
+  						<tr class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}">
+	      				<td>{$group.ip}</td>
+	      				<td>{$group.pays}</td>
+		  				<td>{$group.region}</td>
+						<td>{$group.ville}</td>
+						<td>{$group.nb}</td>
+    					<td style="text-align:center;">
+
+<input type="image" class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}"  
+     src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" 
+	 alt="{'delete'|@translate}" 
+	 onclick = "
+ if (confirm( document.getElementById('btn_delete{$group.ip}').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}'))
+  form_black.info1.value='raz:{$group.ip}' 
+  "; 
+	 id="btn_delete{$group.ip}" 
+      title="{'delete'|@translate} {$group.ip}"		
+		 />
+
+
+		
+    </td>
+  </tr>
+  {/foreach}
+
+  <td> <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" /> supprime de la liste noire</td>
+ 
+</table>
+
+	</fieldset>
+	
+	  {/if}
+	  
+	<fieldset > 
+        <legend>{'liste_ip'|translate}</legend>
+	 <p class="info">
+	   {'IP_adress'|translate} : {$IP}
+	   
+<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
+<script language="JavaScript" type="text/javascript">
+
+var pays     =  geoip_country_name();
+
+	var ville     =  geoip_city();
+	var region    =  geoip_region_name() ;
+	var latitude  =  geoip_latitude() ;
+	var longitude =  geoip_longitude() ; 
+	
+
+document.write ('	<input name="pays"  type="text" value =  '+ pays +'  id = "pays" class="info" >    ');
+document.write ('	<input name="ville"  type="text" value =  '+ ville +'  id = "ville" class="info"  >    ');
+document.write ('	<input name="region"  type="text" value =  '+ region +'   id = "region"   class="info"       >    ');
+document.write ('	<input name="latitude"  type="text" value =  '+ latitude +' id = "latitude" class="info"  > ');
+document.write ('	<input name="longitude"  type="text" value =  '+ longitude + ' id = "longitude" class="info" >  ');
+
+</script>	 
+</p>
+  
+<table class="table2">
+
+   <tr class="throw"> 
+  
+   
+    <th>{$champs_ip[1]|@translate}</th>
+    <th>{$champs_ip[2]|@translate}</th>
+	<th>{$champs_ip[3]|@translate}</th>
+	<th>{$champs_ip[4]|@translate}</th>
+	<th>{$champs_ip[5]|@translate}</th>
+
+    <th>{'blackliste'|@translate}</th>
+  </tr>
+  {if not empty($liste_ip)}
+  
+  {foreach from=$liste_ip item=group name=group_loop}
+  
+  		<tr class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}">
+          <td>{$group.date}</td>
+	      <td>{$group.time}</td>
+	      <td>{$group.user_id}</td>
+		  <td>{$group.IP}</td>
+ <td>{$group.total}</td>
+    <td style="text-align:center;">
+
+
+		 
+<input type="image" 
+  class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}" 
+  src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plug_activate.png" 
+  onclick = "
+ if (confirm( document.getElementById('btn_permissions{$group.IP}').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}'))
+  form_black.info1.value='ajout:{$group.IP}' 
+  "; 
+  id="btn_permissions{$group.IP}"
+  title="{'blacklist'|@translate} {$group.IP}"
+  alt="{'blacklist'|@translate} {$group.IP}"
+/>
+		 
+
+
+ 
+		
+    </td>
+  </tr>
+  			{/foreach}
+ 		 {/if}
+ 			<td> <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plug_activate.png" /> mise sur la liste noire</td>
+
+ 
+		</table>
+	</fieldset> 
+	
+	</table>
+	
+      <p>
+
+	  <input class="submit" type="submit" name="info" value="liste"  />
+
+	  </p> 
+</fieldset>
+
+</form>
Index: /extensions/Mail_supervisor/admin/mail_superv_admin.php
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4131)
+++ /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4132)
@@ -1,2 +1,3 @@
+
 <?php
 // +-----------------------------------------------------------------------+
@@ -26,20 +27,17 @@
   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__)).'/');
 
 
-
-
-
 // +-----------------------------------------------------------------------+
 // | Check Access and exit when user status is not ok                      |
 // +-----------------------------------------------------------------------+
-check_status(ACCESS_ADMINISTRATOR);
+//check_status(ACCESS_ADMINISTRATOR);
 
 global $user, $lang, $conf, $errors,$mails_données;
 global $args, $conf_mail,$infos_message,$erreur_message ;
 
-include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
 
@@ -47,5 +45,5 @@
 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__);
 
@@ -54,5 +52,5 @@
  load_language('plugin.lang', MAIL_SUPERV_PATH);
 
- 
+
 $mails_options = explode("," , $conf['mail_superv']);
 $mails_données=Get_Datas();
@@ -73,10 +71,19 @@
                l10n('Tab_set'),
                $my_base_url.'&amp;tab=mail_superv_admin');
+			   
 $tabsheet->add('mail_superv_test',
                l10n('Tab_test'),
                $my_base_url.'&amp;tab=mail_superv_test');
+			   
+$tabsheet->add( 'mail_black_liste',
+               l10n('blackliste'),
+			   $my_base_url.'&amp;tab=mail_black_liste');
+ 
+			   			   
 $tabsheet->add('mail_superv_help',$tabhelp
               ,
                $my_base_url.'&amp;tab=mail_superv_help');
+			   
+			   
 $tabsheet->select($page['tab']);
 $tabsheet->assign();
@@ -95,8 +102,10 @@
 
 	 	$modif=false ;
+
+
 //================================================================================
 switch ($page['tab'])
  {
-    
+   
 // *************************************************************************
 //                         initialisation                                  |
@@ -133,5 +142,5 @@
 	
 	$mails_données['reste'] = 0;
-	$mails_données['quarantaine']=false;
+	$mails_données['quarantaine']='false';
 	
      sauve_données();
@@ -175,5 +184,8 @@
     $reste= $mails_données['reste'];  	
 
-$quarantaine= $mails_données['quarantaine'];  	
+$quarantaine = ($mails_données['quarantaine'] == 'true') ? true : false ;;  	
+
+	 
+	
 $PHPWG_VERSION=PHPWG_VERSION;
 
@@ -198,5 +210,5 @@
 	 'time_spams_reste' => "'".int_to_heure($rest_spam)."'" ,	
 	 
-	 'quarantaine' => $mails_données['quarantaine'] ,
+	 'quarantaine' => $quarantaine ,
   	'date_quarantaine' => "'".date(l10n('formatdate'),time()+$reste)."'" ,
 	'quarantaine_periode' => "'".$mails_données['quarantaine_periode']."'" ,
@@ -262,5 +274,5 @@
   $result = pwg_query($query);
 //----------------------------------------------------------------	
-  while ($row = mysql_fetch_array($result))
+  while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
   {
     $groups[$row['id']] = $row['name'];
@@ -290,4 +302,65 @@
    break;
 // *************************************************************************
+//              BLACK LISTE                                         |
+// *************************************************************************   
+     case 'mail_black_liste':
+
+   load_language('help/plugin.lang', MAIL_SUPERV_PATH);	
+ 
+	  $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'); 
+		
+$fonction_raz = $my_base_url.'&amp;tab=mail_black_liste&amp;info=raz:';
+$fonction_set = $my_base_url.'&amp;tab=mail_black_liste&amp;info=ajout:';
+$f_action  = $my_base_url.'&amp;tab=mail_black_liste' ;
+		// array_keys($liste_bl[0]);array_keys($liste_ip[0])
+	$champs_ip=array();
+	$champs_bl=array();
+	
+		 if (!empty($liste_ip))
+		$champs_ip=array_keys($liste_ip[0]);
+		
+		 if (!empty($liste_bl))
+        $champs_bl=array_keys($liste_bl[0]);
+ 
+		
+		  $smile_bonjour=MAIL_SUPERV_PATH."smilies/mouche.gif" ; 
+      $template->assign(
+  					array(
+					'smile_bonjour' => $smile_bonjour ,
+
+                		'champs_ip' => $champs_ip ,					
+						'liste_ip' => $liste_ip,
+						'champs_bl' =>  $champs_bl 	 ,	
+						'liste_bl' => $liste_bl ,
+                 		'conf_admin_layout' => $conf['admin_layout'] ,
+						'ip_black' => $ip_black ,
+						'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
+						'fonction_raz' => $fonction_raz ,
+						'fonction_set' => $fonction_set ,
+						'F_ACTION' => $f_action ,
+						'IP' => $_SERVER['REMOTE_ADDR'],
+		 			)
+				);			 
+	 //===============================================================			 
+	 	$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');
+   break; 
+
+// *************************************************************************
 //                      AIDE                                               |
 // *************************************************************************   
@@ -310,7 +383,5 @@
    break; 
  //====================================================================
-
- 
- }
+  }
 //================================================================================
 
@@ -350,4 +421,5 @@
 		}
 		
+
 		  
 		if  ($infos_message != "")  
Index: /extensions/Mail_supervisor/admin/mail_superv_admin.tpl
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 4131)
+++ /extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 4132)
@@ -34,5 +34,5 @@
 	   <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="30%" value={$nb_mails_periode} /></td>
 		<td><input type="text" name="time_mails_reste" size="50%" value={$time_mails_reste} /></td>  
     </tr> 
@@ -44,5 +44,5 @@
 	   <td><input type="text" name="date_spam"  value={$date_spam} /></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="10%" value={$nb_spams_periode} /></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>  
 	    </tr> 
@@ -60,5 +60,5 @@
 		 	<td><input type="text" name="date_quarantaine"  value={$date_quarantaine} />		 	</td><td> </td>
 			
-		  <td><input type="text" name="quarantaine_periode" size="10%" value={$quarantaine_periode} /></td>
+		  <td><input type="text" name="quarantaine_periode" size="30%" value={$quarantaine_periode} /></td>
 		   <td><input type="text" name="reste" size="50%" value={$reste} /></td> 
 		{/if}
Index: /extensions/Mail_supervisor/admin/mail_superv_help.tpl
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_help.tpl	(revision 4131)
+++ /extensions/Mail_supervisor/admin/mail_superv_help.tpl	(revision 4132)
@@ -1,8 +1,10 @@
+
 <div class="instructions" >
  
 <h2>{'Tab_help'|translate}</h2>
 <fieldset style=" position:relative ; top:15px">
+  <legend>{'free_admin_titre'|translate}</legend>
 <div id="instructionFonction" class="instructionBlock" >
-
+ 
   <div
     id="fonction_header"
@@ -47,16 +49,16 @@
 
 <ol>
-  <li><span style="color:#3300FF">{'check_mailto'|translate}</span> </li>
+  <li ><span class="throw"> {'check_mailto'|translate}</span></li>
    <ul>
  <li>{'hlp_2_1'|translate}</li>
 </ul>
-  <li><span style="color:#3300FF">{'check_header_carbon'|translate}</span></li>
+  <li ><span  class="throw">{'check_header_carbon'|translate}</span></li>
   
    <ul>
  <li>{'hlp_2_2'|translate}</li>
 </ul>
-  <li><span style="color:#3300FF">{'check_header_text'|translate}</span> </li> 
+  <li><span  class="throw">{'check_header_text'|translate}</span> </li> 
   <ul>
- <li>{'hlp_2_3'|translate}</span></li>
+ <li>{'hlp_2_3'|translate}</li>
 </ul>
 </ol>
@@ -86,11 +88,11 @@
 <ul>
     <ul>      
-	  <li ><i><span style="color:#3300FF">{'free_nb'|translate}</span></i>       {'hlp_3_1'|translate}</li>
-      <li><i><span style="color:#3300FF">{'free_depuis_le'|translate}</span></i> {'hlp_3_2'|translate}</li>
-      <li><i><span style="color:#3300FF">{'free_nb_maxi'|translate}</span></i>   {'hlp_3_3'|translate}</li>
-      <li><i><span style="color:#3300FF">{'periode'|translate}</span></i>   {'hlp_3_4'|translate}
+	  <li ><i><span class="throw">{'free_nb'|translate}</span></i>       {'hlp_3_1'|translate}</li>
+      <li><i><span class="throw">{'free_depuis_le'|translate}</span></i> {'hlp_3_2'|translate}</li>
+      <li><i><span class="throw">{'free_nb_maxi'|translate}</span></i>   {'hlp_3_3'|translate}</li>
+      <li><i><span class="throw">{'periode'|translate}</span></i>   {'hlp_3_4'|translate}
 	  {'hlp_3_4_0'|translate}
 	  </li>
-      <li><i><span style="color:#3300FF">{'reste'|translate}</span></i>          {'hlp_3_5'|translate}</li>
+      <li><i><span class="throw">{'reste'|translate}</span></i>          {'hlp_3_5'|translate}</li>
  
     </ul>
@@ -118,6 +120,6 @@
 <ul>
 
-      <li><i><span style="color:#FF0000">{'free_quarantaine'|translate}</span></i>   {'hlp_4_1'|translate}</li>
-      <li><i><span style="color:#3300FF">{'quarantaine'|translate}</span></i>     {'hlp_4_2'|translate}</li>
+      <li><i><span class="throw">{'free_quarantaine'|translate}</span></i>   {'hlp_4_1'|translate}</li>
+      <li><i><span  class="throw">{'quarantaine'|translate}</span></i>     {'hlp_4_2'|translate}</li>
 
   
@@ -143,5 +145,5 @@
 <ul>
 
-  <li><i>{'free_admin_description'|translate}</i>     {'hlp_5_1'|translate}</li>
+  <li><i><span  class="throw">{'free_admin_description'|translate}</span></i>     {'hlp_5_1'|translate}</li>
 </ul>
 
@@ -153,4 +155,51 @@
  Rédaction en cours....
  </fieldset>
-
-</div>
+ 
+ 
+ <fieldset >
+  <legend>{'test'|translate}</legend>
+<div id="testFonction" class="instructionBlock" >
+ 
+  <div
+    id="test_header"
+    class="instructionBlockHeaderCollapsed"
+    onclick="blockToggleDisplay('test_header', 'Fonction1')"
+  ><span>
+    {'test'|translate}
+  </span></div>
+  <div
+    id="Fonction1"
+    class="instructionBlockContent"
+    style="display:none"
+  >
+     
+    <p></p>
+  </div> <!-- Fonction -->
+</div> <!-- Fonctions -->
+
+
+ </fieldset>
+ 
+<fieldset >
+  <legend>{'blackliste'|translate}</legend>
+<div id="blacklisteFonction" class="instructionBlock" >
+ 
+  <div
+    id="blackliste_header"
+    class="instructionBlockHeaderCollapsed"
+    onclick="blockToggleDisplay('blackliste_header', 'Fonction2')"
+  ><span>
+    {'blackliste'|translate}
+  </span></div>
+  <div
+    id="Fonction2"
+    class="instructionBlockContent"
+    style="display:none"
+  >
+     
+    <p>{'hlp_7_1'|translate}</p>
+  </div> <!-- Fonction -->
+</div> <!-- Fonctions -->
+
+
+ </fieldset></div>
Index: /extensions/Mail_supervisor/admin/mail_superv_test.tpl
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_test.tpl	(revision 4131)
+++ /extensions/Mail_supervisor/admin/mail_superv_test.tpl	(revision 4132)
@@ -36,4 +36,7 @@
 	  <input class="submit" type="submit" name="raffraichir" value="{'refresh'|translate}" />
 	  <input class="submit" type="submit" name="test_envoie" value="{'test'|translate}" />
+	  
+	
+	  
 	  </p> 
 </fieldset>
Index: /extensions/Mail_supervisor/admin/theme.css
===================================================================
--- /extensions/Mail_supervisor/admin/theme.css	(revision 4132)
+++ /extensions/Mail_supervisor/admin/theme.css	(revision 4132)
@@ -0,0 +1,39 @@
+.Style1 {color: #6699CC}
+
+ 
+.items {
+	font-style: italic;
+	
+
+}
+
+ .row2{
+	font-style: italic;
+	
+	border: 0;
+
+}
+ 
+ .row1{
+	font-style: italic;
+	border: 0;
+
+
+}
+
+.info{
+	background-color: #FFFFFF;
+	border:2 ;
+	
+}
+
+
+ .bug {
+
+	background-image: url(../smilies/mouche.gif);
+	
+	background-repeat: no-repeat;
+
+	width: 100px;
+	height: 75px;
+ }
Index: /extensions/Mail_supervisor/include/constants.php
===================================================================
--- /extensions/Mail_supervisor/include/constants.php	(revision 4131)
+++ /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 4131)
+++ /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 4131)
+++ /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);
+   				}
+				
+
+
+
+
+
+
+?>
Index: /extensions/Mail_supervisor/language/fr_FR/help/plugin.lang.php
===================================================================
--- /extensions/Mail_supervisor/language/fr_FR/help/plugin.lang.php	(revision 4131)
+++ /extensions/Mail_supervisor/language/fr_FR/help/plugin.lang.php	(revision 4132)
@@ -46,5 +46,19 @@
 
 $lang['hlp_5_1']='Dernier message renvoyé par la fonction mail().';
- 
-	  
+//=====================================================================
+
+
+//====================================================================== 
+
+
+$lang['hlp_7_1']='Ce module permet de créer une liste noire contenant les adresses IP indésirables.
+                  Les adresse IP mémorisées dans la liste noire seront blocquées lors de leur tentative de connexions au site.
+				  Les jockers (*) pour remplacer un groupe d\'adresse  sont autorisés.
+				    Exemple : 94.102.63.* 
+				  Exclusion de toutes les adresses IP de 94.102.63.0 à 94.102.63.255
+				  	Exemple : 94.102.*.13 
+				  Exclusion de toutes les adresses IP de 94.102.0.13 à 94.102.255.13
+				  
+				  
+				  ';	  
 ?>
Index: /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 4131)
+++ /extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 4132)
@@ -16,4 +16,9 @@
 $lang['nbm_no_mail_to_send'] = 'Pas de mail à envoyer.';
 */
+$lang['IP_adress'] = 'Votre adresse IP';
+$lang['liste_ip']="Liste des IP (historique)";
+$lang['black_liste']="Liste noire des IP";
+$lang['blackliste']="Liste noire";
+
 $lang['state'] = 'Etat';
 $lang['refresh'] = 'Rafraîchir';
Index: /extensions/Mail_supervisor/main.inc.php
===================================================================
--- /extensions/Mail_supervisor/main.inc.php	(revision 4131)
+++ /extensions/Mail_supervisor/main.inc.php	(revision 4132)
@@ -259,5 +259,4 @@
  			}
  
-
  
 
@@ -280,4 +279,3 @@
 //add_event_handler('loc_end_page_tail', 'affiche_message');
 add_event_handler('loc_after_page_header', 'affiche_message');
-
 ?>
Index: /extensions/Mail_supervisor/maintain.inc.php
===================================================================
--- /extensions/Mail_supervisor/maintain.inc.php	(revision 4131)
+++ /extensions/Mail_supervisor/maintain.inc.php	(revision 4132)
@@ -25,27 +25,25 @@
   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__)).'/');
-
 include_once (MAIL_SUPERV_PATH.'include/constants.php');
-
-include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
-
+ include_once (MAIL_SUPERV_PATH.'include/fonctions.php');  
+ 
 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));
+     $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 = '
+				UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE `id` LIKE "free_mail"';
+        		pwg_query($q);
+   				pwg_query( $q );*/
       $q = '
       DELETE FROM '.PLUGINS_TABLE.'
@@ -78,10 +76,12 @@
   $q = '
     INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
-    VALUES ("mail_superv","on,on,off ,off,off","Parametres du plugin Mail superviseur")
+    VALUES ("mail_superv","off,off,off ,off,off","Parametres du plugin Mail superviseur")
   ;';
   pwg_query($q);
+  
 
-
-	vérif_base();
+  
+  vérif_base();
+  create_table(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs,$superv_bl_type) ;
 
 }
@@ -102,10 +102,11 @@
 
     pwg_query($q);
-
-
-
-  $q = 'DROP TABLE '.MAIL_SUPERV_TABLE.';';
+  }
+   $q = 'DROP TABLE IF EXISTS  '.MAIL_BLACK_LISTE_TABLE.';';
+   pwg_query( $q );  
+   $q = 'DROP TABLE IF EXISTS  '.MAIL_SUPERV_TABLE.';';
    pwg_query( $q );
-   }
+   
+ 
   
 }
@@ -113,4 +114,5 @@
 function plugin_activate()
 {
+ 
 
 }
