Index: /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php	(revision 3840)
+++ /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php	(revision 3841)
@@ -22,5 +22,5 @@
 // +-----------------------------------------------------------------------+
 if (!isset($_GET['tab']))
-  $page['tab'] = 'global';
+	$page['tab'] = 'global';
 else
   $page['tab'] = $_GET['tab'];
@@ -33,4 +33,5 @@
                l10n('Tab_ConfirmMail'),
                $my_base_url.'&amp;tab=confirmmail');
+/* For futur options */
 //$tabsheet->add('Misc_Options',
 //               l10n('Tab_Misc_Options'),
@@ -53,23 +54,23 @@
   case 'global':
 	
-  if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) )
+	if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) )
   {
-    $_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
-	$_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
-		
-	$newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'];
-		
-	$conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
-		
-	$query = '
-	  UPDATE '.CONFIG_TABLE.'
-	  SET value="'.$newconf_nbc_UserAdvManager.'"
-	  WHERE param="nbc_UserAdvManager"
-	  LIMIT 1
-	  ;';
-		
-	pwg_query($query);
-		
-	array_push($page['infos'], l10n('UserAdvManager_save_config'));
+		$_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
+		$_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
+		
+		$newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'];
+		
+		$conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
+		
+		$query = '
+	  	UPDATE '.CONFIG_TABLE.'
+	  	SET value="'.$newconf_nbc_UserAdvManager.'"
+	  	WHERE param="nbc_UserAdvManager"
+	  	LIMIT 1
+	  	;';
+		
+		pwg_query($query);
+		
+		array_push($page['infos'], l10n('UserAdvManager_save_config'));
   }
 	
@@ -84,7 +85,7 @@
   $query = '
     SELECT id, name
-	FROM '.GROUPS_TABLE.'
-	ORDER BY name ASC
-	;';
+		FROM '.GROUPS_TABLE.'
+		ORDER BY name ASC
+		;';
 	
   $result = pwg_query($query);
@@ -96,11 +97,11 @@
     if (isset($conf_nbc_UserAdvManager[3]) and $conf_nbc_UserAdvManager[3] == $row['id'])
     {
-	  $No_Valid = $row['id'];
-	}
+	  	$No_Valid = $row['id'];
+		}
 /* configuration value for validated users */
     if (isset($conf_nbc_UserAdvManager[4]) and $conf_nbc_UserAdvManager[4] == $row['id'])
-	{
-	  $Valid = $row['id'];
-	}
+		{
+	  	$Valid = $row['id'];
+		}
   }
 	
@@ -108,17 +109,17 @@
   $template->assign(
     'No_Confirm_Group',
-    array(
-	  'group_options'=> $groups,
-	  'group_selected' => $No_Valid
-	)
-  );
+   	array(
+	  	'group_options'=> $groups,
+	  	'group_selected' => $No_Valid
+			)
+ 		);
 /* Template initialization for validated users group */
   $template->assign(
     'Validated_Group',
-	array(
+		array(
       'group_options'=> $groups,
       'group_selected' => $Valid
-	)
-  );
+			)
+  	);
 	
 /* Status setting for unvalidated and validated users */
@@ -129,5 +130,5 @@
 /* Get status values */
   foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
-    {
+  {
 	  $status_options[$status] = l10n('user_status_'.$status);
 	  if (isset($conf_nbc_UserAdvManager[9]) and $conf_nbc_UserAdvManager[9] == $status)
@@ -139,15 +140,15 @@
         'No_Confirm_Status',
         array(
-		  'Status_options' => $status_options,
-		  'Status_selected' => $No_Valid_Status
-		)
-	  );
-    }
+					'Status_options' => $status_options,
+		  		'Status_selected' => $No_Valid_Status
+					)
+	  		);
+  }
 /* Get status values */
   foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
