Changeset 28237


Ignore:
Timestamp:
04/20/14 11:04:39 (5 years ago)
Author:
LucMorizur
Message:

Version 2.3.1: fix bug:3044 thanks to svn:27296 and svn:27322

Location:
extensions/LCAS
Files:
78 added
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/branch/2.3/CHANGELOG.txt

    r27186 r28237  
     12014-04-20 2.3.1 
     2                  Added LCAS functionnality on 'password' page (displayed when 
     3                  user has forgotten his/her password). Added tooltips where 
     4                  needed (bug:3044; svn:27296, svn:27322). 
     5 
    162014-02-04 2.3.0 
    27                  Compatibility (correct, this time :-/ ) with version 2.6 of 
  • extensions/LCAS/branch/2.3/include/functions.inc.php

    r27127 r28237  
    284284 
    285285/** 
    286  * Function called from main.inc.php - For test on username case sensitivity 
    287  * Have to be deleted before first release build 
     286 * Function called from main.inc.php 
    288287 *  
    289288 * @param : $username typed in by user for identification 
  • extensions/LCAS/branch/2.3/main.inc.php

    r27129 r28237  
    22/* 
    33Plugin Name: LCAS 
    4 Version: 2.3.0 
     4Version: 2.3.1 
    55Description: Allow to disable login/register name to be sensible to the case/accents 
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=513 
     
    5151// Define prefilter to add tooltips on register page 
    5252add_event_handler('init', 'LCAS_InitPage'); 
    53   
     53 
     54// For page password.php, modifies $POST['username_or_email'] with registered 
     55// username, if this username is found in the DB with current rules of LCAS. 
     56add_event_handler('loc_begin_password', 'LCAS_InitPage'); 
     57 
    5458function LCAS_InitPage() 
    5559{ 
    5660  global $template, $conf, $lang; 
    5761 
    58   $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); 
     62  $conf_LCAS = unserialize($conf['LoginCaseAccentsSensitivity']); 
    5963   
    6064  // Set $conf['insensitive_case_logon'] to false, as LCAS takes completely 
    6165  // in charge everything concerning the case and the accents in the login 
    6266  if ($conf_LCAS[0] != '0') $conf['insensitive_case_logon'] = false; 
    63   
    64   /* User identification */ 
    65   if (script_basename() == 'identification') 
    66   { 
    67     if (isset($_POST['username']) and isset($conf_LCAS[0])) 
    68     { 
    69       $new_username = LCAS_SearchCaseUsername($_POST['username'],$conf_LCAS[0]); 
    70       $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username; 
    71     } 
     67 
     68  $p = ''; 
     69 
     70  switch (script_basename()) { 
     71 
     72    case 'register': 
     73      $template->assign(array( 
     74        'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])], 
     75        'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'], 
     76      )); 
     77      $template->set_prefilter('register', 'LCAS_add_tooltips_prefilter_register'); 
     78    break; 
     79 
     80    case 'identification': 
     81      $p = 'username'; 
     82      $template->assign(array( 
     83        'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])], 
     84        'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'], 
     85      )); 
     86      $template->set_prefilter('identification', 'LCAS_add_tooltips_prefilter_identification'); 
     87    break; 
     88 
     89    case 'password': 
     90      $p = 'username_or_email'; 
     91      $template->assign(array( 
     92        'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])], 
     93      )); 
     94      $template->set_prefilter('password', 'LCAS_add_tooltips_prefilter_password'); 
     95    break; 
     96 
     97    default: return false; 
    7298  } 
    73    
    74   // Add tooltips on register page 
    75   if (script_basename() == 'register') { 
    76     $template->assign(array( 
    77       'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])], 
    78       'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'], 
    79     )); 
    80     $template->set_prefilter('register', 'LCAS_add_tooltips_prefilter_register'); 
     99 
     100  if (($p != '') and isset($_POST[$p]) and isset($conf_LCAS[0])) { 
     101    $new_username = LCAS_SearchCaseUsername($_POST[$p],$conf_LCAS[0]); 
     102    $_POST[$p] = $new_username == '' ? $_POST[$p] : $new_username; 
    81103  } 
     104} 
     105 
     106function LCAS_add_tooltips_prefilter_password($content, &$smarty) { 
     107  $search = '<label> 
     108      {\'Username or email\''; 
     109  $replacement = '<label title="{$LCAS_username_tooltip}"> 
     110      {\'Username or email\''; 
     111  $content = str_replace($search, $replacement, $content); 
     112  $search = 'name="username_or_email"'; 
     113  $replacement = 'name="username_or_email" title="{$LCAS_username_tooltip}"'; 
     114  $content = str_replace($search, $replacement, $content); 
     115  return $content; 
    82116} 
    83117 
     
    100134  $search = 'name="password_conf"'; 
    101135  $replacement = 'name="password_conf" title="{$LCAS_password_tooltip}"'; 
     136  $content = str_replace($search, $replacement, $content); 
     137  return $content; 
     138} 
     139 
     140function LCAS_add_tooltips_prefilter_identification($content, &$smarty) { 
     141  $search = 'for="username"'; 
     142  $replacement = 'for="username" title="{$LCAS_username_tooltip}"'; 
     143  $content = str_replace($search, $replacement, $content); 
     144  $search = 'name="username"'; 
     145  $replacement = 'name="username" title="{$LCAS_username_tooltip}"'; 
     146  $content = str_replace($search, $replacement, $content); 
     147  $search = 'for="password"'; 
     148  $replacement = 'for="password" title="{$LCAS_password_tooltip}"'; 
     149  $content = str_replace($search, $replacement, $content); 
     150  $search = 'name="password"'; 
     151  $replacement = 'name="password" title="{$LCAS_password_tooltip}"'; 
    102152  $content = str_replace($search, $replacement, $content); 
    103153  return $content; 
  • extensions/LCAS/trunk/CHANGELOG.txt

    r27186 r28237  
     12014-04-20 2.3.1 
     2                  Added LCAS functionnality on 'password' page (displayed when 
     3                  user has forgotten his/her password). Added tooltips where 
     4                  needed (bug:3044; svn:27296, svn:27322). 
     5 
    162014-02-04 2.3.0 
    27                  Compatibility (correct, this time :-/ ) with version 2.6 of 
  • extensions/LCAS/trunk/main.inc.php

    r27322 r28237  
    22/* 
    33Plugin Name: LCAS 
    4 Version: 2.3.0 
     4Version: 2.3.1 
    55Description: Allow to disable login/register name to be sensible to the case/accents 
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=513 
Note: See TracChangeset for help on using the changeset viewer.