Index: extensions/LCAS/trunk/admin/LCAS_admin.php
===================================================================
--- extensions/LCAS/trunk/admin/LCAS_admin.php	(revision 8565)
+++ extensions/LCAS/trunk/admin/LCAS_admin.php	(revision 8638)
@@ -23,4 +23,13 @@
 $error = array();
 
+$t = pwg_db_fetch_row(pwg_query('
+  SELECT `value`
+  FROM `'.CONFIG_TABLE.'`
+  WHERE `param` = "LoginCaseAccentsSensitivity"
+  LIMIT 1;
+'));
+
+$conf['LoginCaseAccentsSensitivity'] = $t[0];
+
 // +-----------------------------------------------------------------------+
 // |                      Getting plugin version                           |
@@ -29,13 +38,20 @@
 $version = $plugin['version'];
 
-	if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Case_Sensitive']) and isset($_POST['LCAS_Accent_Sensitive']) and isset($_POST['LCAS_Mail']))
+	if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Option']) and isset($_POST['LCAS_Mail']))
   {
 
 /* General configuration settings */
 		$_POST['LCAS_MailText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['LCAS_MailText'])));
-
-		$newconf_LCAS= array(
-      $_POST['LCAS_Case_Sensitive'],
-      $_POST['LCAS_Accent_Sensitive'],
+    
+		// LCAS configuration is now hereby defined :
+    // $conf_LCAS[0] : "final case", describe how LCAS should behave;
+    // $conf_LCAS[1] : LCAS option, describe the choice of the webmaster;
+    // $conf_LCAS[2] : LCAS_Mail;
+    // $conf_LCAS[3] : LCAS_MailText.
+    $newconf_LCAS= array(
+      LCAS_final_case($_POST['LCAS_Option']),
+      $_POST['LCAS_Option'],
+      // $_POST['LCAS__spare'] : quite lazy, but convenient to not have to
+      // decrease index of each option below everywhere :-/ ...
       $_POST['LCAS_Mail'],
       $_POST['LCAS_MailText']);
@@ -52,120 +68,115 @@
 		pwg_query($query);
 
-    // $conf['insensitive_case_logon'] have to be True for a full LCAS use
-    if ($conf['insensitive_case_logon'])
+    array_push($page['infos'], l10n('LCAS_save_config'));
+  }
+
+	$conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
+  $conf_LCAS[0] = LCAS_final_case($conf_LCAS[1]);
+  
+  if (isset($conf_LCAS[0]))
+  {
+    // $conf['insensitive_case_logon'] must be true or false when needed
+    if ($conf_LCAS[0]=='4' or $conf_LCAS[0]=='5')
+     array_push($page['errors'], l10n('LCAS_warning'));
+    elseif ($conf_LCAS[0]=='6' or $conf_LCAS[0]=='7')
+     array_push($page['errors'], l10n('LCAS_warning2'));
+
+    $case_ins = (in_array($conf_LCAS[0], array('1', '3','6','7')));
+    $acc_ins = (in_array($conf_LCAS[0], array('2', '5', '3','6','7')));
+
+    if ($case_ins or $acc_ins)
     {
-		  array_push($page['infos'], l10n('LCAS_save_config'));
+// +-----------------------------------------------------------------------+
+// |                           initialization                              |
+// +-----------------------------------------------------------------------+
+
+      $lcas_UserToUpdate = -1;
+      if ((isset($_POST['UserToUpdate'])) && ($_POST['UserToUpdate'] != -1)) {
+        $lcas_UserToUpdate = $_POST['UserToUpdate'];
+        
+        if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) {
+          // Vérifier si le nom n'est pas déjà pris
+          
+          
+          
+          // Mise à jour du nom
+          $query = '
+            UPDATE '.USERS_TABLE.'
+            SET username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'"
+            WHERE id='.$lcas_UserToUpdate.'
+            LIMIT 1
+            ;';
+
+          pwg_query($query);
+
+        if (isset($conf_LCAS[2]) and $conf_LCAS[2] = 'true')
+        {
+          LCAS_SendMail($lcas_UserToUpdate, $_POST['user-'.$lcas_UserToUpdate]);
+        }
+
+          array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed'));
+        }
+        else {
+          // User is empty
+          array_push($page['errors'], l10n('LCAS_Err_Userlist_Empty_New_Username'));
+        }
+      }
+
+
+// +-----------------------------------------------------------------------+
+// |                               user list                               |
+// +-----------------------------------------------------------------------+
+
+      $page['all_users'] = LCAS_get_user_list($conf_LCAS[0]);
+
+// +-----------------------------------------------------------------------+
+// |                               user list                               |
+// +-----------------------------------------------------------------------+
+
+      $lcas_previous_compare_user = '';
+      $visible_user_list          = array();
+      foreach ($page['all_users'] as $local_user)
+      {
+        if ($lcas_previous_compare_user != $local_user['transformed']) {
+          $display = 'orange';
+          $lcas_previous_compare_user = $local_user['transformed'];
+        }
+        else {
+          $display = '';
+        }
+
+        $template->append(
+          'users',
+          array(
+            'ID'          => $local_user['id'],
+            'USERNAME'    => stripslashes($local_user['username']),
+            'COMPARE'     => stripslashes($local_user['transformed']),
+            'EMAIL'       => get_email_address_as_display_text($local_user['email']),
+            'DISPLAY'     => $display,
+          )
+        );
+      }
+      /* Plugin version insert */
+      $template->assign(
+        array(
+          'LCAS_VERSION'  => $version,
+          'LCAS_PATH'     => LCAS_PATH,
+        )
+      );    
+
+      
+// +-----------------------------------------------------------------------+
+// |                             errors display                            |
+// +-----------------------------------------------------------------------+
+      if ( isset ($errors) and count($errors) != 0)
+      {
+        $template->assign('errors',array());
+        foreach ($errors as $error)
+        {
+          array_push($page['errors'], $error);
+        }
+      }  
+
     }
-    else
-    {
-      array_push($page['infos'], l10n('LCAS_save_config'));
-      array_push($page['errors'], l10n('LCAS_warning'));
-    }
-  }
-
-	$conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
-
-  if ((isset($conf_LCAS[0]) and $conf_LCAS[0]=='true') || (isset($conf_LCAS[1]) and $conf_LCAS[1]=='true'))
-  {
-// +-----------------------------------------------------------------------+
-// |                           initialization                              |
-// +-----------------------------------------------------------------------+
-
-    $lcas_UserToUpdate = -1;
-    if ((isset($_POST['UserToUpdate'])) && ($_POST['UserToUpdate'] != -1)) {
-    	$lcas_UserToUpdate = $_POST['UserToUpdate'];
-    	
-    	if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) {
-    		// Vérifier si le nom n'est pas déjà pris
-    		
-    		
-    		
-    		// Mise à jour du nom
-				$query = '
-			  	UPDATE '.USERS_TABLE.'
-			  	SET username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'"
-			  	WHERE id='.$lcas_UserToUpdate.'
-			  	LIMIT 1
-			  	;';
-
-				pwg_query($query);
-
-      if (isset($conf_LCAS[2]) and $conf_LCAS[2] = 'true')
-      {
-        LCAS_SendMail($lcas_UserToUpdate, $_POST['user-'.$lcas_UserToUpdate]);
-      }
-
-				array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed'));
-    	}
-    	else {
-    		// User is empty
-				array_push($page['errors'], l10n('LCAS_Err_Userlist_Empty_New_Username'));
-    	}
-    }
-
-
-// +-----------------------------------------------------------------------+
-// |                               user list                               |
-// +-----------------------------------------------------------------------+
-
-		if ($conf_LCAS[0]=='true' && $conf_LCAS[1]=='true')
-			$lcas_rule = 3;
-		else if ($conf_LCAS[0]=='true')
-			$lcas_rule = 1;
-		else if ($conf_LCAS[1]=='true')
-			$lcas_rule = 2;
-		else
-			$lcas_rule = 0;
-		
-		$page['all_users'] = LCAS_get_user_list($lcas_rule);
-
-// +-----------------------------------------------------------------------+
-// |                               user list                               |
-// +-----------------------------------------------------------------------+
-
-		$lcas_previous_compare_user = '';
-    $visible_user_list          = array();
-    foreach ($page['all_users'] as $local_user)
-    {
-      if ($lcas_previous_compare_user != $local_user['transformed']) {
-      	$display = 'orange';
-      	$lcas_previous_compare_user = $local_user['transformed'];
-      }
-      else {
-      	$display = '';
-      }
-
-   		$template->append(
-     		'users',
-       	array(
-       		'ID'          => $local_user['id'],
-         	'USERNAME'    => stripslashes($local_user['username']),
-         	'COMPARE'     => stripslashes($local_user['transformed']),
-					'EMAIL'       => get_email_address_as_display_text($local_user['email']),
-          'DISPLAY'     => $display,
-				)
-			);
-		}
-    /* Plugin version insert */
-    $template->assign(
-      array(
-        'LCAS_VERSION'  => $version,
-        'LCAS_PATH'     => LCAS_PATH,
-      )
-    );    
-
-    
-// +-----------------------------------------------------------------------+
-// |                             errors display                            |
-// +-----------------------------------------------------------------------+
-		if ( isset ($errors) and count($errors) != 0)
-		{
-	  	$template->assign('errors',array());
-			foreach ($errors as $error)
-	  	{
-				array_push($page['errors'], $error);
-	  	}
- 		}  
-
   }
 
@@ -178,9 +189,8 @@
     'LCAS_VERSION'                  => $version,
     'LCAS_PATH'                     => LCAS_PATH,
-    'PWG_insensitive_case_logon'    => $conf['insensitive_case_logon']? 'true'              : 'false',
-		'LCAS_Case_Sensitive_TRUE'      => $conf_LCAS[0]=='true'          ? 'checked="checked"' : '' ,
-		'LCAS_Case_Sensitive_FALSE'     => $conf_LCAS[0]=='false'         ? 'checked="checked"' : '' ,
-		'LCAS_Accent_Sensitive_TRUE'    => $conf_LCAS[1]=='true'          ? 'checked="checked"' : '' ,
-		'LCAS_Accent_Sensitive_FALSE'   => $conf_LCAS[1]=='false'         ? 'checked="checked"' : '' ,
+    'PWG_insensitive_case_logon'    => ($conf['insensitive_case_logon']),
+    'Personalized_not_allowed'      => (!isset($conf['LCAS_replacement_set'][0])),
+		'LCAS_final_case'               => $conf_LCAS[0],
+		'LCAS_Option'                   => $conf_LCAS[1],
 		'LCAS_MAIL_TRUE'                => $conf_LCAS[2]=='true'          ? 'checked="checked"' : '' ,
 		'LCAS_MAIL_FALSE'               => $conf_LCAS[2]=='false'         ? 'checked="checked"' : '' ,
Index: extensions/LCAS/trunk/admin/template/global.tpl
===================================================================
--- extensions/LCAS/trunk/admin/template/global.tpl	(revision 8565)
+++ extensions/LCAS/trunk/admin/template/global.tpl	(revision 8638)
@@ -7,33 +7,52 @@
 
 <script type="text/javascript">
-jQuery().ready(function()
-{ldelim}
+var LCAS_final_case = '{$LCAS_final_case}';
+var PWG_insensitive_case_logon = {if $PWG_insensitive_case_logon}true{else}false{/if};
+var Personalized_not_allowed = {if $Personalized_not_allowed}true{else}false{/if};
+{literal}
+jQuery().ready(function(){
   jQuery('.cluetip').cluetip(
-  {ldelim}
+  {
     width: 550,
     splitTitle: '|'
-  {rdelim});
-{rdelim});
+  });
+});
+
+jQuery().ready(function(){
+  if (PWG_insensitive_case_logon) {
+    jQuery('#LCAS_id_Option0, #LCAS_id_Option2').attr('disabled', 'disabled');
+    jQuery('#LCAS_id_Opt0, #LCAS_id_Opt2').attr("title", "{/literal}{'conf[insensitive_case_logon] is true'|@translate}{literal}");
+  }
+  else {
+    jQuery('#LCAS_id_Option1, #LCAS_id_Option3').attr('disabled', 'disabled');
+    jQuery('#LCAS_id_Opt1, #LCAS_id_Opt3').attr("title", "{/literal}{'conf[insensitive_case_logon] is false'|@translate}{literal}");
+  }
+  if (Personalized_not_allowed) {
+    jQuery('#LCAS_id_Option0').attr('disabled', 'disabled');
+    jQuery('#LCAS_id_Opt0').attr("title", "{/literal}{'Personalized not allowed tooltip'|@translate}{literal}");
+  }
+});
 
 function LCAS_blockToggleDisplay( headerId, contentId )
-{ldelim}
+{
   if (typeof(headerId)=='string')
-  {ldelim}
+  {
    if ( headerId.length>  1)
        blockToggleDisplay(headerId, contentId) ;
       document.getElementById("nb_para").value =headerId ;
       document.getElementById("nb_para2").value =contentId;
-  {rdelim}
-{rdelim}
+  }
+}
 jQuery(document).ready(function() 
-    {ldelim}
+    {
       jQuery("#sorting")
-      .tablesorter({ldelim}sortList:[[3,0]], headers: {ldelim} 1: {ldelim} sorter: false {rdelim}, 4: {ldelim} sorter: false {rdelim}, 5: {ldelim} sorter: false {rdelim} {rdelim} {rdelim})
-      .tablesorterPager({ldelim}container: jQuery("#pager"), positionFixed: false, size: 20, totalPages: 0{rdelim});
-    {rdelim} 
+      .tablesorter({sortList:[[3,0]], headers: { 1: { sorter: false }, 4: { sorter: false }, 5: { sorter: false } } })
+      .tablesorterPager({container: jQuery("#pager"), positionFixed: false, size: 20, totalPages: 0});
+    } 
 );
-function UpdateAUser(UserId) {ldelim}
+function UpdateAUser(UserId) {
 	document.UserList.UserToUpdate.value=UserId;document.UserList.submit();
-{rdelim}
+}
+{/literal}
 </script>
 
@@ -60,25 +79,25 @@
           <li>
             <label class="cluetip" title="{'LCAS_caseSensitiveTitle'|translate}|{'LCAS_caseSensitiveTitle_d'|translate}">
-              {'LCAS_Case_Sensitive'|@translate}
-            </label>
-          <br><br>
-            <input type="radio" value="false" {$LCAS_Case_Sensitive_FALSE} name="LCAS_Case_Sensitive">
-              {'LCAS_DisableOption'|@translate}<br>
-            <input type="radio" value="true" {$LCAS_Case_Sensitive_TRUE} name="LCAS_Case_Sensitive">
-              {'LCAS_EnableOption'|@translate}
+              {'LCAS option'|@translate}
+            </label>
+            <br><br>
+            <label for = "LCAS_id_Option1" id ="LCAS_id_Opt1">
+              <input type="radio" value="1" {if $LCAS_Option == '1'}checked="checked"{/if} id="LCAS_id_Option1" name="LCAS_Option">
+              {'LCAS_Option1'|@translate}<br>
+            </label>
+            <label for = "LCAS_id_Option2" id ="LCAS_id_Opt2">
+              <input type="radio" value="2" {if $LCAS_Option == '2'}checked="checked"{/if} id="LCAS_id_Option2" name="LCAS_Option">
+              {'LCAS_Option2'|@translate}<br>
+            </label>
+            <label for = "LCAS_id_Option3" id ="LCAS_id_Opt3">
+              <input type="radio" value="3" {if $LCAS_Option == '3'}checked="checked"{/if} id="LCAS_id_Option3" name="LCAS_Option">
+              {'LCAS_Option3'|@translate}<br>
+            </label>
+            <label for = "LCAS_id_Option0" id ="LCAS_id_Opt0">
+              <input type="radio" value="0" {if $LCAS_Option == '0'}checked="checked"{/if} id="LCAS_id_Option0" name="LCAS_Option">
+              {'LCAS_Option0'|@translate}{if $Personalized_not_allowed}{'Personalized not allowed explanation'|@translate}{/if}<br>
+            </label>
             <br><br>
           </li>
-
-        	<li>
-            <label class="cluetip" title="{'LCAS_accentSensitiveTitle'|translate}|{'LCAS_accentSensitiveTitle_d'|translate}">
-              {'LCAS_Accent_Sensitive'|@translate}
-            </label>
-         <br><br>
-            <input type="radio" value="false" {$LCAS_Accent_Sensitive_FALSE} name="LCAS_Accent_Sensitive">
-              {'LCAS_DisableOption'|@translate}<br>
-            <input type="radio" value="true" {$LCAS_Accent_Sensitive_TRUE} name="LCAS_Accent_Sensitive">
-              {'LCAS_EnableOption'|@translate}<br>
-            <br><br>
-        	</li>
 
           <li>
@@ -127,8 +146,8 @@
           <label class="cluetip" title="{'LCAS_currentPWGConfig'|translate}|{'LCAS_currentPWGConfig_d'|translate}">
             $conf['insensitive_case_logon'] = 
-{if $PWG_insensitive_case_logon == 'true'}
-	<span style="color: green;">{$PWG_insensitive_case_logon}</span>;
+{if $PWG_insensitive_case_logon}
+	<span style="color: green;">true</span>;
 {else}
-	<span style="color: red;">{$PWG_insensitive_case_logon}</span>;
+	<span style="color: red;">false</span>;
 {/if}
           </label>
Index: extensions/LCAS/trunk/include/LCAS_replacement_set.inc.php
===================================================================
--- extensions/LCAS/trunk/include/LCAS_replacement_set.inc.php	(revision 8565)
+++ extensions/LCAS/trunk/include/LCAS_replacement_set.inc.php	(revision 8638)
@@ -382,4 +382,95 @@
   );
 