-    {
+  {
 	  $status_options[$status] = l10n('user_status_'.$status);
 	  if (isset($conf_nbc_UserAdvManager[5]) and $conf_nbc_UserAdvManager[5] == $status)
-	    {
+		{
 		  $Valid_Status = $status;
 		}
@@ -156,9 +157,9 @@
 	    'Confirm_Status',
 	    array(
-		  'Status_options' => $status_options,
-		  'Status_selected' => $Valid_Status
-		)
-	  );
-    }
+		    'Status_options' => $status_options,
+		    'Status_selected' => $Valid_Status
+		    )
+	    );
+	}
 	
   $template->assign(
@@ -189,19 +190,19 @@
 
   if ( isset($_POST['audit']) or isset($_POST['submit']) )
-    {
-	  $msg_error1 = '';
+  {
+		$msg_error1 = '';
 		
 /* username insensible a la casse */
-      if (isset($conf_nbc_UserAdvManager[3]) and $conf_nbc_UserAdvManager[3] == 'true')
-	    {
-		  $query = "
-		    SELECT ".$conf['user_fields']['username']."
-			FROM ".USERS_TABLE." p1
-			WHERE EXISTS(
-			SELECT ".$conf['user_fields']['username']."
-			FROM ".USERS_TABLE." p2
-			WHERE p1.".$conf['user_fields']['id']." <> p2.".$conf['user_fields']['id']."
-			AND LOWER(p1.".$conf['user_fields']['username'].") = LOWER(p2.".$conf['user_fields']['username'].")
-			)
+    if (isset($conf_nbc_UserAdvManager[3]) and $conf_nbc_UserAdvManager[3] == 'true')
+	  {
+			$query = "
+		  	SELECT ".$conf['user_fields']['username']."
+				FROM ".USERS_TABLE." p1
+				WHERE EXISTS(
+				SELECT ".$conf['user_fields']['username']."
+				FROM ".USERS_TABLE." p2
+				WHERE p1.".$conf['user_fields']['id']." <> p2.".$conf['user_fields']['id']."
+				AND LOWER(p1.".$conf['user_fields']['username'].") = LOWER(p2.".$conf['user_fields']['username'].")
+				)
 			;";
 			  
@@ -209,69 +210,69 @@
 			
 		  while($row = mysql_fetch_array($result))
-		    {
-			  $msg_error1 .= (($msg_error1 <> '') ? '<br/>' : '') . l10n('Err_audit_no_casse').$row['username'];
+	  	{
+				$msg_error1 .= (($msg_error1 <> '') ? '<br/>' : '') . l10n('Err_audit_no_casse').$row['username'];
 			}
 		}
 
-      $msg_error2 = '';
+		$msg_error2 = '';
 		
 /* Username without forbidden keys */
       if ( isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' )
 	    {
-		  $query = "
-		    SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']."
-			FROM ".USERS_TABLE."
-			;";
+		  	$query = "
+		    	SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']."
+					FROM ".USERS_TABLE."
+				;";
 			  
-		  $result = pwg_query($query);
+			  $result = pwg_query($query);
 			
-		  while($row = mysql_fetch_array($result))
-		    {
-			  if ( !ValidateUsername($row['username']) )
-			    $msg_error2 .= (($msg_error2 <> '') ? '<br/>' : '') . l10n('Err_audit_username_char').$row['username'];
+			  while($row = mysql_fetch_array($result))
+			  {
+					if (!ValidateUsername($row['username']))
+				    $msg_error2 .= (($msg_error2 <> '') ? '<br/>' : '') . l10n('Err_audit_username_char').$row['username'];
+				}
 			}
-		}
-
-      $msg_error3 = '';
+
+		$msg_error3 = '';
 		
 /* Email without forbidden domain */
       if ( isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' )
 	    {
-		  $query = "
-		    SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']."
-			FROM ".USERS_TABLE."
-			;";
+		  	$query = "
+		    	SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']."
+					FROM ".USERS_TABLE."
+				;";
 			  
-		  $result = pwg_query($query);
+		  	$result = pwg_query($query);
 			
-		  while($row = mysql_fetch_array($result))
+		  	while($row = mysql_fetch_array($result))
 		    {
-			  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
-			  $conf_nbc_MailExclusion = preg_split('/,/',$conf_nbc_UserAdvManager[13]);
-			  for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
+			  	$conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+			  	$conf_nbc_MailExclusion = preg_split('/,/',$conf_nbc_UserAdvManager[13]);
+			  	for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
 			    {
-	    		  $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
-				  if (preg_match($pattern, $row['mail_address']))
+						$pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
+				  	if (preg_match($pattern, $row['mail_address']))
 				    {
-					  $msg_error3 .=  (($msg_error3 <> '') ? '<br/>' : '') . l10n('Err_audit_email_forbidden').$row['username'].' ('.$row['mail_address'].')';
+					  	$msg_error3 .=  (($msg_error3 <> '') ? '<br/>' : '') . l10n('Err_audit_email_forbidden').$row['username'].' ('.$row['mail_address'].')';
+						}
 					}
 				}
 			}
-		}
 		
       if ($msg_error1 <> '')
-	    $errors[] = $msg_error1.'<br/><br/>';
+		    $errors[] = $msg_error1.'<br/><br/>';
 		
       if ($msg_error2 <> '')
-	    $errors[] = $msg_error2.'<br/><br/>';
-		
-	  if ($msg_error3 <> '')
-	    $errors[] = $msg_error3.'<br/><br/>';
-		
-	  if ($msg_error1 <> '' or $msg_error2 <> '' or $msg_error3 <> '')
-	    array_push($page['errors'], l10n('Err_audit_advise'));
-	  else
+		    $errors[] = $msg_error2.'<br/><br/>';
+		
+	  	if ($msg_error3 <> '')
+	    	$errors[] = $msg_error3.'<br/><br/>';
+		
+	  	if ($msg_error1 <> '' or $msg_error2 <> '' or $msg_error3 <> '')
+	    	array_push($page['errors'], l10n('Err_audit_advise'));
+	  	else
         array_push($page['infos'], l10n('UserAdvManager_audit_ok'));
-    }
+	}
 
 
@@ -280,8 +281,8 @@
 // +-----------------------------------------------------------------------+
   if ( isset ($errors) and count($errors) != 0)
-    {
+  {
 	  $template->assign('errors',array());
 	  foreach ($errors as $error)
-	    {
+	  {
 		  array_push($page['errors'], $error);
 		}
@@ -304,381 +305,469 @@
 	
   if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2]=='true' )
-    {
-      if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_ConfirmMail_TimeOut']) )
-	    {		
-		  $newconf_nbc_UserAdvManager_ConfirmMail = $_POST['UserAdvManager_ConfirmMail_TimeOut'].';'.$_POST['UserAdvManager_ConfirmMail_Delay'];
-	//NODO:Adding new option [Auto deletion : True | False] - No access to cron functionnalities
-	//TODO:Adding new option [Resend_new_validation_key : True | False]
-		  $conf['nbc_UserAdvManager_ConfirmMail'] = $newconf_nbc_UserAdvManager_ConfirmMail;
-		
-		  $query = '
-		    UPDATE '.CONFIG_TABLE.'
-		  	SET value="'.$newconf_nbc_UserAdvManager_ConfirmMail.'"
-		  	WHERE param="nbc_UserAdvManager_ConfirmMail"
-		  	LIMIT 1
-		  	;';
-		
-		  pwg_query($query);
-		
-		  array_push($page['infos'], l10n('UserAdvManager_save_config'));
-		}
-	
-      $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
-
-      function get_unvalid_user_list()
-        {
-          global $conf, $page;
+  {
+    if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_ConfirmMail_TimeOut']) )
+		{
+	  	$_POST['UserAdvManager_ConfirmMail_ReMail_Txt'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_ReMail_Txt']));
+   		  
+	  	$newconf_nbc_UserAdvManager_ConfirmMail = $_POST['UserAdvManager_ConfirmMail_TimeOut'].';'.$_POST['UserAdvManager_ConfirmMail_Delay'].';'.$_POST['UserAdvManager_ConfirmMail_ReMail_Txt'];
+		  
+//NODO:Adding new option [Auto deletion : True | False] - No access to cron functionnalities
+
+	  	$conf['nbc_UserAdvManager_ConfirmMail'] = $newconf_nbc_UserAdvManager_ConfirmMail;
+		
+	  	$query = '
+	    	UPDATE '.CONFIG_TABLE.'
+				SET value="'.$newconf_nbc_UserAdvManager_ConfirmMail.'"
+				WHERE param="nbc_UserAdvManager_ConfirmMail"
+				LIMIT 1
+			;';
+		
+			pwg_query($query);
+		
+			array_push($page['infos'], l10n('UserAdvManager_save_config'));
+		}
+	
+		$conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
+
+// +-----------------------------------------------------------------------+
+// |                           initialization                              |
+// +-----------------------------------------------------------------------+
+
+	if (!defined('PHPWG_ROOT_PATH'))
+    {
+    	die('Hacking attempt!');
+    }
           
-		/* Get ConfirmMail configuration */
-          $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
+    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+	check_status(ACCESS_ADMINISTRATOR);
+
+    $page['order_by_items'] = array(
+      'id' => l10n('registration_date'),
+      'username' => l10n('Username'),
+      'level' => l10n('Privacy level'),
+      'language' => l10n('language'),
+    );
+
+// +-----------------------------------------------------------------------+
+// |                               user list                               |
+// +-----------------------------------------------------------------------+
+
+	$page['filtered_users'] = get_unvalid_user_list();
+
+// +-----------------------------------------------------------------------+
+// |                            selected users                             |
+// +-----------------------------------------------------------------------+
+	if (isset($_POST['Del_Selected']))
+	{
+  	$collection = array();
+
+		switch ($_POST['target'])
+    {
+    	case 'all' :
+      {
+      	foreach($page['filtered_users'] as $local_user)
+        {
+        	array_push($collection, $local_user['id']);
+        }
+        break;
+			}
+      case 'selection' :
+      {
+      	if (isset($_POST['selection']))
+        {
+        	$collection = $_POST['selection'];
+        }
+        break;
+      }
+		}
+
+    if (count($collection) == 0)
+    {
+    	array_push($page['errors'], l10n('Select at least one user'));
+    }
+	}
+
+// +-----------------------------------------------------------------------+
+// |                             delete users                              |
+// +-----------------------------------------------------------------------+
+	if (isset($_POST['Del_Selected']) and count($collection) > 0)
+    {
+      if (in_array($conf['guest_id'], $collection))
+   	  {
+        array_push($page['errors'], l10n('Guest cannot be deleted'));
+      }
+      if (($conf['guest_id'] != $conf['default_user_id']) and
+        in_array($conf['default_user_id'], $collection))
+      {
+        array_push($page['errors'], l10n('Default user cannot be deleted'));
+      }
+      if (in_array($conf['webmaster_id'], $collection))
+      {
+        array_push($page['errors'], l10n('Webmaster cannot be deleted'));
+      }
+      if (in_array($user['id'], $collection))
+      {
+        array_push($page['errors'], l10n('You cannot delete your account'));
+      }
+
+      if (count($page['errors']) == 0)
+      {
+        foreach ($collection as $user_id)
+        {
+          delete_user($user_id);
+        }
+        array_push(
+          $page['infos'],
+          l10n_dec(
+          '%d user deleted', '%d users deleted',
+          count($collection)
+          )
+        );
+
+        foreach ($page['filtered_users'] as $filter_key => $filter_user)
+        {
+       	  if (in_array($filter_user['id'], $collection))
+          {
+            unset($page['filtered_users'][$filter_key]);
+          }
+        }
+      }
+	}
+
+// +-----------------------------------------------------------------------+
+// |                            selected users                             |
+// +-----------------------------------------------------------------------+
+	if (isset($_POST['Mail_With_Key']))
+	{
+  	$collection = array();
+
+		switch ($_POST['target'])
+    {
+    	case 'all' :
+      {
+      	foreach($page['filtered_users'] as $local_user)
+        {
+        	array_push($collection, $local_user['id']);
+        }
+        break;
+			}
+      case 'selection' :
+      {
+      	if (isset($_POST['selection']))
+        {
+        	$collection = $_POST['selection'];
+        }
+        break;
+      }
+		}
+
+    if (count($collection) == 0)
+    {
+    	array_push($page['errors'], l10n('Select at least one user'));
+    }
+	}
+// +-----------------------------------------------------------------------+
+// |                 Resend new validation key to users                    |
+// +-----------------------------------------------------------------------+
+	if (isset($_POST['Mail_With_Key']) and count($collection) > 0)
+	{
+		if (in_array($conf['guest_id'], $collection))
+   	{
+    	array_push($page['errors'], l10n('No_validation_for_Guest'));
+    }
+    if (($conf['guest_id'] != $conf['default_user_id']) and
+    	in_array($conf['default_user_id'], $collection))
+    {
+    	array_push($page['errors'], l10n('No_validation_for_default_user'));
+    }
+   	if (in_array($conf['webmaster_id'], $collection))
+    {
+    	array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+    }
+    if (in_array($user['id'], $collection))
+    {
+    	array_push($page['errors'], l10n('No_validation_for_your_account'));
+    }
+
+    if (count($page['errors']) == 0)
+    {
+    	foreach ($collection as $user_id)
+      {     	
+      	$typemail = 1;
+				    $query = "
+							SELECT id, username, mail_address
+							FROM ".USERS_TABLE."
+							WHERE id = '".$user_id."'
+						;";
+				$data = mysql_fetch_array(pwg_query($query));
+				
+      	ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],true);
+      }
+      array_push(
+      	$page['infos'],
+        l10n_dec(
+        '%d_Mail_With_Key', '%d_Mails_With_Key',
+        count($collection)
+        )
+      );
+
+      foreach ($page['filtered_users'] as $filter_key => $filter_user)
+      {
+      	if (in_array($filter_user['id'], $collection))
+        {
+        	unset($page['filtered_users'][$filter_key]);
+        }
+			}
+		}
+	}
+
+// +-----------------------------------------------------------------------+
+// |                            selected users                             |
+// +-----------------------------------------------------------------------+
+	if (isset($_POST['Mail_Without_Key']))
+	{
+  	$collection = array();
+
+		switch ($_POST['target'])
+    {
+    	case 'all' :
+      {
+      	foreach($page['filtered_users'] as $local_user)
+        {
+        	array_push($collection, $local_user['id']);
+        }
+        break;
+			}
+      case 'selection' :
+      {
+      	if (isset($_POST['selection']))
+        {
+        	$collection = $_POST['selection'];
+        }
+        break;
+      }
+		}
+
+    if (count($collection) == 0)
+    {
+    	array_push($page['errors'], l10n('Select at least one user'));
+    }
+	}
+// +-----------------------------------------------------------------------+
+// |             Send reminder without new key to users                    |
+// +-----------------------------------------------------------------------+
+	if (isset($_POST['Mail_Without_Key']) and count($collection) > 0)
+	{
+		if (in_array($conf['guest_id'], $collection))
+   	{
+    	array_push($page['errors'], l10n('No_validation_for_Guest'));
+    }
+    if (($conf['guest_id'] != $conf['default_user_id']) and
+    	in_array($conf['default_user_id'], $collection))
+    {
+    	array_push($page['errors'], l10n('No_validation_for_default_user'));
+    }
+   	if (in_array($conf['webmaster_id'], $collection))
+    {
+    	array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+    }
+    if (in_array($user['id'], $collection))
+    {
+    	array_push($page['errors'], l10n('No_validation_for_your_account'));
+    }
+
+    if (count($page['errors']) == 0)
+    {
+    	foreach ($collection as $user_id)
+      {
+      	$typemail = 2;
+				    $query = "
+							SELECT id, username, mail_address
+							FROM ".USERS_TABLE."
+							WHERE id = '".$user_id."'
+						;";
+				$data = mysql_fetch_array(pwg_query($query));
+				
+      	ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],false);				
+      }
+      array_push(
+      	$page['infos'],
+        l10n_dec(
+        '%d_Reminder_Sent', '%d_Reminders_Sent',
+        count($collection)
+        )
+      );
+
+      foreach ($page['filtered_users'] as $filter_key => $filter_user)
+      {
+      	if (in_array($filter_user['id'], $collection))
+        {
+        	unset($page['filtered_users'][$filter_key]);
+        }
+			}
+		}
+	}
+
+// +-----------------------------------------------------------------------+
+// |                              groups list                              |
+// +-----------------------------------------------------------------------+
+
+	$groups[-1] = '------------';
+
+    $query = '
+      SELECT id, name
+      FROM '.GROUPS_TABLE.'
+      ORDER BY name ASC
+      ;';
+
+	$result = pwg_query($query);
           
-		/* Get UserAdvManager configuration */
-		  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();  
-  
-          $users = array();
-    
-/* search users depending expiration date */
-          $query = '
-            SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
-                            u.'.$conf['user_fields']['username'].' AS username,
-                            u.'.$conf['user_fields']['email'].' AS email,
-                            ui.status,
-                            ui.adviser,
-                            ui.enabled_high,
-                            ui.level,
-                            ui.registration_date,
-                            ug.group_id
-            FROM '.USERS_TABLE.' AS u
-            	INNER JOIN '.USER_INFOS_TABLE.' AS ui
-              		ON u.'.$conf['user_fields']['id'].' = ui.user_id
-            	INNER JOIN '.USER_GROUP_TABLE.' AS ug
-              		ON u.'.$conf['user_fields']['id'].' = ug.user_id
-            	WHERE u.'.$conf['user_fields']['id'].' >= 0
-           			AND ug.group_id = "'.$conf_nbc_UserAdvManager[3].'"
-            		AND TO_DAYS(NOW()) - TO_DAYS(ui.registration_date) >= "'.$conf_nbc_UserAdvManager_ConfirmMail[1].'"
-           		ORDER BY id ASC
-          ;';
-
-          $result = pwg_query($query);
-      
-          while ($row = mysql_fetch_array($result))
-            {
-              $user = $row;
-              $user['groups'] = array();
-
-              array_push($users, $user);
-            }
-
-/* add group lists */
-          $user_ids = array();
-          foreach ($users as $i => $user)
-            {
-              $user_ids[$i] = $user['id'];
-            }
-          $user_nums = array_flip($user_ids);
-
-          if (count($user_ids) > 0)
-            {
-              $query = '
-                SELECT user_id, group_id
-                FROM '.USER_GROUP_TABLE.'
-                WHERE user_id IN ('.implode(',', $user_ids).')
-              ;';
-        
-              $result = pwg_query($query);
-        
-    		  while ($row = mysql_fetch_array($result))
-                {
-                  array_push(
-                    $users[$user_nums[$row['user_id']]]['groups'],
-                    $row['group_id']
-                  );
-                }
-              }
-
-          return $users;
-        }
-
-// +-----------------------------------------------------------------------+
-// |                           initialization                              |
-// +-----------------------------------------------------------------------+
-
-        if (!defined('PHPWG_ROOT_PATH'))
-          {
-            die('Hacking attempt!');
-          }
-          
-        include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-
-// +-----------------------------------------------------------------------+
-// | Check Access and exit when user status is not ok                      |
-// +-----------------------------------------------------------------------+
-        check_status(ACCESS_ADMINISTRATOR);
-
-        $page['order_by_items'] = array(
-          'id' => l10n('registration_date'),
-          'username' => l10n('Username'),
-          'level' => l10n('Privacy level'),
-          'language' => l10n('language'),
+    while ($row = mysql_fetch_array($result))
+    {
+      $groups[$row['id']] = $row['name'];
+    }
+
+// +-----------------------------------------------------------------------+
+// |                           Template Init                               |
+// +-----------------------------------------------------------------------+
+	$base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list';
+
+    if (isset($_GET['start']) and is_numeric($_GET['start']))
+    {
+      $start = $_GET['start'];
+    }
+    else
+    {
+      $start = 0;
+    }
+
+    $template->assign(
+      array(
+        'F_ADD_ACTION' => $base_url,
+        'F_USERNAME' => @htmlentities($_GET['username']),
+        'F_FILTER_ACTION' => get_root_url().'admin.php'
+        )
+   	  );
+
+/* Hide radio-button if not allow to assign adviser */
+	if ($conf['allow_adviser'])
+    {
+      $template->assign('adviser', true);
+    }
+	
+// +-----------------------------------------------------------------------+
+// |                               user list                               |
+// +-----------------------------------------------------------------------+
+
+	$profile_url = get_root_url().'admin.php?page=profile&amp;user_id=';
+    $perm_url = get_root_url().'admin.php?page=user_perm&amp;user_id=';
+
+    $visible_user_list = array();
+    foreach ($page['filtered_users'] as $num => $local_user)
+    {
+/* simulate LIMIT $start, $conf['users_page'] */
+      if ($num < $start)
+      {
+        continue;
+      }
+      if ($num >= $start + $conf['users_page'])
+      {
+        break;
+      }
+
+      $visible_user_list[] = $local_user;
+	}
+
+	foreach ($visible_user_list as $local_user)
+    {
+      $groups_string = preg_replace(
+      	'/(\d+)/e',
+        "\$groups['$1']",
+        implode(
+        	', ',
+            $local_user['groups']
+         )
         );
 
-// +-----------------------------------------------------------------------+
-// |                               user list                               |
-// +-----------------------------------------------------------------------+
-
-            $page['filtered_users'] = get_unvalid_user_list();
-
-// +-----------------------------------------------------------------------+
-// |                            selected users                             |
-// +-----------------------------------------------------------------------+
-//TODO:Link deletion to all users selected or single user
-        if (isset($_POST['delete']))
-          {
-            $collection = array();
-  
-            switch ($_POST['target'])
-              {
-                case 'all' :
-                  {
-                    foreach($page['filtered_users'] as $local_user)
-                      {
-                        array_push($collection, $local_user['id']);
-                      }
-                    break;
-                  }
-                case 'selection' :
-                  {
-                    if (isset($_POST['selection']))
-                      {
-                        $collection = $_POST['selection'];
-                      }
-                    break;
-                  }
-              }
-
-            if (count($collection) == 0)
-              {
-                array_push($page['errors'], l10n('Select at least one user'));
-              }
-          }
-
-// +-----------------------------------------------------------------------+
-// |                             delete users                              |
-// +-----------------------------------------------------------------------+
-        if (isset($_POST['delete']) and count($collection) > 0)
-          {
-            if (in_array($conf['guest_id'], $collection))
-              {
-                array_push($page['errors'], l10n('Guest cannot be deleted'));
-              }
-            if (($conf['guest_id'] != $conf['default_user_id']) and
-            in_array($conf['default_user_id'], $collection))
-              {
-                array_push($page['errors'], l10n('Default user cannot be deleted'));
-              }
-            if (in_array($conf['webmaster_id'], $collection))
-              {
-                array_push($page['errors'], l10n('Webmaster cannot be deleted'));
-              }
-            if (in_array($user['id'], $collection))
-              {
-                array_push($page['errors'], l10n('You cannot delete your account'));
-              }
-
-            if (count($page['errors']) == 0)
-              {
-                if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
-                  {
-                    foreach ($collection as $user_id)
-                      {
-                        delete_user($user_id);
-                      }
-                    array_push(
-                    $page['infos'],
-                    l10n_dec(
-                      '%d user deleted', '%d users deleted',
-                      count($collection)
-                      )
-                    );
-
-                    foreach ($page['filtered_users'] as $filter_key => $filter_user)
-                      {
-                        if (in_array($filter_user['id'], $collection))
-                          {
-                            unset($page['filtered_users'][$filter_key]);
-                          }
-                      }
-                  }
-                else
-                  {
-                    array_push($page['errors'], l10n('You need to confirm deletion'));
-                  }
-               }
-          }
-// +-----------------------------------------------------------------------+
-// |                 Resend new validation key to users                    |
-// +-----------------------------------------------------------------------+
-
-//TODO:Function to send a new validation key to all | single | selected users
-
-// +-----------------------------------------------------------------------+
-// |                              groups list                              |
-// +-----------------------------------------------------------------------+
-
-          $groups[-1] = '------------';
-
-          $query = '
-            SELECT id, name
-            FROM '.GROUPS_TABLE.'
-            ORDER BY name ASC
-            ;';
-
-          $result = pwg_query($query);
-          
-          while ($row = mysql_fetch_array($result))
-            {
-              $groups[$row['id']] = $row['name'];
-            }
-
-// +-----------------------------------------------------------------------+
-// |                           Template Init                               |
-// +-----------------------------------------------------------------------+
-        $base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list';
-
-        if (isset($_GET['start']) and is_numeric($_GET['start']))
-          {
-            $start = $_GET['start'];
-          }
-        else
-          {
-            $start = 0;
-          }
-
-        $template->assign(
-          array(
-            'F_ADD_ACTION' => $base_url,
-            'F_USERNAME' => @htmlentities($_GET['username']),
-            'F_FILTER_ACTION' => get_root_url().'admin.php'
-            )
-    	  );
-
-/* Hide radio-button if not allow to assign adviser */
-        if ($conf['allow_adviser'])
-          {
-            $template->assign('adviser', true);
-          }
-	
-// +-----------------------------------------------------------------------+
-// |                               user list                               |
-// +-----------------------------------------------------------------------+
-
-        $profile_url = get_root_url().'admin.php?page=profile&amp;user_id=';
-        $perm_url = get_root_url().'admin.php?page=user_perm&amp;user_id=';
-
-        $visible_user_list = array();
-        foreach ($page['filtered_users'] as $num => $local_user)
-          {
-/* simulate LIMIT $start, $conf['users_page'] */
-            if ($num < $start)
-              {
-                continue;
-              }
-            if ($num >= $start + $conf['users_page'])
-              {
-                break;
-              }
-
-            $visible_user_list[] = $local_user;
-          }
-
-        foreach ($visible_user_list as $local_user)
-          {
-            $groups_string = preg_replace(
-              '/(\d+)/e',
-              "\$groups['$1']",
-              implode(
-                ', ',
-                $local_user['groups']
-              )
-            );
-
-            if (isset($_POST['pref_submit'])
-              and isset($_POST['selection'])
-              and in_array($local_user['id'], $_POST['selection']))
-              {
-                $checked = 'checked="checked"';
-              }
-            else
-              {
-                $checked = '';
-              }
-
-            $properties = array();
-            if ( $local_user['level'] != 0 )
-              {
-                $properties[] = l10n( sprintf('Level %d', $local_user['level']) );
-              }
-            $properties[] =
-            (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
-              ? l10n('is_high_enabled') : l10n('is_high_disabled');
+	  if (isset($_POST['pref_submit'])
+        and isset($_POST['selection'])
+        and in_array($local_user['id'], $_POST['selection']))
+	  {
+      	$checked = 'checked="checked"';
+	  }
+      else
+      {
+        $checked = '';
+      }
+
+      $properties = array();
+      if ( $local_user['level'] != 0 )
+      {
+        $properties[] = l10n( sprintf('Level %d', $local_user['level']) );
+      }
+      $properties[] =
+        (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
+          ? l10n('is_high_enabled') : l10n('is_high_disabled');
               
-            if (isset($conf_nbc_UserAdvManager_ConfirmMail[1]) and $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' )
-              {
-                $template->append(
-                  'users',
-                  array(
-                    'ID' => $local_user['id'],
-                    'CHECKED' => $checked,
-                    'U_PROFILE' => $profile_url.$local_user['id'],
-                    'U_PERM' => $perm_url.$local_user['id'],
-                    'USERNAME' => $local_user['username']
-                      .($local_user['id'] == $conf['guest_id']
-                        ? '<BR />['.l10n('is_the_guest').']' : '')
-                      .($local_user['id'] == $conf['default_user_id']
-                        ? '<BR />['.l10n('is_the_default').']' : ''),
-                    'STATUS' => l10n('user_status_'.
-                      $local_user['status']).(($local_user['adviser'] == 'true')
-                      ? '<BR />['.l10n('adviser').']' : ''),
-                    'EMAIL' => get_email_address_as_display_text($local_user['email']),
-                    'GROUPS' => $groups_string,
-                    //TODO:Changing ACTION from $properties to Single_Deletion
-                    //TODO:Addin new ACTION to Resend new validation key
-                    'ACTION' => implode( ', ', $properties),
-                  )
-                );
-              }
-          }		
-
-          $template->assign(
-    	    array(
-    		  'UserAdvManager_CONFIRMMAIL_TIMEOUT_TRUE'		=> $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' ?  'checked="checked"' : '' ,
-    		  'UserAdvManager_CONFIRMMAIL_TIMEOUT_FALSE'	=> $conf_nbc_UserAdvManager_ConfirmMail[0]=='false' ?  'checked="checked"' : '' ,
-    		  'UserAdvManager_CONFIRMMAIL_DELAY'			=> $conf_nbc_UserAdvManager_ConfirmMail[1],
-    		  //TODO:Adding new option [Resend_new_validation_key : True | False]
-    	    )
-    	  );		
+      if (isset($conf_nbc_UserAdvManager_ConfirmMail[1]) and $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' )
+      {
+        $template->append(
+        	'users',
+              array(
+                'ID' => $local_user['id'],
+                'CHECKED' => $checked,
+                'U_PROFILE' => $profile_url.$local_user['id'],
+                'U_PERM' => $perm_url.$local_user['id'],
+                'USERNAME' => $local_user['username']
+                  .($local_user['id'] == $conf['guest_id']
+                    ? '<BR />['.l10n('is_the_guest').']' : '')
+                  .($local_user['id'] == $conf['default_user_id']
+                    ? '<BR />['.l10n('is_the_default').']' : ''),
+                'STATUS' => l10n('user_status_'.
+                  $local_user['status']).(($local_user['adviser'] == 'true')
+                    ? '<BR />['.l10n('adviser').']' : ''),
+                'EMAIL' => get_email_address_as_display_text($local_user['email']),
+                'GROUPS' => $groups_string,
+                'REGISTRATION' => $local_user['registration_date'],
+                )
+              );
+        }
+	  }		
+
+	  $template->assign(
+	  array(
+		'UserAdvManager_CONFIRMMAIL_TIMEOUT_TRUE'		=> $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' ?  'checked="checked"' : '' ,
+		'UserAdvManager_CONFIRMMAIL_TIMEOUT_FALSE'	=> $conf_nbc_UserAdvManager_ConfirmMail[0]=='false' ?  'checked="checked"' : '' ,
+		'UserAdvManager_CONFIRMMAIL_DELAY'					=> $conf_nbc_UserAdvManager_ConfirmMail[1],
+    'UserAdvManager_CONFIRMMAIL_REMAIL_TXT'			=> $conf_nbc_UserAdvManager_ConfirmMail[2],
+    	)
+	  );		
 
 // +-----------------------------------------------------------------------+
 // |                             errors display                            |
 // +-----------------------------------------------------------------------+
-          if ( isset ($errors) and count($errors) != 0)
-    	    {
-              $template->assign('errors',array());
-              foreach ($errors as $error)
-		        {
-		          array_push($page['errors'], $error);
-		        }
-	        }  
+	if ( isset ($errors) and count($errors) != 0)
+	{
+	  $template->assign('errors',array());
+      foreach ($errors as $error)
+	  {
+		array_push($page['errors'], $error);
+	  }
+  	}  
 
 // +-----------------------------------------------------------------------+
 // |                           templates display                           |
 // +-----------------------------------------------------------------------+
-      $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/confirmmail.tpl');
-      $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');		
-    }
+	$template->set_filename('plugin_admin_content', dirname(__FILE__) . '/confirmmail.tpl');
+    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');		
+  }
   else
-    {
-	  array_push($page['infos'], l10n('Err_ConfirmMail_Settings'));
-    }
+  {
+	array_push($page['infos'], l10n('Err_ConfirmMail_Settings'));
+  }
   break;
 }
Index: /extensions/NBC_UserAdvManager/trunk/admin/confirmmail.tpl
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/confirmmail.tpl	(revision 3840)
+++ /extensions/NBC_UserAdvManager/trunk/admin/confirmmail.tpl	(revision 3841)
@@ -40,5 +40,5 @@
       			<td>{'Email address'|@translate}</td>
       			<td>{'Groups'|@translate}</td>
-      			<!--<td>{'UserAdvManager_Indiv_Suppr'|@translate}</td>-->
+      			<td>{'Registration'|@translate}</td>
     			</tr>
   			</thead>
@@ -54,10 +54,6 @@
     			{foreach from=$user.plugin_columns item=data}
     			<td>{$data}</td>
-    		{/foreach}
-    			<!--Todo - Display registration date -->
-				<!--Unaffected column - Can be used in the future -->
-    			<!--<td style="text-align:center;">-->
-      			<!--<a href="{$user.U_ACTION}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" class="button" style="border:none" alt="{'Profile'|@translate}" title="{'Profile'|@translate}" /></a>-->
-      			<!--</td>-->
+    			{/foreach}
+    			<td style="text-align:center;">{$user.REGISTRATION}</td>
   			</tr>
   		{/foreach}
Index: /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php	(revision 3840)
+++ /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php	(revision 3841)
@@ -7,6 +7,8 @@
   global $conf;
   $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
-  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
-  $infos1_perso = "";
+  
+	include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+  
+	$infos1_perso = "";
   $infos2_perso = "";
 
@@ -84,4 +86,138 @@
    fclose($fo) ;
    //return mail ($to,$subject) ;
+}
+
+
+function ResendMail2User($typemail, $user_id, $username, $email, $confirm)
+{
+  global $conf;
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+	$conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
+  
+	include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+  
+	$infos1_perso = "";
+  $infos2_perso = "";
+
+  switch($typemail)
+  {
+    case 1:
+      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_with_key_of_%s', $username));
+      
+      if (isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] <> '')
+      {
+      	if (function_exists('get_user_language_desc'))
+      	{
+					$infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
+				
+					if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true' and $confirm)
+					{
+						$infos2 = array
+						(
+							get_l10n_args('Link: %s', ResetConfirmMail($user_id)),
+							get_l10n_args('', ''),
+						);
+					}
+      	}
+      	else
+      	{
+					$infos1 = $conf_nbc_UserAdvManager_ConfirmMail[2]."\n\n";
+
+					if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true' and $confirm)
+					{	
+						$infos2 = array
+						(
+							get_l10n_args('Link: %s', ResetConfirmMail($user_id)),
+							get_l10n_args('', ''),
+						);
+					}
+      	}
+    	  pwg_mail($email, array(
+    			'subject' => $subject,
+			    'content' => (isset($infos1) ? $infos1."\n\n" : "").(isset($infos2) ? $infos2."\n\n" : "").get_absolute_root_url(),
+				));
+      }
+			elseif (isset($conf_nbc_UserAdvManager[11]) and $conf_nbc_UserAdvManager[11] <> '' and !isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] == '')
+			{
+      	if (function_exists('get_user_language_desc'))
+      	{
+					$infos1 = get_user_language_desc($conf_nbc_UserAdvManager[11])."\n\n";
+				
+					if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true' and $confirm)
+					{
+						$infos2 = array
+						(
+							get_l10n_args('Link: %s', ResetConfirmMail($user_id)),
+							get_l10n_args('', ''),
+						);
+					}
+      	}
+      	else
+      	{
+					$infos1 = $conf_nbc_UserAdvManager[11]."\n\n";
+
+					if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true' and $confirm)
+					{	
+						$infos2 = array
+						(
+							get_l10n_args('Link: %s', ResetConfirmMail($user_id)),
+							get_l10n_args('', ''),
+						);
+					}
+      	}
+				pwg_mail($email, array(
+    			'subject' => $subject,
+    			'content' => (isset($infos1) ? $infos1."\n\n" : "").(isset($infos2) ? $infos2."\n\n" : "").get_absolute_root_url(),
+  			));
+			}
+      
+      break;
+      
+    case 2:
+      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Reminder_without_key_of_%s', $username));
+      
+      if (isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] <> '' and isset($conf_nbc_UserAdvManager[11]) and $conf_nbc_UserAdvManager[11] <> '')
+      {
+      	if (function_exists('get_user_language_desc'))
+      	{
+					$infos1 = get_user_language_desc($conf_nbc_UserAdvManager_ConfirmMail[2])."\n\n";
+      	}
+      	else
+      	{
+					$infos1 = $conf_nbc_UserAdvManager_ConfirmMail[2]."\n\n";
+      	}
+				pwg_mail($email, array(
+    			'subject' => $subject,
+    			'content' => (isset($infos1) ? $infos1."\n\n" : "").(isset($infos2) ? $infos2."\n\n" : "").get_absolute_root_url(),
+  			));
+			}
+			elseif ((function_exists('get_user_language_desc') and isset($conf_nbc_UserAdvManager[11]) and $conf_nbc_UserAdvManager[11] <> '' and !isset($conf_nbc_UserAdvManager_ConfirmMail[2]) and $conf_nbc_UserAdvManager_ConfirmMail[2] == ''))
+			{
+      	if (function_exists('get_user_language_desc'))
+      	{
+					$infos1 = get_user_language_desc($conf_nbc_UserAdvManager[11])."\n\n";
+      	}
+      	else
+      	{
+					$infos1 = $conf_nbc_UserAdvManager[11]."\n\n";
+      	}
+				pwg_mail($email, array(
+    			'subject' => $subject,
+    			'content' => (isset($infos1) ? $infos1."\n\n" : "").(isset($infos2) ? $infos2."\n\n" : "").get_absolute_root_url(),
+  			));
+			}
+			
+      break;
+  }
+
+/* ********************** */
+/* Email sending debugger */
+/* This is only to trace  */
+/* the send of emails for */
+/* debugging              */
+/* ********************** */  
+  MailLog($email,$subject);
+/* ********************** */
+
 }
 
@@ -167,4 +303,32 @@
 }
 
+
+function ResetConfirmMail($user_id)
+{
+  global $conf;
+  
+  $Confirm_Mail_ID = FindAvailableConfirmMailID();
+
+  list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
+  
+  if ( isset($Confirm_Mail_ID) )
+  { 
+    $query = "
+			UPDATE ".USER_CONFIRM_MAIL_TABLE."
+			SET id = '".$Confirm_Mail_ID."'
+			WHERE user_id = '".$user_id."'
+    ;";
+    pwg_query($query);
+
+		$query = "
+    	UPDATE ".USER_INFOS_TABLE."
+      SET registration_date = '".$dbnow."'
+      WHERE user_id = '".$user_id."'
+      ;";
+		pwg_query($query);
+    
+    return get_absolute_root_url().NBC_UserAdvManager_PATH.'ConfirmMail.php?key='.$Confirm_Mail_ID;
+  }
+}
 
 
@@ -347,56 +511,4 @@
 		}
       }
