Index: /extensions/NBC_UserAdvManager/trunk/ConfirmMail.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/ConfirmMail.php	(revision 6353)
+++ /extensions/NBC_UserAdvManager/trunk/ConfirmMail.php	(revision 6354)
@@ -14,15 +14,4 @@
 load_language('plugin.lang', UAM_PATH);
 
-/**
- * set in ./language/en_UK.iso-8859-1/local.lang.php (maybe to create)
- * for example for clear theme:
-  $lang['Theme: clear'] = 'This is the clear theme based on yoga template. '.
-  ' A standard template/theme of PhpWebgallery.';
- *
- * Don't forget php tags !!!
- *
- * Another way is to code it thru the theme itself in ./themeconf.inc.php
- */
-
 $title= l10n('confirm_mail_page_title');
 $page['body_id'] = 'theAboutPage';
@@ -31,4 +20,5 @@
 @include(PHPWG_ROOT_PATH.'template/'.$user['template'].
   '/theme/'.$user['theme'].'/themeconf.inc.php');
+
 
 if (isset($_GET['key']))
Index: /extensions/NBC_UserAdvManager/trunk/admin/UAM_admin.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/UAM_admin.php	(revision 6353)
+++ /extensions/NBC_UserAdvManager/trunk/admin/UAM_admin.php	(revision 6354)
@@ -102,5 +102,5 @@
   case 'global':
 
