Index: /extensions/UserAdvManager/trunk/include/functions.inc.php
===================================================================
--- /extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 17943)
+++ /extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 17944)
@@ -19,6 +19,6 @@
   array_push($menu,
     array(
-      'NAME' => $name,
-      'URL' => get_root_url().'admin.php?page=plugin-'.basename(UAM_PATH)
+    		'NAME' => $name,
+    		'URL' => get_root_url().'admin.php?page=plugin-'.basename(UAM_PATH)
     )
   );
@@ -67,5 +67,5 @@
     {
 
-      $userid = get_userid($user['username']);
+						$userid = get_userid($user['username']);
      	  
       // Looking for existing entry in last visit table
@@ -524,9 +524,9 @@
   {
     if (count($collection) > 0)
-  	{
+  	 {
       // Process if a non-admin nor webmaster user is logged
       // ---------------------------------------------------
       if (in_array($user['id'], $collection))
-    	{
+   			{
         // Check lastvisit reminder state
         // ------------------------------
@@ -561,5 +561,5 @@
           redirect(UAM_PATH.'GT_del_account.php');
         }
-    	}
+    		}
       else // Process if an admin or webmaster user is logged
       {
@@ -603,5 +603,7 @@
             // Delete user from all groups
             // ---------------------------
-            $query = '
+            if ($conf_UAM[2] <> -1 and $conf_UAM[3] <> -1)
+            {
+            		$query = '
 DELETE FROM '.USER_GROUP_TABLE.'
 WHERE user_id = '.$user_id.'
@@ -612,5 +614,6 @@
   )
 ;';
-            pwg_query($query);
+            		pwg_query($query);
+												}
 
             // Change user status
@@ -666,19 +669,19 @@
               // Reset confirmed user status to unvalidated
               // ------------------------------------------
-						  $query = '
+						  						$query = '
 UPDATE '.USER_CONFIRM_MAIL_TABLE.'
 SET date_check = NULL
 WHERE user_id = '.$user_id.'
 ;';
-						  pwg_query($query);
+						  						pwg_query($query);
 
               // Get users information for email notification
               // --------------------------------------------
-						  $query = '
+						  						$query = '
 SELECT id, username, mail_address
 FROM '.USERS_TABLE.'
 WHERE id = '.$user_id.'
 ;';
-						  $data = pwg_db_fetch_assoc(pwg_query($query));
+						  						$data = pwg_db_fetch_assoc(pwg_query($query));
             
               demotion_mail($user_id, $data['username'], $data['mail_address']);
@@ -732,9 +735,9 @@
   {
     if (count($collection) > 0)
-  	{
+  		{
       // Process if a non-admin nor webmaster user is logged
       // ---------------------------------------------------
       if (in_array($user['id'], $collection))
-    	{
+    		{
         // Check ConfirmMail reminder state
         // --------------------------------
@@ -759,5 +762,5 @@
         if (!$reminder and isset($conf_UAM[32]) and $conf_UAM[32] == 'true')
         {
-     		  $typemail = 1;
+     		  	$typemail = 1;
           
           // Get current user informations
@@ -786,5 +789,5 @@
           redirect(UAM_PATH.'USR_del_account.php');
         }
-    	}
+    		}
       else // Process if an admin or webmaster user is logged
       {
@@ -913,8 +916,8 @@
 
   $conf_UAM = unserialize($conf['UserAdvManager']);
-  
-	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 = "";
   $subject = "";
@@ -1155,5 +1158,5 @@
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
   
-	include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+		include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
   
 // We have to get the user's language in database
@@ -1194,5 +1197,5 @@
       if (isset($conf_UAM_ConfirmMail[2]) and $conf_UAM_ConfirmMail[2] <> '' and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and $confirm)
       {
-        // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
+      		// Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
         // -------------------------------------------------------------------------
         $patterns[] = '#\[username\]#i';
@@ -1220,5 +1223,5 @@
           get_l10n_args('', ''),
         );        
-			}
+						}
 
 // Set reminder true 
@@ -1231,5 +1234,5 @@
       pwg_query($query);
       
-		break;
+				break;
       
     case 2: //Generating email content for remind without a new key
@@ -1291,7 +1294,7 @@
   ));
 
-// Switching back to default language
-// ----------------------------------
-switch_lang_back();
+		// Switching back to default language
+		// ----------------------------------
+		switch_lang_back();
 }
 
@@ -1310,5 +1313,5 @@
   $subject = "";
   
-	include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+		include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
 
 // We have to get the user's language in database
@@ -1374,7 +1377,7 @@
   ));
 