+  $conf['LCAS_replacement_set'][2] = array(
+  // 2 : case sensitive, accents insensitive
+    
+  // Latin
+    
+    'a'  => 'à â á ã ä å ā ă ą ǻ ạ ả ấ ầ ẩ ẫ ậ ắ ằ ẳ ẵ ặ @',
+    'A'  => 'À Â Á Ã Ä Å Ā Ă Ą Ǻ Ạ Ả Ấ Ầ Ẩ Ẫ Ậ Ắ Ằ Ẳ Ẵ Ặ',
+    'c'  => 'ç ć ĉ ċ č',
+    'C'  => 'Ç Ć Ĉ Ċ Č',
+    'd'  => 'ď đ',
+    'D'  => 'Ď Đ',
+    'e'  => 'è é ê ë ē ĕ ė ę ě ẹ ẻ ẽ ế ề ể ễ ệ',
+    'E'  => 'È É Ê Ë Ē Ĕ Ė Ę Ě Ẹ Ẻ Ẽ Ế Ề Ể Ễ Ệ',
+    'f'  => 'ƒ',
+    'g'  => 'ĝ ğ ġ ģ',
+    'G'  => 'Ĝ Ğ Ġ Ģ',
+    'h'  => 'ĥ ħ',
+    'H'  => 'Ĥ Ħ',
+    'i'  => 'ì í î ï ĩ ī ĭ į ǐ ỉ ị ı',
+    'I'  => 'Ì Í Î Ï Ĩ Ī Ĭ Į Ǐ Ỉ Ị İ',
+    'j'  => 'ĵ',
+    'J'  => 'Ĵ',
+    'k'  => 'ķ',
+    'K'  => 'Ķ',
+    'l'  => 'ĺ ļ ľ ŀ ł',
+    'L'  => 'Ĺ Ļ Ľ Ŀ Ł',
+    'n'  => 'ñ ń ņ ň ŉ',
+    'N'  => 'Ñ Ń Ņ Ň',
+    'o'  => 'ò ó ô õ ö ø ō ŏ ő ơ ǒ ǿ ọ ỏ ố ồ ổ ỗ ộ ớ ờ ở ỡ ợ',
+    'O'  => 'Ò Ó Ô Õ Ö Ø Ō Ŏ Ő Ơ Ǒ Ǿ Ọ Ỏ Ố Ồ Ổ Ỗ Ộ Ớ Ờ Ở Ỡ Ợ',
+    'q'  => 'ĸ',
+    'r'  => 'ŕ ŗ ř',
+    'R'  => 'Ŕ Ŗ Ř',
+    's'  => 'ś ŝ ş š ſ',
+    'S'  => 'Ś Ŝ Ş Š',
+    'ss' => 'ß',
+    't'  => 'ţ ť ŧ',
+    'T'  => 'Ţ Ť Ŧ',
+    'u'  => 'ù ú û ü ũ ū ŭ ů ű ų ǔ ǖ ǘ ǚ ǜ ư ụ ủ ứ ừ ử ữ ự',
+    'U'  => 'Ù Ú Û Ü Ũ Ū Ŭ Ů Ű Ų Ǔ Ǖ Ǘ Ǚ Ǜ Ư Ụ Ủ Ứ Ừ Ử Ữ Ự',
+    'w'  => 'ŵ ẁ ẃ ẅ',
+    'W'  => 'Ŵ Ẁ Ẃ Ẅ',
+    'y'  => 'ý ÿ ỳ ỵ ỷ ỹ ŷ',
+    'Y'  => 'Ý Ÿ Ỳ Ỵ Ỷ Ỹ Ŷ',
+    'z'  => 'ź ż ž',
+    'Z'  => 'Ź Ż Ž',
+    'ae' => 'ǽ',
+    'AE' => 'Ǽ',
+    'ae' => 'æ',
+    'AE' => 'Æ',
+    'ij' => 'ĳ',
+    'IJ' => 'Ĳ',
+    'oe' => 'œ',
+    'OE' => 'Œ',
+    
+  // Greek
+    
+    'α'  => 'ά',
+    'Α'  => 'Ά',
+    'ε'  => 'έ',
+    'Ε'  => 'Έ',
+    'μ'  => 'µ',
+    'η'  => 'ή',
+    'Η'  => 'Ή',
+    'ι'  => 'ί ϊ ΐ',
+    'Ι'  => 'Ί Ϊ',
+    'ο'  => 'ό',
+    'Ο'  => 'Ό',
+    'σ'  => 'ς',
+    'υ'  => 'ύ ϋ ΰ',
+    'Υ'  => 'Ύ Ϋ',
+    'ω'  => 'ώ',
+    'Ω'  => 'Ώ',
+    
+  // Cyrillic
+    
+    'г'  => 'ґ ғ',
+    'Г'  => 'Ґ Ғ',
+    'ж'  => 'җ',
+    'Ж'  => 'Җ',
+    'к'  => 'қ ҝ',
+    'К'  => 'Қ Ҝ',
+    'н'  => 'ң',
+    'Н'  => 'Ң',
+    'х'  => 'ҳ',
+    'Х'  => 'Ҳ',
+    'ч'  => 'ҹ',
+    'Ч'  => 'Ҹ',
+    
+  );
+
   $conf['LCAS_replacement_set'][3] = array(
   // 3 : case insensitive, accents insensitive
@@ -505,94 +596,3 @@
   );
 
