LSsession :

- Add subDnIsEnabled() function and use it in getSubDnLdapServer()
  - Add debuging support for smarty
  - Change in the detection of the session for safety
This commit is contained in:
Benjamin Renard 2009-10-25 23:34:06 +00:00
parent 58e8bed57d
commit 8e498f34fa
2 changed files with 26 additions and 9 deletions

View file

@ -137,6 +137,10 @@ class LSsession {
$GLOBALS['Smarty'] -> force_compile = TRUE; $GLOBALS['Smarty'] -> force_compile = TRUE;
// recompile template if it is changed // recompile template if it is changed
$GLOBALS['Smarty'] -> compile_check = TRUE; $GLOBALS['Smarty'] -> compile_check = TRUE;
if (isset($_REQUEST['debug_smarty'])) {
// debug smarty
$GLOBALS['Smarty'] -> debugging = true;
}
} }
$GLOBALS['Smarty'] -> assign('LS_CSS_DIR',LS_CSS_DIR); $GLOBALS['Smarty'] -> assign('LS_CSS_DIR',LS_CSS_DIR);
@ -439,7 +443,7 @@ class LSsession {
$_POST['LSsession_user'] = 'a determiner plus tard'; $_POST['LSsession_user'] = 'a determiner plus tard';
} }
if(isset($_SESSION['LSsession'])) { if(isset($_SESSION['LSsession']['dn'])) {
// Session existante // Session existante
self :: $topDn = $_SESSION['LSsession']['topDn']; self :: $topDn = $_SESSION['LSsession']['topDn'];
self :: $dn = $_SESSION['LSsession']['dn']; self :: $dn = $_SESSION['LSsession']['dn'];
@ -845,6 +849,21 @@ class LSsession {
} }
} }
/**
* Use this function to know if subDn is enabled for the curent LdapServer
*
* @retval boolean
**/
public static function subDnIsEnabled() {
if (!isset(self :: $ldapServer['subDn'])) {
return;
}
if ( !is_array(self :: $ldapServer['subDn']) ) {
return;
}
return true;
}
/** /**
* Retourne les sous-dns du serveur Ldap courant * Retourne les sous-dns du serveur Ldap courant
* *
@ -854,10 +873,7 @@ class LSsession {
if (self :: cacheSudDn() && isset(self :: $_subDnLdapServer[self :: $ldapServerId])) { if (self :: cacheSudDn() && isset(self :: $_subDnLdapServer[self :: $ldapServerId])) {
return self :: $_subDnLdapServer[self :: $ldapServerId]; return self :: $_subDnLdapServer[self :: $ldapServerId];
} }
if (!isset(self :: $ldapServer['subDn'])) { if (!self::subDnIsEnabled()) {
return;
}
if ( !is_array(self :: $ldapServer['subDn']) ) {
return; return;
} }
$return=array(); $return=array();
@ -1981,10 +1997,9 @@ class LSsession {
LSerror :: defineError('LSsession_04', LSerror :: defineError('LSsession_04',
_("LSsession : Failed to load LSobject type %{type} : unknon type.") _("LSsession : Failed to load LSobject type %{type} : unknon type.")
); );
// no longer used LSerror :: defineError('LSsession_05',
/*LSerror :: defineError(1005, _("LSsession : Failed to load LSclass %{class}.")
_("LSsession : Object type use for authentication is unknow (%{type}).") );
);*/
LSerror :: defineError('LSsession_06', LSerror :: defineError('LSsession_06',
_("LSsession : Login or password incorrect.") _("LSsession : Login or password incorrect.")
); );

View file

@ -8,6 +8,8 @@
<div id='LSdebug_txt'>{if $LSdebug != ''}{$LSdebug}{/if}</div> <div id='LSdebug_txt'>{if $LSdebug != ''}{$LSdebug}{/if}</div>
<div id="_smarty_console"></div>
<div id='LSlang_select'> <div id='LSlang_select'>
{foreach from=$LSlanguages item=lang} {foreach from=$LSlanguages item=lang}
<img src='{$LS_IMAGES_DIR}/{$lang}.png' alt='{$lang}' title='{$lang}'/> <img src='{$LS_IMAGES_DIR}/{$lang}.png' alt='{$lang}' title='{$lang}'/>