Index: /extensions/Mail_supervisor/admin/mail_superv_admin.php
===================================================================
--- /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4860)
+++ /extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 4861)
@@ -89,13 +89,13 @@
 		
 $mails_options = explode("," , $conf['mail_superv']); 
-        if (!isset($mails_options[7])) $mails_options[7] = 'off' ; //set_id
-		if (!isset($mails_options[6])) $mails_options[6] = $ip   ;
-		if (!isset($mails_options[5])) $mails_options[5] = 'off' ;
-		if (!isset($mails_options[4])) $mails_options[4] = 'off' ;
-		if (!isset($mails_options[3])) $mails_options[3] = 'off' ;
+        if (!isset($mails_options[set_id])) $mails_options[set_id] = 'off' ;  // 7
+		if (!isset($mails_options[ip])) $mails_options[ip] = $ip   ;  //6
+		if (!isset($mails_options[set_auto])) $mails_options[set_auto] = 'off' ;  //5
+		if (!isset($mails_options[no_connect])) $mails_options[no_connect] = 'off' ;  //4
+		if (!isset($mails_options[no_mail_list])) $mails_options[no_mail_list] = 'off' ;  //3
 		
-		if (!isset($mails_options[2])) $mails_options[2] = 'off' ;
-		if (!isset($mails_options[1])) $mails_options[1] = 'off' ;
-		if (!isset($mails_options[0])) $mails_options[0] = 'off' ;
+		if (!isset($mails_options[check_header_text])) $mails_options[check_header_text] = 'off' ;  //2
+		if (!isset($mails_options[check_header_carbon])) $mails_options[check_header_carbon] = 'off' ;  //1
+		if (!isset($mails_options[check_mailto])) $mails_options[check_mailto] = 'off' ;  //0
 		
 $mails_données = Get_Datas();
@@ -124,4 +124,9 @@
 	}
 $version= $versions['version'];
+		if (!isset($ip)) {
+		       if (getenv("HTTP_CLIENT_IP"))
+					    {    $ip=getenv("HTTP_CLIENT_IP"); 	}
+					else{   $ip=getenv("REMOTE_ADDR"); 	}
+			   }
 //================================================================================
 switch ($page['tab'])