-	if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_No_Casse']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_No_Comment_Anonymous']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail']))
+	if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_No_Comment_Anonymous']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail']))
   {
 
@@ -122,5 +122,4 @@
 		$newconf_UAM = array(
       $_POST['UAM_Mail_Info'],
-      $_POST['UAM_No_Casse'],
       $_POST['UAM_Confirm_Mail'],
       (isset($_POST['UAM_No_Confirm_Group'])?$_POST['UAM_No_Confirm_Group']:''),
@@ -220,10 +219,10 @@
     $groups[$row['id']] = $row['name'];
 /* configuration value for unvalidated users */
+    if (isset($conf_UAM[2]) and $conf_UAM[2] == $row['id'])
+    {
+	  	$No_Valid = $row['id'];
+		}
+/* configuration value for validated users */
     if (isset($conf_UAM[3]) and $conf_UAM[3] == $row['id'])
-    {
-	  	$No_Valid = $row['id'];
-		}
-/* configuration value for validated users */
-    if (isset($conf_UAM[4]) and $conf_UAM[4] == $row['id'])
 		{
 	  	$Valid = $row['id'];
@@ -257,5 +256,5 @@
   {
 	  $status_options[$status] = l10n('user_status_'.$status);
-	  if (isset($conf_UAM[9]) and $conf_UAM[9] == $status)
+	  if (isset($conf_UAM[8]) and $conf_UAM[8] == $status)
 	  {
 	    $No_Valid_Status = $status;
@@ -276,5 +275,5 @@
   {
 	  $status_options[$status] = l10n('user_status_'.$status);
-	  if (isset($conf_UAM[5]) and $conf_UAM[5] == $status)
+	  if (isset($conf_UAM[4]) and $conf_UAM[4] == $status)
 		{
 		  $Valid_Status = $status;
@@ -305,35 +304,33 @@
 		'UAM_MAIL_INFO_TRUE'             => $conf_UAM[0]=='true' ?  'checked="checked"' : '' ,
 		'UAM_MAIL_INFO_FALSE'            => $conf_UAM[0]=='false' ?  'checked="checked"' : '' ,
-		'UAM_MAILINFO_TEXT'              => $conf_UAM[10],
-		'UAM_NO_CASSE_TRUE'              => $conf_UAM[1]=='true' ?  'checked="checked"' : '' ,
-		'UAM_NO_CASSE_FALSE'             => $conf_UAM[1]=='false' ?  'checked="checked"' : '' ,
-		'UAM_USERNAME_CHAR_TRUE'         => $conf_UAM[7]=='true' ?  'checked="checked"' : '' ,
-		'UAM_USERNAME_CHAR_FALSE'        => $conf_UAM[7]=='false' ?  'checked="checked"' : '' ,
-		'UAM_USERNAME_CHAR_LIST'         => $conf_UAM[8],
-		'UAM_CONFIRM_MAIL_TRUE'          => $conf_UAM[2]=='true' ?  'checked="checked"' : '' ,
-		'UAM_CONFIRM_MAIL_FALSE'         => $conf_UAM[2]=='false' ?  'checked="checked"' : '' ,
-		'UAM_CONFIRMMAIL_TEXT'           => $conf_UAM[11],
-		'UAM_No_Confirm_Group'           => $conf_UAM[3],
-		'UAM_Validated_Group'            => $conf_UAM[4],
-		'UAM_No_Confirm_Status'          => $conf_UAM[9],
-		'UAM_Validated_Status'           => $conf_UAM[5],
-		'UAM_NO_COMMENT_ANO_TRUE'        => $conf_UAM[6]=='true' ?  'checked="checked"' : '' ,
-		'UAM_NO_COMMENT_ANO_FALSE'       => $conf_UAM[6]=='false' ?  'checked="checked"' : '' ,
-		'UAM_MAILEXCLUSION_TRUE'         => $conf_UAM[12]=='true' ?  'checked="checked"' : '' ,
-		'UAM_MAILEXCLUSION_FALSE'        => $conf_UAM[12]=='false' ?  'checked="checked"' : '' ,
-		'UAM_MAILEXCLUSION_LIST'         => $conf_UAM[13],
-		'UAM_PASSWORDENF_TRUE'           => $conf_UAM[14]=='true' ?  'checked="checked"' : '' ,
-		'UAM_PASSWORDENF_FALSE'          => $conf_UAM[14]=='false' ?  'checked="checked"' : '' ,
-		'UAM_PASSWORD_SCORE'             => $conf_UAM[15],
-    'UAM_ADMINPASSWENF_TRUE'         => $conf_UAM[16]=='true' ?  'checked="checked"' : '' ,
-		'UAM_ADMINPASSWENF_FALSE'        => $conf_UAM[16]=='false' ?  'checked="checked"' : '' ,
-    'UAM_GHOSTRACKER_TRUE'           => $conf_UAM[17]=='true' ?  'checked="checked"' : '' ,
-		'UAM_GHOSTRACKER_FALSE'          => $conf_UAM[17]=='false' ?  'checked="checked"' : '' ,
-    'UAM_GHOSTRACKER_DAYLIMIT'       => $conf_UAM[18],
-    'UAM_GHOSTRACKER_REMINDERTEXT'   => $conf_UAM[19],
-    'UAM_ADDLASTVISIT_TRUE'          => $conf_UAM[20]=='true' ?  'checked="checked"' : '' ,
-    'UAM_ADDLASTVISIT_FALSE'         => $conf_UAM[20]=='false' ?  'checked="checked"' : '' ,
-    'UAM_ADMINCONFMAIL_TRUE'         => $conf_UAM[21]=='true' ?  'checked="checked"' : '' ,
-    'UAM_ADMINCONFMAIL_FALSE'        => $conf_UAM[21]=='false' ?  'checked="checked"' : '' ,
+		'UAM_MAILINFO_TEXT'              => $conf_UAM[9],
+		'UAM_USERNAME_CHAR_TRUE'         => $conf_UAM[6]=='true' ?  'checked="checked"' : '' ,
+		'UAM_USERNAME_CHAR_FALSE'        => $conf_UAM[6]=='false' ?  'checked="checked"' : '' ,
+		'UAM_USERNAME_CHAR_LIST'         => $conf_UAM[7],
+		'UAM_CONFIRM_MAIL_TRUE'          => $conf_UAM[1]=='true' ?  'checked="checked"' : '' ,
+		'UAM_CONFIRM_MAIL_FALSE'         => $conf_UAM[1]=='false' ?  'checked="checked"' : '' ,
+		'UAM_CONFIRMMAIL_TEXT'           => $conf_UAM[10],
+		'UAM_No_Confirm_Group'           => $conf_UAM[2],
+		'UAM_Validated_Group'            => $conf_UAM[3],
+		'UAM_No_Confirm_Status'          => $conf_UAM[8],
+		'UAM_Validated_Status'           => $conf_UAM[4],
+		'UAM_NO_COMMENT_ANO_TRUE'        => $conf_UAM[5]=='true' ?  'checked="checked"' : '' ,
+		'UAM_NO_COMMENT_ANO_FALSE'       => $conf_UAM[5]=='false' ?  'checked="checked"' : '' ,
+		'UAM_MAILEXCLUSION_TRUE'         => $conf_UAM[11]=='true' ?  'checked="checked"' : '' ,
+		'UAM_MAILEXCLUSION_FALSE'        => $conf_UAM[11]=='false' ?  'checked="checked"' : '' ,
+		'UAM_MAILEXCLUSION_LIST'         => $conf_UAM[12],
+		'UAM_PASSWORDENF_TRUE'           => $conf_UAM[13]=='true' ?  'checked="checked"' : '' ,
+		'UAM_PASSWORDENF_FALSE'          => $conf_UAM[13]=='false' ?  'checked="checked"' : '' ,
+		'UAM_PASSWORD_SCORE'             => $conf_UAM[14],
+    'UAM_ADMINPASSWENF_TRUE'         => $conf_UAM[15]=='true' ?  'checked="checked"' : '' ,
+		'UAM_ADMINPASSWENF_FALSE'        => $conf_UAM[15]=='false' ?  'checked="checked"' : '' ,
+    'UAM_GHOSTRACKER_TRUE'           => $conf_UAM[16]=='true' ?  'checked="checked"' : '' ,
+		'UAM_GHOSTRACKER_FALSE'          => $conf_UAM[16]=='false' ?  'checked="checked"' : '' ,
+    'UAM_GHOSTRACKER_DAYLIMIT'       => $conf_UAM[17],
+    'UAM_GHOSTRACKER_REMINDERTEXT'   => $conf_UAM[18],
+    'UAM_ADDLASTVISIT_TRUE'          => $conf_UAM[19]=='true' ?  'checked="checked"' : '' ,
+    'UAM_ADDLASTVISIT_FALSE'         => $conf_UAM[19]=='false' ?  'checked="checked"' : '' ,
+    'UAM_ADMINCONFMAIL_TRUE'         => $conf_UAM[20]=='true' ?  'checked="checked"' : '' ,
+    'UAM_ADMINCONFMAIL_FALSE'        => $conf_UAM[20]=='false' ?  'checked="checked"' : '' ,
 		'UAM_PASSWORD_TEST_SCORE'        => $UAM_Password_Test_Score,
     'UAM_ERROR_REPORTS4'             => $UAM_Exclusionlist_Error,
@@ -355,5 +352,5 @@
 		
 /* username insensible a la casse */
-    if (isset($conf_UAM[3]) and $conf_UAM[3] == 'true')
+    if (isset($conf_UAM[2]) and $conf_UAM[2] == 'true')
 	  {
 			$query = "
@@ -379,5 +376,5 @@
 		
 /* Username without forbidden keys */
-    if ( isset($conf_UAM[7]) and $conf_UAM[7] == 'true' )
+    if ( isset($conf_UAM[6]) and $conf_UAM[6] == 'true' )
 	  {
 			$query = "
@@ -398,5 +395,5 @@
 		
 /* Email without forbidden domain */
-    if ( isset($conf_UAM[12]) and $conf_UAM[12] == 'true' )
+    if ( isset($conf_UAM[11]) and $conf_UAM[11] == 'true' )
 	  {
 			$query = "
@@ -409,5 +406,5 @@
 		  while($row = pwg_db_fetch_assoc($result))
 		  {
-			  $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[13]);
+			  $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[12]);
 			  for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
 			  {
@@ -467,5 +464,5 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
   
-  if (isset($conf_UAM[20]) and $conf_UAM[20]=='true')
+  if (isset($conf_UAM[19]) and $conf_UAM[19]=='true')
   {
 // +-----------------------------------------------------------------------+
@@ -555,17 +552,17 @@
       $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
       
-      if (isset($conf_UAM[17]) and $conf_UAM[17]=='true' and $conf_UAM[18] <> '')
+      if (isset($conf_UAM[16]) and $conf_UAM[16]=='true' and $conf_UAM[17] <> '')
       {
-        if ($deltadays <= ($conf_UAM[18]/2))
+        if ($deltadays <= ($conf_UAM[17]/2))
         {
           $display = 'green';
         }
         
-        if (($deltadays > ($conf_UAM[18]/2)) and ($deltadays < $conf_UAM[18]))
+        if (($deltadays > ($conf_UAM[17]/2)) and ($deltadays < $conf_UAM[17]))
         {
           $display = 'orange';
         }
         
-        if ($deltadays >= $conf_UAM[18])
+        if ($deltadays >= $conf_UAM[17])
         {
           $display = 'red';
@@ -629,5 +626,5 @@
   $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
 	
-  if (isset($conf_UAM[2]) and $conf_UAM[2]=='true' and ((isset($conf_UAM[3]) and $conf_UAM[3] <> '-1') or (isset($conf_UAM[9]) and $conf_UAM[9] <> '-1')) and isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0]=='true')
+  if (isset($conf_UAM[1]) and $conf_UAM[1]=='true' and ((isset($conf_UAM[2]) and $conf_UAM[2] <> '-1') or (isset($conf_UAM[8]) and $conf_UAM[8] <> '-1')) and isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0]=='true')
   {
 // +-----------------------------------------------------------------------+
@@ -1181,5 +1178,5 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
 	
-  if (isset($conf_UAM[17]) and $conf_UAM[17]=='true')
+  if (isset($conf_UAM[16]) and $conf_UAM[16]=='true')
   {
 // +-----------------------------------------------------------------------+
Index: /extensions/NBC_UserAdvManager/trunk/admin/template/global.tpl
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/template/global.tpl	(revision 6353)
+++ /extensions/NBC_UserAdvManager/trunk/admin/template/global.tpl	(revision 6354)
@@ -69,15 +69,4 @@
       <fieldset>
         <ul>
-          <li>
-            <label class="cluetip" title="{'UAM_casenTitle'|translate}|{'UAM_casenTitle_d'|translate}">
-              {'UAM_No_Casse'|@translate}
-            </label>
-          <br><br>
-            <input type="radio" value="false" {$UAM_NO_CASSE_FALSE} name="UAM_No_Casse">
-              {'UAM_No_Casse_false'|@translate}<br>
-            <input type="radio" value="true" {$UAM_NO_CASSE_TRUE} name="UAM_No_Casse">
-              {'UAM_No_Casse_true'|@translate}<br><br>
-          </li>
-      
           <li>
             <label class="cluetip" title="{'UAM_carexcTitle'|translate}|{'UAM_carexcTitle_d'|translate}">
Index: /extensions/NBC_UserAdvManager/trunk/include/functions.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/include/functions.inc.php	(revision 6353)
+++ /extensions/NBC_UserAdvManager/trunk/include/functions.inc.php	(revision 6354)
@@ -45,11 +45,11 @@
       $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
       
-      if (isset($conf_UAM[10]) and $conf_UAM[10] <> '')
+      if (isset($conf_UAM[9]) and $conf_UAM[9] <> '')
       {
         if (function_exists('get_user_language_desc'))
         {
-          $infos1_perso = get_user_language_desc($conf_UAM[10])."\n\n";
+          $infos1_perso = get_user_language_desc($conf_UAM[9])."\n\n";
         }
-        else $infos1_perso = l10n($conf_UAM[10])."\n\n"; 
+        else $infos1_perso = l10n($conf_UAM[9])."\n\n"; 
       }
       
@@ -81,5 +81,5 @@
 
 
-  if ( isset($conf_UAM[2]) and $conf_UAM[2] == 'true' and $confirm)
+  if ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and $confirm)
   {
     $infos2 = array
@@ -89,11 +89,11 @@
     );
 
-    if (isset($conf_UAM[11]) and $conf_UAM[11] <> '')
+    if (isset($conf_UAM[10]) and $conf_UAM[10] <> '')
     {
       if (function_exists('get_user_language_desc'))
       {
-        $infos2_perso = get_user_language_desc($conf_UAM[11])."\n\n";
+        $infos2_perso = get_user_language_desc($conf_UAM[10])."\n\n";
       }
-      else $infos2_perso = l10n($conf_UAM[11])."\n\n";
+      else $infos2_perso = l10n($conf_UAM[10])."\n\n";
     }
   }
@@ -275,13 +275,13 @@
   $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Ghost_reminder_of_%s', $username));     
 
-  if (isset($conf_UAM[19]) and $conf_UAM[19] <> '' and isset($conf_UAM[17]) and $conf_UAM[17] == 'true')
+  if (isset($conf_UAM[18]) and $conf_UAM[18] <> '' and isset($conf_UAM[16]) and $conf_UAM[16] == 'true')
   {
     if (function_exists('get_user_language_desc'))
     {
-      $infos1 = get_user_language_desc($conf_UAM[19])."\n\n";
+      $infos1 = get_user_language_desc($conf_UAM[18])."\n\n";
     }
     else
     {
-      $infos1 = l10n($conf_UAM[19])."\n\n";
+      $infos1 = l10n($conf_UAM[18])."\n\n";
     }
 
@@ -359,16 +359,16 @@
 WHERE user_id = '".$user_id."'
   AND (
+    group_id = '".$conf_UAM[2]."'
+  OR 
     group_id = '".$conf_UAM[3]."'
-  OR 
-    group_id = '".$conf_UAM[4]."'
   )
 ;";
     pwg_query($query);
 
-    if (!is_admin() and $conf_UAM[9] <> -1)
+    if (!is_admin() and $conf_UAM[8] <> -1)
     {
       $query = "
 UPDATE ".USER_INFOS_TABLE."
-SET status = '".$conf_UAM[9]."'
+SET status = '".$conf_UAM[8]."'
 WHERE user_id = '".$user_id."'
 ;";
@@ -376,5 +376,5 @@
     }
 
-    if ( $conf_UAM[3] <> -1 )
+    if ( $conf_UAM[2] <> -1 )
     {
       $query = "
@@ -382,5 +382,5 @@
   (user_id, group_id)
 VALUES
-  ('".$user_id."', '".$conf_UAM[3]."')
+  ('".$user_id."', '".$conf_UAM[2]."')
 ;";
       pwg_query($query);
@@ -525,15 +525,15 @@
 						pwg_query($query);
       
-						if ($conf_UAM[3] <> -1) // Delete user from unvalidated users group
+						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[3]."'
+  AND group_id = '".$conf_UAM[2]."'
 ;";
 							pwg_query($query);
 						}
 	    
-						if ($conf_UAM[4] <> -1) // Add user to validated users group 
+						if ($conf_UAM[3] <> -1) // Add user to validated users group 
 						{
 							$query = "
@@ -541,14 +541,14 @@
   (user_id, group_id)
 VALUES
-  ('".$data['user_id']."', '".$conf_UAM[4]."')
+  ('".$data['user_id']."', '".$conf_UAM[3]."')
 ;";
 							pwg_query($query);
 						}
 
-						if (($conf_UAM[5] <> -1 or isset($data['status']))) // Change user's status
+						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[5])."'
+SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[4])."'
 WHERE user_id = '".$data['user_id']."'
 ;";
@@ -577,4 +577,14 @@
 					pwg_query($query);
       
+					if ($conf_UAM[2] <> -1)
+					{
+						$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)
 					{
@@ -585,14 +595,4 @@
 ;";
 						pwg_query($query);
-					}
-    
-					if ($conf_UAM[4] <> -1)
-					{
-						$query = "
-DELETE FROM ".USER_GROUP_TABLE."
-WHERE user_id = '".$data['user_id']."'
-AND group_id = '".$conf_UAM[4]."'
-;";
-						pwg_query($query);
 
 						$query = "
@@ -600,14 +600,14 @@
   (user_id, group_id)
 VALUES
-  ('".$data['user_id']."', '".$conf_UAM[4]."')
+  ('".$data['user_id']."', '".$conf_UAM[3]."')
 ;";
 						pwg_query($query);
 					}
 
-					if (($conf_UAM[5] <> -1 or isset($data['status'])))
+					if (($conf_UAM[4] <> -1 or isset($data['status'])))
 					{
 						$query = "
 UPDATE ".USER_INFOS_TABLE."
-SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[5])."'
+SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[4])."'
 WHERE user_id = '".$data['user_id']."'
 ;";
@@ -662,4 +662,14 @@
 			pwg_query($query);
 	     
+			if ($conf_UAM[2] <> -1)
+			{
+				$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)
 			{
@@ -668,14 +678,4 @@
 WHERE user_id = '".$data['user_id']."'
   AND group_id = '".$conf_UAM[3]."'
-;";
-				pwg_query($query);
-			}
-  
-			if ($conf_UAM[4] <> -1)
-			{
-				$query = "
-DELETE FROM ".USER_GROUP_TABLE."
-WHERE user_id = '".$data['user_id']."'
-  AND group_id = '".$conf_UAM[4]."'
 				;";
 				pwg_query($query);
@@ -685,14 +685,14 @@
   (user_id, group_id)
 VALUES
-  ('".$data['user_id']."', '".$conf_UAM[4]."')
+  ('".$data['user_id']."', '".$conf_UAM[3]."')
 ;";
 				pwg_query($query);
 			}
 
-			if (($conf_UAM[5] <> -1 or isset($data['status'])))
+			if (($conf_UAM[4] <> -1 or isset($data['status'])))
 			{
 				$query = "
 UPDATE ".USER_INFOS_TABLE."
-SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[5])."'
+SET status = '".(isset($data['status']) ? $data['status'] : $conf_UAM[4])."'
 WHERE user_id = '".$data['user_id']."'
 ;";
@@ -706,28 +706,4 @@
 }
 
-/* Function called from main.inc.php - Get username case insensitive */
-function NotSensibleSearchUsername($username)
-{
-  global $conf;
-  
-  if (isset($username))
-  {
-    $query = "
-SELECT ".$conf['user_fields']['username']."
-FROM ".USERS_TABLE."
-WHERE LOWER(".stripslashes($conf['user_fields']['username']).") = '".strtolower($username)."'
-;";
-    $users = pwg_db_num_rows(pwg_query($query));
-    if ($users > 0)
-    {
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-}
-
 
 /* Function called from main.inc.php - Check if username matches forbidden caracters */
@@ -738,7 +714,7 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
 
-  if (isset($login) and isset($conf_UAM[8]) and $conf_UAM[8] <> '')
-  {
-    $conf_CharExclusion = preg_split("/,/",$conf_UAM[8]);
+  if (isset($login) and isset($conf_UAM[7]) and $conf_UAM[7] <> '')
+  {
+    $conf_CharExclusion = preg_split("/,/",$conf_UAM[7]);
     for ($i = 0 ; $i < count($conf_CharExclusion) ; $i++)
     {
@@ -765,8 +741,8 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
   
-	if (isset($email) and isset($conf_UAM[13]) and $conf_UAM[13] <> '')
+	if (isset($email) and isset($conf_UAM[12]) and $conf_UAM[12] <> '')
 	{
 		//$ncsemail = strtolower($email);
-		$conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[13]);
+		$conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[12]);
 		for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++)
 		{
@@ -816,18 +792,18 @@
   OR TO_DAYS(NOW()) - TO_DAYS(ui.registration_date) < "'.$conf_UAM_ConfirmMail[1].'")';
 
-	if ($conf_UAM[3] <> '-1' and $conf_UAM[9] == '-1')
+	if ($conf_UAM[2] <> '-1' and $conf_UAM[8] == '-1')
   {
     $query.= '
-  AND ug.group_id = '.$conf_UAM[3];
-  }
-  if ($conf_UAM[3] == '-1' and $conf_UAM[9] <> '-1')
+  AND ug.group_id = '.$conf_UAM[2];
+  }
+  if ($conf_UAM[2] == '-1' and $conf_UAM[8] <> '-1')
   {
     $query.= '
-  AND ui.status = \''.$conf_UAM[9]."'";
-  }
-  if ($conf_UAM[3] <> '-1' and $conf_UAM[9] <> '-1')
+  AND ui.status = \''.$conf_UAM[8]."'";
+  }
+  if ($conf_UAM[2] <> '-1' and $conf_UAM[8] <> '-1')
   {
     $query.= '
-  AND ug.group_id = \''.$conf_UAM[3]."'";
+  AND ug.group_id = \''.$conf_UAM[2]."'";
   }
   $query.= '
@@ -896,5 +872,5 @@
   INNER JOIN '.USER_LASTVISIT_TABLE.' AS lv
     ON u.'.$conf['user_fields']['id'].' = lv.user_id
-WHERE (TO_DAYS(NOW()) - TO_DAYS(lv.lastvisit) >= "'.$conf_UAM[18].'")
+WHERE (TO_DAYS(NOW()) - TO_DAYS(lv.lastvisit) >= "'.$conf_UAM[17].'")
 ORDER BY id ASC;';
 
Index: /extensions/NBC_UserAdvManager/trunk/include/upgradedb.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/include/upgradedb.inc.php	(revision 6353)
+++ /extensions/NBC_UserAdvManager/trunk/include/upgradedb.inc.php	(revision 6354)
@@ -204,4 +204,59 @@
 
 		pwg_query($query);
+    
+    upgrade_2153_2154();
+}
+
+/* upgrade from branch 2.15.3 to 2.15.4 */
+/* ************************************ */
+function upgrade_2153_2154()
+{
+  global $conf;
+
+/* Upgrading options */
+  $query = '
+SELECT value
+  FROM '.CONFIG_TABLE.'
+WHERE param = "UserAdvManager"
+;';
+
+  $result = pwg_query($query);
+  $conf_UAM = pwg_db_fetch_assoc($result);
+    
+  $Newconf_UAM = unserialize($conf_UAM['value']);
+  
+  $Newconf_UAM[0] = $Newconf_UAM[0];
+  $Newconf_UAM[1] = $Newconf_UAM[2];
+  $Newconf_UAM[2] = $Newconf_UAM[3];
+  $Newconf_UAM[3] = $Newconf_UAM[4];
+  $Newconf_UAM[4] = $Newconf_UAM[5];
+  $Newconf_UAM[5] = $Newconf_UAM[6];
+  $Newconf_UAM[6] = $Newconf_UAM[7];
+  $Newconf_UAM[7] = $Newconf_UAM[8];
+  $Newconf_UAM[8] = $Newconf_UAM[9];
+  $Newconf_UAM[9] = $Newconf_UAM[10];
+  $Newconf_UAM[10] = $Newconf_UAM[11];
+  $Newconf_UAM[11] = $Newconf_UAM[12];
+  $Newconf_UAM[12] = $Newconf_UAM[13];
+  $Newconf_UAM[13] = $Newconf_UAM[14];
+  $Newconf_UAM[14] = $Newconf_UAM[15];
+  $Newconf_UAM[15] = $Newconf_UAM[16];
+  $Newconf_UAM[16] = $Newconf_UAM[17];
+  $Newconf_UAM[17] = $Newconf_UAM[18];
+  $Newconf_UAM[18] = $Newconf_UAM[19];
+  $Newconf_UAM[19] = $Newconf_UAM[20];
+  $Newconf_UAM[20] = $Newconf_UAM[21];
+  unset($Newconf_UAM[21]);
+  
+  $update_conf = serialize($Newconf_UAM);
+    
+  $query = '
+      UPDATE '.CONFIG_TABLE.'
+			SET value="'.addslashes($update_conf).'"
+			WHERE param="UserAdvManager"
+			LIMIT 1
+		;';
+
+		pwg_query($query);
 }
 ?>
Index: /extensions/NBC_UserAdvManager/trunk/main.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/main.inc.php	(revision 6353)
+++ /extensions/NBC_UserAdvManager/trunk/main.inc.php	(revision 6354)
@@ -80,5 +80,5 @@
   if (!is_admin() and !is_a_guest())
   {
-    if ((isset($conf_UAM[17]) and $conf_UAM[17] == 'true') or (isset($conf_UAM[20]) and $conf_UAM[20] == 'true'))
+    if ((isset($conf_UAM[16]) and $conf_UAM[16] == 'true') or (isset($conf_UAM[19]) and $conf_UAM[19] == 'true'))
     {
 
@@ -129,12 +129,12 @@
   
   /* Sending registration confirmation by email */
-  if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[2]) and $conf_UAM[2] == 'true'))
-  {
-    if (is_admin() and isset($conf_UAM[21]) and $conf_UAM[21] == 'true')
+  if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
+  {
+    if (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'true')
     {
     $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
     SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 
     }
-    elseif (is_admin() and isset($conf_UAM[21]) and $conf_UAM[21] == 'false')
+    elseif (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'false')
     {
     $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
@@ -253,5 +253,5 @@
 
   /* Password enforcement control */
-  if (isset($conf_UAM[14]) and $conf_UAM[14] == 'true' and !empty($conf_UAM[15]))
+  if (isset($conf_UAM[13]) and $conf_UAM[13] == 'true' and !empty($conf_UAM[14]))
   {
     if (!empty($user['password']) and !is_admin())
@@ -259,40 +259,34 @@
       $PasswordCheck = testpassword($user['password']);
   
-      if ($PasswordCheck < $conf_UAM[15])
+      if ($PasswordCheck < $conf_UAM[14])
       {
         $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
-        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[15]);
-      }
-    }
-    else if (!empty($user['password']) and is_admin() and isset($conf_UAM[16]) and $conf_UAM[16] == 'true')
+        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
+      }
+    }
+    else if (!empty($user['password']) and is_admin() and isset($conf_UAM[15]) and $conf_UAM[15] == 'true')
     { 
       $PasswordCheck = testpassword($user['password']);
   
-      if ($PasswordCheck < $conf_UAM[15])
+      if ($PasswordCheck < $conf_UAM[14])
       {
         $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
-        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[15]);
-      }
-    }
-  }
-
-  /* Username non case sensitive */
-  if (isset($conf_UAM[1]) and $conf_UAM[1] == 'true' and NotSensibleSearchUsername($_POST['login']))
-  {
-    return($lang['reg_err_login5'] = l10n('reg_err_login5'));
+        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
+      }
+    }
   }
 
   /* Username without forbidden keys */
-  if (isset($conf_UAM[7]) and $conf_UAM[7] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']) and !is_admin())
+  if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']) and !is_admin())
   {
     $_POST['login'] = '';
-    return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[8]."'");
+    return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[7]."'");
   }
 
   /* Email without forbidden domains */
-  if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']) and !is_admin())
+  if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']) and !is_admin())
   {
     $_POST['mail_address'] = '';
-    return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[13]."'");
+    return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[12]."'");
   }
 }