-/* ****************** end ******************* */ 
-// Original code without time limit
-/*      list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
-
-      $query = '
-        UPDATE '.USER_CONFIRM_MAIL_TABLE.'
-        SET date_check="'.$dbnow.'"
-        WHERE id = "'.$id.'"
-      ;';
-      pwg_query($query);
-      
-      if ( $conf_nbc_UserAdvManager[3] <> -1 )
-      {
-        $query = "
-          DELETE FROM ".USER_GROUP_TABLE."
-          WHERE user_id = '".$data['user_id']."'
-          AND group_id = '".$conf_nbc_UserAdvManager[3]."'
-        ;";
-        pwg_query($query);
-      }
-    
-      if ( $conf_nbc_UserAdvManager[4] <> -1 )
-      {
-        $query = "
-          DELETE FROM ".USER_GROUP_TABLE."
-          WHERE user_id = '".$data['user_id']."'
-          AND group_id = '".$conf_nbc_UserAdvManager[4]."'
-        ;";
-        pwg_query($query);
-
-        $query = "
-          INSERT INTO ".USER_GROUP_TABLE."
-          (user_id, group_id)
-          VALUES
-          ('".$data['user_id']."', '".$conf_nbc_UserAdvManager[4]."')
-        ;";
-        pwg_query($query);
-      }
-
-      if ( ( $conf_nbc_UserAdvManager[5] <> -1 or isset($data['status']) ) )
-      {
-        $query = "
-          UPDATE ".USER_INFOS_TABLE."
-          SET status = '".(isset($data['status']) ? $data['status'] : $conf_nbc_UserAdvManager[5])."'
-          WHERE user_id = '".$data['user_id']."'
-        ;";
-        pwg_query($query);
-      }
-// Refresh user's category cache
-      invalidate_user_cache();
-  
-      return true;*/
     }
   }
