diff --git a/trunk/create.php b/trunk/create.php index c0381e88..7db0c4c5 100644 --- a/trunk/create.php +++ b/trunk/create.php @@ -48,7 +48,7 @@ if($LSsession -> startLSsession()) { if ($form->validate()) { // MàJ des données de l'objet LDAP if ($object -> updateData('create')) { - if (!$GLOBALS['LSerror']->errorsDefined()) { + if (!LSerror::errorsDefined()) { $GLOBALS['LSsession'] -> addInfo(_("L'objet a bien été ajouté.")); } if (isset($_REQUEST['ajax'])) { @@ -88,15 +88,15 @@ if($LSsession -> startLSsession()) { $form -> display(); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_01'); + LSerror::addErrorCode('LSldapObject_01'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } diff --git a/trunk/includes/addons/LSaddons.ftp.php b/trunk/includes/addons/LSaddons.ftp.php index e00efd9d..11ad0225 100644 --- a/trunk/includes/addons/LSaddons.ftp.php +++ b/trunk/includes/addons/LSaddons.ftp.php @@ -74,10 +74,10 @@ $GLOBALS['LSerror_code']['FTP_05']= array ( // Dependance de librairie if (!class_exists('Net_FTP')) { if (!defined('NET_FTP')) { - $GLOBALS['LSerror'] -> addErrorCode('FTP_SUPPORT_02','NET_FTP'); + LSerror::addErrorCode('FTP_SUPPORT_02','NET_FTP'); $retval=false; } else if(!LSsession::includeFile(NET_FTP)) { - $GLOBALS['LSerror'] -> addErrorCode('FTP_SUPPORT_01'); + LSerror::addErrorCode('FTP_SUPPORT_01'); $retval=false; } } @@ -108,14 +108,14 @@ $GLOBALS['LSerror_code']['FTP_05']= array ( return $cnx; } else { - $GLOBALS['LSerror'] -> addErrorCode('FTP_01',"2"); - $GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage()); + LSerror::addErrorCode('FTP_01',"2"); + LSerror::addErrorCode('FTP_00',$do -> getMessage()); return; } } else { - $GLOBALS['LSerror'] -> addErrorCode('FTP_01',"1"); - $GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage()); + LSerror::addErrorCode('FTP_01',"1"); + LSerror::addErrorCode('FTP_00',$do -> getMessage()); return; } } @@ -144,15 +144,15 @@ $GLOBALS['LSerror_code']['FTP_05']= array ( foreach($dirs as $dir) { $do = $cnx -> mkdir($dir,true); if ($do instanceof PEAR_Error) { - $GLOBALS['LSerror'] -> addErrorCode('FTP_02',$dir); - $GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage()); + LSerror::addErrorCode('FTP_02',$dir); + LSerror::addErrorCode('FTP_00',$do -> getMessage()); return; } if ($chmod) { $do = $cnx -> chmod($dir,$chmod); if ($do instanceof PEAR_Error) { - $GLOBALS['LSerror'] -> addErrorCode('FTP_04',$dir); - $GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage()); + LSerror::addErrorCode('FTP_04',$dir); + LSerror::addErrorCode('FTP_00',$do -> getMessage()); } } } @@ -194,8 +194,8 @@ $GLOBALS['LSerror_code']['FTP_05']= array ( } $do = $cnx -> rm($dir,true); if ($do instanceof PEAR_Error) { - $GLOBALS['LSerror'] -> addErrorCode('FTP_03',$dir); - $GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage()); + LSerror::addErrorCode('FTP_03',$dir); + LSerror::addErrorCode('FTP_00',$do -> getMessage()); return; } } @@ -223,8 +223,8 @@ $GLOBALS['LSerror_code']['FTP_05']= array ( } $do = $cnx -> rename($old,$new); if ($do instanceof PEAR_Error) { - $GLOBALS['LSerror'] -> addErrorCode('FTP_05',array('old' => $old,'new' => $new)); - $GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage()); + LSerror::addErrorCode('FTP_05',array('old' => $old,'new' => $new)); + LSerror::addErrorCode('FTP_00',$do -> getMessage()); return; } return true; diff --git a/trunk/includes/addons/LSaddons.mail.php b/trunk/includes/addons/LSaddons.mail.php index 81fc91fc..92b80429 100644 --- a/trunk/includes/addons/LSaddons.mail.php +++ b/trunk/includes/addons/LSaddons.mail.php @@ -52,7 +52,7 @@ $GLOBALS['LSerror_code']['MAIL_01']= array ( // Dependance de librairie if (!class_exists('Mail')) { if(!LSsession::includeFile(PEAR_MAIL)) { - $GLOBALS['LSerror'] -> addErrorCode('MAIL_SUPPORT_01'); + LSerror::addErrorCode('MAIL_SUPPORT_01'); $retval=false; } } @@ -84,8 +84,8 @@ $GLOBALS['LSerror_code']['MAIL_01']= array ( $ret = $mail_obj -> send($to,$headers,$msg); if ($ret instanceof PEAR_Error) { - $GLOBALS['LSerror'] -> addErrorCode('MAIL_01'); - $GLOBALS['LSerror'] -> addErrorCode('MAIL_00',$ret -> getMessage()); + LSerror::addErrorCode('MAIL_01'); + LSerror::addErrorCode('MAIL_00',$ret -> getMessage()); return; } return true; diff --git a/trunk/includes/addons/LSaddons.maildir.php b/trunk/includes/addons/LSaddons.maildir.php index e68e427c..e2f54336 100644 --- a/trunk/includes/addons/LSaddons.maildir.php +++ b/trunk/includes/addons/LSaddons.maildir.php @@ -54,7 +54,7 @@ $retval=true; // Dependance de librairie if (!function_exists('createDirsByFTP')) { if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) { - $GLOBALS['LSerror'] -> addErrorCode('MAILDIR_SUPPORT_01'); + LSerror::addErrorCode('MAILDIR_SUPPORT_01'); $retval=false; } } @@ -67,7 +67,7 @@ $retval=true; foreach($MUST_DEFINE_CONST as $const) { if ( (!defined($const)) || (constant($const) == "")) { - $GLOBALS['LSerror'] -> addErrorCode('MAILDIR_SUPPORT_02',$const); + LSerror::addErrorCode('MAILDIR_SUPPORT_02',$const); $retval=false; } } @@ -95,7 +95,7 @@ $retval=true; $dir.'/tmp' ); if (!createDirsByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$dirs,LS_MAILDIR_FTP_MAILDIR_CHMOD)) { - $GLOBALS['LSerror'] -> addErrorCode('MAILDIR_01'); + LSerror::addErrorCode('MAILDIR_01'); return; } return true; @@ -117,7 +117,7 @@ $retval=true; $dir = getFData(LS_MAILDIR_FTP_MAILDIR_PATH,$ldapObject,'getValue'); } if (!removeDirsByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$dir)) { - $GLOBALS['LSerror'] -> addErrorCode('MAILDIR_02'); + LSerror::addErrorCode('MAILDIR_02'); return; } return true; @@ -135,7 +135,7 @@ $retval=true; */ function renameMaildirByFTP($old,$new) { if (!renameDirByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$old,$new)) { - $GLOBALS['LSerror'] -> addErrorCode('MAILDIR_03'); + LSerror::addErrorCode('MAILDIR_03'); return; } return true; diff --git a/trunk/includes/addons/LSaddons.posix.php b/trunk/includes/addons/LSaddons.posix.php index 0a3c5725..9cc68068 100644 --- a/trunk/includes/addons/LSaddons.posix.php +++ b/trunk/includes/addons/LSaddons.posix.php @@ -53,7 +53,7 @@ $GLOBALS['LSerror_code']['POSIX_01']= array ( // Dependance de librairie if (!function_exists('createDirsByFTP')) { if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) { - $GLOBALS['LSerror'] -> addErrorCode('POSIX_SUPPORT_02'); + LSerror::addErrorCode('POSIX_SUPPORT_02'); $retval=false; } } @@ -74,7 +74,7 @@ $GLOBALS['LSerror_code']['POSIX_01']= array ( foreach($MUST_DEFINE_CONST as $const) { if ( (!defined($const)) || (constant($const) == "")) { - $GLOBALS['LSerror'] -> addErrorCode('POSIX_SUPPORT_O1',$const); + LSerror::addErrorCode('POSIX_SUPPORT_O1',$const); $retval=false; } } @@ -147,7 +147,7 @@ $GLOBALS['LSerror_code']['POSIX_01']= array ( */ function generate_homeDirectory($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_POSIX_UID_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('POSIX_01',array('dependency' => 'uid', 'attr' => 'homeDirectory')); + LSerror::addErrorCode('POSIX_01',array('dependency' => 'uid', 'attr' => 'homeDirectory')); return; } @@ -169,7 +169,7 @@ $GLOBALS['LSerror_code']['POSIX_01']= array ( function createHomeDirectoryByFTP($ldapObject) { $dir = getFData(LS_POSIX_HOMEDIRECTORY_FTP_PATH,$ldapObject,'getValue'); if (!createDirsByFTP(LS_POSIX_HOMEDIRECTORY_FTP_HOST,LS_POSIX_HOMEDIRECTORY_FTP_PORT,LS_POSIX_HOMEDIRECTORY_FTP_USER,LS_POSIX_HOMEDIRECTORY_FTP_PWD,$dir)) { - $GLOBALS['LSerror'] -> addErrorCode('POSIX_02'); + LSerror::addErrorCode('POSIX_02'); return; } return true; diff --git a/trunk/includes/addons/LSaddons.samba.php b/trunk/includes/addons/LSaddons.samba.php index c2b00253..2e21d54a 100644 --- a/trunk/includes/addons/LSaddons.samba.php +++ b/trunk/includes/addons/LSaddons.samba.php @@ -57,7 +57,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array ( // Dependance de librairie if ( !class_exists('smbHash') ) { if ( !LSsession::includeFile(LS_LIB_DIR . 'class.smbHash.php') ) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_01'); + LSerror::addErrorCode('SAMBA_SUPPORT_01'); $retval=false; } } @@ -74,14 +74,14 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array ( foreach($MUST_DEFINE_CONST as $const) { if ( (!defined($const)) || (constant($const) == "")) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_02',$const); + LSerror::addErrorCode('SAMBA_SUPPORT_02',$const); $retval=false; } } // Pour l'intégrité des SID if ( (LS_SAMBA_SID_BASE_USER % 2) == (LS_SAMBA_SID_BASE_GROUP % 2) ) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_03'); + LSerror::addErrorCode('SAMBA_SUPPORT_03'); $retval=false; } @@ -102,7 +102,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array ( */ function generate_sambaUserSID($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_SAMBA_UIDNUMBER_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_01',array('dependency' => LS_SAMBA_UIDNUMBER_ATTR, 'attr' => 'sambaSID')); + LSerror::addErrorCode('SAMBA_01',array('dependency' => LS_SAMBA_UIDNUMBER_ATTR, 'attr' => 'sambaSID')); return; } @@ -128,7 +128,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array ( */ function generate_sambaGroupSID($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_SAMBA_GIDNUMBER_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_01',array('dependency' => LS_SAMBA_GIDNUMBER_ATTR, 'attr' => 'sambaSID')); + LSerror::addErrorCode('SAMBA_01',array('dependency' => LS_SAMBA_GIDNUMBER_ATTR, 'attr' => 'sambaSID')); return; } @@ -154,7 +154,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array ( */ function generate_sambaPrimaryGroupSID($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_SAMBA_GIDNUMBER_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_02',array('dependency' => LS_SAMBA_GIDNUMBER_ATTR, 'attr' => 'sambaPrimaryGroupSID')); + LSerror::addErrorCode('SAMBA_02',array('dependency' => LS_SAMBA_GIDNUMBER_ATTR, 'attr' => 'sambaPrimaryGroupSID')); return; } @@ -176,7 +176,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array ( */ function generate_sambaNTPassword($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_SAMBA_USERPASSWORD_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_03',array('dependency' => LS_SAMBA_USERPASSWORD_ATTR, 'attr' => 'sambaNTPassword')); + LSerror::addErrorCode('SAMBA_03',array('dependency' => LS_SAMBA_USERPASSWORD_ATTR, 'attr' => 'sambaNTPassword')); return; } @@ -201,7 +201,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array ( */ function generate_sambaLMPassword($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_SAMBA_USERPASSWORD_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SAMBA_04',array('dependency' => LS_SAMBA_USERPASSWORD_ATTR, 'attr' => 'sambaLMPassword')); + LSerror::addErrorCode('SAMBA_04',array('dependency' => LS_SAMBA_USERPASSWORD_ATTR, 'attr' => 'sambaLMPassword')); return; } diff --git a/trunk/includes/addons/LSaddons.supann.php b/trunk/includes/addons/LSaddons.supann.php index 56b1d600..a8a0462b 100644 --- a/trunk/includes/addons/LSaddons.supann.php +++ b/trunk/includes/addons/LSaddons.supann.php @@ -51,7 +51,7 @@ $GLOBALS['LSerror_code']['SUPANN_01']= array ( foreach($MUST_DEFINE_CONST as $const) { if ( (!defined($const)) || (constant($const) == "")) { - $GLOBALS['LSerror'] -> addErrorCode('SUPANN_SUPPORT_01',$const); + LSerror::addErrorCode('SUPANN_SUPPORT_01',$const); $retval=false; } } @@ -70,11 +70,11 @@ $GLOBALS['LSerror_code']['SUPANN_01']= array ( */ function generate_displayName($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_LASTNAME_ATTR, 'attr' => 'cn')); + LSerror::addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_LASTNAME_ATTR, 'attr' => 'cn')); return; } if ( get_class($ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_FIRSTNAME_ATTR, 'attr' => 'cn')); + LSerror::addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_FIRSTNAME_ATTR, 'attr' => 'cn')); return; } @@ -95,11 +95,11 @@ $GLOBALS['LSerror_code']['SUPANN_01']= array ( */ function generate_cn($ldapObject) { if ( get_class($ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_LASTNAME_ATTR, 'attr' => 'cn')); + LSerror::addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_LASTNAME_ATTR, 'attr' => 'cn')); return; } if ( get_class($ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ]) != 'LSattribute' ) { - $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_FIRSTNAME_ATTR, 'attr' => 'cn')); + LSerror::addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_FIRSTNAME_ATTR, 'attr' => 'cn')); return; } diff --git a/trunk/includes/class/class.LSattr_html.php b/trunk/includes/class/class.LSattr_html.php index ccd5494d..187233a7 100644 --- a/trunk/includes/class/class.LSattr_html.php +++ b/trunk/includes/class/class.LSattr_html.php @@ -80,12 +80,12 @@ class LSattr_html { */ function addToForm (&$form,$idForm,$data=NULL) { if (!$this -> LSformElement_type) { - $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_01',$this -> name); + LSerror::addErrorCode('LSattr_html_01',$this -> name); return; } $element=$form -> addElement($this -> LSformElement_type, $this -> name, $this -> config['label'],$this -> config, $this); if(!$element) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name); + LSerror::addErrorCode('LSform_06',$this -> name); return; } if ($data) { diff --git a/trunk/includes/class/class.LSattr_html_image.php b/trunk/includes/class/class.LSattr_html_image.php index 8e298f64..f3a24328 100644 --- a/trunk/includes/class/class.LSattr_html_image.php +++ b/trunk/includes/class/class.LSattr_html_image.php @@ -39,12 +39,12 @@ class LSattr_html_image extends LSattr_html { function addToForm (&$form,$idForm,$data=NULL) { $element=$form -> addElement('image', $this -> name, $this -> config['label'],$this -> config, $this); if(!$element) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name); + LSerror::addErrorCode('LSform_06',$this -> name); return; } if (count($data)>1) { - $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_03','password'); + LSerror::addErrorCode('LSattr_html_03','password'); } if ($data) { diff --git a/trunk/includes/class/class.LSattr_html_password.php b/trunk/includes/class/class.LSattr_html_password.php index b727dcf9..4db921d1 100644 --- a/trunk/includes/class/class.LSattr_html_password.php +++ b/trunk/includes/class/class.LSattr_html_password.php @@ -39,12 +39,12 @@ class LSattr_html_password extends LSattr_html { function addToForm (&$form,$idForm,$data=NULL) { $element=$form -> addElement('password', $this -> name, $this -> config['label'], $this -> config, $this); if(!$element) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name); + LSerror::addErrorCode('LSform_06',$this -> name); return; } if (count($data)>1) { - $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_03','password'); + LSerror::addErrorCode('LSattr_html_03','password'); } if ($data) { diff --git a/trunk/includes/class/class.LSattr_html_select_list.php b/trunk/includes/class/class.LSattr_html_select_list.php index 70ef4c74..f3235979 100644 --- a/trunk/includes/class/class.LSattr_html_select_list.php +++ b/trunk/includes/class/class.LSattr_html_select_list.php @@ -41,7 +41,7 @@ class LSattr_html_select_list extends LSattr_html{ $this -> config['text_possible_values'] = $possible_values; $element=$form -> addElement('select', $this -> name, $this -> config['label'],$this -> config, $this); if(!$element) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name); + LSerror::addErrorCode('LSform_06',$this -> name); return; } if ($data) { @@ -76,7 +76,7 @@ class LSattr_html_select_list extends LSattr_html{ foreach($this -> config['possible_values'] as $val_name => $val) { if($val_name=='OTHER_OBJECT') { if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) { - $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_list_01',$this -> name); + LSerror::addErrorCode('LSattr_html_select_list_01',$this -> name); break; } if (!$GLOBALS['LSsession'] -> loadLSobject($val['object_type'])) { diff --git a/trunk/includes/class/class.LSattr_html_select_object.php b/trunk/includes/class/class.LSattr_html_select_object.php index b96fe104..d4f7534c 100644 --- a/trunk/includes/class/class.LSattr_html_select_object.php +++ b/trunk/includes/class/class.LSattr_html_select_object.php @@ -40,7 +40,7 @@ class LSattr_html_select_object extends LSattr_html{ $this -> config['attrObject'] = $this; $element=$form -> addElement('select_object', $this -> name, $this -> config['label'],$this -> config,$this); if(!$element) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name); + LSerror::addErrorCode('LSform_06',$this -> name); return; } if ($data) { @@ -81,7 +81,7 @@ class LSattr_html_select_object extends LSattr_html{ if (isset($this -> config['selectable_object'])) { $conf=$this -> config['selectable_object']; if (!isset($conf['object_type'])) { - $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_object_01',$this -> name); + LSerror::addErrorCode('LSattr_html_select_object_01',$this -> name); return; } @@ -129,7 +129,7 @@ class LSattr_html_select_object extends LSattr_html{ if (isset($this -> config['selectable_object'])) { $conf=$this -> config['selectable_object']; if (!isset($conf['object_type'])) { - $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_object_01',$this -> name); + LSerror::addErrorCode('LSattr_html_select_object_01',$this -> name); return; } diff --git a/trunk/includes/class/class.LSattr_ldap_password.php b/trunk/includes/class/class.LSattr_ldap_password.php index 43b568b5..2746c4fd 100644 --- a/trunk/includes/class/class.LSattr_ldap_password.php +++ b/trunk/includes/class/class.LSattr_ldap_password.php @@ -65,7 +65,7 @@ class LSattr_ldap_password extends LSattr_ldap { break; case 'ext_des': if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 ) { - $GLOBALS['LSerror'] -> addErrorCode(1023,'ext_des'); + LSerror::addErrorCode(1023,'ext_des'); } else { return '{CRYPT}' . crypt( $this -> clearPassword, '_' . $this -> getSalt(8) ); @@ -73,7 +73,7 @@ class LSattr_ldap_password extends LSattr_ldap { break; case 'blowfish': if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 ) { - $GLOBALS['LSerror'] -> addErrorCode(1023,'blowfish'); + LSerror::addErrorCode(1023,'blowfish'); } else { return '{CRYPT}' . crypt( $this -> clearPassword, '$2a$12$' . $this -> getSalt(13) ); @@ -86,7 +86,7 @@ class LSattr_ldap_password extends LSattr_ldap { elseif( function_exists( 'mhash' ) ) { return '{SHA}' . base64_encode( mhash( MHASH_SHA1, $this -> clearPassword ) ); } else { - $GLOBALS['LSerror'] -> addErrorCode(1023,'sha'); + LSerror::addErrorCode(1023,'sha'); } break; case 'ssha': @@ -96,7 +96,7 @@ class LSattr_ldap_password extends LSattr_ldap { return "{SSHA}".base64_encode( mhash( MHASH_SHA1, $this -> clearPassword.$salt ).$salt ); } else { - $GLOBALS['LSerror'] -> addErrorCode(1023,'ssha'); + LSerror::addErrorCode(1023,'ssha'); } break; case 'smd5': @@ -106,7 +106,7 @@ class LSattr_ldap_password extends LSattr_ldap { return "{SMD5}".base64_encode( mhash( MHASH_MD5, $password_clear.$salt ).$salt ); } else { - $GLOBALS['LSerror'] -> addErrorCode(1023,'smd5'); + LSerror::addErrorCode(1023,'smd5'); } break; case 'md5': @@ -114,7 +114,7 @@ class LSattr_ldap_password extends LSattr_ldap { break; case 'md5crypt': if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 ) { - $GLOBALS['LSerror'] -> addErrorCode(1023,'md5crypt'); + LSerror::addErrorCode(1023,'md5crypt'); } else { return '{CRYPT}'.crypt($this -> clearPassword,'$1$'.$this -> getSalt().'$'); diff --git a/trunk/includes/class/class.LSattribute.php b/trunk/includes/class/class.LSattribute.php index 81b1af21..43822510 100644 --- a/trunk/includes/class/class.LSattribute.php +++ b/trunk/includes/class/class.LSattribute.php @@ -73,7 +73,7 @@ class LSattribute { $this -> ldap = new $ldap_type($name,$config,$this); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_01',array('attr' => $name,'html'=>$config['html_type'],'ldap'=>$config['ldap_type'])); + LSerror::addErrorCode('LSattribute_01',array('attr' => $name,'html'=>$config['html_type'],'ldap'=>$config['ldap_type'])); return; } return true; @@ -92,7 +92,7 @@ class LSattribute { function getLabel() { if (!$this -> html) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); + LSerror::addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); return; } return $this -> html -> getLabel(); @@ -158,7 +158,7 @@ class LSattribute { */ function getDisplayValue() { if (!$this -> ldap) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name)); + LSerror::addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name)); return; } $data = $this -> ldap -> getDisplayValue($this -> data); @@ -170,7 +170,7 @@ class LSattribute { $result=$func($result); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func)); + LSerror::addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func)); return; } } @@ -181,7 +181,7 @@ class LSattribute { return $this -> config['onDisplay']($data); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $this -> config['onDisplay'])); + LSerror::addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $this -> config['onDisplay'])); return; } } @@ -207,7 +207,7 @@ class LSattribute { function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) { if(isset($this -> config['form'][$idForm])) { if (!$this -> html) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); + LSerror::addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); return; } if($this -> myRights() == 'n') { @@ -225,7 +225,7 @@ class LSattribute { $element = $this -> html -> addToForm($form,$idForm,$data); if(!$element) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name); + LSerror::addErrorCode('LSform_06',$this -> name); } if($this -> config['required']==1) { @@ -240,7 +240,7 @@ class LSattribute { if(is_array($this -> config['check_data'])) { foreach ($this -> config['check_data'] as $rule => $rule_infos) { if((!$form -> isRuleRegistered($rule))&&($rule!='')) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_03',array('attr' => $this->name,'rule' => $rule)); + LSerror::addErrorCode('LSattribute_03',array('attr' => $this->name,'rule' => $rule)); return; } if(!isset($rule_infos['msg'])) @@ -251,7 +251,7 @@ class LSattribute { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_04',$this->name); + LSerror::addErrorCode('LSattribute_04',$this->name); } } } @@ -314,7 +314,7 @@ class LSattribute { function addToView(&$form) { if((isset($this -> config['view'])) && ($this -> myRights() != 'n') ) { if (!$this -> html) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); + LSerror::addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); return; } if($this -> data !='') { @@ -325,7 +325,7 @@ class LSattribute { } $element = $this -> html -> addToForm($form,'view',$data); if(!$element instanceof LSformElement) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name); + LSerror::addErrorCode('LSform_06',$this -> name); return; } $element -> freeze(); @@ -347,7 +347,7 @@ class LSattribute { function refreshForm(&$form,$idForm) { if(isset($this -> config['form'][$idForm])&&($this -> myRights()!='n')) { if (!$this -> html) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); + LSerror::addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); return; } $form_element = $form -> getElement($this -> name); @@ -504,7 +504,7 @@ class LSattribute { $result=$func($result); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func)); + LSerror::addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func)); return; } } @@ -514,14 +514,14 @@ class LSattribute { $result = $this -> config['onSave']($data); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $this -> config['onSave'])); + LSerror::addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $this -> config['onSave'])); return; } } } else { if (!$this -> ldap) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name)); + LSerror::addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name)); return; } else { diff --git a/trunk/includes/class/class.LSform.php b/trunk/includes/class/class.LSform.php index 2ad384f9..a081bacf 100644 --- a/trunk/includes/class/class.LSform.php +++ b/trunk/includes/class/class.LSform.php @@ -219,7 +219,7 @@ class LSform { return; if ($this -> isSubmit()) { if (!$this -> getPostData()) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_01'); + LSerror::addErrorCode('LSform_01'); return; } $this -> setValuesFromPostData(); @@ -343,7 +343,7 @@ class LSform { function getPostData() { foreach($this -> elements as $element_name => $element) { if( !($element -> getPostData($this -> _postData)) ) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_02',$element_name); + LSerror::addErrorCode('LSform_02',$element_name); return; } } @@ -366,7 +366,7 @@ class LSform { $elementType='LSformElement_'.$type; $GLOBALS['LSsession'] -> loadLSclass($elementType); if (!class_exists($elementType)) { - $GLOBALS['LSerror'] -> addErrorCode('LSform_05',array('type' => $type)); + LSerror::addErrorCode('LSform_05',array('type' => $type)); return; } $element=$this -> elements[$name] = new $elementType($this,$name,$label,$params,$attr_html); @@ -375,7 +375,7 @@ class LSform { } else { unset ($this -> elements[$name]); - $GLOBALS['LSerror'] -> addErrorCode('LSform_06',array('element' => $name)); + LSerror::addErrorCode('LSform_06',array('element' => $name)); return; } } @@ -401,12 +401,12 @@ class LSform { return true; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule)); + LSerror::addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule)); return; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSform_04',array('element' => $element)); + LSerror::addErrorCode('LSform_04',array('element' => $element)); return; } } diff --git a/trunk/includes/class/class.LSformRule_compare.php b/trunk/includes/class/class.LSformRule_compare.php index ddfb76a8..e6ce9d0f 100644 --- a/trunk/includes/class/class.LSformRule_compare.php +++ b/trunk/includes/class/class.LSformRule_compare.php @@ -69,7 +69,7 @@ class LSformRule_compare extends LSformRule { */ function validate ($values,$options=array(),$formElement) { if (!isset($options['params']['operator'])) { - $GLOBALS['LSerror'] -> addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator'); + LSerror::addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator'); return; } $operator = LSformRule_compare :: _findOperator($options['params']['operator']); diff --git a/trunk/includes/class/class.LSformRule_maxlength.php b/trunk/includes/class/class.LSformRule_maxlength.php index 21c1250f..738d32bf 100644 --- a/trunk/includes/class/class.LSformRule_maxlength.php +++ b/trunk/includes/class/class.LSformRule_maxlength.php @@ -39,7 +39,7 @@ class LSformRule_maxlength extends LSformRule { */ function validate ($value,$options,$formElement) { if(!isset($options['params']['limit'])) { - $GLOBALS['LSerror'] -> addErrorCode('LSformRule_01',array('type' => 'maxlength', 'param' => 'limit')); + LSerror::addErrorCode('LSformRule_01',array('type' => 'maxlength', 'param' => 'limit')); return; } return (strlen($value)<=$options['params']['limit']); diff --git a/trunk/includes/class/class.LSformRule_minlength.php b/trunk/includes/class/class.LSformRule_minlength.php index 4ba7252f..48f7d874 100644 --- a/trunk/includes/class/class.LSformRule_minlength.php +++ b/trunk/includes/class/class.LSformRule_minlength.php @@ -39,7 +39,7 @@ class LSformRule_minlength extends LSformRule { */ function validate ($value,$options,$formElement) { if(!isset($options['params']['limit'])) { - $GLOBALS['LSerror'] -> addErrorCode('LSformRule_01',array('type' => 'minlength', 'param' => 'limit'); + LSerror::addErrorCode('LSformRule_01',array('type' => 'minlength', 'param' => 'limit'); return; } return (strlen($value)>=$options['params']['limit']); diff --git a/trunk/includes/class/class.LSformRule_rangelength.php b/trunk/includes/class/class.LSformRule_rangelength.php index 5b832884..8c541917 100644 --- a/trunk/includes/class/class.LSformRule_rangelength.php +++ b/trunk/includes/class/class.LSformRule_rangelength.php @@ -40,7 +40,7 @@ class LSformRule_rangelength extends LSformRule { */ function validate ($value,$options=array(),$formElement) { if(!isset($options['params']['limits'])) { - $GLOBALS['LSerror'] -> addErrorCode('LSformRule_01',array('type' => 'rangelength', 'param' => 'limit'); + LSerror::addErrorCode('LSformRule_01',array('type' => 'rangelength', 'param' => 'limit'); return; } $len=strlen($value); diff --git a/trunk/includes/class/class.LSformRule_regex.php b/trunk/includes/class/class.LSformRule_regex.php index 00ec39d1..3f6451fe 100644 --- a/trunk/includes/class/class.LSformRule_regex.php +++ b/trunk/includes/class/class.LSformRule_regex.php @@ -43,7 +43,7 @@ class LSformRule_regex extends LSformRule { $regex=$option['params']['regex']; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSformRule_regex_01'); + LSerror::addErrorCode('LSformRule_regex_01'); return; } } diff --git a/trunk/includes/class/class.LSldap.php b/trunk/includes/class/class.LSldap.php index c4cad375..3a43bc3f 100644 --- a/trunk/includes/class/class.LSldap.php +++ b/trunk/includes/class/class.LSldap.php @@ -63,7 +63,7 @@ class LSldap { function connect() { $this -> cnx = Net_LDAP2::connect($this -> config); if (Net_LDAP2::isError($this -> cnx)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_01',$this -> cnx -> getMessage()); + LSerror::addErrorCode('LSldap_01',$this -> cnx -> getMessage()); $this -> cnx = NULL; return; } @@ -105,7 +105,7 @@ class LSldap { function search ($filter,$basedn=NULL,$params = array()) { $ret = $this -> cnx -> search($basedn,$filter,$params); if (Net_LDAP2::isError($ret)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_02',$ret -> getMessage()); + LSerror::addErrorCode('LSldap_02',$ret -> getMessage()); return; } $retInfos=array(); @@ -136,7 +136,7 @@ class LSldap { $filter=NULL; $ret = $this -> cnx -> search($basedn,$filter,$params); if (Net_LDAP2::isError($ret)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_02',$ret -> getMessage()); + LSerror::addErrorCode('LSldap_02',$ret -> getMessage()); return; } return $ret -> count(); @@ -212,7 +212,7 @@ class LSldap { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_03'); + LSerror::addErrorCode('LSldap_03'); return; } } @@ -299,8 +299,8 @@ class LSldap { } if (Net_LDAP2::isError($ret)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_05',$dn); - $GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); + LSerror::addErrorCode('LSldap_05',$dn); + LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); } else { if (!empty($dropAttr)) { @@ -316,15 +316,15 @@ class LSldap { } $ret = $entry -> update(); if (Net_LDAP2::isError($ret)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_06'); - $GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); + LSerror::addErrorCode('LSldap_06'); + LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); } } return true; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_04'); + LSerror::addErrorCode('LSldap_04'); return; } } @@ -369,7 +369,7 @@ class LSldap { function remove($dn) { $ret = $this -> cnx -> delete($dn,array('recursive' => true)); if (Net_LDAP2::isError($ret)) { - $GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); + LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); return; } return true; @@ -386,8 +386,8 @@ class LSldap { function move($old,$new) { $ret = $this -> cnx -> move($old,$new); if (Net_LDAP2::isError($ret)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldap_07'); - $GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); + LSerror::addErrorCode('LSldap_07'); + LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); return; } return true; diff --git a/trunk/includes/class/class.LSldapObject.php b/trunk/includes/class/class.LSldapObject.php index 77b78a01..f4f44295 100644 --- a/trunk/includes/class/class.LSldapObject.php +++ b/trunk/includes/class/class.LSldapObject.php @@ -64,7 +64,7 @@ class LSldapObject { $this -> config = $GLOBALS['LSobjects'][$type_name]; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_01'); + LSerror::addErrorCode('LSldapObject_01'); return; } } @@ -276,7 +276,7 @@ class LSldapObject { if(isset($this -> forms[$idForm])) $LSform = $this -> forms[$idForm][0]; else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_02',$this -> getType()); + LSerror::addErrorCode('LSldapObject_02',$this -> getType()); return; } } @@ -289,7 +289,7 @@ class LSldapObject { $LSform = $LSform[0]; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_03',$this -> getType()); + LSerror::addErrorCode('LSldapObject_03',$this -> getType()); return; } } @@ -307,12 +307,12 @@ class LSldapObject { if(isset($this -> config['before_modify'])) { if(function_exists($this -> config['before_modify'])) { if(!$this -> config['before_modify']($this)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_08',$this -> config['before_modify']); + LSerror::addErrorCode('LSldapObject_08',$this -> config['before_modify']); return; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_07',$this -> config['before_modify']); + LSerror::addErrorCode('LSldapObject_07',$this -> config['before_modify']); return; } } @@ -335,11 +335,11 @@ class LSldapObject { if((isset($this -> config['after_modify']))&&(!$this -> submitError)) { if(function_exists($this -> config['after_modify'])) { if(!$this -> config['after_modify']($this)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_10',$this -> config['after_modify']); + LSerror::addErrorCode('LSldapObject_10',$this -> config['after_modify']); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_09',$this -> config['after_modify']); + LSerror::addErrorCode('LSldapObject_09',$this -> config['after_modify']); } } @@ -378,17 +378,17 @@ class LSldapObject { if ( $attr -> canBeGenerated()) { if ($attr -> generateValue()) { if (!$this -> validateAttrData($LSform, $attr)) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_08',$attr -> getLabel()); + LSerror::addErrorCode('LSattribute_08',$attr -> getLabel()); $retval = false; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_07',$attr -> getLabel()); + LSerror::addErrorCode('LSattribute_07',$attr -> getLabel()); $retval = false; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_06',$attr -> getLabel()); + LSerror::addErrorCode('LSattribute_06',$attr -> getLabel()); $retval = false; } } @@ -476,12 +476,12 @@ class LSldapObject { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_04',array('attr' => $attr->name,'obj' => $this->getType(),'func' => $test['function'])); + LSerror::addErrorCode('LSldapObject_04',array('attr' => $attr->name,'obj' => $this->getType(),'func' => $test['function'])); $retval = false; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_05',array('attr' => $attr->name,'obj' => $this->getType())); + LSerror::addErrorCode('LSldapObject_05',array('attr' => $attr->name,'obj' => $this->getType())); $retval = false; } } @@ -492,17 +492,17 @@ class LSldapObject { if (!empty($dependsAttrs)) { foreach($dependsAttrs as $dependAttr) { if(!isset($this -> attrs[$dependAttr])){ - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_14',array('attr_depend' => $dependAttr, 'attr' => $attr -> getLabel())); + LSerror::addErrorCode('LSldapObject_14',array('attr_depend' => $dependAttr, 'attr' => $attr -> getLabel())); continue; } if($this -> attrs[$dependAttr] -> canBeGenerated()) { if (!$this -> attrs[$dependAttr] -> generateValue()) { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel()); + LSerror::addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel()); $retval = false; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSattribute_06',$this -> attrs[$dependAttr] -> getLabel()); + LSerror::addErrorCode('LSattribute_06',$this -> attrs[$dependAttr] -> getLabel()); $retval = false; } } @@ -531,7 +531,7 @@ class LSldapObject { $new = true; LSdebug('Rename'); if (!$this -> beforeRename()) { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_16'); + LSerror::addErrorCode('LSldapObject_16'); return; } $oldDn = $this -> getDn(); @@ -543,7 +543,7 @@ class LSldapObject { } $this -> dn = $newDn; if (!$this -> afterRename($oldDn,$newDn)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_17'); + LSerror::addErrorCode('LSldapObject_17'); return; } } @@ -566,14 +566,14 @@ class LSldapObject { } if ($new) { if (!$this -> afterCreate()) { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_21'); + LSerror::addErrorCode('LSldapObject_21'); return; } } return true; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_13'); + LSerror::addErrorCode('LSldapObject_13'); return; } } @@ -1003,12 +1003,12 @@ class LSldapObject { return $rdn_attr.'='.$rdn_val[0].','.$this -> config['container_dn'].','.$GLOBALS['LSsession']->topDn; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_12',$this -> config['rdn']); + LSerror::addErrorCode('LSldapObject_12',$this -> config['rdn']); return; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_11',$this -> getType()); + LSerror::addErrorCode('LSldapObject_11',$this -> getType()); return; } } @@ -1063,11 +1063,11 @@ class LSldapObject { if ($this -> afterDelete()) { return true; } - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_19'); + LSerror::addErrorCode('LSldapObject_19'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_18'); + LSerror::addErrorCode('LSldapObject_18'); } return; } @@ -1266,12 +1266,12 @@ class LSldapObject { foreach($config as $action) { if(function_exists($action)) { if(!$action($this)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_25',$action); + LSerror::addErrorCode('LSldapObject_25',$action); $error=true; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_24',$action); + LSerror::addErrorCode('LSldapObject_24',$action); $error=true; } } @@ -1327,12 +1327,12 @@ class LSldapObject { foreach($config as $action) { if(function_exists($action)) { if(!$action($this)) { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_23',$action); + LSerror::addErrorCode('LSldapObject_23',$action); $error=true; } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_22',$action); + LSerror::addErrorCode('LSldapObject_22',$action); $error=true; } } @@ -1355,7 +1355,7 @@ class LSldapObject { **/ function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') { if ((!$attr)||(!$objectType)) { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','getObjectKeyValueInRelation'); + LSerror::addErrorCode('LSrelations_05','getObjectKeyValueInRelation'); return; } if ($attrValue=='dn') { @@ -1388,7 +1388,7 @@ class LSldapObject { **/ function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') { if ((!$attr)||(!$objectType)) { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','listObjectsInRelation'); + LSerror::addErrorCode('LSrelations_05','listObjectsInRelation'); return; } if ($attrValue=='dn') { @@ -1420,7 +1420,7 @@ class LSldapObject { **/ function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') { if ((!$attr)||(!$objectType)) { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','addOneObjectInRelation'); + LSerror::addErrorCode('LSrelations_05','addOneObjectInRelation'); return; } if ($object instanceof $objectType) { @@ -1470,7 +1470,7 @@ class LSldapObject { **/ function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') { if ((!$attr)||(!$objectType)) { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','deleteOneObjectInRelation'); + LSerror::addErrorCode('LSrelations_05','deleteOneObjectInRelation'); return; } if ($object instanceof $objectType) { @@ -1515,7 +1515,7 @@ class LSldapObject { */ function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') { if ((!$attr)||(!$objectType)) { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','renameOneObjectInRelation'); + LSerror::addErrorCode('LSrelations_05','renameOneObjectInRelation'); return; } if ($object instanceof $objectType) { @@ -1565,7 +1565,7 @@ class LSldapObject { **/ function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn') { if ((!$attr)||(!$objectType)) { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','updateObjectsInRelation'); + LSerror::addErrorCode('LSrelations_05','updateObjectsInRelation'); return; } $currentObjects = $this -> listObjectsInRelation($object,$attr,$objectType,$attrValue); diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 172e6a2b..465bf05b 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -133,7 +133,6 @@ class LSsession { if(!$this -> loadLSclass('LSerror')) { return; } - $GLOBALS['LSerror'] = new LSerror(); return true; } @@ -172,7 +171,7 @@ class LSsession { $error = 1; } if ($error) { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_04',$object); + LSerror::addErrorCode('LSsession_04',$object); return; } return true; @@ -191,7 +190,7 @@ class LSsession { if(self::includeFile(LS_ADDONS_DIR .'LSaddons.'.$addon.'.php')) { self::includeFile(LS_CONF_DIR."LSaddons/config.LSaddons.".$addon.".php"); if (!call_user_func('LSaddon_'. $addon .'_support')) { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_02',$addon); + LSerror::addErrorCode('LSsession_02',$addon); return; } return true; @@ -209,7 +208,7 @@ class LSsession { */ function loadLSaddons() { if(!is_array($GLOBALS['LSaddons']['loads'])) { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_01',"LSaddons['loads']"); + LSerror::addErrorCode('LSsession_01',"LSaddons['loads']"); return; } @@ -345,11 +344,11 @@ class LSsession { if ($nbresult==0) { // identifiant incorrect LSdebug('identifiant incorrect'); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_06'); + LSerror::addErrorCode('LSsession_06'); } else if ($nbresult>1) { // duplication d'authentité - $GLOBALS['LSerror'] -> addErrorCode('LSsession_07'); + LSerror::addErrorCode('LSsession_07'); } else { if (isset($_GET['LSsession_recoverPassword'])) { @@ -410,19 +409,19 @@ class LSsession { else { // Problème durant l'envoie du mail LSdebug("Problème durant l'envoie du mail"); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',7); + LSerror::addErrorCode('LSsession_20',7); } } else { // Erreur durant la mise à jour de l'objet LSdebug("Erreur durant la mise à jour de l'objet"); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',6); + LSerror::addErrorCode('LSsession_20',6); } } else { // Erreur durant la validation du formulaire de modification de perte de password LSdebug("Erreur durant la validation du formulaire de modification de perte de password"); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',5); + LSerror::addErrorCode('LSsession_20',5); } } // 2nd étape : génération du mot de passe + envoie par mail @@ -455,35 +454,35 @@ class LSsession { else { // Problème durant l'envoie du mail LSdebug("Problème durant l'envoie du mail"); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',4); + LSerror::addErrorCode('LSsession_20',4); } } else { // Erreur durant la mise à jour de l'objet LSdebug("Erreur durant la mise à jour de l'objet"); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',3); + LSerror::addErrorCode('LSsession_20',3); } } else { // Erreur durant la validation du formulaire de modification de perte de password LSdebug("Erreur durant la validation du formulaire de modification de perte de password"); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',2); + LSerror::addErrorCode('LSsession_20',2); } } else { // l'attribut password n'existe pas LSdebug("L'attribut password n'existe pas"); - $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',1); + LSerror::addErrorCode('LSsession_20',1); } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_19'); + LSerror::addErrorCode('LSsession_19'); } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_18'); + LSerror::addErrorCode('LSsession_18'); } } else { @@ -499,18 +498,18 @@ class LSsession { return true; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_06'); + LSerror::addErrorCode('LSsession_06'); LSdebug('mdp incorrect'); } } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_10'); + LSerror::addErrorCode('LSsession_10'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_09'); + LSerror::addErrorCode('LSsession_09'); } } if ($this -> ldapServerId) { @@ -596,7 +595,7 @@ class LSsession { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_03'); + LSerror::addErrorCode('LSsession_03'); return; } } @@ -640,17 +639,17 @@ class LSsession { $return=array_merge($return,$tbl_return); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_17',3); + LSerror::addErrorCode('LSsession_17',3); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_17',2); + LSerror::addErrorCode('LSsession_17',2); } } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_17',1); + LSerror::addErrorCode('LSsession_17',1); } } else { @@ -968,11 +967,11 @@ class LSsession { } if ($this -> ajaxDisplay) { - $GLOBALS['Smarty'] -> assign('LSerror_txt',$GLOBALS['LSerror']->getErrors()); + $GLOBALS['Smarty'] -> assign('LSerror_txt',LSerror::getErrors()); $GLOBALS['Smarty'] -> assign('LSdebug_txt',LSdebug_print(true)); } else { - $GLOBALS['LSerror'] -> display(); + LSerror::display(); LSdebug_print(); } if (!$this -> template) @@ -1004,8 +1003,8 @@ class LSsession { $_SESSION['LSsession_infos']=array(); } - if ($GLOBALS['LSerror']->errorsDefined()) { - $data['LSerror'] = $GLOBALS['LSerror']->getErrors(); + if (LSerror::errorsDefined()) { + $data['LSerror'] = LSerror::getErrors(); } if (isset($_REQUEST['imgload'])) { diff --git a/trunk/includes/functions.php b/trunk/includes/functions.php index 1a533908..8c8a69eb 100644 --- a/trunk/includes/functions.php +++ b/trunk/includes/functions.php @@ -89,7 +89,7 @@ function getFData($format,$data,$meth=NULL) { $format[$i]=ereg_replace($ch[0],$value,$format[$i]); } else { - $GLOBALS['LSerror'] -> addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => $ch[1])); + LSerror::addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => $ch[1])); break; } } @@ -136,7 +136,7 @@ function getFData($format,$data,$meth=NULL) { $format[$i]=ereg_replace($ch[0],$value,$format[$i]); } else { - $GLOBALS['LSerror'] -> addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => get_class($data))); + LSerror::addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => get_class($data))); break; } } diff --git a/trunk/index_ajax.php b/trunk/index_ajax.php index e403529c..fab90c44 100644 --- a/trunk/index_ajax.php +++ b/trunk/index_ajax.php @@ -6,7 +6,7 @@ $GLOBALS['LSsession'] = new LSsession(); if (($_REQUEST['template'] != 'login')&&($_REQUEST['template'] != 'recoverPassword')) { if ( !$GLOBALS['LSsession'] -> startLSsession() ) { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_22'); + LSerror::addErrorCode('LSsession_22'); $_ERRORS = true; } } @@ -156,24 +156,24 @@ if (!isset($_ERRORS)) { ); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$relationName); + LSerror::addErrorCode('LSrelations_01',$relationName); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } break; @@ -209,33 +209,33 @@ if (!isset($_ERRORS)) { $data['id'] = $_REQUEST['id']; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$relationName); + LSerror::addErrorCode('LSrelations_01',$relationName); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$relationName); + LSerror::addErrorCode('LSrelations_03',$relationName); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_02',$relationName); + LSerror::addErrorCode('LSrelations_02',$relationName); } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } break; @@ -257,7 +257,7 @@ if (!isset($_ERRORS)) { foreach($list as $o) { if($o -> getDn() == $_REQUEST['dn']) { if (!$o -> $relationConf['remove_function']($object)) { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$conf['relationName']); + LSerror::addErrorCode('LSrelations_03',$conf['relationName']); } else { $ok = true; @@ -266,7 +266,7 @@ if (!isset($_ERRORS)) { } if (!$ok) { LSdebug($_REQUEST['value']." introuvé parmi la liste"); - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$conf['relationName']); + LSerror::addErrorCode('LSrelations_03',$conf['relationName']); } else { $data=array( @@ -275,28 +275,28 @@ if (!isset($_ERRORS)) { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$conf['relationName']); + LSerror::addErrorCode('LSrelations_03',$conf['relationName']); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$conf['relationName']); + LSerror::addErrorCode('LSrelations_01',$conf['relationName']); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } break; @@ -346,7 +346,7 @@ if (!isset($_ERRORS)) { ); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } break; } @@ -394,7 +394,7 @@ if (!isset($_ERRORS)) { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } break; diff --git a/trunk/modify.php b/trunk/modify.php index 741599ff..5d6cea41 100644 --- a/trunk/modify.php +++ b/trunk/modify.php @@ -52,7 +52,7 @@ if($LSsession -> startLSsession()) { if ($form->validate()) { // MàJ des données de l'objet LDAP if ($object -> updateData('modify')) { - if ($GLOBALS['LSerror']->errorsDefined()) { + if (LSerror::errorsDefined()) { $GLOBALS['LSsession'] -> addInfo(_("L'objet a été modifié partiellement.")); } else { @@ -114,16 +114,16 @@ if($LSsession -> startLSsession()) { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } diff --git a/trunk/remove.php b/trunk/remove.php index 46319c2c..7631fdf6 100644 --- a/trunk/remove.php +++ b/trunk/remove.php @@ -40,7 +40,7 @@ if($LSsession -> startLSsession()) { $GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$_GET['LSobject'].'&refresh'); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_15',$objectname); + LSerror::addErrorCode('LSldapObject_15',$objectname); } } else { @@ -53,19 +53,19 @@ if($LSsession -> startLSsession()) { $GLOBALS['LSsession'] -> setTemplate('question.tpl'); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_01'); + LSerror::addErrorCode('LSldapObject_01'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } diff --git a/trunk/select.php b/trunk/select.php index d75ffc4b..f0bdc202 100644 --- a/trunk/select.php +++ b/trunk/select.php @@ -324,7 +324,7 @@ if($LSsession -> startLSsession()) { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else { diff --git a/trunk/view.php b/trunk/view.php index 51bb5109..016bf565 100644 --- a/trunk/view.php +++ b/trunk/view.php @@ -141,12 +141,12 @@ if($LSsession -> startLSsession()) { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$relationName); + LSerror::addErrorCode('LSrelations_01',$relationName); } $LSrelations[]=$return; } else { - $GLOBALS['LSerror'] -> addErrorCode('LSrelations_04',array('relation' => $relationName,'LSobject' => $relationConf['LSobject'])); + LSerror::addErrorCode('LSrelations_04',array('relation' => $relationName,'LSobject' => $relationConf['LSobject'])); } } } @@ -163,7 +163,7 @@ if($LSsession -> startLSsession()) { $GLOBALS['LSsession'] -> setTemplate('view.tpl'); } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } // Affichage d'une liste d'un type d'objet @@ -477,11 +477,11 @@ if($LSsession -> startLSsession()) { } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_11'); + LSerror::addErrorCode('LSsession_11'); } } else { - $GLOBALS['LSerror'] -> addErrorCode('LSsession_12'); + LSerror::addErrorCode('LSsession_12'); } } else {