@@ -312,9 +306,9 @@
     {
       /* Email without forbidden domains */
-      if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($_POST['mail_address']))
+      if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['mail_address']))
       {
         if (ValidateEmailProvider($_POST['mail_address']))
         {
-          $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[13]."'");
+          $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[12]."'");
           unset($_POST['validate']);
         }
@@ -328,12 +322,12 @@
         
         /* Password enforcement control */
-        if (isset($conf_UAM[14]) and $conf_UAM[14] == 'true' and !empty($conf_UAM[15]))
+        if (isset($conf_UAM[13]) and $conf_UAM[13] == 'true' and !empty($conf_UAM[14]))
         {
           $PasswordCheck = testpassword($_POST['use_new_pwd']);
          
-          if ($PasswordCheck < $conf_UAM[15])
+          if ($PasswordCheck < $conf_UAM[14])
           {
             $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
-            $template->append('errors', l10n_args($message).$conf_UAM[15]);
+            $template->append('errors', l10n_args($message).$conf_UAM[14]);
             unset($_POST['use_new_pwd']);
             unset($_POST['validate']);
@@ -343,5 +337,5 @@
       
       /* Sending registration confirmation by email */
-      if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[2]) and $conf_UAM[2] == 'true'))
+      if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
       {
         $confirm_mail_need = false;
@@ -357,5 +351,5 @@
           list($current_email) = pwg_db_fetch_row(pwg_query($query));
       
-          if ($_POST['mail_address'] != $current_email and ( isset($conf_UAM[2]) and $conf_UAM[2] == 'true'))
+          if ($_POST['mail_address'] != $current_email and ( isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
         
             $confirm_mail_need = true;
@@ -395,7 +389,7 @@
     {
       /* Email without forbidden domains */
-      if (isset($conf_UAM[12]) and $conf_UAM[12] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email']))
-      {
-        $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[13]."'");
+      if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email']))
+      {
+        $template->append('errors', l10n('reg_err_login7')."'".$conf_UAM[12]."'");
         unset($_POST['submit_add']);
       }
@@ -415,5 +409,5 @@
 
 /* User creation OR update */
-  if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and $conf['comments_forall'] == 'true' and $comm['author'] == 'guest')
+  if (isset($conf_UAM[5]) and $conf_UAM[5] == 'true' and $conf['comments_forall'] == 'true' and $comm['author'] == 'guest')
   {
     $comment_action = 'reject';
Index: /extensions/NBC_UserAdvManager/trunk/maintain.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/maintain.inc.php	(revision 6353)
+++ /extensions/NBC_UserAdvManager/trunk/maintain.inc.php	(revision 6354)
@@ -163,5 +163,5 @@
 /* ****************************** */
 // In preparation of next releases
-/*   $query = '
+   $query = '
 SELECT param
   FROM '.CONFIG_TABLE.'
@@ -172,7 +172,21 @@
   if ($count == 2)
   {
-    upgrade_2151_2152();
-  }
-*/
+    $query = '
+SELECT value
+  FROM '.CONFIG_TABLE.'
+WHERE param = "UserAdvManager"
+;';
+
+    $result = pwg_query($query);
+    $conf = pwg_db_fetch_assoc($result);
+    
+    $conf_UAM = unserialize($conf['value']);
+    $Nb_values = count($conf_UAM);
+    if ($Nb_values = 22)
+    {
+      upgrade_2153_2154();
+    }
+  }
+
 load_conf_from_db('param like \'UserAdvManager\\_%\'');
 }