-// Switching back to default language
-// ----------------------------------
-switch_lang_back();
+		// Switching back to default language
+		// ----------------------------------
+		switch_lang_back();
 }
 
@@ -1392,12 +1395,12 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
   
-	include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
-  
-	$custom_txt = "";
-  $subject = "";
+		include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+  
+		$custom_txt = "";
+		$subject = "";
 
 // We have to get the user's language in database
 // ----------------------------------------------
-  $query ='
+  $query = '
 SELECT user_id, language
 FROM '.USER_INFOS_TABLE.'
@@ -1479,7 +1482,7 @@
   ));
 
-// Switching back to default language
-// ----------------------------------
-switch_lang_back();
+		// Switching back to default language
+		// ----------------------------------
+		switch_lang_back();
 }
 
@@ -1497,7 +1500,7 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
   
-	include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
-  
-	$custom_txt = "";
+		include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+  
+		$custom_txt = "";
   $subject = "";
 
@@ -1585,7 +1588,7 @@
   ));
 
-// Switching back to default language
-// ----------------------------------
-switch_lang_back();
+		// Switching back to default language
+		// ----------------------------------
+		switch_lang_back();
 }
 
@@ -1793,10 +1796,10 @@
     pwg_query($query);
 
-		$query = '
+				$query = '
 UPDATE '.USER_INFOS_TABLE.'
 SET registration_date = "'.$dbnow.'"
 WHERE user_id = '.$user_id.'
 ;';
-		pwg_query($query);
+				pwg_query($query);
     
     return get_absolute_root_url().UAM_PATH.'ConfirmMail.php?key='.$Confirm_Mail_ID.'&userid='.$user_id;
