diff --git a/trunk/includes/class/class.LSform.php b/trunk/includes/class/class.LSform.php index e0c32780..a7edcc66 100644 --- a/trunk/includes/class/class.LSform.php +++ b/trunk/includes/class/class.LSform.php @@ -108,8 +108,9 @@ class LSform { ); $GLOBALS['Smarty'] -> assign('LSform_object',$LSform_object); - if (is_array($GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout'])) { - $GLOBALS['Smarty'] -> assign('LSform_layout',$GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout']); + $layout_config=LSconfig :: get("LSobjects.".$LSform_object['type'].".LSform.layout"); + if (is_array($layout_config)) { + $GLOBALS['Smarty'] -> assign('LSform_layout',$layout_config); $GLOBALS['Smarty'] -> assign('LSform_layout_nofield_label',_('No field.')); } @@ -175,8 +176,9 @@ class LSform { } $GLOBALS['Smarty'] -> assign('LSform_fields',$fields); - if (is_array($GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout'])) { - $GLOBALS['Smarty'] -> assign('LSform_layout',$GLOBALS['LSobjects'][$LSform_object['type']]['LSform']['layout']); + $layout_config=LSconfig :: get("LSobjects.".$LSform_object['type'].".LSform.layout"); + if (is_array($layout_config)) { + $GLOBALS['Smarty'] -> assign('LSform_layout',$layout_config); $GLOBALS['Smarty'] -> assign('LSform_layout_nofield_label',_('No field.')); } } diff --git a/trunk/includes/class/class.LSformElement_date.php b/trunk/includes/class/class.LSformElement_date.php index a211b16b..ad4895ac 100644 --- a/trunk/includes/class/class.LSformElement_date.php +++ b/trunk/includes/class/class.LSformElement_date.php @@ -152,7 +152,7 @@ class LSformElement_date extends LSformElement { LSsession :: addCssFile('theme.css',LS_LIB_DIR.'jscalendar/skins/aqua/'); LSsession :: addJSscript('calendar.js',LS_LIB_DIR.'jscalendar/'); LSsession :: addJSscript('calendar-en.js',LS_LIB_DIR.'jscalendar/lang/'); - $codeLang = strtolower($GLOBALS['LSconfig']['lang'][0].$GLOBALS['LSconfig']['lang'][1]); + $codeLang = LSsession :: getLang(true); LSsession :: addJSscript('calendar-'.$codeLang.'.js',LS_LIB_DIR.'jscalendar/lang/'); LSsession :: addJSscript('LSformElement_date_field.js'); LSsession :: addJSscript('LSformElement_date.js'); diff --git a/trunk/includes/class/class.LSldap.php b/trunk/includes/class/class.LSldap.php index 949f5087..bc39fa53 100644 --- a/trunk/includes/class/class.LSldap.php +++ b/trunk/includes/class/class.LSldap.php @@ -184,8 +184,8 @@ class LSldap { * ) */ public static function getEntry($object_type,$dn) { - if(isset($GLOBALS['LSobjects'][$object_type])){ - $obj_conf=$GLOBALS['LSobjects'][$object_type]; + $obj_conf=LSconfig :: get('LSobjects.'.$object_type); + if(is_array($obj_conf)){ $entry = self :: $cnx -> getEntry($dn); if (Net_LDAP2::isError($entry)) { //$newentry = new Net_LDAP2_Entry(&self :: $cnx); diff --git a/trunk/includes/class/class.LSldapObject.php b/trunk/includes/class/class.LSldapObject.php index 291dca5f..d613dbb1 100644 --- a/trunk/includes/class/class.LSldapObject.php +++ b/trunk/includes/class/class.LSldapObject.php @@ -59,8 +59,9 @@ class LSldapObject { */ function LSldapObject() { $this -> type_name = get_class($this); - if(is_array($GLOBALS['LSobjects'][$this -> type_name])) { - $this -> config = $GLOBALS['LSobjects'][$this -> type_name]; + $config = LSconfig :: get('LSobjects.'.$this -> type_name); + if(is_array($config)) { + $this -> config = $config; } else { LSerror :: addErrorCode('LSldapObject_01'); @@ -650,11 +651,11 @@ class LSldapObject { */ function getPatternFilter($pattern=null,$approx=null) { if ($pattern!=NULL) { - if (is_array($GLOBALS['LSobjects'][$this -> getType()]['LSsearch']['attrs'])) { - $attrs=$GLOBALS['LSobjects'][$this -> getType()]['LSsearch']['attrs']; + if (is_array($this -> config['LSsearch']['attrs'])) { + $attrs=$this -> config['LSsearch']['attrs']; } else { - $attrs=array($GLOBALS['LSobjects'][$this -> getType()]['rdn']); + $attrs=array($this -> config['rdn']); } $pfilter='(|'; if ($approx) { @@ -1338,14 +1339,15 @@ class LSldapObject { if (is_array(LSsession :: $ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'])) { foreach(LSsession :: $ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'] as $type) { if (LSsession :: loadLSobject($type)) { - if (isset($GLOBALS['LSobjects'][$type]['container_auto_create'])&&isset($GLOBALS['LSobjects'][$type]['container_dn'])) { - $dn = $GLOBALS['LSobjects'][$type]['container_dn'].','.$this -> getDn(); - if(!LSldap :: getNewEntry($dn,$GLOBALS['LSobjects'][$type]['container_auto_create']['objectclass'],$GLOBALS['LSobjects'][$type]['container_auto_create']['attrs'],true)) { + $conf_type=LSconfig :: get("LSobjects.$type"); + if (isset($conf_type['container_auto_create'])&&isset($conf_type['container_dn'])) { + $dn = $conf_type['container_dn'].','.$this -> getDn(); + if(!LSldap :: getNewEntry($dn,$conf_type['container_auto_create']['objectclass'],$conf_type['container_auto_create']['attrs'],true)) { LSdebug("Impossible de créer l'entrée fille : ".print_r( array( 'dn' => $dn, - 'objectClass' => $GLOBALS['LSobjects'][$type]['container_auto_create']['objectclass'], - 'attrs' => $GLOBALS['LSobjects'][$type]['container_auto_create']['attrs'] + 'objectClass' => $conf_type['container_auto_create']['objectclass'], + 'attrs' => $conf_type['container_auto_create']['attrs'] ) ,true)); $error=1; diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 0e41edfe..df100b87 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -352,6 +352,20 @@ class LSsession { } return $list; } + + /** + * Retourne la langue courante de la session + * + * @param[in] boolean Si true, le code langue retourné sera court + * + * @retval string La langue de la session + **/ + public static function getLang($short=false) { + if ($short) { + return strtolower(self :: $lang[0].self :: $lang[1]); + } + return self :: $lang; + } /** * Vérifie si une locale est disponible @@ -787,7 +801,7 @@ class LSsession { * Définition du serveur Ldap de la session * * Définition du serveur Ldap de la session à partir de son ID dans - * le tableau $GLOBALS['LSconfig']['ldap_servers']. + * le tableau LSconfig :: get('ldap_servers'). * * @param[in] integer Index du serveur Ldap * diff --git a/trunk/select.php b/trunk/select.php index df5849cb..fa468834 100644 --- a/trunk/select.php +++ b/trunk/select.php @@ -65,7 +65,7 @@ if(LSsession :: startLSsession()) { $approx = false; $selectedTopDn = LSsession :: getTopDn(); $orderby = false; - $_REQUEST['orderby']=$GLOBALS['LSobjects'][$LSobject]['orderby']; + $_REQUEST['orderby']=LSconfig :: get("LSobjects.$LSobject.orderby"); $ordersense = 'ASC'; $subDnLdapServer = LSsession :: getSubDnLdapServer(); $doSubDn = (($subDnLdapServer)&&(!LSsession :: isSubDnLSobject($LSobject))); diff --git a/trunk/view.php b/trunk/view.php index 539f93a2..a84417c9 100644 --- a/trunk/view.php +++ b/trunk/view.php @@ -119,7 +119,7 @@ if(LSsession :: startLSsession()) { $recur = false; $approx = false; $orderby = false; - $_REQUEST['orderby']=$GLOBALS['LSobjects'][$LSobject]['orderby']; + $_REQUEST['orderby']=LSconfig :: get("LSobjects.$LSobject.orderby"); $ordersense = 'ASC'; $subDnLdapServer = LSsession :: getSubDnLdapServer(); $doSubDn = (($subDnLdapServer)&&(!LSsession :: isSubDnLSobject($LSobject)));