@@ -404,4 +516,5 @@
     return false;
 }
+
 
 function NotSensibleSearchUsername($username)
@@ -421,4 +534,5 @@
   }
 }
+
 
 function SearchMail($email)
@@ -470,12 +584,88 @@
 		$conf_nbc_MailExclusion = preg_split('/,/',$conf_nbc_UserAdvManager[13]);
 		for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
-			{
-				$pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
-				if (preg_match($pattern, $ncsemail))
-        				return false;
-        			else
-      					return true;
-			}
+		{
+			$pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
+			if (preg_match($pattern, $ncsemail))
+        		return false;
+        	else
+      			return true;
+		}
 	}
 }
+
+
+function get_unvalid_user_list()
+{
+	global $conf, $page;
+          
+	/* Get ConfirmMail configuration */
+    $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
+          
+	/* Get UserAdvManager configuration */
+	$conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();  
+  
+    $users = array();
+    
+	/* search users depending expiration date */
+    $query = '
+    	SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
+											u.'.$conf['user_fields']['username'].' AS username,
+                      u.'.$conf['user_fields']['email'].' AS email,
+                      ui.status,
+                      ui.adviser,
+                      ui.enabled_high,
+                      ui.level,
+                      ui.registration_date,
+                      ug.group_id
+			FROM '.USERS_TABLE.' AS u
+			INNER JOIN '.USER_INFOS_TABLE.' AS ui
+				ON u.'.$conf['user_fields']['id'].' = ui.user_id
+   		INNER JOIN '.USER_GROUP_TABLE.' AS ug
+       	ON u.'.$conf['user_fields']['id'].' = ug.user_id
+     	WHERE u.'.$conf['user_fields']['id'].' >= 0
+      	AND ug.group_id = "'.$conf_nbc_UserAdvManager[3].'"
+       	AND TO_DAYS(NOW()) - TO_DAYS(ui.registration_date) >= "'.$conf_nbc_UserAdvManager_ConfirmMail[1].'"
+     	ORDER BY id ASC
+		;';
+
+	$result = pwg_query($query);
+      
+    while ($row = mysql_fetch_array($result))
+   	{
+    	$user = $row;
+        $user['groups'] = array();
+
+        array_push($users, $user);
+	}
+
+	/* add group lists */
+    $user_ids = array();
+    foreach ($users as $i => $user)
+    {
+    	$user_ids[$i] = $user['id'];
+	}
+	
+	$user_nums = array_flip($user_ids);
+
+    if (count($user_ids) > 0)
+    {
+    	$query = '
+        	SELECT user_id, group_id
+			FROM '.USER_GROUP_TABLE.'
+            WHERE user_id IN ('.implode(',', $user_ids).')
+            ;';
+        
+		$result = pwg_query($query);
+        
+    	while ($row = mysql_fetch_array($result))
+    	{
+        	array_push(
+            	$users[$user_nums[$row['user_id']]]['groups'],
+                $row['group_id']
+                );
+         }
+	}
+
+return $users;
+}
 ?>
