Ignore:
Timestamp:
Dec 1, 2013, 11:01:27 PM (10 years ago)
Author:
LucMorizur
Message:

Compatibility with Piwigo version 2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/main.inc.php

    r18391 r25774  
    22/*
    33Plugin Name: LCAS
    4 Version: 2.2.3
     4Version: 2.2.4
    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
     
    8080    if (isset($_POST['username']) and isset($conf_LCAS[0]))
    8181    {
    82       $new_username =
    83        LCAS_SearchCaseUsername($_POST['username'], $conf_LCAS[0]);
    84       $_POST['username'] = ($new_username == '') ?
    85        $_POST['username'] : $new_username;
     82      $new_username = LCAS_SearchCaseUsername($_POST['username'],$conf_LCAS[0]);
     83      $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    8684    }
    8785  }
    8886 
    89   // Add tooltips on register and identification page
    90   $sb = script_basename(); $fn = '';
    91   if ($sb == 'register' or $sb == 'identification')
    92    $fn = ($sb == 'register') ?
    93     'LCAS_add_tooltips_prefilter_register' :
    94     'LCAS_add_tooltips_prefilter_identification';
    95   if ($fn != '') {
     87  // Add tooltips on register page
     88  if (script_basename() == 'register') {
    9689    $template->assign(array(
    97       'LCAS_username_tooltip' =>
    98        $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])],
    99       'LCAS_password_tooltip' =>
    100        $lang['LCAS_tooltip_password_register'],
     90      'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])],
     91      'LCAS_password_tooltip' => $lang['LCAS_tooltip_password_register'],
    10192    ));
    102     $template->set_prefilter($sb, $fn);
     93    $template->set_prefilter('register', 'LCAS_add_tooltips_prefilter_register');
    10394  }
    10495}
     
    126117}
    127118
    128 function LCAS_add_tooltips_prefilter_identification($content, &$smarty) {
    129   $search = 'for="username"';
    130   $replacement = 'for="username" title="{$LCAS_username_tooltip}"';
    131   $content = str_replace($search, $replacement, $content);
    132   $search = 'name="username"';
    133   $replacement = 'name="username" title="{$LCAS_username_tooltip}"';
    134   $content = str_replace($search, $replacement, $content);
    135   $search = 'for="password"';
    136   $replacement = 'for="password" title="{$LCAS_password_tooltip}"';
    137   $content = str_replace($search, $replacement, $content);
    138   $search = 'name="password"';
    139   $replacement = 'name="password" title="{$LCAS_password_tooltip}"';
    140   $content = str_replace($search, $replacement, $content);
    141   return $content;
    142 }
    143 
    144119// Check users registration
    145120// Returns error
     
    157132   $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'], $conf_LCAS[0]);
    158133 
    159   if (isset($NewPostLogin) and get_userid($NewPostLogin) and (intval($conf_LCAS[0]) != 0))
     134  if (isset($NewPostLogin) and get_userid($NewPostLogin))
    160135   $errors[] = $lang['LCAS_error'][intval($conf_LCAS[0])];
    161136 
Note: See TracChangeset for help on using the changeset viewer.