@@ -1932,59 +1935,59 @@
       if (!empty($registration_date))
       {
-				// Verify Confirmmail with time limit ON
-        // -------------------------------------
-				if (isset ($conf_UAM_ConfirmMail[1]))
-				{
-					// Dates formating and compare
-          // ---------------------------
-					$today = date("d-m-Y"); // Get today's date
-					list($day, $month, $year) = explode('-', $today); // explode date of today						 
- 					$daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
-	  		
-	  			list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
-					list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
-					$regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
-			
-					$deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps	
-					$deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
-
-					// Condition with the value set for time limit
-          // -------------------------------------------
-					if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
-					{
-						list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
-
-            // Update ConfirmMail table
-            // ------------------------
-						$query = '
+								// Verify Confirmmail with time limit ON
+    				// -------------------------------------
+								if (isset ($conf_UAM_ConfirmMail[1]))
+								{
+										// Dates formating and compare
+     					// ---------------------------
+										$today = date("d-m-Y"); // Get today's date
+										list($day, $month, $year) = explode('-', $today); // explode date of today						 
+ 									$daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
+
+	  							list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
+										list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
+										$regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
+
+										$deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps	
+										$deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
+
+										// Condition with the value set for time limit
+     					// -------------------------------------------
+										if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
+										{
+												list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
+
+        				// Update ConfirmMail table
+        				// ------------------------
+												$query = '
 UPDATE '.USER_CONFIRM_MAIL_TABLE.'
 SET date_check="'.$dbnow.'", reminder="false"
 WHERE id = "'.$id.'"
 ;';
-						pwg_query($query);
-
-            // Update LastVisit table - Force reminder field to false
-            // Usefull when a user has been automatically downgraded and revalidate its registration
-            // -------------------------------------------------------------------------------------
-						$query = '
+												pwg_query($query);
+
+        				// Update LastVisit table - Force reminder field to false
+        				// Usefull when a user has been automatically downgraded and revalidate its registration
+        				// -------------------------------------------------------------------------------------
+												$query = '
 UPDATE '.USER_LASTVISIT_TABLE.'
 SET reminder="false"
 WHERE user_id = "'.$data['user_id'].'"
 ;';
-						pwg_query($query);
+												pwg_query($query);
       
-						if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
-						{
-							$query = '
+												if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
+												{
+														$query = '
 DELETE FROM '.USER_GROUP_TABLE.'
 WHERE user_id = '.$data['user_id'].'
   AND group_id = "'.$conf_UAM[2].'"
 ;';
-							pwg_query($query);
-						}
-	    
-						if ($conf_UAM[3] <> -1) // Add user to validated users group 
-						{
-							$query = '
+														pwg_query($query);
+												}
+
+												if ($conf_UAM[3] <> -1) // Add user to validated users group 
+												{
+														$query = '
 INSERT INTO '.USER_GROUP_TABLE.'
   (user_id, group_id)
@@ -1992,83 +1995,83 @@
   ('.$data['user_id'].', "'.$conf_UAM[3].'")
 ;';
-							pwg_query($query);
-						}
-
-						if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status
-						{
-							$query = '
+														pwg_query($query);
+												}
+
+												if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status
+												{
+														$query = '
 UPDATE '.USER_INFOS_TABLE.'
 SET status = "'.(isset($data['status']) ? $data['status'] : $conf_UAM[4]).'"
 WHERE user_id = '.$data['user_id'].'
 ;';
-							pwg_query($query);
-						}
-
-						if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level
-						{
-							$query = '
+														pwg_query($query);
+												}
+
+												if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level
+												{
+														$query = '
 UPDATE '.USER_INFOS_TABLE.'
 SET level = "'.(isset($data['level']) ? $data['level'] : $conf_UAM[36]).'"
 WHERE user_id = '.$data['user_id'].'
 ;';
-							pwg_query($query);
-						}
-
-						// Refresh user's category cache
-            // -----------------------------
-						invalidate_user_cache();
-  
-						return true;
-					}
-					elseif ($deltadays > $conf_UAM_ConfirmMail[1]) // If timelimit exeeds
-					{
-						return false;
-					}
-				}
-				// Verify Confirmmail with time limit OFF
-        // --------------------------------------
-				else
-				{
-					list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
-
-          // Update ConfirmMail table
-          // ------------------------
-					$query = '
+														pwg_query($query);
+												}
+
+												// Refresh user's category cache
+      						// -----------------------------
+												invalidate_user_cache();
+
+												return true;
+										}
+										elseif ($deltadays > $conf_UAM_ConfirmMail[1]) // If timelimit exeeds
+										{
+												return false;
+										}
+								}
+								// Verify Confirmmail with time limit OFF
+    				// --------------------------------------
+								else
+								{
+										list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
+
+      				// Update ConfirmMail table
+      				// ------------------------
+										$query = '
 UPDATE '.USER_CONFIRM_MAIL_TABLE.'
 SET date_check="'.$dbnow.'"
 WHERE id = "'.$id.'"
 ;';
-					pwg_query($query);
-
-          // Update LastVisit table - Force reminder field to false
-          // Usefull when a user has been automatically downgraded and revalidate its registration
-          // -------------------------------------------------------------------------------------
-					$query = '
+										pwg_query($query);
+
+      				// Update LastVisit table - Force reminder field to false
+      				// Usefull when a user has been automatically downgraded and revalidate its registration
+      				// -------------------------------------------------------------------------------------
+										$query = '
 UPDATE '.USER_LASTVISIT_TABLE.'
 SET reminder="false"
 WHERE user_id = "'.$data['user_id'].'"
 ;';
-          pwg_query($query);
-      
-					if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
-					{
-						$query = '
+      				pwg_query($query);
+
+										if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group
+										{
+												$query = '
 DELETE FROM '.USER_GROUP_TABLE.'
 WHERE user_id = '.$data['user_id'].'
 AND group_id = "'.$conf_UAM[2].'"
 ;';
-						pwg_query($query);
-					}
-    
-					if ($conf_UAM[3] <> -1)
-					{
-						$query = '
+												pwg_query($query);
+										}
+
+										if ($conf_UAM[3] <> -1)
+										{
+												$query = '
 DELETE FROM '.USER_GROUP_TABLE.'
 WHERE user_id = '.$data['user_id'].'
 AND group_id = "'.$conf_UAM[3].'"
 ;';
-						pwg_query($query);
-
-						$query = '
+												pwg_query($query);
+
+												$query = '
 INSERT INTO '.USER_GROUP_TABLE.'
   (user_id, group_id)
@@ -2076,40 +2079,40 @@
   ('.$data['user_id'].', "'.$conf_UAM[3].'")
 ;';
-						pwg_query($query);
-					}
-
-					if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status
-					{
-						$query = '
+												pwg_query($query);
+										}
+
+										if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status
+										{
+												$query = '
 UPDATE '.USER_INFOS_TABLE.'
 SET status = "'.(isset($data['status']) ? $data['status'] : $conf_UAM[4]).'"
 WHERE user_id = '.$data['user_id'].'
 ;';
-						pwg_query($query);
-					}
-
-					if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level
-					{
-						$query = '
+												pwg_query($query);
+										}
+
+										if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level
+										{
+												$query = '
 UPDATE '.USER_INFOS_TABLE.'
 SET level = "'.(isset($data['level']) ? $data['level'] : $conf_UAM[36]).'"
 WHERE user_id = '.$data['user_id'].'
 ;';
-						pwg_query($query);
-					}
-
-					// Refresh user's category cache
-          // -----------------------------
-					invalidate_user_cache();
-  
-					return true;
+												pwg_query($query);
+										}
+
+										// Refresh user's category cache
+      				// -----------------------------
+										invalidate_user_cache();
+
+										return true;
+								}
+						}
 				}
