Index: extensions/UserAdvManager/trunk/include/functions.inc.php
===================================================================
--- extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 12247)
+++ extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 12271)
@@ -40,4 +40,5 @@
 
   // Admins, Guests and Adult_Content users are not tracked for Ghost Tracker or Users Tracker
+  // -----------------------------------------------------------------------------------------
   if (!is_admin() and !is_a_guest() and $user['username'] != "16" and $user['username'] != "18")
   {
@@ -48,4 +49,5 @@
      	  
       // Looking for existing entry in last visit table
+      // ----------------------------------------------
       $query = '
 SELECT *
@@ -59,4 +61,5 @@
       {
         // If not, data are inserted in table
+        // ----------------------------------
         $query = '
 INSERT INTO '.USER_LASTVISIT_TABLE.' (user_id, lastvisit, reminder)
@@ -68,4 +71,5 @@
       {
         // If yes, data are updated in table
+        // ---------------------------------
         $query = '
 UPDATE '.USER_LASTVISIT_TABLE.'
@@ -93,4 +97,5 @@
 
   // Exclusion of Adult_Content users
+  // --------------------------------
   if ($register_user['username'] != "16" and $register_user['username'] != "18")
   {
@@ -98,4 +103,5 @@
     {
       // This is to send an information email and set user to "waiting" group or status until admin validation
+      // -----------------------------------------------------------------------------------------------------
       $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
       SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
@@ -105,4 +111,5 @@
     {
       // This is to set user to "waiting" group or status until admin validation
+      // -----------------------------------------------------------------------
       SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation
     }
@@ -110,8 +117,10 @@
     {
       // This is to send an information email without validation key
+      // -----------------------------------------------------------
       $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
       SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
     }
     // Sending registration confirmation by email
+    // ------------------------------------------
     elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true' or $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
     {
@@ -144,8 +153,11 @@
 {
   // Cleanup for ConfirmMail table
+  // -----------------------------
   DeleteConfirmMail($user_id);
   // Cleanup for LastVisit table
+  // ---------------------------
   DeleteLastVisit($user_id);
   // Cleanup Redirection settings
+  // ----------------------------
   DeleteRedir($user_id);
 }
@@ -162,4 +174,5 @@
 
   // Exclusion of Adult_Content users
+  // --------------------------------
   if ($user['username'] != "16" and $user['username'] != "18")
   {
@@ -171,4 +184,5 @@
 
     // Password enforcement control
+    // ----------------------------
     if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($conf_UAM[13]))
     {
@@ -198,4 +212,5 @@
 
     // Username without forbidden keys
+    // -------------------------------
     if (isset($conf_UAM[5]) and $conf_UAM[5] == 'true' and !empty($user['username']) and ValidateUsername($user['username']) and !is_admin())
     {
@@ -205,4 +220,5 @@
 
     // Email without forbidden domains
+    // -------------------------------
     if (isset($conf_UAM[10]) and $conf_UAM[10] == 'true' and !empty($user['email']) and ValidateEmailProvider($user['email']) and !is_admin())
     {
@@ -225,4 +241,5 @@
 
   // Update first redirection parameter
+  // ----------------------------------
   if ((isset($conf_UAM[20]) and $conf_UAM[20] == 'true'))
   {
@@ -242,4 +259,5 @@
 
   // Special message display for password reset
+  // ------------------------------------------
   if ((isset($conf_UAM[38]) and $conf_UAM[38] == 'true'))
   {
@@ -251,7 +269,9 @@
 
   // Controls on profile page submission
+  // -----------------------------------
   if (isset($_POST['validate']) and !is_admin())
   {
     // Email without forbidden domains
+    // -------------------------------
     if (isset($conf_UAM[10]) and $conf_UAM[10] == 'true' and !empty($_POST['mail_address']))
     {
@@ -264,7 +284,9 @@
 
     // Password reset control
+    // ----------------------
     if (isset($conf_UAM[38]) and $conf_UAM[38] == 'true' and UAM_check_pwgreset($user['id']))
     {
       // if password not changed then pwdreset filed = true else pwdreset field = false
+      // ------------------------------------------------------------------------------
       if (!empty($_POST['use_new_pwd']))
       {
@@ -286,4 +308,5 @@
 
       // Password enforcement control
+      // ----------------------------
       if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($conf_UAM[13]))
       {
@@ -301,4 +324,5 @@
 
     // Sending registration confirmation by email
+    // ------------------------------------------
     if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
     {
@@ -316,4 +340,5 @@
 
         // This is to send a new validation key
+        // ------------------------------------
         if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
         
@@ -321,4 +346,5 @@
 
         // This is to set the user to "waiting" group or status until admin validation
+        // ---------------------------------------------------------------------------
         if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
         
@@ -357,4 +383,5 @@
   
   // Performing GhostTracker scheduled tasks
+  // ---------------------------------------
   if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true'))
   {
@@ -363,4 +390,5 @@
 
   // Performing User validation scheduled tasks
+  // ------------------------------------------
   if ((isset($conf_UAM[30]) and $conf_UAM[30] == 'true'))
   {
@@ -369,4 +397,5 @@
 
   // Performing redirection to profile page on first login
+  // -----------------------------------------------------
   if ((isset($conf_UAM[20]) and $conf_UAM[20] == 'true'))
   {  
@@ -387,4 +416,5 @@
 
   // Performing redirection to profile page for password reset
+  // ---------------------------------------------------------
   if ((isset($conf_UAM[38]) and $conf_UAM[38] == 'true'))
   {
@@ -453,5 +483,6 @@
   }
 
-  // Ghost accounts auto group, status or privacy level downgrade with or without information email sending and autodeletion if user already reminded
+  // GhostTracker auto group, status or privacy level downgrade with or without information email sending and autodeletion if user already reminded
+  // ----------------------------------------------------------------------------------------------------------------------------------------------
   if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true') and ((isset($conf_UAM[25]) and $conf_UAM[25] <> -1) or (isset($conf_UAM[26]) and $conf_UAM[26] <> -1) or (isset($conf_UAM[37]) and $conf_UAM[37] <> -1)))
   {
@@ -459,7 +490,9 @@
   	{
       // Process if a non-admin nor webmaster user is logged
+      // ---------------------------------------------------
       if (in_array($user['id'], $collection))
     	{
         // Check lastvisit reminder state
+        // ------------------------------
         $query = '
 SELECT reminder
@@ -479,10 +512,13 @@
 
         // If user already reminded for ghost account
+        // ------------------------------------------
         if ($reminder)
         {
-          // delete account
+          // Delete account
+          // --------------
           delete_user($user['id']);
 
           // Logged-in user cleanup, session destruction and redirected to custom page
+          // -------------------------------------------------------------------------
           invalidate_user_cache();
           logout_user();
@@ -495,4 +531,5 @@
         {
           // Check lastvisit reminder state
+          // ------------------------------
           $query = '
 SELECT reminder
@@ -512,7 +549,9 @@
 
           // If never reminded before
+          // ------------------------
           if (!$reminder)
           {
-            // Reset of lastvisit date 
+            // Reset of lastvisit date
+            // -----------------------
             list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
 
@@ -525,5 +564,7 @@
 
           // Auto change group and / or status
+          // ---------------------------------
             // Delete user from all groups
+            // ---------------------------
             $query = "
 DELETE FROM ".USER_GROUP_TABLE."
@@ -538,4 +579,5 @@
 
             // Change user status
+            // ------------------
             if ($conf_UAM[26] <> -1)
             {
@@ -549,4 +591,5 @@
 
             // Change user group
+            // -----------------
             if ($conf_UAM[25] <> -1)
             {
@@ -561,4 +604,5 @@
 
             // Change user privacy level
+            // -------------------------
             if ($conf_UAM[37] <> -1)
             {
@@ -572,7 +616,9 @@
 
             // Auto send email notification on group / status downgrade
+            // --------------------------------------------------------
             if (isset($conf_UAM[22]) and $conf_UAM[22] == 'true')
             {
               // Set reminder true
+              // -----------------
               $query = "
 UPDATE ".USER_LASTVISIT_TABLE."
@@ -583,4 +629,5 @@
             
               // Reset confirmed user status to unvalidated
+              // ------------------------------------------
 						  $query = '
 UPDATE '.USER_CONFIRM_MAIL_TABLE.'
@@ -591,4 +638,5 @@
 
               // Get users information for email notification
+              // --------------------------------------------
 						  $query = '
 SELECT id, username, mail_address
@@ -603,5 +651,6 @@
           elseif ($reminder) // If user already reminded for ghost account
           {
-            // delete account
+            // Delete account
+            // --------------
             delete_user($user_id);
           }
@@ -643,4 +692,5 @@
 
   // Unvalidated accounts auto email sending and autodeletion if user already reminded
+  // ---------------------------------------------------------------------------------
   if ((isset($conf_UAM[30]) and $conf_UAM[30] == 'true'))
   {
@@ -648,7 +698,9 @@
   	{
       // Process if a non-admin nor webmaster user is logged
+      // ---------------------------------------------------
       if (in_array($user['id'], $collection))
     	{
         // Check ConfirmMail reminder state
+        // --------------------------------
         $query = '
 SELECT reminder
@@ -668,4 +720,5 @@
 
         // If never reminded before, send reminder and set reminder True
+        // -------------------------------------------------------------
         if (!$reminder and isset($conf_UAM[32]) and $conf_UAM[32] == 'true')
         {
@@ -673,4 +726,5 @@
           
           // Get current user informations
+          // -----------------------------
           $query = "
 SELECT id, username, mail_address
@@ -684,4 +738,5 @@
 
         // If already reminded before, delete user
+        // ---------------------------------------
         if ($reminder)
         {
@@ -690,4 +745,5 @@
 
           // Logged-in user cleanup, session destruction and redirected to custom page
+          // -------------------------------------------------------------------------
           invalidate_user_cache();
           logout_user();
@@ -700,4 +756,5 @@
         {
           // Check reminder state
+          // --------------------
           $query = '
 SELECT reminder
@@ -717,4 +774,5 @@
 
           // If never reminded before, send reminder and set reminder True
+          // -------------------------------------------------------------
           if (!$reminder and isset($conf_UAM[32]) and $conf_UAM[32] == 'true')
           {
@@ -722,4 +780,5 @@
           
             // Get current user informations
+            // -----------------------------
             $query = "
 SELECT id, username, mail_address
@@ -733,5 +792,6 @@
           elseif ($reminder) // If user already reminded for account validation
           {
-            // delete account
+            // Delete account
+            // --------------
             delete_user($user_id);
           }
@@ -756,4 +816,5 @@
 
 // Admin user management
+// ---------------------
   if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list')
   {
@@ -761,4 +822,5 @@
     {
       // Email without forbidden domains
+      // -------------------------------
       if (isset($conf_UAM[10]) and $conf_UAM[10] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email']))
       {
@@ -824,4 +886,5 @@
 
 // We have to get the user's language in database
+// ----------------------------------------------
   $query ='
 SELECT user_id, language
@@ -832,7 +895,9 @@
 
 // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
+// -------------------------------------------------------------------------------------------------------------------------------
   if (empty($data))
   {
 // And switch gallery to this language before using personalized and multilangual contents
+// ---------------------------------------------------------------------------------------
     $language = pwg_get_session_var( 'lang_switch', $user['language'] );
     switch_lang_to($language);
@@ -841,5 +906,6 @@
   {
 // And switch gallery to this language before using personalized and multilangual contents
-    $language = $data['language']; // Usefull for debugging
+// ---------------------------------------------------------------------------------------
+    //$language = $data['language']; // Usefull for debugging
     switch_lang_to($data['language']);
     load_language('plugin.lang', UAM_PATH);
@@ -855,4 +921,5 @@
       {
         // Management of Extension flags ([username], [mygallery], [myurl])
+        // ----------------------------------------------------------------
         $patterns[] = '#\[username\]#i';
         $replacements[] = $username;
@@ -907,5 +974,5 @@
   }
 
-  if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and $confirm)
+  if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and $confirm) // Add confirmation link ?
   {
     $infos2 = array
@@ -915,7 +982,8 @@
     );
 
-    if (isset($conf_UAM[9]) and $conf_UAM[9] <> '')
+    if (isset($conf_UAM[9]) and $conf_UAM[9] <> '') // Add personal text in confirmation email ?
     {
       // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
+      // -------------------------------------------------------------------------
       $patterns[] = '#\[username\]#i';
       $replacements[] = $username;
@@ -965,4 +1033,5 @@
 
 // Sending the email with subject and contents
+// -------------------------------------------
   pwg_mail($email, array(
     'subject' => $subject,
@@ -971,4 +1040,5 @@
 
 // Switching back to default language
+// ----------------------------------
 switch_lang_back();
 }
@@ -992,4 +1062,5 @@
   
 // We have to get the user's language in database
+// ----------------------------------------------
   $query ='
 SELECT user_id, language
@@ -1001,4 +1072,5 @@
   
 // And switch gallery to this language before using personalized and multilangual contents
+// ---------------------------------------------------------------------------------------
   switch_lang_to($data['language']);
    
@@ -1013,4 +1085,5 @@
       {
         // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
+        // -------------------------------------------------------------------------
         $patterns[] = '#\[username\]#i';
         $replacements[] = $username;
@@ -1039,5 +1112,6 @@
 			}
 
-// Set reminder true      
+// Set reminder true 
+// -----------------     
       $query = "
 UPDATE ".USER_CONFIRM_MAIL_TABLE."
@@ -1055,4 +1129,5 @@
       {
         // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
+        // -------------------------------------------------------------------------
         $patterns[] = '#\[username\]#i';
         $replacements[] = $username;
@@ -1075,5 +1150,6 @@
       }
       
-// Set reminder true      
+// Set reminder true
+// -----------------
       $query = "
 UPDATE ".USER_CONFIRM_MAIL_TABLE."
@@ -1092,4 +1168,5 @@
 
 // Switching back to default language
+// ----------------------------------
 switch_lang_back();
 }
@@ -1113,4 +1190,5 @@
 
 // We have to get the user's language in database
+// ----------------------------------------------
   $query ='
 SELECT user_id, language
@@ -1122,4 +1200,5 @@
 
 // And switch gallery to this language before using personalized and multilangual contents
+// ---------------------------------------------------------------------------------------
   switch_lang_to($data['language']);
    
@@ -1131,4 +1210,5 @@
   {
     // Management of Extension flags ([username], [mygallery], [myurl], [days])
+    // ------------------------------------------------------------------------
     $patterns[] = '#\[username\]#i';
     $replacements[] = $username;
@@ -1158,4 +1238,5 @@
 
 // Switching back to default language
+// ----------------------------------
 switch_lang_back();
 }
@@ -1179,4 +1260,5 @@
 
 // We have to get the user's language in database
+// ----------------------------------------------
   $query ='
 SELECT user_id, language
@@ -1187,7 +1269,9 @@
 
 // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
+// -------------------------------------------------------------------------------------------------------------------------------
   if (empty($data))
   {
 // And switch gallery to this language before using personalized and multilangual contents
+// ---------------------------------------------------------------------------------------
     $language = pwg_get_session_var( 'lang_switch', $user['language'] );
     switch_lang_to($language);
@@ -1196,4 +1280,5 @@
   {
 // And switch gallery to this language before using personalized and multilangual contents
+// ---------------------------------------------------------------------------------------
     $language = $data['language']; // Usefull for debugging
     switch_lang_to($data['language']);
@@ -1206,4 +1291,5 @@
   {
     // Management of Extension flags ([username], [mygallery], [myurl])
+    // ----------------------------------------------------------------
     $patterns[] = '#\[username\]#i';
     $replacements[] = stripslashes($username);
@@ -1235,4 +1321,5 @@
 
 // Sending the email with subject and contents
+// -------------------------------------------
   pwg_mail($email, array(
     'subject' => $subject,
@@ -1241,4 +1328,5 @@
 
 // Switching back to default language
+// ----------------------------------
 switch_lang_back();
 }
@@ -1262,4 +1350,5 @@
 
 // We have to get the user's language in database
+// ----------------------------------------------
   $query ='
 SELECT user_id, language
@@ -1270,7 +1359,9 @@
 
 // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
+// -------------------------------------------------------------------------------------------------------------------------------
   if (empty($data))
   {
 // And switch gallery to this language before using personalized and multilangual contents
+// ---------------------------------------------------------------------------------------
     $language = pwg_get_session_var( 'lang_switch', $user['language'] );
     switch_lang_to($language);
@@ -1279,4 +1370,5 @@
   {
 // And switch gallery to this language before using personalized and multilangual contents
+// ---------------------------------------------------------------------------------------
     $language = $data['language']; // Usefull for debugging
     switch_lang_to($data['language']);
@@ -1285,4 +1377,5 @@
 
 // Retreive users email and user name from id
+// ------------------------------------------
   $query ='
 SELECT id, username, mail_address
@@ -1297,4 +1390,5 @@
   {
     // Management of Extension flags ([username], [mygallery], [myurl])
+    // ----------------------------------------------------------------
     $patterns[] = '#\[username\]#i';
     $replacements[] = $result['username'];
@@ -1318,4 +1412,5 @@
 
 // Sending the email with subject and contents
+// -------------------------------------------
   pwg_mail($result['mail_address'], array(
     'subject' => $subject,
@@ -1324,4 +1419,5 @@
 
 // Switching back to default language
+// ----------------------------------
 switch_lang_back();
 }
@@ -1387,4 +1483,5 @@
 
     // Delete user from all groups
+    // ---------------------------
     $query = "
 DELETE FROM ".USER_GROUP_TABLE."
@@ -1399,4 +1496,5 @@
 
     // Set user unvalidated status
+    // ---------------------------
     if (!is_admin() and $conf_UAM[7] <> -1)
     {
@@ -1410,4 +1508,5 @@
 
     // Set user unvalidated group
+    // --------------------------
     if (!is_admin() and $conf_UAM[2] <> -1)
     {
@@ -1422,4 +1521,5 @@
 
     // Set user unvalidated privacy level
+    // ----------------------------------
     if (!is_admin() and $conf_UAM[35] <> -1)
     {
@@ -1451,4 +1551,5 @@
 
 // Groups cleanup
+// --------------
   $query = "
 DELETE FROM ".USER_GROUP_TABLE."
@@ -1661,7 +1762,9 @@
       {
 				// Verify Confirmmail with time limit ON
+        // -------------------------------------
 				if (isset ($conf_UAM_ConfirmMail[1]))
 				{
-					// dates formating and compare
+					// Dates formating and compare
+          // ---------------------------
 					$today = date("d-m-Y"); // Get today's date
 					list($day, $month, $year) = explode('-', $today); // explode date of today						 
@@ -1676,9 +1779,11 @@
 
 					// 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 
+            // Update ConfirmMail table
+            // ------------------------
 						$query = '
 UPDATE '.USER_CONFIRM_MAIL_TABLE.'
@@ -1689,5 +1794,6 @@
 
             // Update LastVisit table - Force reminder field to false
-            // Usefull when a user has been automatically downgraded and revalidate its registration  
+            // Usefull when a user has been automatically downgraded and revalidate its registration
+            // -------------------------------------------------------------------------------------
 						$query = '
 UPDATE '.USER_LASTVISIT_TABLE.'
@@ -1739,4 +1845,5 @@
 
 						// Refresh user's category cache
+            // -----------------------------
 						invalidate_user_cache();
   
@@ -1749,9 +1856,11 @@
 				}
 				// Verify Confirmmail with time limit OFF
+        // --------------------------------------
 				else
 				{
 					list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
 
-          // Update ConfirmMail table 
+          // Update ConfirmMail table
+          // ------------------------
 					$query = '
 UPDATE '.USER_CONFIRM_MAIL_TABLE.'
@@ -1762,5 +1871,6 @@
 
           // Update LastVisit table - Force reminder field to false
-          // Usefull when a user has been automatically downgraded and revalidate its registration  
+          // Usefull when a user has been automatically downgraded and revalidate its registration
+          // -------------------------------------------------------------------------------------
 					$query = '
 UPDATE '.USER_LASTVISIT_TABLE.'
@@ -1819,4 +1929,5 @@
 
 					// Refresh user's category cache
+          // -----------------------------
 					invalidate_user_cache();
   
@@ -2039,11 +2150,14 @@
           
 	// Get ConfirmMail configuration
+  // -----------------------------
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
   // Get UAM configuration
+  // ---------------------
   $conf_UAM = unserialize($conf['UserAdvManager']);
   
   $users = array();
 
-	// search users depending expiration date
+	// Search users depending expiration date
+  // --------------------------------------
   $query = '
 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
@@ -2092,5 +2206,6 @@
 	}
 
-	// add group lists
+	// Add groups list
+  // ---------------
   $user_ids = array();
   foreach ($users as $i => $user)
@@ -2136,4 +2251,5 @@
           
 	// Get ConfirmMail configuration
+  // -----------------------------
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
   
@@ -2141,4 +2257,5 @@
 
 	// search users depending expiration date
+  // --------------------------------------
   $query = '
 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
@@ -2176,5 +2293,6 @@
   $users = array();
 
-	// search users depending expiration date
+	// Search users depending expiration date
+  // --------------------------------------
   $query = '
 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
@@ -2199,5 +2317,6 @@
 	}
 
-	// add group lists
+	// Add groups list
+  // ---------------
   $user_ids = array();
   foreach ($users as $i => $user)
@@ -2224,5 +2343,6 @@
   $users = array();
   
-	// search users depending expiration date and reminder sent
+	// Search users depending expiration date and reminder sent
+  // --------------------------------------------------------
   $query = '
 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
@@ -2257,5 +2377,6 @@
   $users = array();
 
-	// search users depending expiration date
+	// Search users depending expiration date
+  // --------------------------------------
   $query = '
 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
@@ -2280,5 +2401,6 @@
 	}
 
-	// add group lists
+	// Add groups list
+  // ---------------
   $user_ids = array();
   foreach ($users as $i => $user)
@@ -2304,7 +2426,9 @@
           
 	// Get ConfirmMail configuration
+  // -----------------------------
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
           
 	// Get UAM configuration
+  // ---------------------
   $conf_UAM = unserialize($conf['UserAdvManager']);
 	
@@ -2320,5 +2444,6 @@
 	if (!empty($registration_date))
   {
-		// dates formating and compare
+		// Dates formating and compare
+    // ---------------------------
 		$today = date("d-m-Y"); // Get today's date
 		list($day, $month, $year) = explode('-', $today); // explode date of today						 
@@ -2333,4 +2458,5 @@
 
 		// Condition with the value set for time limit
+    // -------------------------------------------
 		if ($deltadays <= $conf_UAM_ConfirmMail[1]) // If Nb of days is less than the limit set
 		{
@@ -2358,4 +2484,5 @@
 
   // Initialisation des variables - Variables initiation
+  // ---------------------------------------------------
   $points = 0;
   $point_lowercase = 0;
@@ -2364,5 +2491,6 @@
   $point_characters = 0;
 
-  // On récupère la longueur du mot de passe - Getting password lengh	
+  // On récupère la longueur du mot de passe - Getting password lengh
+  // ----------------------------------------------------------------
   $length = strlen($password);
   
@@ -2372,4 +2500,5 @@
     // 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
+    // -------------------------------------------------------------------------
     $letters = $password[$i];
 
@@ -2377,7 +2506,9 @@
     {
       // 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
+      // --------------------------------------------------------------------------
 		  $point_lowercase = 1;
     }
@@ -2385,7 +2516,9 @@
     {
       // On ajoute 2 points pour une majuscule - Adding 2 points to score for uppercase
+      // ------------------------------------------------------------------------------
       $points = $points + 2;
 		
       // On rajoute le bonus pour une majuscule - Adding bonus points for uppercase
+      // --------------------------------------------------------------------------
       $point_uppercase = 2;
     }
@@ -2393,7 +2526,9 @@
     {
       // On ajoute 3 points pour un chiffre - Adding 3 points to score for numbers
+      // -------------------------------------------------------------------------
       $points = $points + 3;
 		
       // On rajoute le bonus pour un chiffre - Adding bonus points for numbers
+      // ---------------------------------------------------------------------
       $point_numbers = 3;
     }
@@ -2401,7 +2536,9 @@
     {
       // On ajoute 5 points pour un caractère autre - 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
+      // ----------------------------------------------------------------------------------------
       $point_characters = 5;
     }
@@ -2409,13 +2546,17 @@
 
   // Calcul du coefficient points/longueur - 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...
+  // ---------------------------------------------------------------------------------------------------------------------
   $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
+  // --------------------------------------------------------------------------------------------------------------------------------------------
   $score = $step1 * $step2;
 
   // Multiplication du resultat par la longueur de la chaine - Multiplying the result by the length of the string
+  // ------------------------------------------------------------------------------------------------------------
   $finalscore = $score * $length;
 
@@ -2486,4 +2627,5 @@
   }
 // IMPORTANT SECURITY !
+// --------------------
   $plugin = array_map('htmlspecialchars', $plugin);
 
@@ -2619,4 +2761,5 @@
 
   // Query to get informations in database
+  // -------------------------------------
   if (!empty($user_ids))
   {
@@ -2659,4 +2802,5 @@
   
   // Initial backup folder creation and file initialisation
+  // ------------------------------------------------------
   if (!is_dir(UAM_PATH.'/include/backup'))
     mkdir(UAM_PATH.'/include/backup');
@@ -2668,4 +2812,5 @@
 
   // Saving UAM specific tables
+  // --------------------------
   $ListTables = array(USER_CONFIRM_MAIL_TABLE, USER_LASTVISIT_TABLE);
   $j=0;
@@ -2708,4 +2853,5 @@
   
   // Saving UAM configuration
+  // ------------------------
   $insertions = "-- -------------------------------------------------------\n";
   $insertions .= "-- Insert UAM configuration in ".CONFIG_TABLE."\n";
@@ -2734,4 +2880,5 @@
 
   // Download generated dump file
+  // ----------------------------
   if ($download == 'true')
   {
Index: extensions/UserAdvManager/trunk/include/upgradedb.inc.php
===================================================================
--- extensions/UserAdvManager/trunk/include/upgradedb.inc.php	(revision 12247)
+++ extensions/UserAdvManager/trunk/include/upgradedb.inc.php	(revision 12271)
@@ -29,8 +29,10 @@
 {  
   // Get current plugin version
+  // --------------------------
   $plugin =  PluginInfos(UAM_PATH);
   $version = $plugin['version'];
 
   // Update plugin version in #_config table
+  // ---------------------------------------
   $query = '
 UPDATE '.CONFIG_TABLE.'
@@ -45,4 +47,5 @@
 // Check #_plugin table consistency
 // Only useful if a previous version upgrade has not worked correctly (rare case)
+// ------------------------------------------------------------------------------
   $query = '
 SELECT version
@@ -133,4 +136,5 @@
 {
   // Create missing table
+  // --------------------
   $query = "
 ALTER TABLE ".USER_CONFIRM_MAIL_TABLE."
@@ -141,4 +145,5 @@
 
   // Upgrade plugin configuration
+  // ----------------------------
 	global $conf;
 
@@ -191,4 +196,5 @@
 
   // Changing parameter name
+  // -----------------------
   $q = '
 UPDATE '.CONFIG_TABLE.'
@@ -206,4 +212,5 @@
 
   // Upgrading ConfirmMail options
+  // -----------------------------
   $query = '
 SELECT value
@@ -235,4 +242,5 @@
 
   // Upgrading options
+  // -----------------
   $query = '
 SELECT value
@@ -289,4 +297,5 @@
 
   // Upgrading options
+  // -----------------
   $query = '
 SELECT value
@@ -313,4 +322,5 @@
 
   // Insert a new config entry for futur plugin's version check
+  // ----------------------------------------------------------
   $query = '
 INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
@@ -329,4 +339,5 @@
 
   // Upgrading options
+  // -----------------
   $query = '
 SELECT value
@@ -352,4 +363,5 @@
 
   // Create new UAM entry in plugins table
+  // -------------------------------------
   $uam_new_version = "2.20.0";
 
@@ -361,5 +373,6 @@
   pwg_query($query);
 
-  // Delete old plugin entry in plugins table 
+  // Delete old plugin entry in plugins table
+  // ----------------------------------------
   $query = '
 DELETE FROM '.PLUGINS_TABLE.'
@@ -370,5 +383,6 @@
   pwg_query($query);
 
-  // rename directory
+  // Rename directory
+  // ----------------
   if (!rename(PHPWG_PLUGINS_PATH.'NBC_UserAdvManager', PHPWG_PLUGINS_PATH.'UserAdvManager'))
   {
@@ -384,4 +398,5 @@
 
   // Upgrading options
+  // -----------------
   $query = '
 SELECT value
@@ -409,4 +424,5 @@
 
   // Upgrading options
+  // -----------------
   $query = '
 SELECT value
@@ -435,4 +451,5 @@
 
   // Upgrading options
+  // -----------------
   $query = '
 SELECT value
@@ -447,4 +464,5 @@
 
   // Refactoring all configuration options
+  // -------------------------------------
   $Newconf_UAM[0] = $Newconf_UAM[0];
   $Newconf_UAM[1] = $Newconf_UAM[1];
@@ -484,4 +502,5 @@
   
   // unset obsolete conf
+  // -------------------
   unset ($Newconf_UAM[35]);
   unset ($Newconf_UAM[36]);
@@ -501,4 +520,5 @@
 
   // Upgrading options
+  // -----------------
   $query = '
 SELECT value
@@ -522,4 +542,5 @@
 
   // Piwigo's native tables modifications for password reset function - Add pwdreset column
+  // --------------------------------------------------------------------------------------
   $query = '
 SHOW COLUMNS FROM '.USERS_TABLE.'