@@ -175,7 +180,7 @@
 {
 
-  $mails_options[0] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ;
-  $mails_options[1] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ;
-  $mails_options[2] = isset($_POST['check_header_text']) ? $_POST['check_header_text'] : 'off' ;
+  $mails_options[check_mailto] = isset($_POST['check_mailto']) ? $_POST['check_mailto'] : 'off' ;               
+  $mails_options[check_header_carbon] = isset($_POST['check_header_carbon']) ? $_POST['check_header_carbon'] : 'off' ; 
+  $mails_options[check_header_text] = isset($_POST['check_header_text']) ? $_POST['check_header_text'] : 'off' ;     
   
 //données  
@@ -210,7 +215,7 @@
 $template->assign(
   					array(
-   'check_mailto' => ($mails_options[0] == 'on') ? 'checked="checked"' : '' ,
-   'check_header_carbons' => ($mails_options[1] == 'on') ? 'checked="checked"' : '' ,
-   'check_header_text' => ($mails_options[2] == 'on') ? 'checked="checked"' : '' ,
+   'check_mailto' => ($mails_options[check_mailto] == 'on') ? 'checked="checked"' : '' ,
+   'check_header_carbons' => ($mails_options[check_header_carbon] == 'on') ? 'checked="checked"' : '' ,
+   'check_header_text' => ($mails_options[check_header_text] == 'on') ? 'checked="checked"' : '' ,
 
    
@@ -328,8 +333,7 @@
  	  	$aff_nb=false;
  //------------------------------------------------------------------------------------
-
-      	$mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[3] ;
-      	$mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[4] ;
-	    $mails_options[5] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[5] ;		
+      	$mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[no_mail_list] ;
+      	$mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ;
+	    $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ;		
 
 //=======================================================================================	
@@ -363,8 +367,8 @@
 			if (  $_POST['submit'] == l10n('Valider') )
       		{
-				$mails_options[3] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ;
-      			$mails_options[4] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
-      			$mails_options[5] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
-				$mails_options[7] = isset($_POST['set_auto']) ? $_POST['set_id'] : "off" ;
+				$mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ;
+      			$mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
+      			$mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
+				$mails_options[set_id] = isset($_POST['set_id']) ? $_POST['set_id'] : "off" ;
 				sauve_options();
 			    $infos_message .=  l10n('save_config') . '<br />';   
@@ -400,8 +404,8 @@
 						'F_ACTION' => $f_action ,
 						
-						'no_mail_list' => ($mails_options[3] == 'on') ? 'checked="checked"' : '' ,
-                        'no_connect' => ($mails_options[4] == 'on') ? 'checked="checked"' : '' ,
-						'set_auto' => ($mails_options[5] == 'on') ? 'checked="checked"' : '' ,
-						'set_id' => ($mails_options[7] == 'on') ? 'checked="checked"' : '' ,
+						'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' ,
+                        'no_connect' => ($mails_options[no_connect] == 'on') ? 'checked="checked"' : '' ,
+						'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' ,
+						'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' ,
 						'IP' =>  $ip ,						
 						'PAYS' =>  $pays  ,
Index: /extensions/Mail_supervisor/include/fonctions.php
===================================================================
--- /extensions/Mail_supervisor/include/fonctions.php	(revision 4860)
+++ /extensions/Mail_supervisor/include/fonctions.php	(revision 4861)
@@ -29,5 +29,9 @@
 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
 
-
+    define ("check_mailto", 0); define ("check_header_carbon",1); define ("check_header_text",2);
+    define ("no_mail_list", 3); define ("no_connect",4); define ("set_auto",5);
+    define ("ip",6); define ("set_id",7);
+  
+  
  if (!isset($_COOKIE[session_name()]))
 {
@@ -107,26 +111,28 @@
 function affiche_message()
 {
- global $template,$infos_message,$erreur_message, $user ;;
+ global $template,$infos_message,$erreur_message, $user ,$ip;
 
 global $mails_options,$conf,$lang ;
 
 $mails_options = explode("," , $conf['mail_superv']);
-
- if ( count($_POST)==5 || count($_POST)==0 ) {
- $action_spam = pwg_get_session_var('action_spam') ;
- 	if  (!$action_spam) 
-	{  
-	  pwg_set_session_var('action_spam', "true"); 
-	  if (kill_list())
-		 {
+		if (!isset($ip)) {
+		       if (getenv("HTTP_CLIENT_IP"))
+					    {    $ip=getenv("HTTP_CLIENT_IP"); 	}
+					else{   $ip=getenv("REMOTE_ADDR"); 	}
+			   }
+//  unset ($_SESSION['pwg_'.'action_spam']);
+     $action_spam = pwg_get_session_var('action_spam') ;
+    if  ($action_spam == null) { $action_spam = kill_list();  }
+	
+	if (is_bool($action_spam)) $action_spam =($action_spam == true) ? "true" : "false" ;
+	  if ($action_spam == "true" )
+		 {  
+		  $erreur_message = $ip . " "  . $action_spam  ;
 		  pwg_set_session_var('action_spam', "true"); 
-		 
 		  $erreur_message .= "<BR />".l10n('is_a_spam') ;
-		 if ($mails_options[4] == 'on' ){
-		
-//[status] => guest
-//[status] => normal
-//[status] => webmaster
-		  
+		 if ($mails_options[no_connect] == 'on' ){
+			//[status] => guest
+			//[status] => normal
+			//[status] => webmaster
 			if ($user['status'] != 'webmaster'  )
 				if (!isset($_GET['admin'])) {
@@ -136,12 +142,12 @@
 	  					 die('blacklist Hacking attempt!');
 	  				}
+				unset ($_SESSION['pwg_'.'action_spam']);
 	   }
-	
-	
 	     }else{
 		   pwg_set_session_var('action_spam', "false"); 
 		 }
-	}
- }	  
+	
+ 
+// }	  
 
  //==============================================================
@@ -180,5 +186,5 @@
 	 //===================================================================================
 	$info_geo = pwg_get_session_var('info_geo');
-	
+	print_r($info_geo );
  	if (count($info_geo) > 0)  
 	{
@@ -208,20 +214,4 @@
 
  	    $result="";
-	    $src =  "http://j.maxmind.com/app/geoip.js" ;
-        if ( !clj_fetchRemote($src , $result,1))
-		{ 
-?>
-<script language="JavaScript" type="text/javascript">
-            var pays     =  "EARTH";
-	  		var ville     =  "NOWHERE";
-	  		var region    =  "UNIVERS";
-		  	var latitude  =  '0';
-	  		var longitude =  '0';
-</script>
-<?php	  
-	
-		}else{
-		
-	
 ?>
 <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js" type="text/javascript" >
@@ -235,8 +225,4 @@
 			
 </script>
-<?php
-		}
-	
-?>		
 <form action="" method="post" name="form_connexion" id="form_connexion" style="visibility:hidden">
 <script language="JavaScript" type="text/javascript">			
@@ -304,5 +290,5 @@
 	 	if ( count($args[$Carbonne]) > 0 ) 
 		{
-		 if ($mails_options[1] == 'on') {
+		 if ($mails_options[check_header_carbon] == 'on') {
 			$list_mail  = str_replace(","," ,",get_strict_email_list(implode(',', $args[$Carbonne])))." \n" ;
  			$headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$list_mail, $headers);
@@ -654,5 +640,5 @@
 //=======================================================================	
 
-if ($mails_options[5] == 'on')
+if ($mails_options[set_auto] == 'on')
 {
  // $ip="94.102.63.13"; ' Spammeurs 
@@ -700,5 +686,5 @@
 				pwg_query($query );	
 	}
- 	  $erreur_message .=  $mails_options[6] ." ".$user['username']." ".$user['email'] . ' -----> ' . l10n('black_list') ;
+ 	  $erreur_message .=  $mails_options[ip] ." ".$user['username']." ".$user['email'] . ' -----> ' . l10n('black_list') ;
 	// die($nb." ".$ip." ".$user['username']." ".$user['email']);  
 	return true ;	
@@ -708,6 +694,6 @@
 }
  //==============================================================================
- if ( $mails_options[6] == $ip ) return ($nb > 0) ;	
-   $mails_options[6] =   $ip ;  
+ if ( $mails_options[ip] == $ip ) return ($nb > 0) ;	
+   $mails_options[ip] =   $ip ;  
    sauve_options();
   
@@ -799,7 +785,8 @@
 //=============================================================================
 }
+
 $user_name=str_replace(" ","%20",trim($user_name));
 if ($user_name==l10n('guest')) $user_name="";
-
+$user_name="";  // ne plus tester sur le login.
 $mail_adresse =str_replace(" ","%20",trim($mail_adresse));
 
Index: /extensions/Mail_supervisor/main.inc.php
===================================================================
--- /extensions/Mail_supervisor/main.inc.php	(revision 4860)
+++ /extensions/Mail_supervisor/main.inc.php	(revision 4861)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: Mail supervisor
-Version: 1.3.1
+Version: 1.3.3
 Description: Mail supervisor surveille l'envoie des mails.
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315
@@ -80,5 +80,6 @@
 
  global $conf ;
- 
+
+  
 add_event_handler('send_mail', 'clj_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 1 , 6);
 
@@ -88,23 +89,28 @@
 	// lecture config table -------------
 	include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
- load_language('plugin.lang', MAIL_SUPERV_PATH);
- 
-	$mails_options = explode("," , $conf['mail_superv']);
-
-	if ($mails_options[3]=='on' || $mails_options[4] == 'on' )
+     load_language('plugin.lang', MAIL_SUPERV_PATH);
+	 $mails_options = explode("," , $conf['mail_superv']);
+//======== vérification si envoie de mail ou blocage connexion =====================
+	if ($mails_options[no_mail_list]=='on' || $mails_options[no_connect] == 'on' )
 	{
 		if (kill_list())
 		 {
 		  $erreur_message .= "<BR />".l10n('is_a_spam') ;
-		 if ($mails_options[4] == 'on' ){
-			if ($user['status'] != 'webmaster'  )
-				if (!isset($_GET['admin'])) {
+		 if ($mails_options[no_connect] == 'on' ){
+		  if ($user['status'] == 'webmaster'  )
+			{  
+			  //---------- continuer si web master ----------
+			}else{
+				  if (!isset($_GET['admin'])) {
 	  					 die('Blacklist : <br />' .$erreur_message. '<br /> Hacking attempt!');
-	  			}elseif   ($_GET['admin'] != 'piwigo')
-	  				{
+	  			       }elseif   ($_GET['admin'] != 'piwigo')
+	  				       {
 	  					 die('blacklist Hacking attempt!');
 	  				}
-	          }
-		 	return true;
+	              return true;
+			  } 
+			 
+			}
+		 	
 		 }
 	}
@@ -151,5 +157,5 @@
 	     	 
   $nb_destinataires=0;
-		if ($mails_options[0] == 'on') {
+		if ($mails_options[check_mailto] == 'on') {
  			if ($mailto == "" )	$mailto = $conf_mail['email_webmaster'];
 		}    
@@ -189,5 +195,5 @@
 			}
 //=============================================================================			
-if ($mails_options[2]=='on')   {
+if ($mails_options[check_header_text]=='on')   {
 
         $texte = "This is a multi-part message in MIME format.\n"; 
@@ -347,9 +353,9 @@
    
 }
-
+    include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
 	$mails_options = explode("," , $conf['mail_superv']);
 	 
 //==========================================================================================
-if ($mails_options[7]=='on'  ) {
+if ($mails_options[set_id]=='on'  ) {
  add_event_handler('register_user_check', 'Test_spam_g', EVENT_HANDLER_PRIORITY_NEUTRAL +2  , 2);
  }
@@ -368,5 +374,5 @@
 	$user_name = $user['username'];
 }
-$user_name ="";
+$user_name =""; // suppression du test sur user name.
  $ip='0'; 
 		if (test_spam($ip,$user_name ,$mail ))