-			}
+    else if (!empty($data) and !is_null($data['date_check']))
+    {
+      return false;
+    }
 		}
-    else if (!empty($data) and !is_null($data['date_check']))
-    {
-      return false;
-    }
-	}
   else
     return false;
@@ -2247,16 +2250,16 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
   
-	if (isset($email) and isset($conf_UAM[11]) and $conf_UAM[11] <> '')
-	{
-		$conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[11]);
-		for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
+		if (isset($email) and isset($conf_UAM[11]) and $conf_UAM[11] <> '')
 		{
-			$pattern = '/'.$conf_MailExclusion[$i].'/i';
-			if (preg_match($pattern, $email))
-      {
-        		return true;
-      }
+				$conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[11]);
+				for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
+				{
+						$pattern = '/'.$conf_MailExclusion[$i].'/i';
+						if (preg_match($pattern, $email))
+      {
+      		return true;
+      }
+				}
 		}
-	}
   else
   {
@@ -2274,7 +2277,7 @@
 function get_unvalid_user_list()
 {
-	global $conf, $page;
+		global $conf, $page;
           
-	// Get ConfirmMail configuration
+		// Get ConfirmMail configuration
   // -----------------------------
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
@@ -2285,5 +2288,5 @@
   $users = array();
 
-	// Search users depending expiration date
+		// Search users depending expiration date
   // --------------------------------------
   $query = '
@@ -2304,5 +2307,5 @@
   OR TO_DAYS(NOW()) - TO_DAYS(ui.registration_date) < "'.$conf_UAM_ConfirmMail[1].'")';
 
-	if ($conf_UAM[2] <> '-1' and $conf_UAM[7] == '-1')
+		if ($conf_UAM[2] <> '-1' and $conf_UAM[7] == '-1')
   {
     $query.= '
@@ -2319,31 +2322,32 @@
   AND ug.group_id = '.$conf_UAM[2];
   }
+
   $query.= '
 ORDER BY ui.registration_date ASC
 ;';
 
-	$result = pwg_query($query);
+		$result = pwg_query($query);
       
   while ($row = pwg_db_fetch_assoc($result))
   {
-  	$user = $row;
+  		$user = $row;
     $user['groups'] = array();
 
     array_push($users, $user);
-	}
-
-	// Add groups list
+		}
+
+		// Add groups list
   // ---------------
   $user_ids = array();
   foreach ($users as $i => $user)
   {
-  	$user_ids[$i] = $user['id'];
-	}
-	
-	$user_nums = array_flip($user_ids);
+  		$user_ids[$i] = $user['id'];
+		}
+
+		$user_nums = array_flip($user_ids);
 
   if (count($user_ids) > 0)
   {
-  	$query = '
+  		$query = '
 SELECT user_id, group_id
   FROM '.USER_GROUP_TABLE.'
@@ -2351,16 +2355,16 @@
 ;';
         
-		$result = pwg_query($query);
+				$result = pwg_query($query);
         
     while ($row = pwg_db_fetch_assoc($result))
     {
-    	array_push(
-      	$users[$user_nums[$row['user_id']]]['groups'],
+    		array_push(
+      		$users[$user_nums[$row['user_id']]]['groups'],
         $row['group_id']
-			);
+						);
+				}
 		}
