From 8e498f34fae25cc83085a2bd74c9cb08ff01ca87 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 25 Oct 2009 23:34:06 +0000 Subject: [PATCH] LSsession : - Add subDnIsEnabled() function and use it in getSubDnLdapServer() - Add debuging support for smarty - Change in the detection of the session for safety --- trunk/includes/class/class.LSsession.php | 33 +++++++++++++++++------- trunk/templates/default/LSdefault.tpl | 2 ++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 016c11f5..e3415998 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -137,6 +137,10 @@ class LSsession { $GLOBALS['Smarty'] -> force_compile = TRUE; // recompile template if it is changed $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); @@ -439,7 +443,7 @@ class LSsession { $_POST['LSsession_user'] = 'a determiner plus tard'; } - if(isset($_SESSION['LSsession'])) { + if(isset($_SESSION['LSsession']['dn'])) { // Session existante self :: $topDn = $_SESSION['LSsession']['topDn']; 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 * @@ -854,10 +873,7 @@ class LSsession { if (self :: cacheSudDn() && isset(self :: $_subDnLdapServer[self :: $ldapServerId])) { return self :: $_subDnLdapServer[self :: $ldapServerId]; } - if (!isset(self :: $ldapServer['subDn'])) { - return; - } - if ( !is_array(self :: $ldapServer['subDn']) ) { + if (!self::subDnIsEnabled()) { return; } $return=array(); @@ -1981,10 +1997,9 @@ class LSsession { LSerror :: defineError('LSsession_04', _("LSsession : Failed to load LSobject type %{type} : unknon type.") ); - // no longer used - /*LSerror :: defineError(1005, - _("LSsession : Object type use for authentication is unknow (%{type}).") - );*/ + LSerror :: defineError('LSsession_05', + _("LSsession : Failed to load LSclass %{class}.") + ); LSerror :: defineError('LSsession_06', _("LSsession : Login or password incorrect.") ); diff --git a/trunk/templates/default/LSdefault.tpl b/trunk/templates/default/LSdefault.tpl index 4c9e4b56..e060537f 100644 --- a/trunk/templates/default/LSdefault.tpl +++ b/trunk/templates/default/LSdefault.tpl @@ -8,6 +8,8 @@
{if $LSdebug != ''}{$LSdebug}{/if}
+
+
{foreach from=$LSlanguages item=lang} {$lang}