- Ajout d'un fichier core.php s'occupant des inclusions minimum pour le lancement de toutes les mécaniques

-> Déplacement des définitions des constantes de chemins et 
     de gettext dans ce fichier
  -> Déplacement des ini_set() dans ce fichier
- LSdebug :
  -> La variable d'activation devient la constante LSdebug
  -> Le tableau de stockages des messages s'appel maintenant
     LSdebug_fieds
- LSconfig : Ajout d'une classe gérant la configuration du
  projet qui servira d'abstraction à la configuration
- LSsession :
  -> Suppresion de la méthode loadConfig() et ajout de la 
     méthode startLSconfig()
  -> Ajout de la méthode startLStemplate()
  -> Ajout du commentaire à la méthode getTopDn()
  -> La méthode vérifie l'existance de la classe portant le nom
     du type d'objet avant de lancer le chargement
  -> Utilisation LSconfig pour l'accès à la configuration
This commit is contained in:
Benjamin Renard 2009-03-25 12:26:32 +00:00
parent 713cccedb1
commit 3bcfd6e39f
12 changed files with 246 additions and 103 deletions

View file

@ -172,7 +172,7 @@ define('LS_IMAGES_DIR', 'images/'.LS_THEME);
define('LS_CSS_DIR', 'css/'.LS_THEME); define('LS_CSS_DIR', 'css/'.LS_THEME);
//Debug //Debug
$GLOBALS['LSdebug']['active'] = true; define('LSdebug',true);
// Logs // Logs
$GLOBALS['LSlog']['filename'] = 'tmp/LS.log'; $GLOBALS['LSlog']['filename'] = 'tmp/LS.log';
@ -183,16 +183,6 @@ define('NB_LSOBJECT_LIST_SELECT',11);
define('MAX_SEND_FILE_SIZE',2000000); define('MAX_SEND_FILE_SIZE',2000000);
// Définitions des dossiers d'inclusions
define('LS_CONF_DIR','conf/');
define('LS_OBJECTS_DIR', LS_CONF_DIR . 'LSobjects/');
define('LS_INCLUDE_DIR','includes/');
define('LS_CLASS_DIR', LS_INCLUDE_DIR .'class/');
define('LS_LIB_DIR', LS_INCLUDE_DIR .'libs/');
define('LS_ADDONS_DIR', LS_INCLUDE_DIR .'addons/');
define('LS_JS_DIR', LS_INCLUDE_DIR .'js/');
define('LS_TMP_DIR', 'tmp/');
// Javascript // Javascript
$GLOBALS['defaultJSscipts']=array( $GLOBALS['defaultJSscipts']=array(
@ -202,13 +192,4 @@ $GLOBALS['defaultJSscipts']=array(
'LSdefault.js' 'LSdefault.js'
); );
// PHP values
ini_set( 'magic_quotes_gpc', 'off' );
ini_set( 'magic_quotes_sybase', 'off' );
ini_set( 'magic_quotes_runtime', 'off' );
// Locale
define('LS_TEXT_DOMAIN', 'ldapsaisie');
define('LS_I18N_DIR', 'lang');
?> ?>

46
trunk/core.php Normal file
View file

@ -0,0 +1,46 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
// PHP values
ini_set( 'magic_quotes_gpc', 'off' );
ini_set( 'magic_quotes_sybase', 'off' );
ini_set( 'magic_quotes_runtime', 'off' );
// Définitions des dossiers d'inclusions
define('LS_CONF_DIR','conf/');
define('LS_OBJECTS_DIR', LS_CONF_DIR . 'LSobjects/');
define('LS_INCLUDE_DIR','includes/');
define('LS_CLASS_DIR', LS_INCLUDE_DIR .'class/');
define('LS_LIB_DIR', LS_INCLUDE_DIR .'libs/');
define('LS_ADDONS_DIR', LS_INCLUDE_DIR .'addons/');
define('LS_JS_DIR', LS_INCLUDE_DIR .'js/');
define('LS_TMP_DIR', 'tmp/');
// Locale
define('LS_TEXT_DOMAIN', 'ldapsaisie');
define('LS_I18N_DIR', 'lang');
require_once LS_INCLUDE_DIR.'functions.php';
require_once LS_CLASS_DIR.'class.LSsession.php';
?>

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
require_once 'includes/class/class.LSsession.php'; require_once 'core.php';
if(LSsession :: startLSsession()) { if(LSsession :: startLSsession()) {

View file

@ -0,0 +1,95 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
/**
* Object LSconfig
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSconfig {
// Configuration Data
private static $data=array();
/**
* Lancement de LSconfig
*
* Chargement initiale des données de configuration à partir des fichiers en
* config.*.php du dossier LS_CONF_DIR
*
* @retval boolean True si tout s'est bien passé, False sinon
**/
public static function start() {
if (loadDir(LS_CONF_DIR, '^config\..*\.php$')) {
if (is_array($GLOBALS['LSconfig'])) {
self :: $data = $GLOBALS['LSconfig'];
self :: $data['LSaddons'] = $GLOBALS['LSaddons'];
return true;
}
}
return;
}
/**
* Récupération d'une valeur
*
* @param[in] $var string Le nom de valeur à récupérer (Exemple : cacheSearch)
*
* @retval mixed La valeur de la variable, ou false si son nom n'est parsable
**/
public static function get($var) {
$vars=explode('.',$var);
if(is_array($vars)) {
$data=self :: $data;
foreach ($vars as $v) {
$data=$data[$v];
}
return $data;
}
return;
}
/**
* Définition d'une valeur
*
* @param[in] $var string Le nom de valeur à définir
* @param[in] $val mixed La valeur de la variable
*
* @retval boolean True si tout s'est bien passé, False sinon
**/
public static function set($var,$val) {
$vars=explode('.',$var);
if(is_array($vars)) {
$code='self :: $data';
foreach ($vars as $v) {
$code.='["'.$v.'"]';
}
$code.='=$val;';
return (eval($code)===NULL);
}
return;
}
}
?>

View file

@ -20,9 +20,6 @@
******************************************************************************/ ******************************************************************************/
define('LS_DEFAULT_CONF_DIR','conf');
require_once 'includes/functions.php';
/** /**
* Gestion des sessions * Gestion des sessions
* *
@ -95,7 +92,7 @@ class LSsession {
if (!file_exists($file)) { if (!file_exists($file)) {
return; return;
} }
if ($GLOBALS['LSdebug']['active']) { if (LSdebug) {
return include_once($file); return include_once($file);
} }
else { else {
@ -105,22 +102,36 @@ class LSsession {
} }
/** /**
* Chargement de la configuration * Lancement de LSconfig
*
* Chargement des fichiers de configuration et création de l'objet Smarty.
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @retval true si tout c'est bien passé, false sinon * @retval true si tout c'est bien passé, false sinon
*/ */
private static function loadConfig() { private static function startLSconfig() {
if (loadDir(LS_DEFAULT_CONF_DIR, '^config\..*\.php$')) { if (self :: loadLSclass('LSconfig')) {
if ( self :: includeFile($GLOBALS['LSconfig']['Smarty']) ) { if (LSconfig :: start()) {
return true;
}
}
die("ERROR : Can't load configuration files.");
return;
}
/**
* Lancement et initialisation de Smarty
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retval true si tout c'est bien passé, false sinon
*/
private static function startLStemplate() {
if ( self :: includeFile(LSconfig :: get('Smarty')) ) {
$GLOBALS['Smarty'] = new Smarty(); $GLOBALS['Smarty'] = new Smarty();
$GLOBALS['Smarty'] -> template_dir = LS_TEMPLATES_DIR; $GLOBALS['Smarty'] -> template_dir = LS_TEMPLATES_DIR;
$GLOBALS['Smarty'] -> compile_dir = LS_TMP_DIR; $GLOBALS['Smarty'] -> compile_dir = LS_TMP_DIR;
if ($GLOBALS['LSdebug']['active']) { if (LSdebug) {
$GLOBALS['Smarty'] -> caching = 0; $GLOBALS['Smarty'] -> caching = 0;
// cache files are always regenerated // cache files are always regenerated
$GLOBALS['Smarty'] -> force_compile = TRUE; $GLOBALS['Smarty'] -> force_compile = TRUE;
@ -134,19 +145,17 @@ class LSsession {
self :: addJSconfigParam('LS_IMAGES_DIR',LS_IMAGES_DIR); self :: addJSconfigParam('LS_IMAGES_DIR',LS_IMAGES_DIR);
return true; return true;
} }
else {
die("ERROR : Can't load Smarty."); die("ERROR : Can't load Smarty.");
return; return;
} }
return true;
}
else {
die("ERROR : Can't load configuration files.");
return;
}
}
/**
* Retourne le topDn de la session
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retval string le topDn de la session
*/
public static function getTopDn() { public static function getTopDn() {
return self :: $topDn; return self :: $topDn;
} }
@ -194,6 +203,9 @@ class LSsession {
* @retval boolean true si le chargement a réussi, false sinon. * @retval boolean true si le chargement a réussi, false sinon.
*/ */
public static function loadLSobject($object) { public static function loadLSobject($object) {
if(class_exists($object)) {
return true;
}
$error = 0; $error = 0;
self :: loadLSclass('LSldapObject'); self :: loadLSclass('LSldapObject');
if (!self :: loadLSclass($object,'LSobjects')) { if (!self :: loadLSclass($object,'LSobjects')) {
@ -202,6 +214,11 @@ class LSsession {
if (!self :: includeFile( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) { if (!self :: includeFile( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) {
$error = 1; $error = 1;
} }
else {
if (!LSconfig :: set("LSobjects.$object",$GLOBALS['LSobjects'][$object])) {
$error = 1;
}
}
if ($error) { if ($error) {
LSerror :: addErrorCode('LSsession_04',$object); LSerror :: addErrorCode('LSsession_04',$object);
return; return;
@ -239,12 +256,13 @@ class LSsession {
* @retval boolean true si le chargement a réussi, false sinon. * @retval boolean true si le chargement a réussi, false sinon.
*/ */
public static function loadLSaddons() { public static function loadLSaddons() {
if(!is_array($GLOBALS['LSaddons']['loads'])) { $conf=LSconfig :: get('LSaddons.loads');
if(!is_array($conf)) {
LSerror :: addErrorCode('LSsession_01',"LSaddons['loads']"); LSerror :: addErrorCode('LSsession_01',"LSaddons['loads']");
return; return;
} }
foreach ($GLOBALS['LSaddons']['loads'] as $addon) { foreach ($conf as $addon) {
self :: loadLSaddon($addon); self :: loadLSaddon($addon);
} }
return true; return true;
@ -266,7 +284,7 @@ class LSsession {
$lang = self :: $ldapServer['lang']; $lang = self :: $ldapServer['lang'];
} }
else { else {
$lang = $GLOBALS['LSconfig']['lang']; $lang = LSconfig :: get('lang');
} }
if (isset($_REQUEST['encoding'])) { if (isset($_REQUEST['encoding'])) {
@ -279,7 +297,7 @@ class LSsession {
$encoding = self :: $ldapServer['encoding']; $encoding = self :: $ldapServer['encoding'];
} }
else { else {
$encoding = $GLOBALS['LSconfig']['encoding']; $encoding = LSconfig :: get('encoding');
} }
$_SESSION['LSlang']=$lang; $_SESSION['LSlang']=$lang;
@ -360,9 +378,12 @@ class LSsession {
* @retval boolean True si l'initialisation à réussi, false sinon. * @retval boolean True si l'initialisation à réussi, false sinon.
*/ */
public static function initialize() { public static function initialize() {
if (!self :: loadConfig()) { if (!self :: startLSconfig()) {
return; return;
} }
self :: startLStemplate();
session_start(); session_start();
self :: setLocale(); self :: setLocale();
@ -773,9 +794,10 @@ class LSsession {
* @retval boolean True sinon false. * @retval boolean True sinon false.
*/ */
public static function setLdapServer($id) { public static function setLdapServer($id) {
if ( isset($GLOBALS['LSconfig']['ldap_servers'][$id]) ) { $conf = LSconfig :: get("ldap_servers.$id");
if ( is_array($conf) ) {
self :: $ldapServerId = $id; self :: $ldapServerId = $id;
self :: $ldapServer=$GLOBALS['LSconfig']['ldap_servers'][$id]; self :: $ldapServer = $conf;
self :: setLocale(); self :: setLocale();
return true; return true;
} }
@ -791,7 +813,7 @@ class LSsession {
*/ */
public static function LSldapConnect() { public static function LSldapConnect() {
if (self :: $ldapServer) { if (self :: $ldapServer) {
self :: includeFile($GLOBALS['LSconfig']['NetLDAP2']); self :: includeFile(LSconfig :: get('NetLDAP2'));
if (!self :: loadLSclass('LSldap')) { if (!self :: loadLSclass('LSldap')) {
return; return;
} }
@ -964,13 +986,13 @@ class LSsession {
else { else {
$GLOBALS['Smarty'] -> assign('loginform_action',$_SERVER['REQUEST_URI']); $GLOBALS['Smarty'] -> assign('loginform_action',$_SERVER['REQUEST_URI']);
} }
if (count($GLOBALS['LSconfig']['ldap_servers'])==1) { if (count(LSconfig :: get('ldap_servers'))==1) {
$GLOBALS['Smarty'] -> assign('loginform_ldapserver_style','style="display: none"'); $GLOBALS['Smarty'] -> assign('loginform_ldapserver_style','style="display: none"');
} }
$GLOBALS['Smarty'] -> assign('loginform_label_ldapserver',_('LDAP server')); $GLOBALS['Smarty'] -> assign('loginform_label_ldapserver',_('LDAP server'));
$ldapservers_name=array(); $ldapservers_name=array();
$ldapservers_index=array(); $ldapservers_index=array();
foreach($GLOBALS['LSconfig']['ldap_servers'] as $id => $infos) { foreach(LSconfig :: get('ldap_servers') as $id => $infos) {
$ldapservers_index[]=$id; $ldapservers_index[]=$id;
$ldapservers_name[]=__($infos['name']); $ldapservers_name[]=__($infos['name']);
} }
@ -1002,14 +1024,14 @@ class LSsession {
$GLOBALS['Smarty'] -> assign('pagetitle',_('Recovery of your credentials')); $GLOBALS['Smarty'] -> assign('pagetitle',_('Recovery of your credentials'));
$GLOBALS['Smarty'] -> assign('recoverpasswordform_action','index.php?LSsession_recoverPassword'); $GLOBALS['Smarty'] -> assign('recoverpasswordform_action','index.php?LSsession_recoverPassword');
if (count($GLOBALS['LSconfig']['ldap_servers'])==1) { if (count(LSconfig :: get('ldap_servers'))==1) {
$GLOBALS['Smarty'] -> assign('recoverpasswordform_ldapserver_style','style="display: none"'); $GLOBALS['Smarty'] -> assign('recoverpasswordform_ldapserver_style','style="display: none"');
} }
$GLOBALS['Smarty'] -> assign('recoverpasswordform_label_ldapserver',_('LDAP server')); $GLOBALS['Smarty'] -> assign('recoverpasswordform_label_ldapserver',_('LDAP server'));
$ldapservers_name=array(); $ldapservers_name=array();
$ldapservers_index=array(); $ldapservers_index=array();
foreach($GLOBALS['LSconfig']['ldap_servers'] as $id => $infos) { foreach(LSconfig :: get('ldap_servers') as $id => $infos) {
$ldapservers_index[]=$id; $ldapservers_index[]=$id;
$ldapservers_name[]=$infos['name']; $ldapservers_name[]=$infos['name'];
} }
@ -1127,15 +1149,12 @@ class LSsession {
$JSscript_txt.="<script src='".$script['path'].$script['file']."' type='text/javascript'></script>\n"; $JSscript_txt.="<script src='".$script['path'].$script['file']."' type='text/javascript'></script>\n";
} }
$KAconf = LSconfig :: get('keepLSsessionActive');
if ( if (
( (
(!isset(self :: $ldapServer['keepLSsessionActive'])) (!isset(self :: $ldapServer['keepLSsessionActive']))
&& &&
( (!($KAconf === false))
(!isset($GLOBALS['LSconfig']['keepLSsessionActive']))
||
($GLOBALS['LSconfig']['keepLSsessionActive'])
)
) )
|| ||
(self :: $ldapServer['keepLSsessionActive']) (self :: $ldapServer['keepLSsessionActive'])
@ -1145,7 +1164,7 @@ class LSsession {
$GLOBALS['Smarty'] -> assign('LSjsConfig',json_encode(self :: $_JSconfigParams)); $GLOBALS['Smarty'] -> assign('LSjsConfig',json_encode(self :: $_JSconfigParams));
if ($GLOBALS['LSdebug']['active']) { if (LSdebug) {
$JSscript_txt.="<script type='text/javascript'>LSdebug_active = 1;</script>\n"; $JSscript_txt.="<script type='text/javascript'>LSdebug_active = 1;</script>\n";
} }
else { else {
@ -1397,7 +1416,7 @@ class LSsession {
foreach($objectConf['LSobjects'] as $type) { foreach($objectConf['LSobjects'] as $type) {
if (self :: loadLSobject($type)) { if (self :: loadLSobject($type)) {
if (self :: canAccess($type)) { if (self :: canAccess($type)) {
$access[$type] = $GLOBALS['LSobjects'][$type]['label']; $access[$type] = LSconfig :: get('LSobjects.'.$type.'.label');
} }
} }
} }
@ -1418,7 +1437,7 @@ class LSsession {
foreach($config['LSobjects'] as $objectType) { foreach($config['LSobjects'] as $objectType) {
if (self :: loadLSobject($objectType)) { if (self :: loadLSobject($objectType)) {
if (self :: canAccess($objectType)) { if (self :: canAccess($objectType)) {
$access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label']; $access[$objectType] = LSconfig :: get('LSobjects.'.$objectType.'.label');
} }
} }
} }
@ -1434,7 +1453,7 @@ class LSsession {
foreach(self :: $ldapServer['LSaccess'] as $objectType) { foreach(self :: $ldapServer['LSaccess'] as $objectType) {
if (self :: loadLSobject($objectType)) { if (self :: loadLSobject($objectType)) {
if (self :: canAccess($objectType)) { if (self :: canAccess($objectType)) {
$access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label']; $access[$objectType] = LSconfig :: get('LSobjects.'.$objectType.'.label');
} }
} }
} }
@ -1529,22 +1548,22 @@ class LSsession {
} }
} }
else { else {
$objectdn=$GLOBALS['LSobjects'][$LSobject]['container_dn'].','.self :: $topDn; $objectdn=LSconfig :: get('LSobjects.'.$LSobject.'.container_dn').','.self :: $topDn;
$whoami = self :: whoami($objectdn); $whoami = self :: whoami($objectdn);
} }
// Pour un attribut particulier // Pour un attribut particulier
if ($attr) { if ($attr) {
if ($attr=='rdn') { if ($attr=='rdn') {
$attr=$GLOBALS['LSobjects'][$LSobject]['rdn']; $attr=LSconfig :: get('LSobjects.'.$LSobject.'.rdn');
} }
if (!isset($GLOBALS['LSobjects'][$LSobject]['attrs'][$attr])) { if (!is_array(LSconfig :: get('LSobjects.'.$LSobject.'.attrs.'.$attr))) {
return; return;
} }
$r = 'n'; $r = 'n';
foreach($whoami as $who) { foreach($whoami as $who) {
$nr = $GLOBALS['LSobjects'][$LSobject]['attrs'][$attr]['rights'][$who]; $nr = LSconfig :: get('LSobjects.'.$LSobject.'.attrs.'.$attr.'.rights.'.$who);
if($nr == 'w') { if($nr == 'w') {
$r = 'w'; $r = 'w';
} }
@ -1570,10 +1589,11 @@ class LSsession {
} }
// Pour un attribut quelconque // Pour un attribut quelconque
if (is_array($GLOBALS['LSobjects'][$LSobject]['attrs'])) { $attrs_conf=LSconfig :: get('LSobjects.'.$LSobject.'.attrs');
if (is_array($attrs_conf)) {
if (($right=='r')||($right=='w')) { if (($right=='r')||($right=='w')) {
foreach($whoami as $who) { foreach($whoami as $who) {
foreach ($GLOBALS['LSobjects'][$LSobject]['attrs'] as $attr_name => $attr_config) { foreach ($attrs_conf as $attr_name => $attr_config) {
if ($attr_config['rights'][$who]==$right) { if ($attr_config['rights'][$who]==$right) {
return true; return true;
} }
@ -1582,7 +1602,7 @@ class LSsession {
} }
else { else {
foreach($whoami as $who) { foreach($whoami as $who) {
foreach ($GLOBALS['LSobjects'][$LSobject]['attrs'] as $attr_name => $attr_config) { foreach ($attrs_conf as $attr_name => $attr_config) {
if ( ($attr_config['rights'][$who]=='r') || ($attr_config['rights'][$who]=='w') ) { if ( ($attr_config['rights'][$who]=='r') || ($attr_config['rights'][$who]=='w') ) {
return true; return true;
} }
@ -1640,14 +1660,15 @@ class LSsession {
* @retval boolean True si l'utilisateur a accès, false sinon * @retval boolean True si l'utilisateur a accès, false sinon
*/ */
public static function relationCanAccess($dn,$LSobject,$relationName,$right=NULL) { public static function relationCanAccess($dn,$LSobject,$relationName,$right=NULL) {
if (!isset($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName])) $relConf=LSconfig :: get('LSobjects.'.$LSobject.'.LSrelation.'.$relationName);
if (!is_array($relConf))
return; return;
$whoami = self :: whoami($dn); $whoami = self :: whoami($dn);
if (($right=='w') || ($right=='r')) { if (($right=='w') || ($right=='r')) {
$r = 'n'; $r = 'n';
foreach($whoami as $who) { foreach($whoami as $who) {
$nr = $GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who]; $nr = $relConf['rights'][$who];
if($nr == 'w') { if($nr == 'w') {
$r = 'w'; $r = 'w';
} }
@ -1664,7 +1685,7 @@ class LSsession {
} }
else { else {
foreach($whoami as $who) { foreach($whoami as $who) {
if (($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who] == 'w') || ($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who] == 'r')) { if (($relConf['rights'][$who] == 'w') || ($relConf['rights'][$who] == 'r')) {
return true; return true;
} }
} }
@ -1774,7 +1795,7 @@ class LSsession {
* @retval boolean True si le cache des droits est activé, false sinon. * @retval boolean True si le cache des droits est activé, false sinon.
*/ */
public static function cacheLSprofiles() { public static function cacheLSprofiles() {
return ( ($GLOBALS['LSconfig']['cacheLSprofiles']) || (self :: $ldapServer['cacheLSprofiles']) ); return ( (LSconfig :: get('cacheLSprofiles')) || (self :: $ldapServer['cacheLSprofiles']) );
} }
/** /**
@ -1785,7 +1806,7 @@ class LSsession {
* @retval boolean True si le cache des subDn est activé, false sinon. * @retval boolean True si le cache des subDn est activé, false sinon.
*/ */
public static function cacheSudDn() { public static function cacheSudDn() {
return (($GLOBALS['LSconfig']['cacheSubDn']) || (self :: $ldapServer['cacheSubDn'])); return ( (LSconfig :: get('cacheSubDn')) || (self :: $ldapServer['cacheSubDn']));
} }
/** /**
@ -1796,7 +1817,7 @@ class LSsession {
* @retval boolean True si le cache des recherches est activé, false sinon. * @retval boolean True si le cache des recherches est activé, false sinon.
*/ */
public static function cacheSearch() { public static function cacheSearch() {
return (($GLOBALS['LSconfig']['cacheSearch']) || (self :: $ldapServer['cacheSearch'])); return ( (LSconfig :: get('cacheSearch')) || (self :: $ldapServer['cacheSearch']));
} }
/** /**

View file

@ -188,29 +188,29 @@ function return_data($data) {
return $data; return $data;
} }
$GLOBALS['LSdebug']['fields']=array(); $GLOBALS['LSdebug_fields']=array();
function LSdebug($data,$dump=false) { function LSdebug($data,$dump=false) {
if ($dump) { if ($dump) {
ob_start(); ob_start();
var_dump($data); var_dump($data);
$GLOBALS['LSdebug']['fields'][]=ob_get_contents(); $GLOBALS['LSdebug_fields'][]=ob_get_contents();
ob_end_clean(); ob_end_clean();
} }
else { else {
if (is_array($data)||is_object($data)) { if (is_array($data)||is_object($data)) {
$GLOBALS['LSdebug']['fields'][]=$data; $GLOBALS['LSdebug_fields'][]=$data;
} }
else { else {
$GLOBALS['LSdebug']['fields'][]="[$data]"; $GLOBALS['LSdebug_fields'][]="[$data]";
} }
} }
return true; return true;
} }
function LSdebug_print($return=false) { function LSdebug_print($return=false) {
if (( $GLOBALS['LSdebug']['fields'] ) && ( $GLOBALS['LSdebug']['active'] )) { if (( $GLOBALS['LSdebug_fields'] ) && (LSdebug)) {
$txt='<ul>'; $txt='<ul>';
foreach($GLOBALS['LSdebug']['fields'] as $debug) { foreach($GLOBALS['LSdebug_fields'] as $debug) {
if (is_array($debug)||is_object($debug)) { if (is_array($debug)||is_object($debug)) {
$txt.='<li><pre>'.print_r($debug,true).'</pre></li>'; $txt.='<li><pre>'.print_r($debug,true).'</pre></li>';
} }
@ -228,9 +228,9 @@ function LSdebug_print($return=false) {
} }
function LSdebugDefined() { function LSdebugDefined() {
if (!$GLOBALS['LSdebug']['active']) if (!LSdebug)
return; return;
return (!empty($GLOBALS['LSdebug']['fields'])); return (!empty($GLOBALS['LSdebug_fields']));
} }
/** /**

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
require_once 'includes/class/class.LSsession.php'; require_once 'core.php';
if(LSsession :: startLSsession()) { if(LSsession :: startLSsession()) {

View file

@ -1,6 +1,6 @@
<?php <?php
require_once 'includes/class/class.LSsession.php'; require_once 'core.php';
if (!isset($_REQUEST['noLSsession'])) { if (!isset($_REQUEST['noLSsession'])) {
if ( !LSsession :: startLSsession() ) { if ( !LSsession :: startLSsession() ) {

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
require_once 'includes/class/class.LSsession.php'; require_once 'core.php';
if(LSsession :: startLSsession()) { if(LSsession :: startLSsession()) {

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
require_once 'includes/class/class.LSsession.php'; require_once 'core.php';
if(LSsession :: startLSsession()) { if(LSsession :: startLSsession()) {

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
require_once 'includes/class/class.LSsession.php'; require_once 'core.php';
if(LSsession :: startLSsession()) { if(LSsession :: startLSsession()) {
if (isset($_REQUEST['LSobject'])) { if (isset($_REQUEST['LSobject'])) {

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
require_once 'includes/class/class.LSsession.php'; require_once 'core.php';
if(LSsession :: startLSsession()) { if(LSsession :: startLSsession()) {
if (isset($_REQUEST['LSobject'])) { if (isset($_REQUEST['LSobject'])) {