-	}
-
-	return $users;
+
+		return $users;
 }
 
@@ -2375,7 +2379,7 @@
 function get_unvalid_user_autotasks()
 {
-	global $conf, $page;
+		global $conf, $page;
           
-	// Get ConfirmMail configuration
+		// Get ConfirmMail configuration
   // -----------------------------
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
@@ -2383,5 +2387,5 @@
   $users = array();
 
-	// search users depending expiration date
+		// search users depending expiration date
   // --------------------------------------
   $query = '
@@ -2395,12 +2399,12 @@
 ORDER BY ui.registration_date ASC;';
 
-	$result = pwg_query($query);
-      
+		$result = pwg_query($query);
+
   while ($row = pwg_db_fetch_assoc($result))
   {
     array_push($users, $row);
-	}
-
-	return $users;
+		}
+
+		return $users;
 }
 
@@ -2414,11 +2418,11 @@
 function get_ghost_user_list()
 {
-	global $conf, $page;
+		global $conf, $page;
 
   $conf_UAM = unserialize($conf['UserAdvManager']);
-  
+
   $users = array();
 
-	// Search users depending expiration date
+		// Search users depending expiration date
   // --------------------------------------
   $query = '
@@ -2434,15 +2438,15 @@
 ORDER BY lv.lastvisit ASC;';
 
-	$result = pwg_query($query);
+		$result = pwg_query($query);
       
   while ($row = pwg_db_fetch_assoc($result))
   {
-  	$user = $row;
+  		$user = $row;
     $user['groups'] = array();
 
     array_push($users, $user);
-	}
-
-	// Add groups list
+		}
+
+		// Add groups list
   // ---------------
   $user_ids = array();
@@ -2450,7 +2454,7 @@
   {
   	$user_ids[$i] = $user['id'];
-	}
-
-	return $users;
+		}
+
+		return $users;
 }
 
@@ -2464,5 +2468,5 @@
 function get_ghosts_autotasks()
 {
-	global $conf, $page;
+		global $conf, $page;
 
   $conf_UAM = unserialize($conf['UserAdvManager']);
@@ -2470,5 +2474,5 @@
   $users = array();
   
-	// Search users depending expiration date and reminder sent
+		// Search users depending expiration date and reminder sent
   // --------------------------------------------------------
   $query = '
@@ -2481,12 +2485,12 @@
 ORDER BY lv.lastvisit ASC;';
 
-	$result = pwg_query($query);
+		$result = pwg_query($query);
       
-  while ($row = pwg_db_fetch_assoc($result))
+		while ($row = pwg_db_fetch_assoc($result))
   {
     array_push($users, $row);
-	}
-  
-	return $users;
+		}
+  
+		return $users;
 }
 