-  $conf['LCAS_replacement_set'][2] = array(
-  // 2 : case sensitive, accents insensitive
-    
-  // Latin
-    
-    'a'  => 'à â á ã ä å ā ă ą ǻ ạ ả ấ ầ ẩ ẫ ậ ắ ằ ẳ ẵ ặ @',
-    'A'  => 'À Â Á Ã Ä Å Ā Ă Ą Ǻ Ạ Ả Ấ Ầ Ẩ Ẫ Ậ Ắ Ằ Ẳ Ẵ Ặ',
-    'c'  => 'ç ć ĉ ċ č',
-    'C'  => 'Ç Ć Ĉ Ċ Č',
-    'd'  => 'ď đ',
-    'D'  => 'Ď Đ',
-    'e'  => 'è é ê ë ē ĕ ė ę ě ẹ ẻ ẽ ế ề ể ễ ệ',
-    'E'  => 'È É Ê Ë Ē Ĕ Ė Ę Ě Ẹ Ẻ Ẽ Ế Ề Ể Ễ Ệ',
-    'f'  => 'ƒ',
-    'g'  => 'ĝ ğ ġ ģ',
-    'G'  => 'Ĝ Ğ Ġ Ģ',
-    'h'  => 'ĥ ħ',
-    'H'  => 'Ĥ Ħ',
-    'i'  => 'ì í î ï ĩ ī ĭ į ǐ ỉ ị ı',
-    'I'  => 'Ì Í Î Ï Ĩ Ī Ĭ Į Ǐ Ỉ Ị İ',
-    'j'  => 'ĵ',
-    'J'  => 'Ĵ',
-    'k'  => 'ķ',
-    'K'  => 'Ķ',
-    'l'  => 'ĺ ļ ľ ŀ ł',
-    'L'  => 'Ĺ Ļ Ľ Ŀ Ł',
-    'n'  => 'ñ ń ņ ň ŉ',
-    'N'  => 'Ñ Ń Ņ Ň',
-    'o'  => 'ò ó ô õ ö ø ō ŏ ő ơ ǒ ǿ ọ ỏ ố ồ ổ ỗ ộ ớ ờ ở ỡ ợ',
-    'O'  => 'Ò Ó Ô Õ Ö Ø Ō Ŏ Ő Ơ Ǒ Ǿ Ọ Ỏ Ố Ồ Ổ Ỗ Ộ Ớ Ờ Ở Ỡ Ợ',
-    'q'  => 'ĸ',
-    'r'  => 'ŕ ŗ ř',
-    'R'  => 'Ŕ Ŗ Ř',
-    's'  => 'ś ŝ ş š ſ',
-    'S'  => 'Ś Ŝ Ş Š',
-    'ss' => 'ß',
-    't'  => 'ţ ť ŧ',
-    'T'  => 'Ţ Ť Ŧ',
-    'u'  => 'ù ú û ü ũ ū ŭ ů ű ų ǔ ǖ ǘ ǚ ǜ ư ụ ủ ứ ừ ử ữ ự',
-    'U'  => 'Ù Ú Û Ü Ũ Ū Ŭ Ů Ű Ų Ǔ Ǖ Ǘ Ǚ Ǜ Ư Ụ Ủ Ứ Ừ Ử Ữ Ự',
-    'w'  => 'ŵ ẁ ẃ ẅ',
-    'W'  => 'Ŵ Ẁ Ẃ Ẅ',
-    'y'  => 'ý ÿ ỳ ỵ ỷ ỹ ŷ',
-    'Y'  => 'Ý Ÿ Ỳ Ỵ Ỷ Ỹ Ŷ',
-    'z'  => 'ź ż ž',
-    'Z'  => 'Ź Ż Ž',
-    'ae' => 'ǽ',
-    'AE' => 'Ǽ',
-    'ae' => 'æ',
-    'AE' => 'Æ',
-    'ij' => 'ĳ',
-    'IJ' => 'Ĳ',
-    'oe' => 'œ',
-    'OE' => 'Œ',
-    
-  // Greek
-    
-    'α'  => 'ά',
-    'Α'  => 'Ά',
-    'ε'  => 'έ',
-    'Ε'  => 'Έ',
-    'μ'  => 'µ',
-    'η'  => 'ή',
-    'Η'  => 'Ή',
-    'ι'  => 'ί ϊ ΐ',
-    'Ι'  => 'Ί Ϊ',
-    'ο'  => 'ό',
-    'Ο'  => 'Ό',
-    'σ'  => 'ς',
-    'υ'  => 'ύ ϋ ΰ',
-    'Υ'  => 'Ύ Ϋ',
-    'ω'  => 'ώ',
-    'Ω'  => 'Ώ',
-    
-  // Cyrillic
-    
-    'г'  => 'ґ ғ',
-    'Г'  => 'Ґ Ғ',
-    'ж'  => 'җ',
-    'Ж'  => 'Җ',
-    'к'  => 'қ ҝ',
-    'К'  => 'Қ Ҝ',
-    'н'  => 'ң',
-    'Н'  => 'Ң',
-    'х'  => 'ҳ',
-    'Х'  => 'Ҳ',
-    'ч'  => 'ҹ',
-    'Ч'  => 'Ҹ',
-    
-  );
-
 ?>
