Index: extensions/Mail_supervisor/admin/header_2_1.tpl
===================================================================
--- extensions/Mail_supervisor/admin/header_2_1.tpl	(revision 8917)
+++ extensions/Mail_supervisor/admin/header_2_1.tpl	(revision 8917)
@@ -0,0 +1,5 @@
+﻿{known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.js" } 
+{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.js" }
+{known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.js"}
+{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js" }
+{known_script id="mail_script" src= $MAIL_SUPERV_PATH|@cat:"include/Scripts.js"}
Index: extensions/Mail_supervisor/admin/header_2_2.tpl
===================================================================
--- extensions/Mail_supervisor/admin/header_2_2.tpl	(revision 8917)
+++ extensions/Mail_supervisor/admin/header_2_2.tpl	(revision 8917)
@@ -0,0 +1,5 @@
+﻿{combine_script id="jquery" path= $ROOT_URL|@cat:$path_js|@cat:"jquery.js" }
+{combine_script id="jquery.cluetip" path=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.js" require="jquery"}
+{combine_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.js"}
+{combine_script id="jquery.cluetip" path=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js" require="jquery"}
+{combine_script id="my_script" path= $MAIL_SUPERV_PATH|@cat:"include/Scripts.js" }
Index: extensions/Mail_supervisor/admin/mail_black_liste.tpl
===================================================================
--- extensions/Mail_supervisor/admin/mail_black_liste.tpl	(revision 7715)
+++ extensions/Mail_supervisor/admin/mail_black_liste.tpl	(revision 8917)
@@ -1,5 +1,6 @@
 {* $Id: mail_black_liste.tpl 3723 2009-08-07 04:53:38Z rvelices $ *}
-{known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
+{html_head}
+{if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
+{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
 
 <script type="text/javascript">
@@ -26,6 +27,6 @@
  <table> 
 <td><input type="checkbox" name="no_mail_list" value="on" {$no_mail_list}  />&nbsp;&nbsp;{'Sv_no_mail_list'|translate}	</td>
-<td><input type="checkbox" name="no_connect" value="on" {$no_connect} />&nbsp;&nbsp;{'Sv_no_connect'|translate}</td>
-<td><input type="checkbox" name="set_auto" value="on" {$set_auto} />&nbsp;&nbsp;{'Sv_set_auto'|translate}</td>
+<td><input type="checkbox" style="visibility:hidden" name="no_connect" value="off" {$no_connect} />&nbsp;&nbsp; </td>
+<td><input type="checkbox" style="visibility:hidden" name="set_auto" value="off" {$set_auto} />&nbsp;&nbsp; </td>
 <td><input type="checkbox" name="set_id" value="on" {$set_id} />&nbsp;&nbsp;{'Sv_set_id'|translate}</td>
 <tr><p></p><td>
Index: extensions/Mail_supervisor/admin/mail_superv_admin.php
===================================================================
--- extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 7715)
+++ extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 8917)
@@ -28,4 +28,5 @@
 
 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+if (!defined('MAIL_SUPERV_PATH_ABS')) define('MAIL_SUPERV_PATH_ABS' ,  dirname(__FILE__).'/');
 
 global $user, $lang, $conf, $errors,$mails_donnees;
@@ -77,7 +78,4 @@
 
 $tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
-
- 
-
 $tabsheet = new tabsheet();
 $tabsheet->add('mail_superv_admin',
@@ -98,5 +96,4 @@
                $my_base_url.'&amp;tab=mail_superv_help');
 			   
-			   
 $tabsheet->select($page['tab']);
 $tabsheet->assign();
@@ -133,5 +130,8 @@
 		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_options[set_auto] = 'off' ;
+$mails_options[no_connect] = 'off' ;
+	
 $mails_donnees = Get_Datas();
 
@@ -144,6 +144,4 @@
 $aff_nb=true;
 
-
-	
 // *************************************************************************
 // |                          Selection de l'onglet                        |
@@ -151,17 +149,7 @@
 
 	 	$modif=false ;
-		/*
-		$sql="SELECT * 
-FROM `".$prefixeTable."plugins` 
-WHERE `id` LIKE 'Mail_supervisor'
-";
- $result = @pwg_query($sql);
-	if ($result) {
-	    $versions = mysql_fetch_array($result,MYSQL_ASSOC);
-	}
-$version = $versions['version'];
-*/
-$plugin =  Get_Version_plugins( MAIL_SUPERV_PATH);
-$version = $plugin['version'] ;
+
+	$plugin =  Get_Version_plugins( MAIL_SUPERV_PATH);
+	$version = $plugin['version'] ;
  //=========================================================
 
@@ -219,5 +207,5 @@
 	}
 
-  
+  //===================================================================
 	if ( $_POST['submit'] == l10n('Sv_Valider') )  
 		{
@@ -287,10 +275,14 @@
 	 'version' =>	 $version ,
 	'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
-	'path_js' => $path_js
+	'path_js' => $path_js,
+    'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
+     
 		 				)
 				);	
 
 	$template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_admin.tpl')));
-		$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+ 
+
+	$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 		
  break; 
@@ -302,146 +294,132 @@
  
    case 'mail_superv_test':
-   
-   $mails_donnees = Get_Datas() ;
-   	$group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
-	if ($group_id >= 0) {
-      $query = '
-		SELECT
-    		name
-  		FROM '.GROUPS_TABLE.'
-  		WHERE id = '.$group_id.'
-		;';
-  		list($group_name) = mysql_fetch_row(pwg_query($query));
+   		load_language('plugin.lang', MAIL_SUPERV_PATH); 
+   		$mails_donnees = Get_Datas() ;
+   		$group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
+
+		if ($group_id >= 0) {
+      		$query = 'SELECT
+    					name
+  						FROM '.GROUPS_TABLE.'
+  						WHERE id = '.$group_id.'
+						;';
+  			list($group_name) = mysql_fetch_row(pwg_query($query));
 		}	else {
 				$group_name="";		 
 		}		
+
 //================================================
 // info by email to an access granted group of category informations
-if (isset($_POST['submitEmail']) and !empty($_POST['group']))
+
+
+if (isset($_POST['Submit']) and !empty($_POST['group']))
 {
   set_make_full_url();
+
   /* TODO: if $category['representative_picture_id'] 
     is empty find child representative_picture_id */
-/*
- * send en email to user's group
- *
- * @param:
- *   - group_id: mail are sent to group with this Id
- *   - email_format: mail format
- *   - keyargs_subject: mail subject on l10n_args format
- *   - dirname: short name of directory including template
- *   - tpl_shortname: short template name without extension
- *   - assign_vars: array used to assign_vars to mail template
- *   - language_selected: send mail only to user with this selected language
- *
- * @return boolean (Ok or not)
-*/ 
-
-if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
-else
-$titre=$conf['gallery_title'];
-
-$message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
+
+
+	if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
+	else $titre=$conf['gallery_title'];
+
+	$message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
 
  if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message);
-  // TODO Mettre un array pour traduction subjet
-
-  
-  pwg_mail_group(
-    $_POST['group'],
-    get_str_email_format(true),  
-    get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
-    'cat_group_info',  // template 
-    array
-    (
-      'CPL_CONTENT' => $message."\n\n".$user['username'] 
-    ),
-    '' );
-	
-
-$mails_donnees['message_test']= str_replace('"',"'",$message) ;
- unset_make_full_url();
+
+ if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
+	 /*
+	 * send en email to user's group
+	 *
+	 * @param:
+	 *   - group_id: mail are sent to group with this Id
+	 *   - email_format: mail format
+	 *   - keyargs_subject: mail subject on l10n_args format
+	 *   - dirname: short name of directory including template
+	 *   - tpl_shortname: short template name without extension
+	 *   - assign_vars: array used to assign_vars to mail template
+	 *   - language_selected: send mail only to user with this selected language
+	 *
+	 * @return boolean (Ok or not)
+	*/   
+  	pwg_mail_group(
+    		$_POST['group'],
+    		get_str_email_format(true),  
+    		get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
+    		'cat_group_info',  // template 
+    		array    ('CPL_CONTENT' => $message."\n\n".$user['username'] ),
+    		'' );
+	
+	$mails_donnees['message_test']= str_replace('"',"'",$message) ;
+
+ 	unset_make_full_url();
 	sauve_donnees();
-$mails_donnees = Get_Datas() ;
-	
-  $query = '
-SELECT
-    name
-  FROM '.GROUPS_TABLE.'
-  WHERE id = '.$_POST['group'].'
-;';
-  list($group_name) = mysql_fetch_row(pwg_query($query));
-  
-  array_push(
-    $page['infos'],
-    sprintf(
-      l10n('An information email was sent to group "%s"'),
-      $group_name
-      )
-    );
+	$mails_donnees = Get_Datas() ;
+    $query = 'SELECT
+    		name
+  			FROM '.GROUPS_TABLE.'
+ 			WHERE id = '.$_POST['group'].'
+			;';
+		list($group_name) = mysql_fetch_row(pwg_query($query));
+		 
+		  array_push(
+					$page['infos'],
+					sprintf( l10n('An information email was sent to group "%s"'),
+							$group_name  )
+					); 
+								$group_id =-1 ;
+  }
 }  
- load_language('plugin.lang', MAIL_SUPERV_PATH);
-//=====================================================================================
-if ( isset($_POST['test_envoie']) ) {
-$mails_donnees['message_test'] = empty($_POST['MAIL_CONTENT']) ? '' : stripslashes($_POST['MAIL_CONTENT']);
-		$message=$mails_donnees['message_test'];
-//test_envoie($message,$group_name,$group_id); 
-		sauve_donnees();
-  
-		$mails_donnees = Get_Datas() ;
-		
-  } 
-
+
+//======================================================================================
   $groups[-1] = '---------';
-
-  $query = '
-    SELECT id, name
-		FROM '.GROUPS_TABLE.'
-		ORDER BY name ASC
-		;';
+  $query = ' SELECT id, name
+			FROM '.GROUPS_TABLE.'
+			ORDER BY name ASC
+			;';
 
   $result = pwg_query($query);
 //----------------------------------------------------------------	
   while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
-  {
-    $groups[$row['id']] = $row['name'];
-  }
+  {    $groups[$row['id']] = $row['name'];  }
  //--------------------------------------------------------------- 
-
+if ( isset($_POST['Submit'])) $group_id=-1;
   $template->assign(
     	'Group',
-   		array(
-	  		'group_options'=> $groups,
-			'selected' => $group_id 
+   		array( 'group_options'=> $groups,
+				'selected' => $group_id 
 			)
  		);
 //=================================================================
 $destinataires= implode("<br />",get_liste($group_id));
+if( $destinataires !="" )
+$infos_message .= " List :<hr>" .  $destinataires . "<hr>" ;
+ 
   $template->assign(
   					array(
-				'Groupe'     => $groups,
-    			'message_test' => $mails_donnees['message_test'] ,
-				'liste' => $destinataires ,
- 'version' =>	 $version ,
-			    'MAIL_CONTENT' => $mails_donnees['message_test'],
-	            'path_js' => $path_js
+						'Groupe'     => $groups,
+    					'message_test' => $mails_donnees['message_test'] ,
+						'liste' => $destinataires ,
+ 						'version' =>	 $version ,
+						'MAIL_CONTENT' => $mails_donnees['message_test'],
+						'path_js' => $path_js,
+                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
+                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
 		 				)
 				);	
 				
-   	$template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
-		$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
-		
-		  $toolbar = 'Basic';
-  $width = '750px';
-  $height = '200px';
-  $areas = array();
-  $areas[]='MAIL_CONTENT';
- //  $areas[]= 'MAIL_CONTENT';
- if (!empty($areas))
-  {
-  if (function_exists('set_fckeditor_instance'))
-    set_fckeditor_instance($areas, $toolbar, $width, $height);
-  }
-  
+   $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
+   $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+//=========================================================================		
+		$toolbar = 'Basic';
+  		$width = '750px';
+  		$height = '200px';
+  		$areas = array();
+  		$areas[]='MAIL_CONTENT';
+		if (!empty($areas)){
+  				if (function_exists('set_fckeditor_instance'))
+    				set_fckeditor_instance($areas, $toolbar, $width, $height);
+  			}
+			
    break;
 // *************************************************************************
@@ -453,6 +431,6 @@
  //------------------------------------------------------------------------------------
       	$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] ;		
+      	$mails_options[no_connect] = 'off' ;//isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ;
+	    $mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ;		
 //=======================================================================================	
     $info_ip = (isset($info_ip)) ? $info_ip : '' ;
@@ -485,6 +463,6 @@
       		{
 				$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[no_connect] ='off' ;// isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
+      			$mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
 				$mails_options[set_id] = isset($_POST['set_id']) ? $_POST['set_id'] : "off" ;
 				sauve_options();
@@ -518,31 +496,32 @@
      $template->assign(
   					array(
-					'start' => $params['start'],
-					'per_page' => $params['per_page'] ,
-			        'maxipage'  =>  $maxipage ,
-					    'smile_bonjour' => $smile_bonjour ,
-						'img_logo' => $img_logo ,
-                		'champs_ip' => $champs_ip ,					
-						'liste_ip' => $liste_ip,
-						'champs_bl' =>  $champs_bl 	 ,	
-						'liste_bl' => $liste_bl ,
-                 		//'conf_admin_layout' => $conf['admin_layout'] ,
-						'istype' => $istype ,
-						'ip_black' => $ip_black ,
-						'IS_SPAM' => test_spam(  $ip_black),
-						'ip_black_len' =>  strlen($ip_black)  ,
-						'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
-	                    'path_js' => $path_js ,
-						'F_ACTION' => $f_action ,
+                        'start' => $params['start'],
+                        'per_page' => $params['per_page'] ,
+                        'maxipage'  =>  $maxipage ,
+                        'smile_bonjour' => $smile_bonjour ,
+                        'img_logo' => $img_logo ,
+                        'champs_ip' => $champs_ip ,					
+                        'liste_ip' => $liste_ip,
+                        'champs_bl' =>  $champs_bl 	 ,	
+                        'liste_bl' => $liste_bl ,
+                        //'conf_admin_layout' => $conf['admin_layout'] ,
+                        'istype' => $istype ,
+                        'ip_black' => $ip_black ,
+                        'IS_SPAM' => test_spam(  $ip_black),
+                        'ip_black_len' =>  strlen($ip_black)  ,
+                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
+                        'path_js' => $path_js ,
+                        'F_ACTION' => $f_action ,
 						
-						'no_mail_list' => ($mails_options[no_mail_list] == '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  ,
- 		                'VILLE' =>  $ville ,
- 		                'REGION' =>  $region ,	
-						 'version' =>	 $version ,
+                        'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' ,
+                        'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' ,
+                        'IP' =>  $ip ,						
+                        'PAYS' =>  $pays  ,
+                        'VILLE' =>  $ville ,
+                        'REGION' =>  $region ,	
+                        'version' =>	 $version ,
+                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
 		 			)
 				);			 
@@ -567,5 +546,6 @@
 					 'version' =>	 $version ,
 					 'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
-	                 'path_js' => $path_js
+	                 'path_js' => $path_js,
+                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
 					)
 			);		
Index: extensions/Mail_supervisor/admin/mail_superv_admin.tpl
===================================================================
--- extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 7715)
+++ extensions/Mail_supervisor/admin/mail_superv_admin.tpl	(revision 8917)
@@ -1,4 +1,4 @@
-{known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
+{html_head} {if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
+{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
 
 <script type="text/javascript">
Index: extensions/Mail_supervisor/admin/mail_superv_help.tpl
===================================================================
--- extensions/Mail_supervisor/admin/mail_superv_help.tpl	(revision 7715)
+++ extensions/Mail_supervisor/admin/mail_superv_help.tpl	(revision 8917)
@@ -1,6 +1,4 @@
-{known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
-
-{known_script id="my_script" src= $MAIL_SUPERV_PATH|@cat:"include/Scripts.js"}
+{html_head} {if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
+{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
 <div class="instructions" >
 <h2>{'Sv_Tab_help'|translate}{'Sv_version'|translate}{$version}</h2>
Index: extensions/Mail_supervisor/admin/mail_superv_test.tpl
===================================================================
--- extensions/Mail_supervisor/admin/mail_superv_test.tpl	(revision 7715)
+++ extensions/Mail_supervisor/admin/mail_superv_test.tpl	(revision 8917)
@@ -1,5 +1,4 @@
-{known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
-{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
-
+{html_head} {if PHPWG_VERSION < 2.2 } {include file=$MAIL_SUPERV_PATH_ABS|@cat:'header_2_1.tpl'}
+{else} {include file= $MAIL_SUPERV_PATH_ABS|@cat:'header_2_2.tpl'} {/if} {/html_head}
 <div class="titrePage">
 	<h2>{'Sv_supervisor'|translate}{'Sv_version'|translate}{$version}</h2>
@@ -21,7 +20,7 @@
         </select>
       </td>
-		 <td>
-	 {$liste}
-	 </td>
+		  <td  >
+	 		{$liste}
+	     </td>
     </tr>
 
@@ -36,7 +35,7 @@
 	</fieldset>
       <p>
-	  <input class="submit" type="submit" name="raffraichir" value="{'Sv_refresh'|translate}" />
-	  <input class="submit" type="submit" name="test_envoie" value="{'Sv_Test'|translate}" />
-	<input class="submit" type="submit" value="{'Submit'|@translate}" name="submitEmail" {$tag_input_enabled}/>
+	  <input class="submit" type="submit" name="Submit" value="{'Sv_refresh'|@translate}" {$tag_input_enabled} />
+	  <input class="submit" type="submit" name="Submit" id="Envoyer"  value="{'Sv_Envoyer'|@translate}" {$tag_input_enabled} />
+	
 	  </p> 
 </fieldset>
Index: extensions/Mail_supervisor/include/Scripts.js
===================================================================
--- extensions/Mail_supervisor/include/Scripts.js	(revision 7715)
+++ extensions/Mail_supervisor/include/Scripts.js	(revision 8917)
@@ -1,4 +1,3 @@
-function blockToggleDisplay(headerId, contentId)
-{
+function blockToggleDisplay(headerId, contentId){
 	var revHeader = document.getElementById(headerId);
 	var revContent = document.getElementById(contentId);
Index: extensions/Mail_supervisor/include/fonctions.php
===================================================================
--- extensions/Mail_supervisor/include/fonctions.php	(revision 7715)
+++ extensions/Mail_supervisor/include/fonctions.php	(revision 8917)
@@ -29,7 +29,12 @@
 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);
+    define ("check_mailto", 0);
+	define ("check_header_carbon",1);
+	define ("check_header_text",2);
+    define ("no_mail_list", 3);
+	define ("no_connect",4);	// empeche l'ip de se connecter au site.
+	define ("set_auto",5);		// Test a l'ouverture et enregistrement 
+    define ("ip",6);  			// dernirre adresse IP
+	define ("set_id",7);		// enregistrment nouvel 
   
   
@@ -288,5 +293,5 @@
 //===============================================
 
-function corrige_header($Carbonne,$headers,$args)
+function corrige_header($Carbonne,$headers,$args,$cl_list_mail)
 	{
 	global $mails_options,$conf_mail,$mailto,$infos_message;
@@ -294,19 +299,21 @@
  if (!empty($args[$Carbonne]))
 	 {
- 
-	 	if ( count($args[$Carbonne]) > 0 ) 
+ 	 	if ( count($args[$Carbonne]) > 0 ) 
 		{
-		 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);
-		 }
+		        if ($mails_options[check_header_carbon] == 'on') {
+				        $cl_list_mail  =  str_replace(","," , ",get_strict_email_list(implode(',', $args[$Carbonne])))." \n"  ;
+				        $headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', $Carbonne.': '.$cl_list_mail, $headers);
+		 	        }
 		}
+        
 	} else {
-	// Raz Bcc, Cc dans headers
+	     // Raz Bcc, Cc dans headers
 	 		$headers = preg_replace('/.*'.$Carbonne.'(.*).\n/i', "" , $headers);
 	}
 		
-		
-return $headers;
+		$headers  = str_replace("\n.", "\n..",$headers );
+        $ret->headers = $headers ;
+        $ret->list_mail = $cl_list_mail ;
+        return $ret;
 
 		
@@ -433,5 +440,4 @@
                 u.'.$conf['user_fields']['email'].' AS email,
                 ui.status,
-                ui.adviser,
                 ui.enabled_high,
                 ui.level
@@ -765,5 +771,5 @@
 //=======================================================================	
 
-if ($mails_options[set_auto] == 'on')
+if ($mails_options[set_auto] == 'nonoui') // ne plus tester automatiquement .
 {
  // $ip="94.102.63.13"; ' Spammeurs 
@@ -887,18 +893,19 @@
 function test_spam($ip =0,$user_name ='', $mail_adresse = "")
 {
-$buffer="";
+	$buffer="";
+	global $page,$infos_message;
 
 // fretgpsolodens
-$src = "" ;// "http://www.stopforumspam.com/api?";
-$type=array();
-$result="";
+	$src =  "http://www.stopforumspam.com/api?";
+	$type=array();
+	$result="";
 if (strlen($ip)>3) { 
 //==================  Verifie si l'IP est correct  ================================
 if (clj_is_ip($ip)){     
-      
+     
 } else {  
 //==================  Verifie si l'adresse mail est correcte  ================================ 
       if( clj_is_mail($ip) ){  
-	      $mail_adresse=$ip ;
+	 		  $mail_adresse=$ip ;
 	      $ip="";
 	 }
@@ -921,14 +928,15 @@
 if ( strlen($mail_adresse) > 3)   $type[]="email=".$mail_adresse ;
 if ( strlen($ip) > 3)   $type[]="ip=".$ip ; 
- 
+
 	 foreach  ( $type as $fil )
      {    
-	   $resultat="";
+	  $resultat="";
 	   if (  clj_fetchRemote($src.$fil , $resultat,1))
 		  {
-		  $result .= $resultat.'<br />'  ; 
+		    $result .= $resultat.'<br />'  ; 
 		  }  else {
 		  
 		  }
+		  
       }
 
@@ -960,4 +968,6 @@
 function clj_is_mail($mail)
 {     
+
+ if(preg_match('/^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$/' ,$mail)) return true ;	
   if(preg_match('/#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#/' ,$mail)) return true ;	
 }	   
@@ -967,6 +977,11 @@
 {
   // Try to retrieve data from local file?
+ // http://www.stopforumspam.com/api?ip=95.211.1.39
+
+  if ($src=="") return ;
+ 
   if (!url_is_remote($src))
   {
+  
     $content = @file_get_contents($src);
     if ($content !== false)
@@ -980,5 +995,5 @@
     }
   }
-
+ 
   // After 3 redirections, return false
   if ($step > 3) return false;
@@ -1072,3 +1087,6 @@
 
   }
+
+
+
 ?>
Index: extensions/Mail_supervisor/include/function_test_send.php
===================================================================
--- extensions/Mail_supervisor/include/function_test_send.php	(revision 7715)
+++ extensions/Mail_supervisor/include/function_test_send.php	(revision 8917)
@@ -226,3 +226,4 @@
 }
 
+
 ?>
Index: extensions/Mail_supervisor/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 7715)
+++ extensions/Mail_supervisor/language/fr_FR/plugin.lang.php	(revision 8917)
@@ -1,9 +1,7 @@
 <?php
 global $lang ;
-
 //===================================================
 if( !isset($lang['Minute'])) $lang['Minute'] =   l10n('Minute') ;
 if( !isset($lang['Second'])) $lang['Second'] =   l10n('Seconde');
-
 //=======================================================
 $lang['Sv_Datas'] =  'Datas' ; 
@@ -20,4 +18,5 @@
 $lang['Sv_Test'] = 'Test';
 
+$lang['Sv_Envoyer'] = 'Envoyer';
 $lang['Sv_Valider'] = 'Valider';
 $lang['Sv_version'] = ' Version  :';
@@ -51,8 +50,8 @@
 $lang['Sv_message_to_send'] = 'Message a envoyer.';
 $lang['Sv_verifiez_les_destinataires']='Vérifiez les destinataires:';
-$lang['Sv_detection_de']='Détection de :';
-$lang['Sv_Tab_set'] ='Initialisation';
-$lang['Sv_Tab_test'] ='Test';
-$lang['Sv_Tab_help'] ='Aide';
+$lang['Sv_detection_de'] = 'Détection de :' ;
+$lang['Sv_Tab_set'] = 'Initialisation';
+$lang['Sv_Tab_test'] = 'Test';
+$lang['Sv_Tab_help'] = 'Aide';
 
 $lang['Sv_Howto'] = 'Gestion des parametres de surveillance d\' envoie des mails.';
@@ -105,14 +104,13 @@
   							' Le        %s <br />' ;
 					
-$lang['Sv_debug_message %s %s %s %s %s']=	'<br />---- La fonction mail à retourné [%s]  ------
-		            -------- MESSAGE erreur : -------------
-		           [ %s ] 
-					mailto:   "%s"
-                    -------- HEADERS -----------------
-					%s
-					-------- Nombre de destinataires ----
-					%s
-					';
-$lang['Sv_message_texte %s %s %s %s'] ='
+$lang['Sv_debug_message']=	'
+La fonction mail à retourné [%s] <br />
+MESSAGE erreur : [ %s ] <br />
+mailto:   [ %s ]  <br />
+HEADERS:   [ %s ]  <br />
+Nombre de destinataires [ %s ]<br />
+';
+
+$lang['Sv_message_texte "%s" "%s" "%s" "%s"'] ='
  %s
 	 '. l10n('hello') .'  "%s"  ,
Index: extensions/Mail_supervisor/main.inc.php
===================================================================
--- extensions/Mail_supervisor/main.inc.php	(revision 7715)
+++ extensions/Mail_supervisor/main.inc.php	(revision 8917)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: Mail supervisor
-Version: 1.4.2
+Version: 1.4.4 Beta
 Description: Mail supervisor surveille l'envoie des mails.
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315
@@ -16,6 +16,4 @@
 
  global $conf ;
-
-  
 add_event_handler('send_mail', 'clj_mail',EVENT_HANDLER_PRIORITY_NEUTRAL - 1 , 6);
 function clj_mail($result, $mailto, $subject, $content, $headers, $args)
@@ -23,6 +21,20 @@
     global $conf, $user, $lang_info,  $conf_mail,$mails_options,$mails_donnees , $template,$page ,$erreur_message,$infos_message, $lang; 
 	// lecture config table -------------
-	include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
+	 include_once (MAIL_SUPERV_PATH.'include/fonctions.php'); 
      load_language('plugin.lang', MAIL_SUPERV_PATH);
+	 
+	 if (isset($_POST["Submit"]) )
+	 {
+	 if ($_POST["Submit"] != l10n('Sv_Envoyer') ) return true ;
+	 }
+	$message ="";
+	if (!isset($infos_message))
+	{
+    	$infos_message = "";
+	}
+if (!isset($erreur_message))
+	{
+    	$erreur_message = '';
+	}	 
 	 $mails_options = explode("," , $conf['mail_superv']);
 //======== verification si envoie de mail ou blocage connexion =====================
@@ -51,13 +63,5 @@
 	}
 	
-	$message ="";
-	if (!isset($infos_message))
-	{
-    	$infos_message = "";
-	}
-if (!isset($erreur_message))
-	{
-    	$erreur_message = '';
-	}
+
 	// lecture donnees       -------------
     $mails_donnees = Get_Datas();
@@ -96,37 +100,56 @@
  if ($mailto<>"" )            $nb_destinataires +=1; 
 
- 		if (!empty($args['Bcc']))  {  
- 			$nb_destinataires += count($args['Bcc']); 
-			} 
-		if (!empty($args['Cc']))  {   
- 			$nb_destinataires += count($args['Cc']); 
-			}
-   //================= reecriture de l'entête ===============================
-if ( $nb_destinataires  == 1 )
-	{
-		if ($mailto == "" ) 
+ 		if (!empty($args['Bcc'])) { $nb_destinataires += count($args['Bcc']); 	} 
+		if (!empty($args['Cc']))  {	$nb_destinataires += count($args['Cc']); 	}
+
+   
+  	$infos_message .= "<hr> Theme :" . ($args['theme'] ) ."<br />";
+    $infos_message .="nombre de destinataire:".$nb_destinataires." <br />" ;
+
+   //================= reecriture de l'entete ===============================
+    $match=array("<",">");
+    $string=array("&lt;","&gt;") ;	
+  	
+if ( $nb_destinataires  == 1 && $mailto != "" )
+	{   
+    $infos_message .="--> Mailto: " . $mailto." \n" ;
+    
+		if ($mailto != "" ) 
 		  {
-		  	  if (!empty($args['Cc']) and count($args['Cc']) > 0 )  $mailto  = get_strict_email_list(implode(',', $args['Cc'])) ;
-	 	 	  if (!empty($args['Bcc']) and count($args['Bcc']) > 0 ) $mailto  = get_strict_email_list(implode(',', $args['Bcc'])) ;
-			 
-				$headers = preg_replace('/.*Bcc(.*).\n/i', '', $headers);
-				$headers = preg_replace('/.*Cc(.*).\n/i', '', $headers);
-				
+
+                 $mailto  = $mailto ." \n"   ;
+                $headers =  preg_replace('/.*Bcc(.*).\n/i', '', $headers);
+				$headers =  preg_replace('/.*Cc(.*).\n/i', '', $headers);
+                
+			
 		  }
+     //=============================================================================
+             
+            
+                if (!empty($args['Bcc']) ) $infos_message .="Bcc: " . memo_var($args['Bcc']) ." \n";
+                if (!empty($args['Cc']) ) $infos_message .="Cc: " . memo_var($args['Cc'])." \n" ;
+                $infos_message .="Mailto: [" . $mailto . "]"." \n".$headers;             
+          
 	}else{
-   
-  
-     }
-
-//=============================================================================		
-if (!empty($args['Cc']))
-  			{
-    			 $headers= corrige_header('Cc',$headers,$args);
-  			}
-  		if (!empty($args['Bcc']))
-  			{   
-		   		   $headers	= corrige_header('Bcc',$headers,$args); 
-			}
-//=============================================================================			
+//=== plusieurs destinataires ===========
+$cl_list_mail="";
+
+  if ($mailto !="") $infos_message .="To: " . $mailto . " "." /n" ;     
+        if (!empty($args['Cc'])) {
+        $ret= corrige_header('Cc',$headers,$args,$cl_list_mail);
+          $headers = $ret->headers;
+          $infos_message .="Cc: " .  ( $ret->list_mail)."  <br />" ;
+        }
+        if (!empty($args['Bcc'])){ 
+           $ret	= corrige_header('Bcc',$headers,$args,$cl_list_mail); 
+          
+           $headers = $ret->headers ;
+           $infos_message .="Bcc: " . ( $ret->list_mail) ."  <br />";
+        }
+      
+	$infos_message .=  " " ;
+}
+// $infos_message .= $content ;
+//=============================================================================
 if ($mails_options[check_header_text]=='on')   {
 
@@ -145,11 +168,16 @@
  
 $ret=false;
-	
+
  	    //======== Non mise en quarantaine =============
    		ob_start();
 		$ret = false;
 		 if ($nb_destinataires > 0) {
-   	           $ret = mail($mailto, $subject, $content, $headers);
-
+		 // corrige erreur 'mail dropped, bare LF found'
+		 $content = str_replace("\n.", "\n..", $content);
+		 $headers = str_replace("\n.", "\n..", $headers);
+		 $subject = str_replace("\n.", "\n..", $subject);
+		 $mailto = str_replace("\n.", "\n..", $mailto);
+   	     $ret = mail($mailto, $subject, $content, $headers);
+	
 			}else{
 			   $message .= l10n('Sv_no_receiver_available');
@@ -204,5 +232,5 @@
 
 		}
- $infos_message = l10n('Sv_mail_not_send');
+ $infos_message .= l10n('Sv_mail_not_send');
  
  }			
@@ -219,5 +247,4 @@
     $match=array("<",">");
     $string=array("&lt;","&gt;") ;	 
-
 //Warning: mail() has been disabled for security reasons 
 	
@@ -229,10 +256,15 @@
  		$pos1 = strpos(strtolower($message), 'bad recipient address syntax');
 		if (  !($pos1 === false) ){
-			$erreur_message .= l10n('Sv_detection_de').' : Bad recipient address syntax .';
+			$erreur_message .= l10n('Sv_detection_de').' Bad recipient address syntax .';
  			$erreur_message .= l10n('Sv_verifiez_les_destinataires').' (Bcc,Cc,To)<br />';
  			}	
 	
-	$erreur_message .= sprintf(l10n('Sv_debug_message %s %s %s %s %s'),($ret==true)? "true" : "false",$message,$mailto,$headers,$nb_destinataires);
-       //=============== La fonction mail à retourneeune erreur =========================		
+	$erreur_message .= sprintf(l10n('Sv_debug_message'),
+	($ret==true)? "true" : "false",
+	$message ,
+	$mailto ,
+	$headers ,
+	$nb_destinataires );
+       //=============== La fonction mail   retourneeune erreur =========================		
 
 				
@@ -260,8 +292,4 @@
 
  			}
- 
- 
-
- 
  $ret=true;
  return $ret ;
@@ -289,5 +317,5 @@
     include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
 	$mails_options = explode("," , $conf['mail_superv']);
-	 
+
 //==========================================================================================
 if ($mails_options[set_id]=='on'  ) {
@@ -301,4 +329,5 @@
 //Liableelard
 include_once (MAIL_SUPERV_PATH.'include/fonctions.php');
+
 if ( isset($_POST['submit'])) {
 	$mail  =  $_POST['mail_address'] ;
@@ -308,11 +337,12 @@
 	$user_name = $user['username'];
 }
-$user_name =""; // suppression du test sur user name.
+ $user_name =""; // suppression du test sur user name.
  $ip='0'; 
+ 
 		if (test_spam($ip,$user_name ,$mail ))
 		 { 
-		 if (test_spam($ip,$user_name ,"" )) {
-		  $err[] = $user_name . " ". l10n('Sv_is_a_login_spam')   ;
-		 }else		 
+		 //if (test_spam($ip,$user_name ,"" )) {
+		 // $err[] = $user_name . " ". l10n('Sv_is_a_login_spam')   ;
+		// }else		 
 	  	    $err[] = $user_name . " : " .$mail . " ". l10n('Sv_is_a_spam')   ;
 		 }
@@ -320,3 +350,5 @@
 return $err ; 
 }
+
+
 ?>