@@ -2500,9 +2504,9 @@
 function get_user_list()
 {
-	global $conf, $page;
+		global $conf, $page;
   
   $users = array();
 
-	// Search users depending expiration date with exclusion of Adult_Content generic users
+		// Search users depending expiration date with exclusion of Adult_Content generic users
   // ------------------------------------------------------------------------------------
   $query = '
@@ -2520,23 +2524,23 @@
 ;';
 
-	$result = pwg_query($query);
+		$result = pwg_query($query);
       
   while ($row = pwg_db_fetch_assoc($result))
   {
-  	$user = $row;
+  		$user = $row;
     $user['groups'] = array();
 
     array_push($users, $user);
-	}
-
-	// Add groups list
+		}
+
+		// Add groups list
   // ---------------
   $user_ids = array();
   foreach ($users as $i => $user)
   {
-  	$user_ids[$i] = $user['id'];
-	}
-
-	return $users;
+ 			$user_ids[$i] = $user['id'];
+		}
+
+		return $users;
 }
 
@@ -2554,47 +2558,47 @@
 	global $conf, $page;
           
-	// Get ConfirmMail configuration
+		// Get ConfirmMail configuration
   // -----------------------------
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
           
-	// Get UAM configuration
+		// Get UAM configuration
   // ---------------------
   $conf_UAM = unserialize($conf['UserAdvManager']);
 	
-	$query = '
+		$query = '
 SELECT registration_date
   FROM '.USER_INFOS_TABLE.'
 WHERE user_id = '.$id.'
 ;';
-	list($registration_date) = pwg_db_fetch_row(pwg_query($query));
+		list($registration_date) = pwg_db_fetch_row(pwg_query($query));
 
 //              Time limit process             
 // ********************************************  
-	if (!empty($registration_date))
-  {
-		// Dates formating and compare
-    // ---------------------------
-		$today = date("d-m-Y"); // Get today's date
-		list($day, $month, $year) = explode('-', $today); // explode date of today						 
- 		$daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
+		if (!empty($registration_date))
+  {
+				// Dates formating and compare
+  		// ---------------------------
+				$today = date("d-m-Y"); // Get today's date
+				list($day, $month, $year) = explode('-', $today); // explode date of today						 
+ 			$daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
 	  	
-	  list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
-		list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
-		$regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
+	  	list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
+				list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
+				$regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
 			
-		$deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps	
-		$deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
-
-		// Condition with the value set for time limit
+				$deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps	
+				$deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
+
+				// Condition with the value set for time limit
     // -------------------------------------------
-		if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
-		{
-			return false;
+				if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
+				{
+						return false;
+				}
+				else
+				{
+						return true;
+				}
 		}
-		else
-		{
-			return true;
-		}
-	}
 }
 
@@ -2609,9 +2613,9 @@
  * Thanx to MathieuGut from http://m-gut.developpez.com
  */
