diff --git a/trunk/create.php b/trunk/create.php
index 7db0c4c5..e5789be6 100644
--- a/trunk/create.php
+++ b/trunk/create.php
@@ -22,9 +22,7 @@
require_once 'includes/class/class.LSsession.php';
-$GLOBALS['LSsession'] = new LSsession();
-
-if($LSsession -> startLSsession()) {
+if(LSsession :: startLSsession()) {
if (isset($_POST['LSform_objecttype'])) {
$LSobject = $_POST['LSform_objecttype'];
@@ -35,8 +33,8 @@ if($LSsession -> startLSsession()) {
if (isset($LSobject)) {
// Création d'un LSobject
- if ($GLOBALS['LSsession'] -> loadLSobject($LSobject)) {
- if ( $GLOBALS['LSsession'] -> canCreate($LSobject) ) {
+ if (LSsession ::loadLSobject($LSobject)) {
+ if ( LSsession :: canCreate($LSobject) ) {
$object = new $LSobject();
if ($_GET['load']!='') {
@@ -49,10 +47,10 @@ if($LSsession -> startLSsession()) {
// MàJ des données de l'objet LDAP
if ($object -> updateData('create')) {
if (!LSerror::errorsDefined()) {
- $GLOBALS['LSsession'] -> addInfo(_("L'objet a bien été ajouté."));
+ LSsession :: addInfo(_("L'objet a bien été ajouté."));
}
if (isset($_REQUEST['ajax'])) {
- $GLOBALS['LSsession'] -> displayAjaxReturn (
+ LSsession :: displayAjaxReturn (
array(
'LSredirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()
)
@@ -61,12 +59,12 @@ if($LSsession -> startLSsession()) {
}
else {
if (!LSdebugDefined()) {
- $GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn());
+ LSsession :: redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn());
}
}
}
else {
- $GLOBALS['LSsession'] -> displayAjaxReturn (
+ LSsession :: displayAjaxReturn (
array(
'LSformErrors' => $form -> getErrors()
)
@@ -75,7 +73,7 @@ if($LSsession -> startLSsession()) {
}
}
else if (isset($_REQUEST['ajax']) && $form -> definedError()) {
- $GLOBALS['LSsession'] -> displayAjaxReturn (
+ LSsession :: displayAjaxReturn (
array(
'LSformErrors' => $form -> getErrors()
)
@@ -84,25 +82,25 @@ if($LSsession -> startLSsession()) {
}
// Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Nouveau').' : '.$object -> getLabel());
- $GLOBALS['LSsession'] -> setTemplate('create.tpl');
+ LSsession :: setTemplate('create.tpl');
$form -> display();
}
else {
- LSerror::addErrorCode('LSsession_11');
+ LSerror :: addErrorCode('LSsession_11');
}
}
else {
- LSerror::addErrorCode('LSldapObject_01');
+ LSerror :: addErrorCode('LSldapObject_01');
}
}
else {
- LSerror::addErrorCode('LSsession_12');
+ LSerror :: addErrorCode('LSsession_12');
}
}
else {
- $GLOBALS['LSsession'] -> setTemplate('login.tpl');
+ LSsession :: setTemplate('login.tpl');
}
-$GLOBALS['LSsession'] -> displayTemplate();
+LSsession :: displayTemplate();
?>
diff --git a/trunk/includes/addons/LSaddons.ftp.php b/trunk/includes/addons/LSaddons.ftp.php
index 11ad0225..b101e577 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')) {
- LSerror::addErrorCode('FTP_SUPPORT_02','NET_FTP');
+ LSerror :: addErrorCode('FTP_SUPPORT_02','NET_FTP');
$retval=false;
} else if(!LSsession::includeFile(NET_FTP)) {
- 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 {
- LSerror::addErrorCode('FTP_01',"2");
- LSerror::addErrorCode('FTP_00',$do -> getMessage());
+ LSerror :: addErrorCode('FTP_01',"2");
+ LSerror :: addErrorCode('FTP_00',$do -> getMessage());
return;
}
}
else {
- LSerror::addErrorCode('FTP_01',"1");
- 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) {
- LSerror::addErrorCode('FTP_02',$dir);
- 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) {
- LSerror::addErrorCode('FTP_04',$dir);
- 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) {
- LSerror::addErrorCode('FTP_03',$dir);
- 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) {
- LSerror::addErrorCode('FTP_05',array('old' => $old,'new' => $new));
- 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 92b80429..0f1eb1af 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)) {
- LSerror::addErrorCode('MAIL_SUPPORT_01');
+ LSerror :: addErrorCode('MAIL_SUPPORT_01');
$retval=false;
}
}
@@ -76,21 +76,18 @@ $GLOBALS['LSerror_code']['MAIL_01']= array (
if ($subject) {
$headers["Subject"] = $subject;
}
- if (!isset($headers['From']) && ($GLOBALS['LSsession'] -> getEmailSender() != "")) {
- $headers['From'] = $GLOBALS['LSsession'] -> getEmailSender();
+ if (!isset($headers['From']) && (LSsession :: getEmailSender() != "")) {
+ $headers['From'] = LSsession :: getEmailSender();
}
$headers["To"] = $to;
$ret = $mail_obj -> send($to,$headers,$msg);
if ($ret instanceof PEAR_Error) {
- LSerror::addErrorCode('MAIL_01');
- 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 0bc8d115..1f97d6e3 100644
--- a/trunk/includes/addons/LSaddons.maildir.php
+++ b/trunk/includes/addons/LSaddons.maildir.php
@@ -56,8 +56,8 @@ $retval=true;
// Dependance de librairie
if (!function_exists('createDirsByFTP')) {
- if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) {
- LSerror::addErrorCode('MAILDIR_SUPPORT_01');
+ if(!LSsession :: loadLSaddon('ftp')) {
+ LSerror :: addErrorCode('MAILDIR_SUPPORT_01');
$retval=false;
}
}
@@ -71,7 +71,7 @@ $retval=true;
foreach($MUST_DEFINE_CONST as $const) {
if ( (!defined($const)) || (constant($const) == "")) {
- LSerror::addErrorCode('MAILDIR_SUPPORT_02',$const);
+ LSerror :: addErrorCode('MAILDIR_SUPPORT_02',$const);
$retval=false;
}
}
@@ -102,7 +102,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)) {
- LSerror::addErrorCode('MAILDIR_01');
+ LSerror :: addErrorCode('MAILDIR_01');
return;
}
return true;
@@ -127,7 +127,7 @@ $retval=true;
}
}
if (!removeDirsByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$dir)) {
- LSerror::addErrorCode('MAILDIR_02');
+ LSerror :: addErrorCode('MAILDIR_02');
return;
}
return true;
@@ -155,7 +155,7 @@ $retval=true;
}
if ($dir=="") {
- LSerror::addErrorCode('MAILDIR_04');
+ LSerror :: addErrorCode('MAILDIR_04');
return;
}
@@ -174,7 +174,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)) {
- 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 9cc68068..34b7208c 100644
--- a/trunk/includes/addons/LSaddons.posix.php
+++ b/trunk/includes/addons/LSaddons.posix.php
@@ -52,8 +52,8 @@ $GLOBALS['LSerror_code']['POSIX_01']= array (
// Dependance de librairie
if (!function_exists('createDirsByFTP')) {
- if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) {
- LSerror::addErrorCode('POSIX_SUPPORT_02');
+ if(!LSsession :: loadLSaddon('ftp')) {
+ 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) == "")) {
- 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' ) {
- 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)) {
- 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 2e21d54a..61bed19a 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') ) {
- 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) == "")) {
- 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) ) {
- 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' ) {
- 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' ) {
- 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' ) {
- 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' ) {
- 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' ) {
- 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 a8a0462b..14326de3 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) == "")) {
- 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' ) {
- 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' ) {
- 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' ) {
- 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' ) {
- 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 187233a7..919d7be2 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) {
- 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) {
- 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 f3a24328..4ba67247 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) {
- LSerror::addErrorCode('LSform_06',$this -> name);
+ LSerror :: addErrorCode('LSform_06',$this -> name);
return;
}
if (count($data)>1) {
- 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 4db921d1..c1ffdbea 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) {
- LSerror::addErrorCode('LSform_06',$this -> name);
+ LSerror :: addErrorCode('LSform_06',$this -> name);
return;
}
if (count($data)>1) {
- 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 f3235979..326e9b1b 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) {
- LSerror::addErrorCode('LSform_06',$this -> name);
+ LSerror :: addErrorCode('LSform_06',$this -> name);
return;
}
if ($data) {
@@ -76,10 +76,10 @@ 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']))) {
- 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'])) {
+ if (!LSsession :: loadLSobject($val['object_type'])) {
return;
}
$obj = new $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 d4f7534c..f1796cf7 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) {
- LSerror::addErrorCode('LSform_06',$this -> name);
+ LSerror :: addErrorCode('LSform_06',$this -> name);
return;
}
if ($data) {
@@ -81,11 +81,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) {
- LSerror::addErrorCode('LSattr_html_select_object_01',$this -> name);
+ LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
return;
}
- if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) {
+ if (!LSsession :: loadLSobject($conf['object_type'])) {
return;
}
@@ -129,11 +129,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) {
- LSerror::addErrorCode('LSattr_html_select_object_01',$this -> name);
+ LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
return;
}
- if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) {
+ if (!LSsession :: loadLSobject($conf['object_type'])) {
return;
}
diff --git a/trunk/includes/class/class.LSattr_ldap_password.php b/trunk/includes/class/class.LSattr_ldap_password.php
index 2746c4fd..a75df2a7 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 ) {
- 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 ) {
- 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 {
- 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 {
- 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 {
- 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 ) {
- 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 43822510..7581563e 100644
--- a/trunk/includes/class/class.LSattribute.php
+++ b/trunk/includes/class/class.LSattribute.php
@@ -20,8 +20,8 @@
******************************************************************************/
-$GLOBALS['LSsession'] -> loadLSclass('LSattr_ldap');
-$GLOBALS['LSsession'] -> loadLSclass('LSattr_html');
+LSsession :: loadLSclass('LSattr_ldap');
+LSsession :: loadLSclass('LSattr_html');
/**
* Attribut Ldap
@@ -66,14 +66,14 @@ class LSattribute {
$this -> ldapObject = $ldapObject;
$html_type = "LSattr_html_".$config['html_type'];
$ldap_type = "LSattr_ldap_".$config['ldap_type'];
- $GLOBALS['LSsession'] -> loadLSclass($html_type);
- $GLOBALS['LSsession'] -> loadLSclass($ldap_type);
+ LSsession :: loadLSclass($html_type);
+ LSsession :: loadLSclass($ldap_type);
if((class_exists($html_type))&&(class_exists($ldap_type))) {
$this -> html = new $html_type($name,$config,$this);
$this -> ldap = new $ldap_type($name,$config,$this);
}
else {
- 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) {
- 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) {
- 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 {
- 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 {
- 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) {
- 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) {
- 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!='')) {
- 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 {
- 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) {
- 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) {
- 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) {
- 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 {
- 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 {
- 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) {
- 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 a081bacf..18a0d5bd 100644
--- a/trunk/includes/class/class.LSform.php
+++ b/trunk/includes/class/class.LSform.php
@@ -61,7 +61,7 @@ class LSform {
$this -> idForm = $idForm;
$this -> submit = $submit;
$this -> ldapObject = $ldapObject;
- $GLOBALS['LSsession'] -> loadLSclass('LSformElement');
+ LSsession :: loadLSclass('LSformElement');
}
/**
@@ -73,16 +73,16 @@ class LSform {
*/
function display(){
if ($this -> idForm == 'view') {
- $GLOBALS['LSsession'] -> addJSscript('LSview.js');
- $GLOBALS['LSsession'] -> addJSscript('LSform.js');
+ LSsession :: addJSscript('LSview.js');
+ LSsession :: addJSscript('LSform.js');
}
else {
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_field.js');
- $GLOBALS['LSsession'] -> addJSscript('LSformElement.js');
- $GLOBALS['LSsession'] -> addJSscript('LSform.js');
+ LSsession :: addJSscript('LSformElement_field.js');
+ LSsession :: addJSscript('LSformElement.js');
+ LSsession :: addJSscript('LSform.js');
}
- $GLOBALS['LSsession'] -> addHelpInfos(
+ LSsession :: addHelpInfos(
'LSform',
array(
'addFieldBtn' => _('Ajouter un champ pour saisir une autre valeur.'),
@@ -90,7 +90,7 @@ class LSform {
)
);
- $GLOBALS['LSsession'] -> addCssFile('LSform.css');
+ LSsession :: addCssFile('LSform.css');
$GLOBALS['Smarty'] -> assign('LSform_action',$_SERVER['PHP_SELF']);
$LSform_header = "\t\n
\t\n
@@ -138,8 +138,8 @@ class LSform {
* @retval void
*/
function displayView(){
- $GLOBALS['LSsession'] -> addCssFile('LSform.css');
- $GLOBALS['LSsession'] -> addJSscript('LSform.js');
+ LSsession :: addCssFile('LSform.css');
+ LSsession :: addJSscript('LSform.js');
$LSform_object = array(
'type' => $this -> ldapObject -> getType(),
'dn' => $this -> ldapObject -> getDn()
@@ -219,7 +219,7 @@ class LSform {
return;
if ($this -> isSubmit()) {
if (!$this -> getPostData()) {
- LSerror::addErrorCode('LSform_01');
+ LSerror :: addErrorCode('LSform_01');
return;
}
$this -> setValuesFromPostData();
@@ -260,10 +260,10 @@ class LSform {
}
if (!is_array($this -> _rules[$element]))
continue;
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule');
+ LSsession :: loadLSclass('LSformRule');
foreach($this -> _rules[$element] as $rule) {
$ruleType="LSformRule_".$rule['name'];
- $GLOBALS['LSsession'] -> loadLSclass($ruleType);
+ LSsession :: loadLSclass($ruleType);
if (! call_user_func(array( $ruleType,'validate') , $value, $rule['options'], $this -> getElement($element))) {
$retval=false;
$this -> setElementError($this -> elements[$element],$rule['options']['msg']);
@@ -343,7 +343,7 @@ class LSform {
function getPostData() {
foreach($this -> elements as $element_name => $element) {
if( !($element -> getPostData($this -> _postData)) ) {
- LSerror::addErrorCode('LSform_02',$element_name);
+ LSerror :: addErrorCode('LSform_02',$element_name);
return;
}
}
@@ -364,9 +364,9 @@ class LSform {
*/
function addElement($type,$name,$label,$params=array(),&$attr_html) {
$elementType='LSformElement_'.$type;
- $GLOBALS['LSsession'] -> loadLSclass($elementType);
+ LSsession :: loadLSclass($elementType);
if (!class_exists($elementType)) {
- 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]);
- LSerror::addErrorCode('LSform_06',array('element' => $name));
+ LSerror :: addErrorCode('LSform_06',array('element' => $name));
return;
}
}
@@ -401,12 +401,12 @@ class LSform {
return true;
}
else {
- LSerror::addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule));
+ LSerror :: addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule));
return;
}
}
else {
- LSerror::addErrorCode('LSform_04',array('element' => $element));
+ LSerror :: addErrorCode('LSform_04',array('element' => $element));
return;
}
}
@@ -440,8 +440,8 @@ class LSform {
* @param[in] $element string Le nom de l'élément conserné
*/
function isRuleRegistered($rule) {
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule');
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule_'.$rule);
+ LSsession :: loadLSclass('LSformRule');
+ LSsession :: loadLSclass('LSformRule_'.$rule);
return class_exists('LSformRule_'.$rule);
}
diff --git a/trunk/includes/class/class.LSformElement.php b/trunk/includes/class/class.LSformElement.php
index bbdbe00d..50db43c2 100644
--- a/trunk/includes/class/class.LSformElement.php
+++ b/trunk/includes/class/class.LSformElement.php
@@ -267,7 +267,7 @@ class LSformElement {
if (!$template) {
$template = $this -> template;
}
- return $GLOBALS['LSsession'] -> fetchTemplate(
+ return LSsession :: fetchTemplate(
$template,
array_merge_recursive(
$variables,
diff --git a/trunk/includes/class/class.LSformElement_boolean.php b/trunk/includes/class/class.LSformElement_boolean.php
index 07b4f71a..20f37f23 100644
--- a/trunk/includes/class/class.LSformElement_boolean.php
+++ b/trunk/includes/class/class.LSformElement_boolean.php
@@ -46,13 +46,13 @@ class LSformElement_boolean extends LSformElement {
$return = $this -> getLabelInfos();
if (!$this -> isFreeze()) {
// Help Infos
- $GLOBALS['LSsession'] -> addHelpInfos(
+ LSsession :: addHelpInfos(
'LSformElement_boolean',
array(
'clear' => _('Effacer le choix.')
)
);
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_boolean.js');
+ LSsession :: addJSscript('LSformElement_boolean.js');
}
$return['html'] = $this -> fetchTemplate(
NULL,
diff --git a/trunk/includes/class/class.LSformElement_date.php b/trunk/includes/class/class.LSformElement_date.php
index 5dfc8d73..d4653dd3 100644
--- a/trunk/includes/class/class.LSformElement_date.php
+++ b/trunk/includes/class/class.LSformElement_date.php
@@ -135,7 +135,7 @@ class LSformElement_date extends LSformElement {
// value
if (!$this -> isFreeze()) {
// Help Infos
- $GLOBALS['LSsession'] -> addHelpInfos(
+ LSsession :: addHelpInfos(
'LSformElement_date',
array(
'calendar' => _('Sélectionner dans un calendrier.')
@@ -146,15 +146,15 @@ class LSformElement_date extends LSformElement {
'format' => $this -> php2js_format($this -> getFormat()),
'firstDayOfWeek' => $this -> getFirstDayOfWeek()
);
- $GLOBALS['LSsession'] -> addJSconfigParam($this -> name,$params);
+ LSsession :: addJSconfigParam($this -> name,$params);
- $GLOBALS['LSsession'] -> addCssFile('theme.css',LS_LIB_DIR.'jscalendar/skins/aqua/');
- $GLOBALS['LSsession'] -> addJSscript('calendar.js',LS_LIB_DIR.'jscalendar/');
- $GLOBALS['LSsession'] -> addJSscript('calendar-en.js',LS_LIB_DIR.'jscalendar/lang/');
+ 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]);
- $GLOBALS['LSsession'] -> addJSscript('calendar-'.$codeLang.'.js',LS_LIB_DIR.'jscalendar/lang/');
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_date_field.js');
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_date.js');
+ LSsession :: addJSscript('calendar-'.$codeLang.'.js',LS_LIB_DIR.'jscalendar/lang/');
+ LSsession :: addJSscript('LSformElement_date_field.js');
+ LSsession :: addJSscript('LSformElement_date.js');
}
$return['html'] = $this -> fetchTemplate();
return $return;
diff --git a/trunk/includes/class/class.LSformElement_image.php b/trunk/includes/class/class.LSformElement_image.php
index a2f121ef..c97fdfc3 100644
--- a/trunk/includes/class/class.LSformElement_image.php
+++ b/trunk/includes/class/class.LSformElement_image.php
@@ -44,10 +44,10 @@ class LSformElement_image extends LSformElement {
* @retval array
*/
function getDisplay(){
- $GLOBALS['LSsession'] -> addCssFile('LSformElement_image.css');
+ LSsession :: addCssFile('LSformElement_image.css');
$return = true;
if (!$this -> isFreeze()) {
- $GLOBALS['LSsession'] -> addHelpInfos(
+ LSsession :: addHelpInfos(
'LSformElement_date',
array(
'zoom' => _('Cliquer pour agrandir.'),
@@ -61,7 +61,7 @@ class LSformElement_image extends LSformElement {
}
if (!empty($this -> values[0])) {
- $img_path = $GLOBALS['LSsession'] -> getTmpFile($this -> values[0]);
+ $img_path = LSsession :: getTmpFile($this -> values[0]);
$GLOBALS['Smarty'] -> assign('LSformElement_image',array(
'img' => $img_path,
'id' => $id,
@@ -73,7 +73,7 @@ class LSformElement_image extends LSformElement {
if ($this -> form -> definedError($this -> name)) {
$GLOBALS['Smarty'] -> assign('LSformElement_image_errors',true);
}
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_image.js');
+ LSsession :: addJSscript('LSformElement_image.js');
}
return $return;
}
@@ -99,7 +99,7 @@ class LSformElement_image extends LSformElement {
fclose($fp);
$tmp_file = LS_TMP_DIR.$this -> name.'_'.rand().'.tmp';
if (move_uploaded_file($_FILES[$this -> name]['tmp_name'],$tmp_file)) {
- $GLOBALS['LSsession'] -> addTmpFile($buf,$tmp_file);
+ LSsession :: addTmpFile($buf,$tmp_file);
}
$return[$this -> name][0] = $buf;
}
diff --git a/trunk/includes/class/class.LSformElement_mail.php b/trunk/includes/class/class.LSformElement_mail.php
index 6a56a20a..482a9d2f 100644
--- a/trunk/includes/class/class.LSformElement_mail.php
+++ b/trunk/includes/class/class.LSformElement_mail.php
@@ -20,7 +20,7 @@
******************************************************************************/
-$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text');
+LSsession :: loadLSclass('LSformElement_text');
/**
* Element mail d'un formulaire pour LdapSaisie
@@ -52,7 +52,7 @@ class LSformElement_mail extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() {
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addHelpInfos (
'LSformElement_mail',
array(
'mail' => _("Envoyer un mail depuis l'interface.")
diff --git a/trunk/includes/class/class.LSformElement_mailQuota.php b/trunk/includes/class/class.LSformElement_mailQuota.php
index 5c19dd12..6c2d15ba 100644
--- a/trunk/includes/class/class.LSformElement_mailQuota.php
+++ b/trunk/includes/class/class.LSformElement_mailQuota.php
@@ -82,7 +82,7 @@ class LSformElement_mailQuota extends LSformElement {
}
}
- $GLOBALS['LSsession'] -> addCssFile('LSformElement_mailQuota.css');
+ LSsession :: addCssFile('LSformElement_mailQuota.css');
$return['html'] = $this -> fetchTemplate(
NULL,
diff --git a/trunk/includes/class/class.LSformElement_maildir.php b/trunk/includes/class/class.LSformElement_maildir.php
index d63b0cb0..6f0e3636 100644
--- a/trunk/includes/class/class.LSformElement_maildir.php
+++ b/trunk/includes/class/class.LSformElement_maildir.php
@@ -20,8 +20,8 @@
******************************************************************************/
-$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text');
-$GLOBALS['LSsession'] -> loadLSaddon('maildir');
+LSsession :: loadLSclass('LSformElement_text');
+LSsession :: loadLSaddon('maildir');
/**
* Element maildir d'un formulaire pour LdapSaisie
@@ -63,7 +63,7 @@ class LSformElement_maildir extends LSformElement_text {
var $fieldTemplate = 'LSformElement_maildir_field.tpl';
function getDisplay() {
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addHelpInfos (
'LSformElement_maildir',
array(
'do' => _("La création ou modification de la maildir en même temps que l'utilisateur est activée. Cliquer sur ce bouton pour la désactiver."),
@@ -140,7 +140,7 @@ class LSformElement_maildir extends LSformElement_text {
$newname=getFData($this -> params['html_options']['archiveNameFormat'],$this -> _toDo['old']);
if ($newname) {
if (renameMaildirByFTP($this -> _toDo['old'],$newname)) {
- $GLOBALS['LSsession'] -> addInfo("La boîte mail a été archivée.");
+ LSsession :: addInfo("La boîte mail a été archivée.");
return true;
}
return;
@@ -150,7 +150,7 @@ class LSformElement_maildir extends LSformElement_text {
}
else {
if (removeMaildirByFTP(null,$this -> _toDo['old'])) {
- $GLOBALS['LSsession'] -> addInfo("La boîte mail a été supprimée.");
+ LSsession :: addInfo("La boîte mail a été supprimée.");
return true;
}
return;
@@ -158,14 +158,14 @@ class LSformElement_maildir extends LSformElement_text {
break;
case 'modify':
if (renameMaildirByFTP($this -> _toDo['old'],$this -> _toDo['new'])) {
- $GLOBALS['LSsession'] -> addInfo("La boîte mail a été déplacée.");
+ LSsession :: addInfo("La boîte mail a été déplacée.");
return true;
}
return;
break;
case 'create':
if (createMaildirByFTP(null,$this -> _toDo['new'])) {
- $GLOBALS['LSsession'] -> addInfo("La boîte mail a été créée.");
+ LSsession :: addInfo("La boîte mail a été créée.");
return true;
}
return;
diff --git a/trunk/includes/class/class.LSformElement_password.php b/trunk/includes/class/class.LSformElement_password.php
index 0dc2118d..fa03057d 100644
--- a/trunk/includes/class/class.LSformElement_password.php
+++ b/trunk/includes/class/class.LSformElement_password.php
@@ -70,7 +70,7 @@ class LSformElement_password extends LSformElement {
$this -> sendMail = true;
LSdebug ('send by config');
}
- if ($this -> sendMail && $GLOBALS['LSsession'] -> loadLSaddon('mail')) {
+ if ($this -> sendMail && LSsession :: loadLSaddon('mail')) {
$msg = getFData($this -> params['html_options']['mail']['msg'],$return[$this -> name][0]);
$subject = $this -> params['html_options']['mail']['subject'];
if (isset($_POST['LSformElement_password_'.$this -> name.'_msg'])) {
@@ -104,13 +104,13 @@ class LSformElement_password extends LSformElement {
* @retval array
*/
function getDisplay(){
- $GLOBALS['LSsession'] -> addCssFile('LSformElement_password.css');
+ LSsession :: addCssFile('LSformElement_password.css');
$return = $this -> getLabelInfos();
$pwd = "";
if (!$this -> isFreeze()) {
// Help Infos
- $GLOBALS['LSsession'] -> addHelpInfos(
+ LSsession :: addHelpInfos(
'LSformElement_password',
array(
'generate' => _('Générer un mot de passe.'),
@@ -134,10 +134,10 @@ class LSformElement_password extends LSformElement {
if (isset($this -> params['html_options']['mail'])) {
$params['mail'] = $this -> params['html_options']['mail'];
}
- $GLOBALS['LSsession'] -> addJSconfigParam($this -> name,$params);
+ LSsession :: addJSconfigParam($this -> name,$params);
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_password_field.js');
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_password.js');
+ LSsession :: addJSscript('LSformElement_password_field.js');
+ LSsession :: addJSscript('LSformElement_password.js');
}
$return['html'] = $this -> fetchTemplate(NULL,array('pwd' => $pwd));
return $return;
@@ -151,7 +151,7 @@ class LSformElement_password extends LSformElement {
if ($this -> attr_html -> attribute -> ldapObject -> isNew()) {
return false;
}
- return $GLOBALS['LSsession'] -> checkUserPwd($this -> attr_html -> attribute -> ldapObject,$pwd);
+ return LSsession :: checkUserPwd($this -> attr_html -> attribute -> ldapObject,$pwd);
}
function send($params) {
@@ -176,7 +176,7 @@ class LSformElement_password extends LSformElement {
$this -> sendMail['subject'],
$this -> sendMail['msg']
)) {
- $GLOBALS['LSsession'] -> addInfo(_('Mail de changement de mot de passe envoyé.'));
+ LSsession :: addInfo(_('Mail de changement de mot de passe envoyé.'));
}
}
else {
diff --git a/trunk/includes/class/class.LSformElement_rss.php b/trunk/includes/class/class.LSformElement_rss.php
index 65111c36..9570170d 100644
--- a/trunk/includes/class/class.LSformElement_rss.php
+++ b/trunk/includes/class/class.LSformElement_rss.php
@@ -20,7 +20,7 @@
******************************************************************************/
-$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text');
+LSsession :: loadLSclass('LSformElement_text');
/**
* Element RSS d'un formulaire pour LdapSaisie
@@ -43,7 +43,7 @@ class LSformElement_rss extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() {
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addHelpInfos (
'LSformElement_rss',
array(
'display' => _("Afficher la file RSS.")
diff --git a/trunk/includes/class/class.LSformElement_select.php b/trunk/includes/class/class.LSformElement_select.php
index 7b9b5c0e..e1e848ad 100644
--- a/trunk/includes/class/class.LSformElement_select.php
+++ b/trunk/includes/class/class.LSformElement_select.php
@@ -46,13 +46,13 @@ class LSformElement_select extends LSformElement {
$return = $this -> getLabelInfos();
$params = array();
if (!$this -> isFreeze()) {
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addHelpInfos (
'LSformElement_select',
array(
'clear' => _("Effacer la sélection.")
)
);
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_select.js');
+ LSsession :: addJSscript('LSformElement_select.js');
}
$params['possible_values'] = $this -> params['text_possible_values'];
$return['html'] = $this -> fetchTemplate(NULL,$params);
diff --git a/trunk/includes/class/class.LSformElement_select_object.php b/trunk/includes/class/class.LSformElement_select_object.php
index 30d9647e..63aca7c4 100644
--- a/trunk/includes/class/class.LSformElement_select_object.php
+++ b/trunk/includes/class/class.LSformElement_select_object.php
@@ -43,14 +43,14 @@ class LSformElement_select_object extends LSformElement {
* @retval array
*/
function getDisplay($refresh=NULL){
- $GLOBALS['LSsession'] -> addCssFile('LSformElement_select_object.css');
+ LSsession :: addCssFile('LSformElement_select_object.css');
if ($refresh) {
$this -> values = $this -> getValuesFromSession();
}
$return = $this -> getLabelInfos();
if (!$this -> isFreeze()) {
- $GLOBALS['LSsession'] -> addJSconfigParam(
+ LSsession :: addJSconfigParam(
$this -> name,
array(
'object_type' => $this -> selectableObject,
@@ -62,7 +62,7 @@ class LSformElement_select_object extends LSformElement {
)
);
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addHelpInfos (
'LSformElement_select_object',
array(
'searchAdd' => _("Ajout rapide"),
@@ -71,15 +71,15 @@ class LSformElement_select_object extends LSformElement {
)
);
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_select_object_field.js');
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_select_object.js');
- $GLOBALS['LSsession'] -> addJSscript('LSform.js');
- $GLOBALS['LSsession'] -> addJSscript('LSselect.js');
- $GLOBALS['LSsession'] -> addCssFile('LSselect.css');
- $GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js');
- $GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css');
- $GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js');
- $GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css');
+ LSsession :: addJSscript('LSformElement_select_object_field.js');
+ LSsession :: addJSscript('LSformElement_select_object.js');
+ LSsession :: addJSscript('LSform.js');
+ LSsession :: addJSscript('LSselect.js');
+ LSsession :: addCssFile('LSselect.css');
+ LSsession :: addJSscript('LSsmoothbox.js');
+ LSsession :: addCssFile('LSsmoothbox.css');
+ LSsession :: addJSscript('LSconfirmBox.js');
+ LSsession :: addCssFile('LSconfirmBox.css');
}
$return['html'] = $this -> fetchTemplate(NULL,array('selectableObject' => $this -> selectableObject));
@@ -142,7 +142,7 @@ class LSformElement_select_object extends LSformElement {
*/
function searchAdd ($pattern) {
if (is_array($this -> params['selectable_object'])) {
- if ($GLOBALS['LSsession'] -> loadLSobject($this -> params['selectable_object']['object_type'])) {
+ if (LSsession :: loadLSobject($this -> params['selectable_object']['object_type'])) {
$obj = new $this -> params['selectable_object']['object_type']();
$ret = $obj -> getSelectArray($pattern,NULL,$this -> params['selectable_object']['display_attribute']);
if (is_array($ret)) {
diff --git a/trunk/includes/class/class.LSformElement_ssh_key.php b/trunk/includes/class/class.LSformElement_ssh_key.php
index 58919c85..cd864037 100644
--- a/trunk/includes/class/class.LSformElement_ssh_key.php
+++ b/trunk/includes/class/class.LSformElement_ssh_key.php
@@ -43,15 +43,15 @@ class LSformElement_ssh_key extends LSformElement {
* @retval array
*/
function getDisplay(){
- $GLOBALS['LSsession'] -> addCssFile('LSformElement_ssh_key.css');
+ LSsession :: addCssFile('LSformElement_ssh_key.css');
$return = $this -> getLabelInfos();
$params = array();
if (!$this -> isFreeze()) {
$params['values_txt'] = $this -> values;
}
else {
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_ssh_key.js');
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addJSscript('LSformElement_ssh_key.js');
+ LSsession :: addHelpInfos (
'LSformElement_ssh_key',
array(
'display' => _("Afficher la clef complète.")
diff --git a/trunk/includes/class/class.LSformElement_text.php b/trunk/includes/class/class.LSformElement_text.php
index e5db8532..59b865a1 100644
--- a/trunk/includes/class/class.LSformElement_text.php
+++ b/trunk/includes/class/class.LSformElement_text.php
@@ -48,22 +48,22 @@ class LSformElement_text extends LSformElement {
// value
if (!$this -> isFreeze()) {
if (isset($this -> params['html_options'])) {
- $GLOBALS['LSsession'] -> addJSconfigParam($this -> name,$this -> params['html_options']);
+ LSsession :: addJSconfigParam($this -> name,$this -> params['html_options']);
}
- $GLOBALS['LSsession'] -> addHelpInfos(
+ LSsession :: addHelpInfos(
'LSformElement_text',
array(
'generate' => _('Générer la valeur')
)
);
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_text_field.js');
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_text.js');
+ LSsession :: addJSscript('LSformElement_text_field.js');
+ LSsession :: addJSscript('LSformElement_text.js');
}
foreach ($this -> JSscripts as $js) {
- $GLOBALS['LSsession'] -> addJSscript($js);
+ LSsession :: addJSscript($js);
}
foreach ($this -> CSSfiles as $css) {
- $GLOBALS['LSsession'] -> addCssFile($css);
+ LSsession :: addCssFile($css);
}
$return['html'] = $this -> fetchTemplate();
return $return;
diff --git a/trunk/includes/class/class.LSformElement_textarea.php b/trunk/includes/class/class.LSformElement_textarea.php
index 476b5487..dbb45ab5 100644
--- a/trunk/includes/class/class.LSformElement_textarea.php
+++ b/trunk/includes/class/class.LSformElement_textarea.php
@@ -44,13 +44,13 @@ class LSformElement_textarea extends LSformElement {
function getDisplay(){
$return = $this -> getLabelInfos();
if (!$this -> isFreeze()) {
- $GLOBALS['LSsession'] -> addHelpInfos(
+ LSsession :: addHelpInfos(
'LSformElement_textarea',
array(
'clear' => _('Effacer')
)
);
- $GLOBALS['LSsession'] -> addJSscript('LSformElement_textarea.js');
+ LSsession :: addJSscript('LSformElement_textarea.js');
}
$return['html'] = $this -> fetchTemplate();
return $return;
diff --git a/trunk/includes/class/class.LSformElement_url.php b/trunk/includes/class/class.LSformElement_url.php
index a9ca0c87..e849e518 100644
--- a/trunk/includes/class/class.LSformElement_url.php
+++ b/trunk/includes/class/class.LSformElement_url.php
@@ -20,7 +20,7 @@
******************************************************************************/
-$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text');
+LSsession :: loadLSclass('LSformElement_text');
/**
* Element texte d'un formulaire pour LdapSaisie
@@ -44,7 +44,7 @@ class LSformElement_url extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() {
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addHelpInfos (
'LSformElement_url',
array(
'go' => _("Afficher ce site."),
diff --git a/trunk/includes/class/class.LSformElement_xmpp.php b/trunk/includes/class/class.LSformElement_xmpp.php
index 0adb8170..142cb65a 100644
--- a/trunk/includes/class/class.LSformElement_xmpp.php
+++ b/trunk/includes/class/class.LSformElement_xmpp.php
@@ -20,7 +20,7 @@
******************************************************************************/
-$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text');
+LSsession :: loadLSclass('LSformElement_text');
/**
* Element xmpp d'un formulaire pour LdapSaisie
@@ -44,7 +44,7 @@ class LSformElement_xmpp extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() {
- $GLOBALS['LSsession'] -> addHelpInfos (
+ LSsession :: addHelpInfos (
'LSformElement_xmpp',
array(
'chat' => _("Dialoguer avec cette personne.")
diff --git a/trunk/includes/class/class.LSformRule_alphanumeric.php b/trunk/includes/class/class.LSformRule_alphanumeric.php
index 1bc02496..03f8516a 100644
--- a/trunk/includes/class/class.LSformRule_alphanumeric.php
+++ b/trunk/includes/class/class.LSformRule_alphanumeric.php
@@ -38,7 +38,7 @@ class LSformRule_alphanumeric extends LSformRule {
*/
function validate ($value,$options=array(),$formElement) {
$regex = '/^[a-zA-Z0-9]+$/';
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex');
+ LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement);
}
diff --git a/trunk/includes/class/class.LSformRule_compare.php b/trunk/includes/class/class.LSformRule_compare.php
index e6ce9d0f..de81fb7f 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'])) {
- 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_imagefile.php b/trunk/includes/class/class.LSformRule_imagefile.php
index 3b1785c6..243287a5 100644
--- a/trunk/includes/class/class.LSformRule_imagefile.php
+++ b/trunk/includes/class/class.LSformRule_imagefile.php
@@ -39,7 +39,7 @@ class LSformRule_imagefile extends LSformRule {
* @return boolean true si la valeur est valide, false sinon
*/
function validate ($value,$options,$formElement) {
- $file = $GLOBALS['LSsession'] -> getTmpFile($value);
+ $file = LSsession :: getTmpFile($value);
$mimetype = mime_content_type($file);
diff --git a/trunk/includes/class/class.LSformRule_imagefilesize.php b/trunk/includes/class/class.LSformRule_imagefilesize.php
index 6b88cf67..778c1db8 100644
--- a/trunk/includes/class/class.LSformRule_imagefilesize.php
+++ b/trunk/includes/class/class.LSformRule_imagefilesize.php
@@ -39,7 +39,7 @@ class LSformRule_imagefilesize extends LSformRule {
* @return boolean true si la valeur est valide, false sinon
*/
function validate ($value,$options,$formElement) {
- $file = $GLOBALS['LSsession'] -> getTmpFile($value);
+ $file = LSsession :: getTmpFile($value);
$size = filesize($file);
diff --git a/trunk/includes/class/class.LSformRule_imagesize.php b/trunk/includes/class/class.LSformRule_imagesize.php
index 44567a1f..9cedee66 100644
--- a/trunk/includes/class/class.LSformRule_imagesize.php
+++ b/trunk/includes/class/class.LSformRule_imagesize.php
@@ -41,7 +41,7 @@ class LSformRule_imagesize extends LSformRule {
* @return boolean true si la valeur est valide, false sinon
*/
function validate ($value,$options,$formElement) {
- $file = $GLOBALS['LSsession'] -> getTmpFile($value);
+ $file = LSsession :: getTmpFile($value);
list($width, $height, $type, $attr) = getimagesize($file);
if (is_int($options['params']['maxWidth'])) {
diff --git a/trunk/includes/class/class.LSformRule_lettersonly.php b/trunk/includes/class/class.LSformRule_lettersonly.php
index c07b1bdf..9a77c441 100644
--- a/trunk/includes/class/class.LSformRule_lettersonly.php
+++ b/trunk/includes/class/class.LSformRule_lettersonly.php
@@ -38,7 +38,7 @@ class LSformRule_lettersonly extends LSformRule {
*/
function validate ($value,$options=array(),$formElement) {
$regex = '/^[a-zA-Z]+$/';
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex');
+ LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement);
}
diff --git a/trunk/includes/class/class.LSformRule_maxlength.php b/trunk/includes/class/class.LSformRule_maxlength.php
index 738d32bf..e7558614 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'])) {
- 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 48f7d874..b0916b47 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'])) {
- 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_nonzero.php b/trunk/includes/class/class.LSformRule_nonzero.php
index 9f4d32a2..7f6adfff 100644
--- a/trunk/includes/class/class.LSformRule_nonzero.php
+++ b/trunk/includes/class/class.LSformRule_nonzero.php
@@ -38,7 +38,7 @@ class LSformRule_nonzero extends LSformRule {
*/
function validate ($value,$options,$formElement) {
$regex = '/^-?[1-9][0-9]*/';
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex');
+ LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement);
}
diff --git a/trunk/includes/class/class.LSformRule_nopunctuation.php b/trunk/includes/class/class.LSformRule_nopunctuation.php
index c7d28496..f6487a57 100644
--- a/trunk/includes/class/class.LSformRule_nopunctuation.php
+++ b/trunk/includes/class/class.LSformRule_nopunctuation.php
@@ -38,7 +38,7 @@ class LSformRule_nopunctuation extends LSformRule {
*/
function validate ($value,$options=array(),$formElement) {
$regex = '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/';
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex');
+ LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement);
}
diff --git a/trunk/includes/class/class.LSformRule_numeric.php b/trunk/includes/class/class.LSformRule_numeric.php
index 80392ce9..9aeadb39 100644
--- a/trunk/includes/class/class.LSformRule_numeric.php
+++ b/trunk/includes/class/class.LSformRule_numeric.php
@@ -38,7 +38,7 @@ class LSformRule_numeric extends LSformRule{
*/
function validate ($value,$options=array(),$formElement) {
$regex = '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/';
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex');
+ LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement);
}
diff --git a/trunk/includes/class/class.LSformRule_rangelength.php b/trunk/includes/class/class.LSformRule_rangelength.php
index 8c541917..c512a468 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'])) {
- 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 3f6451fe..f554c076 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 {
- LSerror::addErrorCode('LSformRule_regex_01');
+ LSerror :: addErrorCode('LSformRule_regex_01');
return;
}
}
diff --git a/trunk/includes/class/class.LSformRule_telephonenumber.php b/trunk/includes/class/class.LSformRule_telephonenumber.php
index 4aa98996..3d9c01b8 100644
--- a/trunk/includes/class/class.LSformRule_telephonenumber.php
+++ b/trunk/includes/class/class.LSformRule_telephonenumber.php
@@ -38,7 +38,7 @@ class LSformRule_telephonenumber extends LSformRule {
*/
function validate($value,$option=array(),$formElement) {
$regex = '/^(01|02|03|04|05|06|08|09)[0-9]{8}$/';
- $GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex');
+ LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement);
}
diff --git a/trunk/includes/class/class.LSldap.php b/trunk/includes/class/class.LSldap.php
index 3a43bc3f..fe47383d 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)) {
- 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)) {
- 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)) {
- LSerror::addErrorCode('LSldap_02',$ret -> getMessage());
+ LSerror :: addErrorCode('LSldap_02',$ret -> getMessage());
return;
}
return $ret -> count();
@@ -212,7 +212,7 @@ class LSldap {
}
}
else {
- LSerror::addErrorCode('LSldap_03');
+ LSerror :: addErrorCode('LSldap_03');
return;
}
}
@@ -299,8 +299,8 @@ class LSldap {
}
if (Net_LDAP2::isError($ret)) {
- LSerror::addErrorCode('LSldap_05',$dn);
- 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)) {
- LSerror::addErrorCode('LSldap_06');
- LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
+ LSerror :: addErrorCode('LSldap_06');
+ LSerror :: addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
}
}
return true;
}
}
else {
- 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)) {
- 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)) {
- LSerror::addErrorCode('LSldap_07');
- 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 bcdc947e..a307f447 100644
--- a/trunk/includes/class/class.LSldapObject.php
+++ b/trunk/includes/class/class.LSldapObject.php
@@ -20,7 +20,7 @@
******************************************************************************/
-$GLOBALS['LSsession'] -> loadLSclass('LSattribute');
+LSsession :: loadLSclass('LSattribute');
/**
* Base d'un objet ldap
@@ -64,7 +64,7 @@ class LSldapObject {
$this -> config = $GLOBALS['LSobjects'][$type_name];
}
else {
- LSerror::addErrorCode('LSldapObject_01');
+ LSerror :: addErrorCode('LSldapObject_01');
return;
}
}
@@ -147,7 +147,7 @@ class LSldapObject {
$spe = $this -> getDisplayNameFormat();
}
$val = $this -> getFData($spe,&$this -> attrs,'getDisplayValue');
- if ($GLOBALS['LSsession'] -> haveSubDn() && $full) {
+ if (LSsession :: haveSubDn() && $full) {
$val.=' ('.$this -> getSubDnName().')';
}
return $val;
@@ -184,7 +184,7 @@ class LSldapObject {
* @retval LSform Le formulaire crée
*/
function getForm($idForm,$load=NULL) {
- $GLOBALS['LSsession'] -> loadLSclass('LSform');
+ LSsession :: loadLSclass('LSform');
$LSform = new LSform($this,$idForm);
$this -> forms[$idForm] = array($LSform,$load);
@@ -227,7 +227,7 @@ class LSldapObject {
* @retval LSform Le formulaire crée
*/
function getView() {
- $GLOBALS['LSsession'] -> loadLSclass('LSform');
+ LSsession :: loadLSclass('LSform');
$this -> view = new LSform($this,'view');
foreach($this -> attrs as $attr_name => $attr) {
$this -> attrs[$attr_name] -> addToView($this -> view);
@@ -276,7 +276,7 @@ class LSldapObject {
if(isset($this -> forms[$idForm]))
$LSform = $this -> forms[$idForm][0];
else {
- LSerror::addErrorCode('LSldapObject_02',$this -> getType());
+ LSerror :: addErrorCode('LSldapObject_02',$this -> getType());
return;
}
}
@@ -289,7 +289,7 @@ class LSldapObject {
$LSform = $LSform[0];
}
else {
- 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)) {
- LSerror::addErrorCode('LSldapObject_08',$this -> config['before_modify']);
+ LSerror :: addErrorCode('LSldapObject_08',$this -> config['before_modify']);
return;
}
}
else {
- 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)) {
- LSerror::addErrorCode('LSldapObject_10',$this -> config['after_modify']);
+ LSerror :: addErrorCode('LSldapObject_10',$this -> config['after_modify']);
}
}
else {
- 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)) {
- LSerror::addErrorCode('LSattribute_08',$attr -> getLabel());
+ LSerror :: addErrorCode('LSattribute_08',$attr -> getLabel());
$retval = false;
}
}
else {
- LSerror::addErrorCode('LSattribute_07',$attr -> getLabel());
+ LSerror :: addErrorCode('LSattribute_07',$attr -> getLabel());
$retval = false;
}
}
else {
- LSerror::addErrorCode('LSattribute_06',$attr -> getLabel());
+ LSerror :: addErrorCode('LSattribute_06',$attr -> getLabel());
$retval = false;
}
}
@@ -422,7 +422,7 @@ class LSldapObject {
foreach($vconfig as $test) {
// Définition du basedn par défaut
if (!isset($test['basedn'])) {
- $test['basedn']=$GLOBALS['LSsession']->topDn;
+ $test['basedn']=LSsession :: getTopDn();
}
// Définition du message d'erreur
@@ -476,12 +476,12 @@ class LSldapObject {
}
}
else {
- 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 {
- 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])){
- 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()) {
- LSerror::addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel());
+ LSerror :: addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel());
$retval = false;
}
}
else {
- 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()) {
- 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)) {
- LSerror::addErrorCode('LSldapObject_17');
+ LSerror :: addErrorCode('LSldapObject_17');
return;
}
}
@@ -566,14 +566,14 @@ class LSldapObject {
}
if ($new) {
if (!$this -> afterCreate()) {
- LSerror::addErrorCode('LSldapObject_21');
+ LSerror :: addErrorCode('LSldapObject_21');
return;
}
}
return true;
}
else {
- LSerror::addErrorCode('LSldapObject_13');
+ LSerror :: addErrorCode('LSldapObject_13');
return;
}
}
@@ -997,18 +997,19 @@ class LSldapObject {
}
else {
$rdn_attr=$this -> config['rdn'];
- if( (isset($this -> config['rdn'])) && (isset($this -> attrs[$rdn_attr])) && (isset($this -> config['container_dn'])) && (isset($GLOBALS['LSsession']->topDn)) ) {
+ $topDn = LSsession :: getTopDn();
+ if( (isset($this -> config['rdn'])) && (isset($this -> attrs[$rdn_attr])) && (isset($this -> config['container_dn'])) && ($topDn) ) {
$rdn_val=$this -> attrs[$rdn_attr] -> getUpdateData();
if (!empty($rdn_val)) {
- return $rdn_attr.'='.$rdn_val[0].','.$this -> config['container_dn'].','.$GLOBALS['LSsession']->topDn;
+ return $rdn_attr.'='.$rdn_val[0].','.$this -> config['container_dn'].','.$topDn;
}
else {
- LSerror::addErrorCode('LSldapObject_12',$this -> config['rdn']);
+ LSerror :: addErrorCode('LSldapObject_12',$this -> config['rdn']);
return;
}
}
else {
- LSerror::addErrorCode('LSldapObject_11',$this -> getType());
+ LSerror :: addErrorCode('LSldapObject_11',$this -> getType());
return;
}
}
@@ -1034,7 +1035,7 @@ class LSldapObject {
*/
function whoami() {
if (!$this -> _whoami)
- $this -> _whoami = $GLOBALS['LSsession'] -> whoami($this -> dn);
+ $this -> _whoami = LSsession :: whoami($this -> dn);
return $this -> _whoami;
}
@@ -1063,11 +1064,11 @@ class LSldapObject {
if ($this -> afterDelete()) {
return true;
}
- LSerror::addErrorCode('LSldapObject_19');
+ LSerror :: addErrorCode('LSldapObject_19');
}
}
else {
- LSerror::addErrorCode('LSldapObject_18');
+ LSerror :: addErrorCode('LSldapObject_18');
}
return;
}
@@ -1098,7 +1099,7 @@ class LSldapObject {
return $this -> _subDn_value[$dn];
}
$subDn_value='';
- $subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
+ $subDnLdapServer = LSsession :: getSortSubDnLdapServer();
foreach ($subDnLdapServer as $subDn => $subDn_name) {
if (isCompatibleDNs($subDn,$dn)&&($subDn!=$dn)) {
$subDn_value=$subDn;
@@ -1117,7 +1118,7 @@ class LSldapObject {
* @return string Le nom du subDn de l'object
*/
function getSubDnName($dn=NULL) {
- $subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
+ $subDnLdapServer = LSsession :: getSortSubDnLdapServer();
return $subDnLdapServer[$this -> getSubDnValue($dn)];
}
@@ -1135,7 +1136,7 @@ class LSldapObject {
$me -> loadData($this -> getDn());
foreach($this->config['LSrelation'] as $relation_name => $relation_conf) {
if ( isset($relation_conf['list_function']) ) {
- if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) {
+ if (LSsession :: loadLSobject($relation_conf['LSobject'])) {
$obj = new $relation_conf['LSobject']();
if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) {
$list = $obj -> $relation_conf['list_function']($me);
@@ -1194,8 +1195,8 @@ class LSldapObject {
*/
function afterRename($oldDn,$newDn) {
$error = 0;
- if($GLOBALS['LSsession'] -> dn == $oldDn) {
- $GLOBALS['LSsession'] -> changeAuthUser($this);
+ if(LSsession :: getLSuserObjectDn() == $oldDn) {
+ LSsession :: changeAuthUser($this);
}
foreach($this -> _LSrelationsCache as $relation_name => $objInfos) {
@@ -1274,12 +1275,12 @@ class LSldapObject {
foreach($config as $action) {
if(function_exists($action)) {
if(!$action($this)) {
- LSerror::addErrorCode('LSldapObject_25',$action);
+ LSerror :: addErrorCode('LSldapObject_25',$action);
$error=true;
}
}
else {
- LSerror::addErrorCode('LSldapObject_24',$action);
+ LSerror :: addErrorCode('LSldapObject_24',$action);
$error=true;
}
}
@@ -1306,10 +1307,10 @@ class LSldapObject {
function afterCreate() {
LSdebug('after');
$error = 0;
- if ($GLOBALS['LSsession'] -> isSubDnLSobject($this -> getType())) {
- if (is_array($GLOBALS['LSsession'] -> ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'])) {
- foreach($GLOBALS['LSsession'] -> ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'] as $type) {
- if ($GLOBALS['LSsession'] -> loadLSobject($type)) {
+ if (LSsession :: isSubDnLSobject($this -> getType())) {
+ 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(!$GLOBALS['LSldap'] -> getNewEntry($dn,$GLOBALS['LSobjects'][$type]['container_auto_create']['objectclass'],$GLOBALS['LSobjects'][$type]['container_auto_create']['attrs'],true)) {
@@ -1341,12 +1342,12 @@ class LSldapObject {
foreach($config as $action) {
if(function_exists($action)) {
if(!$action($this)) {
- LSerror::addErrorCode('LSldapObject_23',$action);
+ LSerror :: addErrorCode('LSldapObject_23',$action);
$error=true;
}
}
else {
- LSerror::addErrorCode('LSldapObject_22',$action);
+ LSerror :: addErrorCode('LSldapObject_22',$action);
$error=true;
}
}
@@ -1369,7 +1370,7 @@ class LSldapObject {
**/
function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
- LSerror::addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
+ LSerror :: addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
return;
}
if ($attrValue=='dn') {
@@ -1402,7 +1403,7 @@ class LSldapObject {
**/
function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
- LSerror::addErrorCode('LSrelations_05','listObjectsInRelation');
+ LSerror :: addErrorCode('LSrelations_05','listObjectsInRelation');
return;
}
if ($attrValue=='dn') {
@@ -1415,7 +1416,7 @@ class LSldapObject {
if ($val) {
$filter = $this -> getObjectFilter();
$filter = '(&'.$filter.'('.$attr.'='.$val.'))';
- return $this -> listObjects($filter,$GLOBALS['LSsession'] -> ldapServer['ldap_config']['basedn'],array('scope' => 'sub'));
+ return $this -> listObjects($filter,LSsession :: $ldapServer['ldap_config']['basedn'],array('scope' => 'sub'));
}
return;
}
@@ -1434,7 +1435,7 @@ class LSldapObject {
**/
function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
- LSerror::addErrorCode('LSrelations_05','addOneObjectInRelation');
+ LSerror :: addErrorCode('LSrelations_05','addOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@@ -1484,7 +1485,7 @@ class LSldapObject {
**/
function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
- LSerror::addErrorCode('LSrelations_05','deleteOneObjectInRelation');
+ LSerror :: addErrorCode('LSrelations_05','deleteOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@@ -1529,7 +1530,7 @@ class LSldapObject {
*/
function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
- LSerror::addErrorCode('LSrelations_05','renameOneObjectInRelation');
+ LSerror :: addErrorCode('LSrelations_05','renameOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@@ -1579,7 +1580,7 @@ class LSldapObject {
**/
function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
- 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 465bf05b..194f04a7 100644
--- a/trunk/includes/class/class.LSsession.php
+++ b/trunk/includes/class/class.LSsession.php
@@ -32,39 +32,53 @@ require_once 'includes/functions.php';
*/
class LSsession {
- var $confDir = NULL;
- var $ldapServer = NULL;
- var $ldapServerId = NULL;
- var $topDn = NULL;
- var $LSuserObject = NULL;
- var $dn = NULL;
- var $rdn = NULL;
- var $JSscripts = array();
- var $_JSconfigParams = array();
- var $CssFiles = array();
- var $template = NULL;
- var $LSprofiles = array();
- var $LSaccess = array();
- var $tmp_file = array();
- var $_subDnLdapServer = array();
- var $ajaxDisplay = false;
-
- /**
- * Constructeur
- *
- * @author Benjamin Renard
- *
- * @retval void
+ // La configuration du serveur Ldap utilisé
+ public static $ldapServer = NULL;
+
+ // L'id du serveur Ldap utilisé
+ private static $ldapServerId = NULL;
+
+ // Le topDn courant
+ private static $topDn = NULL;
+
+ // Le DN de l'utilisateur connecté
+ private static $dn = NULL;
+
+ // Le RDN de l'utilisateur connecté (son identifiant)
+ private static $rdn = NULL;
+
+ // Les LSprofiles de l'utilisateur
+ private static $LSprofiles = array();
+
+ // Les droits d'accès de l'utilisateur
+ private static $LSaccess = array();
+
+ // Les fichiers temporaires
+ private static $tmp_file = array();
+
+ /*
+ * Constante de classe non stockée en session
*/
- function LSsession ($configDir=LS_DEFAULT_CONF_DIR) {
- $this -> confDir = $configDir;
- if ($this -> loadConfig()) {
- $this -> startLSerror();
- }
- else {
- return;
- }
- }
+ // Le template à afficher
+ private static $template = NULL;
+
+ // Les subDn des serveurs Ldap
+ private static $_subDnLdapServer = array();
+
+ // Affichage Ajax
+ private static $ajaxDisplay = false;
+
+ // Les fichiers JS à charger dans la page
+ private static $JSscripts = array();
+
+ // Les paramètres JS à communiquer dans la page
+ private static $_JSconfigParams = array();
+
+ // Les fichiers CSS à charger dans la page
+ private static $CssFiles = array();
+
+ // L'objet de l'utilisateur connecté
+ private static $LSuserObject = NULL;
/**
* Include un fichier PHP
@@ -73,7 +87,7 @@ class LSsession {
*
* @retval true si tout c'est bien passé, false sinon
*/
- function includeFile($file) {
+ public static function includeFile($file) {
if (!file_exists($file)) {
return;
}
@@ -95,9 +109,9 @@ class LSsession {
*
* @retval true si tout c'est bien passé, false sinon
*/
- function loadConfig() {
- if (loadDir($this -> confDir, '^config\..*\.php$')) {
- if ( self::includeFile($GLOBALS['LSconfig']['Smarty']) ) {
+ private static function loadConfig() {
+ if (loadDir(LS_DEFAULT_CONF_DIR, '^config\..*\.php$')) {
+ if ( self :: includeFile($GLOBALS['LSconfig']['Smarty']) ) {
$GLOBALS['Smarty'] = new Smarty();
$GLOBALS['Smarty'] -> template_dir = LS_TEMPLATES_DIR;
$GLOBALS['Smarty'] -> compile_dir = LS_TMP_DIR;
@@ -105,7 +119,7 @@ class LSsession {
$GLOBALS['Smarty'] -> assign('LS_CSS_DIR',LS_CSS_DIR);
$GLOBALS['Smarty'] -> assign('LS_IMAGES_DIR',LS_IMAGES_DIR);
- $this -> addJSconfigParam('LS_IMAGES_DIR',LS_IMAGES_DIR);
+ self :: addJSconfigParam('LS_IMAGES_DIR',LS_IMAGES_DIR);
return true;
}
else {
@@ -119,6 +133,10 @@ class LSsession {
}
}
+
+ public static function getTopDn() {
+ return self :: $topDn;
+ }
/**
* Initialisation de la gestion des erreurs
@@ -129,8 +147,8 @@ class LSsession {
*
* @retval boolean true si l'initialisation a réussi, false sinon.
*/
- function startLSerror() {
- if(!$this -> loadLSclass('LSerror')) {
+ private static function startLSerror() {
+ if(!self :: loadLSclass('LSerror')) {
return;
}
return true;
@@ -146,12 +164,12 @@ class LSsession {
*
* @retval boolean true si le chargement a réussi, false sinon.
*/
- function loadLSclass($class,$type='') {
+ public static function loadLSclass($class,$type='') {
if (class_exists($class))
return true;
if($type!='')
$type=$type.'.';
- return self::includeFile(LS_CLASS_DIR .'class.'.$type.$class.'.php');
+ return self :: includeFile(LS_CLASS_DIR .'class.'.$type.$class.'.php');
}
/**
@@ -161,17 +179,17 @@ class LSsession {
*
* @retval boolean true si le chargement a réussi, false sinon.
*/
- function loadLSobject($object) {
+ public static function loadLSobject($object) {
$error = 0;
- $this -> loadLSclass('LSldapObject');
- if (!$this -> loadLSclass($object,'LSobjects')) {
+ self :: loadLSclass('LSldapObject');
+ if (!self :: loadLSclass($object,'LSobjects')) {
$error = 1;
}
- if (!self::includeFile( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) {
+ if (!self :: includeFile( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) {
$error = 1;
}
if ($error) {
- LSerror::addErrorCode('LSsession_04',$object);
+ LSerror :: addErrorCode('LSsession_04',$object);
return;
}
return true;
@@ -186,11 +204,11 @@ class LSsession {
*
* @retval boolean true si le chargement a réussi, false sinon.
*/
- function loadLSaddon($addon) {
- if(self::includeFile(LS_ADDONS_DIR .'LSaddons.'.$addon.'.php')) {
- self::includeFile(LS_CONF_DIR."LSaddons/config.LSaddons.".$addon.".php");
+ public static function loadLSaddon($addon) {
+ 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')) {
- LSerror::addErrorCode('LSsession_02',$addon);
+ LSerror :: addErrorCode('LSsession_02',$addon);
return;
}
return true;
@@ -206,18 +224,32 @@ class LSsession {
*
* @retval boolean true si le chargement a réussi, false sinon.
*/
- function loadLSaddons() {
+ public static function loadLSaddons() {
if(!is_array($GLOBALS['LSaddons']['loads'])) {
- LSerror::addErrorCode('LSsession_01',"LSaddons['loads']");
+ LSerror :: addErrorCode('LSsession_01',"LSaddons['loads']");
return;
}
foreach ($GLOBALS['LSaddons']['loads'] as $addon) {
- $this -> loadLSaddon($addon);
+ self :: loadLSaddon($addon);
}
return true;
}
+/**
+ * Initialisation LdapSaisie
+ *
+ * @retval boolean True si l'initialisation à réussi, false sinon.
+ */
+ public static function initialize() {
+ if (!self :: loadConfig()) {
+ return;
+ }
+ self :: startLSerror();
+ self :: loadLSaddons();
+ return true;
+ }
+
/**
* Initialisation de la session LdapSaisie
*
@@ -229,301 +261,357 @@ class LSsession {
*
* @retval boolean True si l'initialisation à réussi (utilisateur authentifié), false sinon.
*/
- function startLSsession() {
- $this -> loadLSaddons();
- session_start();
+ public static function startLSsession() {
+ if (!self :: initialize()) {
+ return;
+ }
- // Déconnexion
- if (isset($_GET['LSsession_logout'])||isset($_GET['LSsession_recoverPassword'])) {
- session_destroy();
-
- if (is_array($_SESSION['LSsession']['tmp_file'])) {
- $this -> tmp_file = $_SESSION['LSsession']['tmp_file'];
- }
- $this -> deleteTmpFile();
- unset($_SESSION['LSsession']);
- }
+ session_start();
+
+ // Déconnexion
+ if (isset($_GET['LSsession_logout'])||isset($_GET['LSsession_recoverPassword'])) {
+ session_destroy();
- // Récupération de mot de passe
- if (isset($_GET['recoveryHash'])) {
- $_POST['LSsession_user'] = 'a determiner plus tard';
+ if (is_array($_SESSION['LSsession']['tmp_file'])) {
+ self :: $tmp_file = $_SESSION['LSsession']['tmp_file'];
}
+ self :: deleteTmpFile();
+ unset($_SESSION['LSsession']);
+ }
+
+ // Récupération de mot de passe
+ if (isset($_GET['recoveryHash'])) {
+ $_POST['LSsession_user'] = 'a determiner plus tard';
+ }
+
+ if(isset($_SESSION['LSsession'])) {
+ // Session existante
+ self :: $topDn = $_SESSION['LSsession']['topDn'];
+ self :: $dn = $_SESSION['LSsession']['dn'];
+ self :: $rdn = $_SESSION['LSsession']['rdn'];
+ self :: $ldapServerId = $_SESSION['LSsession']['ldapServerId'];
+ self :: $tmp_file = $_SESSION['LSsession']['tmp_file'];
- if(isset($_SESSION['LSsession'])) {
- // Session existante
- $this -> confDir = $_SESSION['LSsession']['confDir'];
- $this -> topDn = $_SESSION['LSsession']['topDn'];
- $this -> dn = $_SESSION['LSsession']['dn'];
- $this -> rdn = $_SESSION['LSsession']['rdn'];
- $this -> ldapServerId = $_SESSION['LSsession']['ldapServerId'];
- $this -> tmp_file = $_SESSION['LSsession']['tmp_file'];
-
- if ( $this -> cacheLSprofiles() && !isset($_REQUEST['LSsession_refresh']) ) {
- $this -> ldapServer = $_SESSION['LSsession']['ldapServer'];
- $this -> LSprofiles = $_SESSION['LSsession']['LSprofiles'];
- $this -> LSaccess = $_SESSION['LSsession']['LSaccess'];
- if (!$this -> LSldapConnect())
- return;
- }
- else {
- $this -> setLdapServer($this -> ldapServerId);
- if (!$this -> LSldapConnect())
- return;
- $this -> loadLSprofiles();
- }
-
- if ( $this -> cacheSudDn() && (!isset($_REQUEST['LSsession_refresh'])) ) {
- $this -> _subDnLdapServer = $_SESSION['LSsession_subDnLdapServer'];
- }
-
- if (!$this -> loadLSobject($this -> ldapServer['authObjectType'])) {
+ if ( self :: cacheLSprofiles() && !isset($_REQUEST['LSsession_refresh']) ) {
+ self :: setLdapServer(self :: $ldapServerId);
+ self :: $LSprofiles = $_SESSION['LSsession']['LSprofiles'];
+ self :: $LSaccess = $_SESSION['LSsession']['LSaccess'];
+ if (!self :: LSldapConnect())
return;
- }
-
- $this -> LSuserObject = new $this -> ldapServer['authObjectType']();
- $this -> LSuserObject -> loadData($this -> dn);
-
- if ( !$this -> cacheLSprofiles() || isset($_REQUEST['LSsession_refresh']) ) {
- $this -> loadLSaccess();
- }
-
- $GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getDisplayName());
-
- if ($_POST['LSsession_topDn']) {
- if ($this -> validSubDnLdapServer($_POST['LSsession_topDn'])) {
- $this -> topDn = $_POST['LSsession_topDn'];
- $_SESSION['LSsession']['topDn'] = $_POST['LSsession_topDn'];
- } // end if
- } // end if
-
- return true;
-
}
else {
- // Session inexistante
- $recoveryPasswordInfos=array();
+ self :: setLdapServer(self :: $ldapServerId);
+ if (!self :: LSldapConnect())
+ return;
+ self :: loadLSprofiles();
+ }
+
+ if ( self :: cacheSudDn() && (!isset($_REQUEST['LSsession_refresh'])) ) {
+ self :: $_subDnLdapServer = $_SESSION['LSsession_subDnLdapServer'];
+ }
+
+ if (!self :: loadLSobject(self :: $ldapServer['authObjectType'])) {
+ return;
+ }
+
+ self :: getLSuserObject();
+
+ if ( !self :: cacheLSprofiles() || isset($_REQUEST['LSsession_refresh']) ) {
+ self :: loadLSaccess();
+ }
+
+ $GLOBALS['Smarty'] -> assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
+
+ if ($_POST['LSsession_topDn']) {
+ if (self :: validSubDnLdapServer($_POST['LSsession_topDn'])) {
+ self :: $topDn = $_POST['LSsession_topDn'];
+ $_SESSION['LSsession']['topDn'] = $_POST['LSsession_topDn'];
+ } // end if
+ } // end if
+
+ return true;
+
+ }
+ else {
+ // Session inexistante
+ $recoveryPasswordInfos=array();
- if (isset($_POST['LSsession_user'])) {
- if (isset($_POST['LSsession_ldapserver'])) {
- $this -> setLdapServer($_POST['LSsession_ldapserver']);
+ if (isset($_POST['LSsession_user'])) {
+ if (isset($_POST['LSsession_ldapserver'])) {
+ self :: setLdapServer($_POST['LSsession_ldapserver']);
+ }
+ else {
+ self :: setLdapServer(0);
+ }
+
+ // Connexion au serveur LDAP
+ if (self :: LSldapConnect()) {
+
+ // topDn
+ if ( $_POST['LSsession_topDn'] != '' ){
+ self :: $topDn = $_POST['LSsession_topDn'];
}
else {
- $this -> setLdapServer(0);
+ self :: $topDn = self :: $ldapServer['ldap_config']['basedn'];
}
-
- // Connexion au serveur LDAP
- if ($this -> LSldapConnect()) {
+ $_SESSION['LSsession_topDn']=self :: $topDn;
- // topDn
- if ( $_POST['LSsession_topDn'] != '' ){
- $this -> topDn = $_POST['LSsession_topDn'];
+ if ( self :: loadLSobject(self :: $ldapServer['authObjectType']) ) {
+ $authobject = new self :: $ldapServer['authObjectType']();
+ $find=true;
+ if (isset($_GET['recoveryHash'])) {
+ $filter=self :: $ldapServer['recoverPassword']['recoveryHashAttr']."=".$_GET['recoveryHash'];
+ $result = $authobject -> listObjects($filter,self :: $topDn);
+ $nbresult=count($result);
+ if ($nbresult==1) {
+ $rdn = $result[0] -> getValue('rdn');
+ $rdn = $rdn[0];
+ $_POST['LSsession_user'] = $rdn;
+ $find=false;
+ }
+ }
+ if ($find) {
+ $result = $authobject -> searchObject($_POST['LSsession_user'],self :: $topDn);
+ $nbresult=count($result);
+ }
+ if ($nbresult==0) {
+ // identifiant incorrect
+ LSdebug('identifiant incorrect');
+ LSerror :: addErrorCode('LSsession_06');
+ }
+ else if ($nbresult>1) {
+ // duplication d'authentité
+ LSerror :: addErrorCode('LSsession_07');
}
else {
- $this -> topDn = $this -> ldapServer['ldap_config']['basedn'];
- }
- $_SESSION['LSsession_topDn']=$this -> topDn;
+ if (isset($_GET['LSsession_recoverPassword'])) {
+ LSdebug('Recover : Id trouvé');
+ if (self :: $ldapServer['recoverPassword']) {
+ if (self :: loadLSaddon('mail')) {
+ LSdebug('Récupération active');
+ $user=$result[0];
+ $emailAddress = $user -> getValue(self :: $ldapServer['recoverPassword']['mailAttr']);
+ $emailAddress = $emailAddress[0];
+
+ // Header des mails
+ $sendParams=array();
+ if (self :: $ldapServer['recoverPassword']['recoveryEmailSender']) {
+ $sendParams['From']=self :: $ldapServer['recoverPassword']['recoveryEmailSender'];
+ }
+
+ if (checkEmail($emailAddress)) {
+ LSdebug('Email : '.$emailAddress);
+ self :: $dn = $user -> getDn();
+ // 1ère étape : envoie du recoveryHash
+ if (!isset($_GET['recoveryHash'])) {
+ // Generer un hash
+ $rdn=$user -> getValue('rdn');
+ $rdn = $rdn[0];
+ $recovery_hash = md5($rdn . strval(time()) . strval(rand()));
+
+ $lostPasswdForm = $user -> getForm('lostPassword');
+ $lostPasswdForm -> setPostData(
+ array(
+ self :: $ldapServer['recoverPassword']['recoveryHashAttr'] => $recovery_hash
+ )
+ ,true
+ );
+
+ if($lostPasswdForm -> validate()) {
+ if ($user -> updateData('lostPassword')) {
+ // recoveryHash de l'utilisateur mis à jour
+ if ($_SERVER['HTTPS']=='on') {
+ $recovery_url='https://';
+ }
+ else {
+ $recovery_url='http://';
+ }
+ $recovery_url .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'&recoveryHash='.$recovery_hash;
- if ( $this -> loadLSobject($this -> ldapServer['authObjectType']) ) {
- $authobject = new $this -> ldapServer['authObjectType']();
- $find=true;
- if (isset($_GET['recoveryHash'])) {
- $filter=$this -> ldapServer['recoverPassword']['recoveryHashAttr']."=".$_GET['recoveryHash'];
- $result = $authobject -> listObjects($filter,$this -> topDn);
- $nbresult=count($result);
- if ($nbresult==1) {
- $rdn = $result[0] -> getValue('rdn');
- $rdn = $rdn[0];
- $_POST['LSsession_user'] = $rdn;
- $find=false;
- }
- }
- if ($find) {
- $result = $authobject -> searchObject($_POST['LSsession_user'],$this -> topDn);
- $nbresult=count($result);
- }
- if ($nbresult==0) {
- // identifiant incorrect
- LSdebug('identifiant incorrect');
- LSerror::addErrorCode('LSsession_06');
- }
- else if ($nbresult>1) {
- // duplication d'authentité
- LSerror::addErrorCode('LSsession_07');
- }
- else {
- if (isset($_GET['LSsession_recoverPassword'])) {
- LSdebug('Recover : Id trouvé');
- if ($this -> ldapServer['recoverPassword']) {
- if ($this -> loadLSaddon('mail')) {
- LSdebug('Récupération active');
- $user=$result[0];
- $emailAddress = $user -> getValue($this -> ldapServer['recoverPassword']['mailAttr']);
- $emailAddress = $emailAddress[0];
-
- // Header des mails
- $sendParams=array();
- if ($this -> ldapServer['recoverPassword']['recoveryEmailSender']) {
- $sendParams['From']=$this -> ldapServer['recoverPassword']['recoveryEmailSender'];
+ if (
+ sendMail(
+ $emailAddress,
+ self :: $ldapServer['recoverPassword']['recoveryHashMail']['subject'],
+ getFData(self :: $ldapServer['recoverPassword']['recoveryHashMail']['msg'],$recovery_url),
+ $sendParams
+ )
+ ){
+ // Mail a bien été envoyé
+ $recoveryPasswordInfos['recoveryHashMail']=$emailAddress;
+ }
+ else {
+ // Problème durant l'envoie du mail
+ LSdebug("Problème durant l'envoie du mail");
+ LSerror :: addErrorCode('LSsession_20',7);
+ }
+ }
+ else {
+ // Erreur durant la mise à jour de l'objet
+ LSdebug("Erreur durant la mise à jour de l'objet");
+ 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");
+ LSerror :: addErrorCode('LSsession_20',5);
+ }
}
-
- if (checkEmail($emailAddress)) {
- LSdebug('Email : '.$emailAddress);
- $this -> dn = $user -> getDn();
- // 1ère étape : envoie du recoveryHash
- if (!isset($_GET['recoveryHash'])) {
- // Generer un hash
- $rdn=$user -> getValue('rdn');
- $rdn = $rdn[0];
- $recovery_hash = md5($rdn . strval(time()) . strval(rand()));
-
+ // 2nd étape : génération du mot de passe + envoie par mail
+ else {
+ $attr=$user -> attrs[self :: $ldapServer['authObjectTypeAttrPwd']];
+ if ($attr instanceof LSattribute) {
+ $mdp = generatePassword($attr -> config['html_options']['chars'],$attr -> config['html_options']['lenght']);
+ LSdebug('Nvx mpd : '.$mdp);
$lostPasswdForm = $user -> getForm('lostPassword');
$lostPasswdForm -> setPostData(
array(
- $this -> ldapServer['recoverPassword']['recoveryHashAttr'] => $recovery_hash
+ self :: $ldapServer['recoverPassword']['recoveryHashAttr'] => array(''),
+ self :: $ldapServer['authObjectTypeAttrPwd'] => array($mdp)
)
,true
);
-
if($lostPasswdForm -> validate()) {
if ($user -> updateData('lostPassword')) {
- // recoveryHash de l'utilisateur mis à jour
- if ($_SERVER['HTTPS']=='on') {
- $recovery_url='https://';
- }
- else {
- $recovery_url='http://';
- }
- $recovery_url .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'&recoveryHash='.$recovery_hash;
-
if (
sendMail(
$emailAddress,
- $this -> ldapServer['recoverPassword']['recoveryHashMail']['subject'],
- getFData($this -> ldapServer['recoverPassword']['recoveryHashMail']['msg'],$recovery_url),
+ self :: $ldapServer['recoverPassword']['newPasswordMail']['subject'],
+ getFData(self :: $ldapServer['recoverPassword']['newPasswordMail']['msg'],$mdp),
$sendParams
)
){
// Mail a bien été envoyé
- $recoveryPasswordInfos['recoveryHashMail']=$emailAddress;
+ $recoveryPasswordInfos['newPasswordMail']=$emailAddress;
}
else {
// Problème durant l'envoie du mail
LSdebug("Problème durant l'envoie du mail");
- LSerror::addErrorCode('LSsession_20',7);
+ LSerror :: addErrorCode('LSsession_20',4);
}
}
else {
// Erreur durant la mise à jour de l'objet
LSdebug("Erreur durant la mise à jour de l'objet");
- LSerror::addErrorCode('LSsession_20',6);
+ 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");
- LSerror::addErrorCode('LSsession_20',5);
+ LSerror :: addErrorCode('LSsession_20',2);
}
}
- // 2nd étape : génération du mot de passe + envoie par mail
else {
- $attr=$user -> attrs[$this -> ldapServer['authObjectTypeAttrPwd']];
- if ($attr instanceof LSattribute) {
- $mdp = generatePassword($attr -> config['html_options']['chars'],$attr -> config['html_options']['lenght']);
- LSdebug('Nvx mpd : '.$mdp);
- $lostPasswdForm = $user -> getForm('lostPassword');
- $lostPasswdForm -> setPostData(
- array(
- $this -> ldapServer['recoverPassword']['recoveryHashAttr'] => array(''),
- $this -> ldapServer['authObjectTypeAttrPwd'] => array($mdp)
- )
- ,true
- );
- if($lostPasswdForm -> validate()) {
- if ($user -> updateData('lostPassword')) {
- if (
- sendMail(
- $emailAddress,
- $this -> ldapServer['recoverPassword']['newPasswordMail']['subject'],
- getFData($this -> ldapServer['recoverPassword']['newPasswordMail']['msg'],$mdp),
- $sendParams
- )
- ){
- // Mail a bien été envoyé
- $recoveryPasswordInfos['newPasswordMail']=$emailAddress;
- }
- else {
- // Problème durant l'envoie du mail
- LSdebug("Problème durant l'envoie du mail");
- LSerror::addErrorCode('LSsession_20',4);
- }
- }
- else {
- // Erreur durant la mise à jour de l'objet
- LSdebug("Erreur durant la mise à jour de l'objet");
- 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");
- LSerror::addErrorCode('LSsession_20',2);
- }
- }
- else {
- // l'attribut password n'existe pas
- LSdebug("L'attribut password n'existe pas");
- LSerror::addErrorCode('LSsession_20',1);
- }
+ // l'attribut password n'existe pas
+ LSdebug("L'attribut password n'existe pas");
+ LSerror :: addErrorCode('LSsession_20',1);
}
}
- else {
- LSerror::addErrorCode('LSsession_19');
- }
}
- }
- else {
- LSerror::addErrorCode('LSsession_18');
+ else {
+ LSerror :: addErrorCode('LSsession_19');
+ }
}
}
else {
- if ( $this -> checkUserPwd($result[0],$_POST['LSsession_pwd']) ) {
- // Authentification réussi
- $this -> LSuserObject = $result[0];
- $this -> dn = $result[0]->getValue('dn');
- $this -> rdn = $_POST['LSsession_user'];
- $this -> loadLSprofiles();
- $this -> loadLSaccess();
- $GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getDisplayName());
- $_SESSION['LSsession']=get_object_vars($this);
- return true;
- }
- else {
- LSerror::addErrorCode('LSsession_06');
- LSdebug('mdp incorrect');
- }
+ LSerror :: addErrorCode('LSsession_18');
+ }
+ }
+ else {
+ if ( self :: checkUserPwd($result[0],$_POST['LSsession_pwd']) ) {
+ // Authentification réussi
+ self :: $LSuserObject = $result[0];
+ self :: $dn = $result[0]->getValue('dn');
+ self :: $rdn = $_POST['LSsession_user'];
+ self :: loadLSprofiles();
+ self :: loadLSaccess();
+ $GLOBALS['Smarty'] -> assign('LSsession_username',self :: getLSuserObject() -> getDisplayName());
+ $_SESSION['LSsession']=self :: getContextInfos();
+ return true;
+ }
+ else {
+ LSerror :: addErrorCode('LSsession_06');
+ LSdebug('mdp incorrect');
}
}
}
- else {
- LSerror::addErrorCode('LSsession_10');
- }
}
else {
- LSerror::addErrorCode('LSsession_09');
+ LSerror :: addErrorCode('LSsession_10');
}
}
- if ($this -> ldapServerId) {
- $GLOBALS['Smarty'] -> assign('ldapServerId',$this -> ldapServerId);
- }
- $GLOBALS['Smarty'] -> assign('topDn',$this -> topDn);
- if (isset($_GET['LSsession_recoverPassword'])) {
- $this -> displayRecoverPasswordForm($recoveryPasswordInfos);
- }
else {
- $this -> displayLoginForm();
+ LSerror :: addErrorCode('LSsession_09');
}
+ }
+ if (self :: $ldapServerId) {
+ $GLOBALS['Smarty'] -> assign('ldapServerId',self :: $ldapServerId);
+ }
+ $GLOBALS['Smarty'] -> assign('topDn',self :: $topDn);
+ if (isset($_GET['LSsession_recoverPassword'])) {
+ self :: displayRecoverPasswordForm($recoveryPasswordInfos);
+ }
+ else {
+ self :: displayLoginForm();
+ }
+ return;
+ }
+ }
+
+ /**
+ * Retourne les informations du contexte
+ *
+ * @author Benjamin Renard self :: $tmp_file,
+ 'topDn' => self :: $topDn,
+ 'dn' => self :: $dn,
+ 'rdn' => self :: $rdn,
+ 'ldapServerId' => self :: $ldapServerId,
+ 'ldapServer' => self :: $ldapServer,
+ 'LSprofiles' => self :: $LSprofiles,
+ 'LSaccess' => self :: $LSaccess
+ );
+ }
+
+ /**
+ * Retourne l'objet de l'utilisateur connecté
+ *
+ * @author Benjamin Renard loadData(self :: $dn);
+ }
+ else {
return;
}
+ }
+ return self :: $LSuserObject;
+ }
+
+ /**
+ * Retourne le DN de l'utilisateur connecté
+ *
+ * @author Benjamin Renard ldapServer['authObjectType']
+ * self :: $ldapServer['authObjectType']
*
* @retval boolean True en cas de succès, false sinon
*/
- function changeAuthUser($object) {
- if ($object instanceof $this -> ldapServer['authObjectType']) {
- $this -> dn = $object -> getDn();
+ public static function changeAuthUser($object) {
+ if ($object instanceof self :: $ldapServer['authObjectType']) {
+ self :: $dn = $object -> getDn();
$rdn = $object -> getValue('rdn');
if(is_array($rdn)) {
$rdn = $rdn[0];
}
- $this -> rdn = $rdn;
- $this -> LSuserObject = $object;
+ self :: $rdn = $rdn;
+ self :: $LSuserObject = $object;
- if($this -> loadLSprofiles()) {
- $this -> loadLSaccess();
- $_SESSION['LSsession']=get_object_vars($this);
+ if(self :: loadLSprofiles()) {
+ self :: loadLSaccess();
+ $_SESSION['LSsession']=self :: getContextInfos();
return true;
}
}
@@ -564,10 +652,10 @@ class LSsession {
*
* @retval boolean True sinon false.
*/
- function setLdapServer($id) {
+ public static function setLdapServer($id) {
if ( isset($GLOBALS['LSconfig']['ldap_servers'][$id]) ) {
- $this -> ldapServerId = $id;
- $this -> ldapServer=$GLOBALS['LSconfig']['ldap_servers'][$id];
+ self :: $ldapServerId = $id;
+ self :: $ldapServer=$GLOBALS['LSconfig']['ldap_servers'][$id];
return true;
}
else {
@@ -580,13 +668,13 @@ class LSsession {
*
* @retval boolean True sinon false.
*/
- function LSldapConnect() {
- if ($this -> ldapServer) {
- self::includeFile($GLOBALS['LSconfig']['NetLDAP2']);
- if (!$this -> loadLSclass('LSldap')) {
+ public static function LSldapConnect() {
+ if (self :: $ldapServer) {
+ self :: includeFile($GLOBALS['LSconfig']['NetLDAP2']);
+ if (!self :: loadLSclass('LSldap')) {
return;
}
- $GLOBALS['LSldap'] = @new LSldap($this -> ldapServer['ldap_config']);
+ $GLOBALS['LSldap'] = @new LSldap(self :: $ldapServer['ldap_config']);
if ($GLOBALS['LSldap'] -> isConnected()) {
return true;
}
@@ -595,7 +683,7 @@ class LSsession {
}
}
else {
- LSerror::addErrorCode('LSsession_03');
+ LSerror :: addErrorCode('LSsession_03');
return;
}
}
@@ -605,18 +693,18 @@ class LSsession {
*
* @retval mixed Tableau des subDn, false si une erreur est survenue.
*/
- function getSubDnLdapServer() {
- if ($this -> cacheSudDn() && isset($this -> _subDnLdapServer[$this -> ldapServerId])) {
- return $this -> _subDnLdapServer[$this -> ldapServerId];
+ public static function getSubDnLdapServer() {
+ if (self :: cacheSudDn() && isset(self :: $_subDnLdapServer[self :: $ldapServerId])) {
+ return self :: $_subDnLdapServer[self :: $ldapServerId];
}
- if (!isset($this ->ldapServer['subDn'])) {
+ if (!isset(self :: $ldapServer['subDn'])) {
return;
}
- if ( !is_array($this ->ldapServer['subDn']) ) {
+ if ( !is_array(self :: $ldapServer['subDn']) ) {
return;
}
$return=array();
- foreach($this ->ldapServer['subDn'] as $subDn_name => $subDn_config) {
+ foreach(self :: $ldapServer['subDn'] as $subDn_name => $subDn_config) {
if ($subDn_name == 'LSobject') {
if (is_array($subDn_config)) {
foreach($subDn_config as $LSobject_name => $LSoject_config) {
@@ -632,35 +720,35 @@ class LSsession {
else {
$displayName = NULL;
}
- if( $this -> loadLSobject($LSobject_name) ) {
+ if( self :: loadLSobject($LSobject_name) ) {
if ($subdnobject = new $LSobject_name()) {
$tbl_return = $subdnobject -> getSelectArray(NULL,$basedn,$displayName);
if (is_array($tbl_return)) {
$return=array_merge($return,$tbl_return);
}
else {
- LSerror::addErrorCode('LSsession_17',3);
+ LSerror :: addErrorCode('LSsession_17',3);
}
}
else {
- LSerror::addErrorCode('LSsession_17',2);
+ LSerror :: addErrorCode('LSsession_17',2);
}
}
}
}
else {
- LSerror::addErrorCode('LSsession_17',1);
+ LSerror :: addErrorCode('LSsession_17',1);
}
}
else {
- if ((isCompatibleDNs($subDn_config['dn'],$this -> ldapServer['ldap_config']['basedn']))&&($subDn_config['dn']!="")) {
+ if ((isCompatibleDNs($subDn_config['dn'],self :: $ldapServer['ldap_config']['basedn']))&&($subDn_config['dn']!="")) {
$return[$subDn_config['dn']] = $subDn_name;
}
}
}
- if ($this -> cacheSudDn()) {
- $this -> _subDnLdapServer[$this -> ldapServerId]=$return;
- $_SESSION['LSsession_subDnLdapServer'] = $this -> _subDnLdapServer;
+ if (self :: cacheSudDn()) {
+ self :: $_subDnLdapServer[self :: $ldapServerId]=$return;
+ $_SESSION['LSsession_subDnLdapServer'] = self :: $_subDnLdapServer;
}
return $return;
}
@@ -671,8 +759,8 @@ class LSsession {
*
* @return array() Tableau des subDn trié
*/
- function getSortSubDnLdapServer() {
- $subDnLdapServer = $this -> getSubDnLdapServer();
+ public static function getSortSubDnLdapServer() {
+ $subDnLdapServer = self :: getSubDnLdapServer();
if (!$subDnLdapServer) {
return array();
}
@@ -684,12 +772,12 @@ class LSsession {
* Retourne les options d'une liste déroulante pour le choix du topDn
* de connexion au serveur Ldap
*
- * Liste les subdn ($this ->ldapServer['subDn'])
+ * Liste les subdn (self :: $ldapServer['subDn'])
*
* @retval string Les options (