Changeset 8638 for extensions


Ignore:
Timestamp:
Jan 13, 2011, 2:58:32 AM (13 years ago)
Author:
LucMorizur
Message:

Properely hook (normally :-/ ...) all cases between LCAS options and $confinsensitive_case_logon , at login as well as at register (normally :-/ ...)

Location:
extensions/LCAS/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/admin/LCAS_admin.php

    r8271 r8638  
    2323$error = array();
    2424
     25$t = pwg_db_fetch_row(pwg_query('
     26  SELECT `value`
     27  FROM `'.CONFIG_TABLE.'`
     28  WHERE `param` = "LoginCaseAccentsSensitivity"
     29  LIMIT 1;
     30'));
     31
     32$conf['LoginCaseAccentsSensitivity'] = $t[0];
     33
    2534// +-----------------------------------------------------------------------+
    2635// |                      Getting plugin version                           |
     
    2938$version = $plugin['version'];
    3039
    31         if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Case_Sensitive']) and isset($_POST['LCAS_Accent_Sensitive']) and isset($_POST['LCAS_Mail']))
     40        if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Option']) and isset($_POST['LCAS_Mail']))
    3241  {
    3342
    3443/* General configuration settings */
    3544                $_POST['LCAS_MailText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['LCAS_MailText'])));
    36 
    37                 $newconf_LCAS= array(
    38       $_POST['LCAS_Case_Sensitive'],
    39       $_POST['LCAS_Accent_Sensitive'],
     45   
     46                // LCAS configuration is now hereby defined :
     47    // $conf_LCAS[0] : "final case", describe how LCAS should behave;
     48    // $conf_LCAS[1] : LCAS option, describe the choice of the webmaster;
     49    // $conf_LCAS[2] : LCAS_Mail;
     50    // $conf_LCAS[3] : LCAS_MailText.
     51    $newconf_LCAS= array(
     52      LCAS_final_case($_POST['LCAS_Option']),
     53      $_POST['LCAS_Option'],
     54      // $_POST['LCAS__spare'] : quite lazy, but convenient to not have to
     55      // decrease index of each option below everywhere :-/ ...
    4056      $_POST['LCAS_Mail'],
    4157      $_POST['LCAS_MailText']);
     
    5268                pwg_query($query);
    5369
    54     // $conf['insensitive_case_logon'] have to be True for a full LCAS use
    55     if ($conf['insensitive_case_logon'])
     70    array_push($page['infos'], l10n('LCAS_save_config'));
     71  }
     72
     73        $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
     74  $conf_LCAS[0] = LCAS_final_case($conf_LCAS[1]);
     75 
     76  if (isset($conf_LCAS[0]))
     77  {
     78    // $conf['insensitive_case_logon'] must be true or false when needed
     79    if ($conf_LCAS[0]=='4' or $conf_LCAS[0]=='5')
     80     array_push($page['errors'], l10n('LCAS_warning'));
     81    elseif ($conf_LCAS[0]=='6' or $conf_LCAS[0]=='7')
     82     array_push($page['errors'], l10n('LCAS_warning2'));
     83
     84    $case_ins = (in_array($conf_LCAS[0], array('1', '3','6','7')));
     85    $acc_ins = (in_array($conf_LCAS[0], array('2', '5', '3','6','7')));
     86
     87    if ($case_ins or $acc_ins)
    5688    {
    57                   array_push($page['infos'], l10n('LCAS_save_config'));
     89// +-----------------------------------------------------------------------+
     90// |                           initialization                              |
     91// +-----------------------------------------------------------------------+
     92
     93      $lcas_UserToUpdate = -1;
     94      if ((isset($_POST['UserToUpdate'])) && ($_POST['UserToUpdate'] != -1)) {
     95        $lcas_UserToUpdate = $_POST['UserToUpdate'];
     96       
     97        if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) {
     98          // Vérifier si le nom n'est pas déjà pris
     99         
     100         
     101         
     102          // Mise à jour du nom
     103          $query = '
     104            UPDATE '.USERS_TABLE.'
     105            SET username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'"
     106            WHERE id='.$lcas_UserToUpdate.'
     107            LIMIT 1
     108            ;';
     109
     110          pwg_query($query);
     111
     112        if (isset($conf_LCAS[2]) and $conf_LCAS[2] = 'true')
     113        {
     114          LCAS_SendMail($lcas_UserToUpdate, $_POST['user-'.$lcas_UserToUpdate]);
     115        }
     116
     117          array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed'));
     118        }
     119        else {
     120          // User is empty
     121          array_push($page['errors'], l10n('LCAS_Err_Userlist_Empty_New_Username'));
     122        }
     123      }
     124
     125
     126// +-----------------------------------------------------------------------+
     127// |                               user list                               |
     128// +-----------------------------------------------------------------------+
     129
     130      $page['all_users'] = LCAS_get_user_list($conf_LCAS[0]);
     131
     132// +-----------------------------------------------------------------------+
     133// |                               user list                               |
     134// +-----------------------------------------------------------------------+
     135
     136      $lcas_previous_compare_user = '';
     137      $visible_user_list          = array();
     138      foreach ($page['all_users'] as $local_user)
     139      {
     140        if ($lcas_previous_compare_user != $local_user['transformed']) {
     141          $display = 'orange';
     142          $lcas_previous_compare_user = $local_user['transformed'];
     143        }
     144        else {
     145          $display = '';
     146        }
     147
     148        $template->append(
     149          'users',
     150          array(
     151            'ID'          => $local_user['id'],
     152            'USERNAME'    => stripslashes($local_user['username']),
     153            'COMPARE'     => stripslashes($local_user['transformed']),
     154            'EMAIL'       => get_email_address_as_display_text($local_user['email']),
     155            'DISPLAY'     => $display,
     156          )
     157        );
     158      }
     159      /* Plugin version insert */
     160      $template->assign(
     161        array(
     162          'LCAS_VERSION'  => $version,
     163          'LCAS_PATH'     => LCAS_PATH,
     164        )
     165      );   
     166
     167     
     168// +-----------------------------------------------------------------------+
     169// |                             errors display                            |
     170// +-----------------------------------------------------------------------+
     171      if ( isset ($errors) and count($errors) != 0)
     172      {
     173        $template->assign('errors',array());
     174        foreach ($errors as $error)
     175        {
     176          array_push($page['errors'], $error);
     177        }
     178      } 
     179
    58180    }
    59     else
    60     {
    61       array_push($page['infos'], l10n('LCAS_save_config'));
    62       array_push($page['errors'], l10n('LCAS_warning'));
    63     }
    64   }
    65 
    66         $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
    67 
    68   if ((isset($conf_LCAS[0]) and $conf_LCAS[0]=='true') || (isset($conf_LCAS[1]) and $conf_LCAS[1]=='true'))
    69   {
    70 // +-----------------------------------------------------------------------+
    71 // |                           initialization                              |
    72 // +-----------------------------------------------------------------------+
    73 
    74     $lcas_UserToUpdate = -1;
    75     if ((isset($_POST['UserToUpdate'])) && ($_POST['UserToUpdate'] != -1)) {
    76         $lcas_UserToUpdate = $_POST['UserToUpdate'];
    77        
    78         if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) {
    79                 // Vérifier si le nom n'est pas déjà pris
    80                
    81                
    82                
    83                 // Mise à jour du nom
    84                                 $query = '
    85                                 UPDATE '.USERS_TABLE.'
    86                                 SET username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'"
    87                                 WHERE id='.$lcas_UserToUpdate.'
    88                                 LIMIT 1
    89                                 ;';
    90 
    91                                 pwg_query($query);
    92 
    93       if (isset($conf_LCAS[2]) and $conf_LCAS[2] = 'true')
    94       {
    95         LCAS_SendMail($lcas_UserToUpdate, $_POST['user-'.$lcas_UserToUpdate]);
    96       }
    97 
    98                                 array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed'));
    99         }
    100         else {
    101                 // User is empty
    102                                 array_push($page['errors'], l10n('LCAS_Err_Userlist_Empty_New_Username'));
    103         }
    104     }
    105 
    106 
    107 // +-----------------------------------------------------------------------+
    108 // |                               user list                               |
    109 // +-----------------------------------------------------------------------+
    110 
    111                 if ($conf_LCAS[0]=='true' && $conf_LCAS[1]=='true')
    112                         $lcas_rule = 3;
    113                 else if ($conf_LCAS[0]=='true')
    114                         $lcas_rule = 1;
    115                 else if ($conf_LCAS[1]=='true')
    116                         $lcas_rule = 2;
    117                 else
    118                         $lcas_rule = 0;
    119                
    120                 $page['all_users'] = LCAS_get_user_list($lcas_rule);
    121 
    122 // +-----------------------------------------------------------------------+
    123 // |                               user list                               |
    124 // +-----------------------------------------------------------------------+
    125 
    126                 $lcas_previous_compare_user = '';
    127     $visible_user_list          = array();
    128     foreach ($page['all_users'] as $local_user)
    129     {
    130       if ($lcas_previous_compare_user != $local_user['transformed']) {
    131         $display = 'orange';
    132         $lcas_previous_compare_user = $local_user['transformed'];
    133       }
    134       else {
    135         $display = '';
    136       }
    137 
    138                 $template->append(
    139                 'users',
    140         array(
    141                 'ID'          => $local_user['id'],
    142                 'USERNAME'    => stripslashes($local_user['username']),
    143                 'COMPARE'     => stripslashes($local_user['transformed']),
    144                                         'EMAIL'       => get_email_address_as_display_text($local_user['email']),
    145           'DISPLAY'     => $display,
    146                                 )
    147                         );
    148                 }
    149     /* Plugin version insert */
    150     $template->assign(
    151       array(
    152         'LCAS_VERSION'  => $version,
    153         'LCAS_PATH'     => LCAS_PATH,
    154       )
    155     );   
    156 
    157    
    158 // +-----------------------------------------------------------------------+
    159 // |                             errors display                            |
    160 // +-----------------------------------------------------------------------+
    161                 if ( isset ($errors) and count($errors) != 0)
    162                 {
    163                 $template->assign('errors',array());
    164                         foreach ($errors as $error)
    165                 {
    166                                 array_push($page['errors'], $error);
    167                 }
    168                 } 
    169 
    170181  }
    171182
     
    178189    'LCAS_VERSION'                  => $version,
    179190    'LCAS_PATH'                     => LCAS_PATH,
    180     'PWG_insensitive_case_logon'    => $conf['insensitive_case_logon']? 'true'              : 'false',
    181                 'LCAS_Case_Sensitive_TRUE'      => $conf_LCAS[0]=='true'          ? 'checked="checked"' : '' ,
    182                 'LCAS_Case_Sensitive_FALSE'     => $conf_LCAS[0]=='false'         ? 'checked="checked"' : '' ,
    183                 'LCAS_Accent_Sensitive_TRUE'    => $conf_LCAS[1]=='true'          ? 'checked="checked"' : '' ,
    184                 'LCAS_Accent_Sensitive_FALSE'   => $conf_LCAS[1]=='false'         ? 'checked="checked"' : '' ,
     191    'PWG_insensitive_case_logon'    => ($conf['insensitive_case_logon']),
     192    'Personalized_not_allowed'      => (!isset($conf['LCAS_replacement_set'][0])),
     193                'LCAS_final_case'               => $conf_LCAS[0],
     194                'LCAS_Option'                   => $conf_LCAS[1],
    185195                'LCAS_MAIL_TRUE'                => $conf_LCAS[2]=='true'          ? 'checked="checked"' : '' ,
    186196                'LCAS_MAIL_FALSE'               => $conf_LCAS[2]=='false'         ? 'checked="checked"' : '' ,
  • extensions/LCAS/trunk/admin/template/global.tpl

    r8565 r8638  
    77
    88<script type="text/javascript">
    9 jQuery().ready(function()
    10 {ldelim}
     9var LCAS_final_case = '{$LCAS_final_case}';
     10var PWG_insensitive_case_logon = {if $PWG_insensitive_case_logon}true{else}false{/if};
     11var Personalized_not_allowed = {if $Personalized_not_allowed}true{else}false{/if};
     12{literal}
     13jQuery().ready(function(){
    1114  jQuery('.cluetip').cluetip(
    12   {ldelim}
     15  {
    1316    width: 550,
    1417    splitTitle: '|'
    15   {rdelim});
    16 {rdelim});
     18  });
     19});
     20
     21jQuery().ready(function(){
     22  if (PWG_insensitive_case_logon) {
     23    jQuery('#LCAS_id_Option0, #LCAS_id_Option2').attr('disabled', 'disabled');
     24    jQuery('#LCAS_id_Opt0, #LCAS_id_Opt2').attr("title", "{/literal}{'conf[insensitive_case_logon] is true'|@translate}{literal}");
     25  }
     26  else {
     27    jQuery('#LCAS_id_Option1, #LCAS_id_Option3').attr('disabled', 'disabled');
     28    jQuery('#LCAS_id_Opt1, #LCAS_id_Opt3').attr("title", "{/literal}{'conf[insensitive_case_logon] is false'|@translate}{literal}");
     29  }
     30  if (Personalized_not_allowed) {
     31    jQuery('#LCAS_id_Option0').attr('disabled', 'disabled');
     32    jQuery('#LCAS_id_Opt0').attr("title", "{/literal}{'Personalized not allowed tooltip'|@translate}{literal}");
     33  }
     34});
    1735
    1836function LCAS_blockToggleDisplay( headerId, contentId )
    19 {ldelim}
     37{
    2038  if (typeof(headerId)=='string')
    21   {ldelim}
     39  {
    2240   if ( headerId.length>  1)
    2341       blockToggleDisplay(headerId, contentId) ;
    2442      document.getElementById("nb_para").value =headerId ;
    2543      document.getElementById("nb_para2").value =contentId;
    26   {rdelim}
    27 {rdelim}
     44  }
     45}
    2846jQuery(document).ready(function()
    29     {ldelim}
     47    {
    3048      jQuery("#sorting")
    31       .tablesorter({ldelim}sortList:[[3,0]], headers: {ldelim} 1: {ldelim} sorter: false {rdelim}, 4: {ldelim} sorter: false {rdelim}, 5: {ldelim} sorter: false {rdelim} {rdelim} {rdelim})
    32       .tablesorterPager({ldelim}container: jQuery("#pager"), positionFixed: false, size: 20, totalPages: 0{rdelim});
    33     {rdelim}
     49      .tablesorter({sortList:[[3,0]], headers: { 1: { sorter: false }, 4: { sorter: false }, 5: { sorter: false } } })
     50      .tablesorterPager({container: jQuery("#pager"), positionFixed: false, size: 20, totalPages: 0});
     51    }
    3452);
    35 function UpdateAUser(UserId) {ldelim}
     53function UpdateAUser(UserId) {
    3654        document.UserList.UserToUpdate.value=UserId;document.UserList.submit();
    37 {rdelim}
     55}
     56{/literal}
    3857</script>
    3958
     
    6079          <li>
    6180            <label class="cluetip" title="{'LCAS_caseSensitiveTitle'|translate}|{'LCAS_caseSensitiveTitle_d'|translate}">
    62               {'LCAS_Case_Sensitive'|@translate}
    63             </label>
    64           <br><br>
    65             <input type="radio" value="false" {$LCAS_Case_Sensitive_FALSE} name="LCAS_Case_Sensitive">
    66               {'LCAS_DisableOption'|@translate}<br>
    67             <input type="radio" value="true" {$LCAS_Case_Sensitive_TRUE} name="LCAS_Case_Sensitive">
    68               {'LCAS_EnableOption'|@translate}
     81              {'LCAS option'|@translate}
     82            </label>
     83            <br><br>
     84            <label for = "LCAS_id_Option1" id ="LCAS_id_Opt1">
     85              <input type="radio" value="1" {if $LCAS_Option == '1'}checked="checked"{/if} id="LCAS_id_Option1" name="LCAS_Option">
     86              {'LCAS_Option1'|@translate}<br>
     87            </label>
     88            <label for = "LCAS_id_Option2" id ="LCAS_id_Opt2">
     89              <input type="radio" value="2" {if $LCAS_Option == '2'}checked="checked"{/if} id="LCAS_id_Option2" name="LCAS_Option">
     90              {'LCAS_Option2'|@translate}<br>
     91            </label>
     92            <label for = "LCAS_id_Option3" id ="LCAS_id_Opt3">
     93              <input type="radio" value="3" {if $LCAS_Option == '3'}checked="checked"{/if} id="LCAS_id_Option3" name="LCAS_Option">
     94              {'LCAS_Option3'|@translate}<br>
     95            </label>
     96            <label for = "LCAS_id_Option0" id ="LCAS_id_Opt0">
     97              <input type="radio" value="0" {if $LCAS_Option == '0'}checked="checked"{/if} id="LCAS_id_Option0" name="LCAS_Option">
     98              {'LCAS_Option0'|@translate}{if $Personalized_not_allowed}{'Personalized not allowed explanation'|@translate}{/if}<br>
     99            </label>
    69100            <br><br>
    70101          </li>
    71 
    72                 <li>
    73             <label class="cluetip" title="{'LCAS_accentSensitiveTitle'|translate}|{'LCAS_accentSensitiveTitle_d'|translate}">
    74               {'LCAS_Accent_Sensitive'|@translate}
    75             </label>
    76          <br><br>
    77             <input type="radio" value="false" {$LCAS_Accent_Sensitive_FALSE} name="LCAS_Accent_Sensitive">
    78               {'LCAS_DisableOption'|@translate}<br>
    79             <input type="radio" value="true" {$LCAS_Accent_Sensitive_TRUE} name="LCAS_Accent_Sensitive">
    80               {'LCAS_EnableOption'|@translate}<br>
    81             <br><br>
    82                 </li>
    83102
    84103          <li>
     
    127146          <label class="cluetip" title="{'LCAS_currentPWGConfig'|translate}|{'LCAS_currentPWGConfig_d'|translate}">
    128147            $conf['insensitive_case_logon'] =
    129 {if $PWG_insensitive_case_logon == 'true'}
    130         <span style="color: green;">{$PWG_insensitive_case_logon}</span>;
     148{if $PWG_insensitive_case_logon}
     149        <span style="color: green;">true</span>;
    131150{else}
    132         <span style="color: red;">{$PWG_insensitive_case_logon}</span>;
     151        <span style="color: red;">false</span>;
    133152{/if}
    134153          </label>
  • extensions/LCAS/trunk/include/LCAS_replacement_set.inc.php

    r8565 r8638  
    382382  );
    383383
     384  $conf['LCAS_replacement_set'][2] = array(
     385  // 2 : case sensitive, accents insensitive
     386   
     387  // Latin
     388   
     389    'a'  => 'à â á ã ä å ā ă ą ǻ ạ ả ấ ầ ẩ ẫ ậ ắ ằ ẳ ẵ ặ @',
     390    'A'  => 'À Â Á Ã Ä Å Ā Ă Ą Ǻ Ạ Ả Ấ Ầ Ẩ Ẫ Ậ Ắ Ằ Ẳ Ẵ Ặ',
     391    'c'  => 'ç ć ĉ ċ č',
     392    'C'  => 'Ç Ć Ĉ Ċ Č',
     393    'd'  => 'ď đ',
     394    'D'  => 'Ď Đ',
     395    'e'  => 'è é ê ë ē ĕ ė ę ě ẹ ẻ ẽ ế ề ể ễ ệ',
     396    'E'  => 'È É Ê Ë Ē Ĕ Ė Ę Ě Ẹ Ẻ Ẽ Ế Ề Ể Ễ Ệ',
     397    'f'  => 'ƒ',
     398    'g'  => 'ĝ ğ ġ ģ',
     399    'G'  => 'Ĝ Ğ Ġ Ģ',
     400    'h'  => 'ĥ ħ',
     401    'H'  => 'Ĥ Ħ',
     402    'i'  => 'ì í î ï ĩ ī ĭ į ǐ ỉ ị ı',
     403    'I'  => 'Ì Í Î Ï Ĩ Ī Ĭ Į Ǐ Ỉ Ị İ',
     404    'j'  => 'ĵ',
     405    'J'  => 'Ĵ',
     406    'k'  => 'ķ',
     407    'K'  => 'Ķ',
     408    'l'  => 'ĺ ļ ľ ŀ ł',
     409    'L'  => 'Ĺ Ļ Ľ Ŀ Ł',
     410    'n'  => 'ñ ń ņ ň ʼn',
     411    'N'  => 'Ñ Ń Ņ Ň',
     412    'o'  => 'ò ó ô õ ö ø ō ŏ ő ơ ǒ ǿ ọ ỏ ố ồ ổ ỗ ộ ớ ờ ở ỡ ợ',
     413    'O'  => 'Ò Ó Ô Õ Ö Ø Ō Ŏ Ő Ơ Ǒ Ǿ Ọ Ỏ Ố Ồ Ổ Ỗ Ộ Ớ Ờ Ở Ỡ Ợ',
     414    'q'  => 'ĸ',
     415    'r'  => 'ŕ ŗ ř',
     416    'R'  => 'Ŕ Ŗ Ř',
     417    's'  => 'ś ŝ ş š ſ',
     418    'S'  => 'Ś Ŝ Ş Š',
     419    'ss' => 'ß',
     420    't'  => 'ţ ť ŧ',
     421    'T'  => 'Ţ Ť Ŧ',
     422    'u'  => 'ù ú û ü ũ ū ŭ ů ű ų ǔ ǖ ǘ ǚ ǜ ư ụ ủ ứ ừ ử ữ ự',
     423    'U'  => 'Ù Ú Û Ü Ũ Ū Ŭ Ů Ű Ų Ǔ Ǖ Ǘ Ǚ Ǜ Ư Ụ Ủ Ứ Ừ Ử Ữ Ự',
     424    'w'  => 'ŵ ẁ ẃ ẅ',
     425    'W'  => 'Ŵ Ẁ Ẃ Ẅ',
     426    'y'  => 'ý ÿ ỳ ỵ ỷ ỹ ŷ',
     427    'Y'  => 'Ý Ÿ Ỳ Ỵ Ỷ Ỹ Ŷ',
     428    'z'  => 'ź ż ž',
     429    'Z'  => 'Ź Ż Ž',
     430    'ae' => 'ǽ',
     431    'AE' => 'Ǽ',
     432    'ae' => 'æ',
     433    'AE' => 'Æ',
     434    'ij' => 'ij',
     435    'IJ' => 'IJ',
     436    'oe' => 'œ',
     437    'OE' => 'Œ',
     438   
     439  // Greek
     440   
     441    'α'  => 'ά',
     442    'Α'  => 'Ά',
     443    'ε'  => 'έ',
     444    'Ε'  => 'Έ',
     445    'μ'  => 'µ',
     446    'η'  => 'ή',
     447    'Η'  => 'Ή',
     448    'ι'  => 'ί ϊ ΐ',
     449    'Ι'  => 'Ί Ϊ',
     450    'ο'  => 'ό',
     451    'Ο'  => 'Ό',
     452    'σ'  => 'ς',
     453    'υ'  => 'ύ ϋ ΰ',
     454    'Υ'  => 'Ύ Ϋ',
     455    'ω'  => 'ώ',
     456    'Ω'  => 'Ώ',
     457   
     458  // Cyrillic
     459   
     460    'г'  => 'ґ ғ',
     461    'Г'  => 'Ґ Ғ',
     462    'ж'  => 'җ',
     463    'Ж'  => 'Җ',
     464    'к'  => 'қ ҝ',
     465    'К'  => 'Қ Ҝ',
     466    'н'  => 'ң',
     467    'Н'  => 'Ң',
     468    'х'  => 'ҳ',
     469    'Х'  => 'Ҳ',
     470    'ч'  => 'ҹ',
     471    'Ч'  => 'Ҹ',
     472   
     473  );
     474
    384475  $conf['LCAS_replacement_set'][3] = array(
    385476  // 3 : case insensitive, accents insensitive
     
    505596  );
    506597
    507   $conf['LCAS_replacement_set'][2] = array(
    508   // 2 : case sensitive, accents insensitive
    509    
    510   // Latin
    511    
    512     'a'  => 'à â á ã ä å ā ă ą ǻ ạ ả ấ ầ ẩ ẫ ậ ắ ằ ẳ ẵ ặ @',
    513     'A'  => 'À Â Á Ã Ä Å Ā Ă Ą Ǻ Ạ Ả Ấ Ầ Ẩ Ẫ Ậ Ắ Ằ Ẳ Ẵ Ặ',
    514     'c'  => 'ç ć ĉ ċ č',
    515     'C'  => 'Ç Ć Ĉ Ċ Č',
    516     'd'  => 'ď đ',
    517     'D'  => 'Ď Đ',
    518     'e'  => 'è é ê ë ē ĕ ė ę ě ẹ ẻ ẽ ế ề ể ễ ệ',
    519     'E'  => 'È É Ê Ë Ē Ĕ Ė Ę Ě Ẹ Ẻ Ẽ Ế Ề Ể Ễ Ệ',
    520     'f'  => 'ƒ',
    521     'g'  => 'ĝ ğ ġ ģ',
    522     'G'  => 'Ĝ Ğ Ġ Ģ',
    523     'h'  => 'ĥ ħ',
    524     'H'  => 'Ĥ Ħ',
    525     'i'  => 'ì í î ï ĩ ī ĭ į ǐ ỉ ị ı',
    526     'I'  => 'Ì Í Î Ï Ĩ Ī Ĭ Į Ǐ Ỉ Ị İ',
    527     'j'  => 'ĵ',
    528     'J'  => 'Ĵ',
    529     'k'  => 'ķ',
    530     'K'  => 'Ķ',
    531     'l'  => 'ĺ ļ ľ ŀ ł',
    532     'L'  => 'Ĺ Ļ Ľ Ŀ Ł',
    533     'n'  => 'ñ ń ņ ň ʼn',
    534     'N'  => 'Ñ Ń Ņ Ň',
    535     'o'  => 'ò ó ô õ ö ø ō ŏ ő ơ ǒ ǿ ọ ỏ ố ồ ổ ỗ ộ ớ ờ ở ỡ ợ',
    536     'O'  => 'Ò Ó Ô Õ Ö Ø Ō Ŏ Ő Ơ Ǒ Ǿ Ọ Ỏ Ố Ồ Ổ Ỗ Ộ Ớ Ờ Ở Ỡ Ợ',
    537     'q'  => 'ĸ',
    538     'r'  => 'ŕ ŗ ř',
    539     'R'  => 'Ŕ Ŗ Ř',
    540     's'  => 'ś ŝ ş š ſ',
    541     'S'  => 'Ś Ŝ Ş Š',
    542     'ss' => 'ß',
    543     't'  => 'ţ ť ŧ',
    544     'T'  => 'Ţ Ť Ŧ',
    545     'u'  => 'ù ú û ü ũ ū ŭ ů ű ų ǔ ǖ ǘ ǚ ǜ ư ụ ủ ứ ừ ử ữ ự',
    546     'U'  => 'Ù Ú Û Ü Ũ Ū Ŭ Ů Ű Ų Ǔ Ǖ Ǘ Ǚ Ǜ Ư Ụ Ủ Ứ Ừ Ử Ữ Ự',
    547     'w'  => 'ŵ ẁ ẃ ẅ',
    548     'W'  => 'Ŵ Ẁ Ẃ Ẅ',
    549     'y'  => 'ý ÿ ỳ ỵ ỷ ỹ ŷ',
    550     'Y'  => 'Ý Ÿ Ỳ Ỵ Ỷ Ỹ Ŷ',
    551     'z'  => 'ź ż ž',
    552     'Z'  => 'Ź Ż Ž',
    553     'ae' => 'ǽ',
    554     'AE' => 'Ǽ',
    555     'ae' => 'æ',
    556     'AE' => 'Æ',
    557     'ij' => 'ij',
    558     'IJ' => 'IJ',
    559     'oe' => 'œ',
    560     'OE' => 'Œ',
    561    
    562   // Greek
    563    
    564     'α'  => 'ά',
    565     'Α'  => 'Ά',
    566     'ε'  => 'έ',
    567     'Ε'  => 'Έ',
    568     'μ'  => 'µ',
    569     'η'  => 'ή',
    570     'Η'  => 'Ή',
    571     'ι'  => 'ί ϊ ΐ',
    572     'Ι'  => 'Ί Ϊ',
    573     'ο'  => 'ό',
    574     'Ο'  => 'Ό',
    575     'σ'  => 'ς',
    576     'υ'  => 'ύ ϋ ΰ',
    577     'Υ'  => 'Ύ Ϋ',
    578     'ω'  => 'ώ',
    579     'Ω'  => 'Ώ',
    580    
    581   // Cyrillic
    582    
    583     'г'  => 'ґ ғ',
    584     'Г'  => 'Ґ Ғ',
    585     'ж'  => 'җ',
    586     'Ж'  => 'Җ',
    587     'к'  => 'қ ҝ',
    588     'К'  => 'Қ Ҝ',
    589     'н'  => 'ң',
    590     'Н'  => 'Ң',
    591     'х'  => 'ҳ',
    592     'Х'  => 'Ҳ',
    593     'ч'  => 'ҹ',
    594     'Ч'  => 'Ҹ',
    595    
    596   );
    597 
    598598?>
  • extensions/LCAS/trunk/include/functions.inc.php

    r8565 r8638  
    3333 * @return : string, or array of strings, modified as stated
    3434*/
    35 function LCAS_change_case($Username, $Option)
     35function LCAS_change_case($Username, $Opt, $At_login=true)
    3636{
    3737  global $conf;
    38 
    39   // Exits immediately without changing the parameter, if the configuration
    40   // is set on "case sensitive and accent sensitive".
    41   if (!isset($Option) or
    42     $Option != 0 and
    43     $Option != 1 and
    44     $Option != 2 and
    45     $Option != 3
    46   ) return $Username;
     38 
     39  if ($Opt == '0' and !isset($conf['LCAS_replacement_set'][0]))
     40   return $Username;
     41  $Option = intval($Opt);
     42  if (!isset($Opt) or ($Option < 0) or ($Option > 7)) return $Username;
     43  if ($Option > 3) {
     44    // Management of bad setting of $conf['insensitive_case_logon']
     45    switch ($Opt) {
     46      case '4':
     47        // LCAS set to case insensitive, but $conf['insensitive_case_logon']
     48        // is false : exit immediately, LCAS actually inactive
     49        return $Username;
     50      break;
     51      case '5':
     52        // LCAS set to case and accents insensitive, but
     53        // $conf['insensitive_case_logon'] is false : only accents are
     54        // insensitive
     55        $Option = 2;
     56      break;
     57      case '6':
     58        // LCAS set to accents only insensitive, but
     59        // $conf['insensitive_case_logon'] is true : if check is done at
     60        // login, LCAS cares for both case and accents insensitivity, but
     61        // using strtolower() as does Piwigo at register; in case the check is
     62        // done at register, Piwigo cares for the case, thus LCAS cares only
     63        // for the accents.
     64        $Option = 2;
     65        if ($At_login) $Username = strtolower($Username);
     66      break;
     67      case '7':
     68        // LCAS set to personal, but $conf['insensitive_case_logon'] is true :
     69        // if check is done at login, LCAS cares for both case and personal
     70        // insensitivity, but using strtolower() as does Piwigo at register;
     71        // in case the check is done at register, Piwigo cares for the case,
     72        // thus LCAS cares only for the personal setting.
     73        $Option = 0;
     74        if ($At_login) $Username = strtolower($Username);
     75      break;
     76    }
     77  }
    4778 
    4879  include(LCAS_PATH.'include/LCAS_replacement_set.inc.php');
     
    320351
    321352/*
     353 * LCAS_final_case($var)
     354 * return the value of the case in which is the gallery, regarding
     355 * case and accents sensitivity
     356 *
     357 * @param $var
     358 *   the inital proposal from the webmaster
     359 * @return
     360 *   string being an image of the case and accents sensitivity
     361 */
     362function LCAS_final_case($var) {
     363
     364  global $conf;
     365 
     366  if (isset($conf['insensitive_case_logon']) and $conf['insensitive_case_logon'] == true)
     367  {
     368    // Uncomfortable status if $conf['insensitive_case_logon'] is true and
     369    // case insensitivity is not set in LCAS
     370    if ($var == '2') return '6';
     371    elseif  ($var == '0') return '7';
     372  }
     373  else
     374  {
     375    // Uncomfortable status if $conf['insensitive_case_logon'] is false and
     376    // case insensitivity is set in LCAS
     377    if ($var == '1') return '4';
     378    elseif  ($var == '3') return '5';
     379  }
     380 
     381  return $var;
     382
     383}
     384
     385
     386/*
    322387 * str_from_var3($var)
    323388 * returns a string easing array var informations displaying in Piwigo :
  • extensions/LCAS/trunk/language/en_UK/plugin.lang.php

    r8271 r8638  
    1010
    1111
    12 $lang['LCAS_Case_Sensitive'] = 'Case insensitivity :';
     12$lang['LCAS option'] = 'LCAS option:';
    1313
    14 $lang['LCAS_Accent_Sensitive'] = 'Accents insensivity :';
     14$lang['LCAS_Accent_Sensitive'] = 'Accents insensivity:';
    1515
    1616$lang['LCAS_currentPWGConfigHeader'] = 'Current Piwigo\'s setting';
  • extensions/LCAS/trunk/language/fr_FR/help/plugin.lang.php

    r8271 r8638  
    1 <?php
     1  <?php
    22global $lang;
    33
     
    1010<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>
    1111';
    12 $lang['LCAS_caseSensitiveTitle'] = 'La casse';
    13 $lang['LCAS_caseSensitiveTitle_d'] = 'Cette option permet de s\'authentifier sans tenir compte des majuscules et minuscules dans le nom de l\'utilisateur.<br>
     12$lang['LCAS_caseSensitiveTitle'] = 'Les options';
     13$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>
    1414<b style=&quot;color: red;&quot;>NB: Le mot de passe reste sensible à la casse !</b><br>
    1515';
  • extensions/LCAS/trunk/language/fr_FR/plugin.lang.php

    r8271 r8638  
    1010
    1111
    12 $lang['LCAS_Case_Sensitive'] = 'Insensible à la casse :';
     12$lang['LCAS option'] = 'Option LCAS :';
     13$lang['LCAS_Option1'] = 'Insensibilité à la casse';
     14$lang['LCAS_Option2'] = 'Insensibilité aux accents';
     15$lang['LCAS_Option3'] = 'Insensibilité à la casse et aux accents';
     16$lang['LCAS_Option0'] = 'Tableau personnel';
     17$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>)';
     18$lang['Personalized not allowed tooltip'] = 'Pas de tableau $conf[\'LCAS_replacement_set\'][0] de défini';
    1319
    14 $lang['LCAS_Accent_Sensitive'] = 'Insensible aux accents :';
     20$lang['conf[insensitive_case_logon] is true'] = '$conf[\'insensitive_case_logon\'] vaut true';
     21$lang['conf[insensitive_case_logon] is false'] = '$conf[\'insensitive_case_logon\'] vaut false';
    1522
    1623$lang['LCAS_currentPWGConfigHeader'] = 'Paramètre actuel de Piwigo';
     
    5158$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.';
    5259
     60$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.';
     61
    5362$lang['LCAS_MailText'] = 'Personnalisation de la notification par email';
    5463
  • extensions/LCAS/trunk/main.inc.php

    r8239 r8638  
    2525load_language('plugin.lang', LCAS_PATH);
    2626
     27$t = pwg_db_fetch_row(pwg_query('
     28  SELECT `value`
     29  FROM `'.CONFIG_TABLE.'`
     30  WHERE `param` = "LoginCaseAccentsSensitivity"
     31  LIMIT 1;
     32'));
     33
     34$conf['LoginCaseAccentsSensitivity'] = $t[0];
    2735
    2836/* Plugin admin */
     
    5967  if (script_basename() == 'identification')
    6068  {
    61     if (isset($_POST['username']))
     69    if (isset($_POST['username']) and isset($conf_LCAS[0]))
    6270    {
    63       /* Username is case insensitive only */
    64       if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'false')
    65       {
    66         $new_username = LCAS_SearchCaseUsername($_POST['username'],1);
    67         $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    68       }
    69 
    70       /* Username is accent insensitive only */
    71       if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'false' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
    72       {
    73         $new_username = LCAS_SearchCaseUsername($_POST['username'],2);
    74         $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    75       }
    76 
    77       //* Username is accent and case insensitive */
    78       if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
    79       {
    80         $new_username = LCAS_SearchCaseUsername($_POST['username'],3);
    81         $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    82       }
     71      $new_username = LCAS_SearchCaseUsername($_POST['username'],$conf_LCAS[0]);
     72      $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    8373    }
    8474  }
     
    8676
    8777// Check users registration
     78// Returns error
    8879add_event_handler('register_user_check', 'LCAS_RegistrationCheck');
    8980
     
    9687  load_language('plugin.lang', LCAS_PATH);
    9788
    98   /* Username is accent and case insensitive */
    99   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')
    100   {
    101     $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'],3);
    102   }
    103   /* Username is accent insensitive only */
    104   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')
    105   {
    106     $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'],2);
    107   }
    108   /* Username is case insensitive only is already controled by Piwigo with $conf['insensitive_case_logon'] == true */
    109 
     89  if (isset($conf_LCAS[0]))
     90   $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'], $conf_LCAS[0], false);
     91 
    11092  if (isset($NewPostLogin) and get_userid($NewPostLogin))
    11193  {
Note: See TracChangeset for help on using the changeset viewer.