-function testpassword($password) // Le mot de passe passé en paramètre - $password given by user
-{
-
-  // Initialisation des variables - Variables initiation
-  // ---------------------------------------------------
+function testpassword($password) // $password given by user
+{
+
+  // Variables initiation
+  // --------------------
   $points = 0;
   $point_lowercase = 0;
@@ -2620,72 +2624,72 @@
   $point_characters = 0;
 
-  // On récupère la longueur du mot de passe - Getting password lengh
-  // ----------------------------------------------------------------
+  // Getting password lengh
+  // ----------------------
   $length = strlen($password);
-  
-  // On fait une boucle pour lire chaque lettre - Loop to read password characters
+
+  // Loop to read password characters
   for($i = 0; $i < $length; $i++)
   {
-    // On sélectionne une à une chaque lettre - Select each letters
-    // $i étant à 0 lors du premier passage de la boucle - $i is 0 at first turn
-    // -------------------------------------------------------------------------
+    // Select each letters
+    // $i is 0 at first turn
+    // ---------------------
     $letters = $password[$i];
 
     if ($letters>='a' && $letters<='z')
     {
-      // On ajoute 1 point pour une minuscule - Adding 1 point to score for a lowercase
-      // ------------------------------------------------------------------------------
-		  $points = $points + 1;
-
-		  // On rajoute le bonus pour une minuscule - Adding bonus points for lowercase
-      // --------------------------------------------------------------------------
+      // Adding 1 point to score for a lowercase
+      // ---------------------------------------
+		  		$points = $points + 1;
+
+		  		// Adding bonus points for lowercase
+      // ---------------------------------
 		  $point_lowercase = 1;
     }
     else if ($letters>='A' && $letters <='Z')
     {
-      // On ajoute 2 points pour une majuscule - Adding 2 points to score for uppercase
-      // ------------------------------------------------------------------------------
+      // Adding 2 points to score for uppercase
+      // --------------------------------------
       $points = $points + 2;
 		
-      // On rajoute le bonus pour une majuscule - Adding bonus points for uppercase
-      // --------------------------------------------------------------------------
+      // Adding bonus points for uppercase
+      // ---------------------------------
       $point_uppercase = 2;
     }
     else if ($letters>='0' && $letters<='9')
     {
-      // On ajoute 3 points pour un chiffre - Adding 3 points to score for numbers
-      // -------------------------------------------------------------------------
+      // Adding 3 points to score for numbers
+      // ------------------------------------
       $points = $points + 3;
 		
-      // On rajoute le bonus pour un chiffre - Adding bonus points for numbers
-      // ---------------------------------------------------------------------
+      // Adding bonus points for numbers
+      // -------------------------------
       $point_numbers = 3;
     }
     else
     {
-      // On ajoute 5 points pour un caractère autre - Adding 5 points to score for special characters
-      // --------------------------------------------------------------------------------------------
+      // Adding 5 points to score for special characters
+      // -----------------------------------------------
       $points = $points + 5;
 		
-      // On rajoute le bonus pour un caractère autre - Adding bonus points for special characters
-      // ----------------------------------------------------------------------------------------
+      // Adding bonus points for special characters
+      // ------------------------------------------
       $point_characters = 5;
     }
   }
 
-  // Calcul du coefficient points/longueur - calculating the coefficient points/length
-  // ---------------------------------------------------------------------------------
+  // Calculating the coefficient points/length
+  // -----------------------------------------
   $step1 = $points / $length;
 
-  // Calcul du coefficient de la diversité des types de caractères... - Calculation of the diversity of character types...
-  // ---------------------------------------------------------------------------------------------------------------------
+  // Calculation of the diversity of character types...
+  // --------------------------------------------------
   $step2 = $point_lowercase + $point_uppercase + $point_numbers + $point_characters;
 
-  // Multiplication du coefficient de diversité avec celui de la longueur - Multiplying the coefficient of diversity with that of the length
-  // --------------------------------------------------------------------------------------------------------------------------------------------
+  // Multiplying the coefficient of diversity with that of the length
+  // ----------------------------------------------------------------
   $score = $step1 * $step2;
 
-  // Multiplication du resultat par la longueur de la chaine - Multiplying the result by the length of the string
-  // ------------------------------------------------------------------------------------------------------------
+  // Multiplying the result by the length of the string
+  // --------------------------------------------------
   $finalscore = $score * $length;
 
@@ -2898,5 +2902,5 @@
   $ListTables = array(USER_CONFIRM_MAIL_TABLE, USER_LASTVISIT_TABLE);
   $j=0;
-  
+
   while($j < count($ListTables))
   {