Index: extensions/LCAS/trunk/include/functions.inc.php
===================================================================
--- extensions/LCAS/trunk/include/functions.inc.php	(revision 8565)
+++ extensions/LCAS/trunk/include/functions.inc.php	(revision 8638)
@@ -33,16 +33,47 @@
  * @return : string, or array of strings, modified as stated
 */
-function LCAS_change_case($Username, $Option)
+function LCAS_change_case($Username, $Opt, $At_login=true)
 {
   global $conf;
-
-  // Exits immediately without changing the parameter, if the configuration
-  // is set on "case sensitive and accent sensitive".
-  if (!isset($Option) or
-    $Option != 0 and
-    $Option != 1 and
-    $Option != 2 and
-    $Option != 3
-  ) return $Username;
+  
+  if ($Opt == '0' and !isset($conf['LCAS_replacement_set'][0]))
+   return $Username;
+  $Option = intval($Opt);
+  if (!isset($Opt) or ($Option < 0) or ($Option > 7)) return $Username;
+  if ($Option > 3) {
+    // Management of bad setting of $conf['insensitive_case_logon']
+    switch ($Opt) {
+      case '4':
+        // LCAS set to case insensitive, but $conf['insensitive_case_logon']
+        // is false : exit immediately, LCAS actually inactive
+        return $Username;
+      break;
+      case '5':
+        // LCAS set to case and accents insensitive, but
+        // $conf['insensitive_case_logon'] is false : only accents are
+        // insensitive
+        $Option = 2;
+      break;
+      case '6':
+        // LCAS set to accents only insensitive, but
+        // $conf['insensitive_case_logon'] is true : if check is done at
+        // login, LCAS cares for both case and accents insensitivity, but
+        // using strtolower() as does Piwigo at register; in case the check is
+        // done at register, Piwigo cares for the case, thus LCAS cares only
+        // for the accents.
+        $Option = 2; 
+        if ($At_login) $Username = strtolower($Username);
+      break;
+      case '7':
+        // LCAS set to personal, but $conf['insensitive_case_logon'] is true :
+        // if check is done at login, LCAS cares for both case and personal
+        // insensitivity, but using strtolower() as does Piwigo at register;
+        // in case the check is done at register, Piwigo cares for the case,
+        // thus LCAS cares only for the personal setting.
+        $Option = 0;
+        if ($At_login) $Username = strtolower($Username);
+      break;
+    }
+  }
   
   include(LCAS_PATH.'include/LCAS_replacement_set.inc.php');
@@ -320,4 +351,38 @@
 
 /*
+ * LCAS_final_case($var)
+ * return the value of the case in which is the gallery, regarding
+ * case and accents sensitivity
+ *
+ * @param $var
+ *   the inital proposal from the webmaster
+ * @return
+ *   string being an image of the case and accents sensitivity
+ */
+function LCAS_final_case($var) {
+
+  global $conf;
+  
+  if (isset($conf['insensitive_case_logon']) and $conf['insensitive_case_logon'] == true)
+  {
+    // Uncomfortable status if $conf['insensitive_case_logon'] is true and
+    // case insensitivity is not set in LCAS
+    if ($var == '2') return '6';
+    elseif  ($var == '0') return '7';
+  }
+  else
+  {
+    // Uncomfortable status if $conf['insensitive_case_logon'] is false and
+    // case insensitivity is set in LCAS
+    if ($var == '1') return '4';
+    elseif  ($var == '3') return '5';
+  }
+  
+  return $var;
+
+}
+
+
+/*
  * str_from_var3($var)
  * returns a string easing array var informations displaying in Piwigo :
Index: extensions/LCAS/trunk/language/en_UK/plugin.lang.php
===================================================================
--- extensions/LCAS/trunk/language/en_UK/plugin.lang.php	(revision 8565)
+++ extensions/LCAS/trunk/language/en_UK/plugin.lang.php	(revision 8638)
@@ -10,7 +10,7 @@
 
 
-$lang['LCAS_Case_Sensitive'] = 'Case insensitivity :';
+$lang['LCAS option'] = 'LCAS option:';
 
-$lang['LCAS_Accent_Sensitive'] = 'Accents insensivity :';
+$lang['LCAS_Accent_Sensitive'] = 'Accents insensivity:';
 
 $lang['LCAS_currentPWGConfigHeader'] = 'Current Piwigo\'s setting';
Index: extensions/LCAS/trunk/language/fr_FR/help/plugin.lang.php
===================================================================
--- extensions/LCAS/trunk/language/fr_FR/help/plugin.lang.php	(revision 8565)
+++ extensions/LCAS/trunk/language/fr_FR/help/plugin.lang.php	(revision 8638)
@@ -1,3 +1,3 @@
-<?php
+  <?php
 global $lang;
 
@@ -10,6 +10,6 @@
 <b style=&quot;color: red;&quot;>Important : L\'option de Piwigo &quot;$conf[\'insensitive_case_logon\']&quot; doit être activée pour un fonctionnement optimal.</b>
 ';
-$lang['LCAS_caseSensitiveTitle'] = 'La casse';
-$lang['LCAS_caseSensitiveTitle_d'] = 'Cette option permet de s\'authentifier sans tenir compte des majuscules et minuscules dans le nom de l\'utilisateur.<br>
+$lang['LCAS_caseSensitiveTitle'] = 'Les options';
+$lang['LCAS_caseSensitiveTitle_d'] = 'Ces options permettent que les utilisateurs soient identifiés soit sans tenir compte de la casse (majusules et minuscules) de leur identifiant, soit sans tenir compte des accents, soit sans tenir compte d\'aucun des deux.<br>Attention, le paramètre de configuration $conf[\'insensitive_case_logon\'] doit avoir un réglage cohérent avec l\'option LCAS que vous voulez choisir.<br>
 <b style=&quot;color: red;&quot;>NB: Le mot de passe reste sensible à la casse !</b><br>
 ';
Index: extensions/LCAS/trunk/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/LCAS/trunk/language/fr_FR/plugin.lang.php	(revision 8565)
+++ extensions/LCAS/trunk/language/fr_FR/plugin.lang.php	(revision 8638)
@@ -10,7 +10,14 @@
 
 
-$lang['LCAS_Case_Sensitive'] = 'Insensible à la casse :';
+$lang['LCAS option'] = 'Option LCAS :';
+$lang['LCAS_Option1'] = 'Insensibilité à la casse';
+$lang['LCAS_Option2'] = 'Insensibilité aux accents';
+$lang['LCAS_Option3'] = 'Insensibilité à la casse et aux accents';
+$lang['LCAS_Option0'] = 'Tableau personnel';
+$lang['Personalized not allowed explanation'] = ' (vous devez définir un tableau $conf[\'LCAS_replacement_set\'][0] . Voir <a title = "To be defined">les tableaux d\'origine</a>)';
+$lang['Personalized not allowed tooltip'] = 'Pas de tableau $conf[\'LCAS_replacement_set\'][0] de défini';
 
-$lang['LCAS_Accent_Sensitive'] = 'Insensible aux accents :';
+$lang['conf[insensitive_case_logon] is true'] = '$conf[\'insensitive_case_logon\'] vaut true';
+$lang['conf[insensitive_case_logon] is false'] = '$conf[\'insensitive_case_logon\'] vaut false';
 
 $lang['LCAS_currentPWGConfigHeader'] = 'Paramètre actuel de Piwigo';
@@ -51,4 +58,6 @@
 $lang['LCAS_warning'] = 'La sensibilité à la casse à l\'enregistrement de Piwigo n\'est pas activé ! Veuillez insérer ou modifier l\'option "$conf[\'insensitive_case_logon\'] = true;" dans votre fichier de configuration local via le plugin LocalFiles Editor.';
 
+$lang['LCAS_warning2'] = 'La sensibilité à la casse à l\'enregistrement de Piwigo est activée ! Veuillez insérer ou modifier l\'option "$conf[\'insensitive_case_logon\'] = false;" dans votre fichier de configuration local via le plugin LocalFiles Editor.';
+
 $lang['LCAS_MailText'] = 'Personnalisation de la notification par email';
 
Index: extensions/LCAS/trunk/main.inc.php
===================================================================
--- extensions/LCAS/trunk/main.inc.php	(revision 8565)
+++ extensions/LCAS/trunk/main.inc.php	(revision 8638)
@@ -25,4 +25,12 @@
 load_language('plugin.lang', LCAS_PATH);
 
+$t = pwg_db_fetch_row(pwg_query('
+  SELECT `value`
+  FROM `'.CONFIG_TABLE.'`
+  WHERE `param` = "LoginCaseAccentsSensitivity"
+  LIMIT 1;
+'));
+
+$conf['LoginCaseAccentsSensitivity'] = $t[0];
 
 /* Plugin admin */
@@ -59,26 +67,8 @@
   if (script_basename() == 'identification')
   {
-    if (isset($_POST['username']))
+    if (isset($_POST['username']) and isset($conf_LCAS[0]))
     {
-      /* Username is case insensitive only */
-      if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'false')
-      {
-        $new_username = LCAS_SearchCaseUsername($_POST['username'],1);
-        $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
-      }
-
-      /* Username is accent insensitive only */
-      if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'false' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
-      {
-        $new_username = LCAS_SearchCaseUsername($_POST['username'],2);
-        $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
-      }
-
-      //* Username is accent and case insensitive */
-      if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
-      {
-        $new_username = LCAS_SearchCaseUsername($_POST['username'],3);
-        $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
-      }
+      $new_username = LCAS_SearchCaseUsername($_POST['username'],$conf_LCAS[0]);
+      $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
     }
   }
@@ -86,4 +76,5 @@
 
 // Check users registration
+// Returns error
 add_event_handler('register_user_check', 'LCAS_RegistrationCheck');
 
@@ -96,16 +87,7 @@
   load_language('plugin.lang', LCAS_PATH);
 
-  /* Username is accent and case insensitive */
-  if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and $conf['insensitive_case_logon'] == true and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
-  {
-    $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'],3);
-  }
-  /* Username is accent insensitive only */
-  elseif (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'false' and $conf['insensitive_case_logon'] == false and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
-  {
-    $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'],2);
-  }
-  /* Username is case insensitive only is already controled by Piwigo with $conf['insensitive_case_logon'] == true */
-
+  if (isset($conf_LCAS[0]))
+   $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'], $conf_LCAS[0], false);
+  
   if (isset($NewPostLogin) and get_userid($NewPostLogin))
   {