Index: /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 3840)
+++ /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 3841)
@@ -96,4 +96,17 @@
 - Valider manuellement une inscription en attente de validation même si la date d\'expiration est révolue <b>(forçage de la validation)</b>.
 <br>';
+$lang['Registration'] = 'Date d\'enregistrement';
+$lang['No_validation_for_Guest'] = 'Le compte Guest n\'est pas soumis à validation';
+$lang['No_validation_for_default_user'] = 'Le compte par défaut n\'est pas soumis à validation';
+$lang['No_validation_for_Webmaster'] = 'Le compte du Webmaster n\'est pas soumis à validation';
+$lang['No_validation_for_your_account'] = 'Votre compte d\'admin n\'est pas soumis à validation';
+
+$lang['%d_Mail_With_Key'] = '%d message avec renouvellement de clé a été envoyé';
+$lang['%d_Mails_With_Key'] = '%d messages avec renouvellement de clé ont été envoyés';
+$lang['%d_Reminder_Sent'] = '%d message de relance a été envoyé';
+$lang['%d_Reminders_Sent'] = '%d messages de relance ont été envoyés';
+
+$lang['Reminder_with_key_of_%s'] = '%s, votre clé de confirmation a été renouvelée';
+$lang['Reminder_without_key_of_%s'] = '%s, votre clé de confirmation va expirer';
 
 $lang['Delete_selected'] = 'Supprimer';
Index: /extensions/NBC_UserAdvManager/trunk/maintain.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/maintain.inc.php	(revision 3840)
+++ /extensions/NBC_UserAdvManager/trunk/maintain.inc.php	(revision 3841)
@@ -16,5 +16,5 @@
   $q = '
     INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
-    VALUES ("nbc_UserAdvManager_ConfirmMail","false;5;","Parametres nbc_UserAdvManager - ConfirmMail")
+    VALUES ("nbc_UserAdvManager_ConfirmMail","false;5;;","Parametres nbc_UserAdvManager - ConfirmMail")
   ;';
   pwg_query($q);
