- LSsession : Tranformation de la classe pour la rendre "statique".

-> Tout les appels on été revus.
This commit is contained in:
Benjamin Renard 2009-01-24 17:45:14 +00:00
parent 6a7a135d3c
commit 03c375d827
55 changed files with 992 additions and 898 deletions

View file

@ -22,9 +22,7 @@
require_once 'includes/class/class.LSsession.php'; require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession(); if(LSsession :: startLSsession()) {
if($LSsession -> startLSsession()) {
if (isset($_POST['LSform_objecttype'])) { if (isset($_POST['LSform_objecttype'])) {
$LSobject = $_POST['LSform_objecttype']; $LSobject = $_POST['LSform_objecttype'];
@ -35,8 +33,8 @@ if($LSsession -> startLSsession()) {
if (isset($LSobject)) { if (isset($LSobject)) {
// Création d'un LSobject // Création d'un LSobject
if ($GLOBALS['LSsession'] -> loadLSobject($LSobject)) { if (LSsession ::loadLSobject($LSobject)) {
if ( $GLOBALS['LSsession'] -> canCreate($LSobject) ) { if ( LSsession :: canCreate($LSobject) ) {
$object = new $LSobject(); $object = new $LSobject();
if ($_GET['load']!='') { if ($_GET['load']!='') {
@ -49,10 +47,10 @@ if($LSsession -> startLSsession()) {
// MàJ des données de l'objet LDAP // MàJ des données de l'objet LDAP
if ($object -> updateData('create')) { if ($object -> updateData('create')) {
if (!LSerror::errorsDefined()) { if (!LSerror::errorsDefined()) {
$GLOBALS['LSsession'] -> addInfo(_("L'objet a bien été ajouté.")); LSsession :: addInfo(_("L'objet a bien été ajouté."));
} }
if (isset($_REQUEST['ajax'])) { if (isset($_REQUEST['ajax'])) {
$GLOBALS['LSsession'] -> displayAjaxReturn ( LSsession :: displayAjaxReturn (
array( array(
'LSredirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn() 'LSredirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()
) )
@ -61,12 +59,12 @@ if($LSsession -> startLSsession()) {
} }
else { else {
if (!LSdebugDefined()) { if (!LSdebugDefined()) {
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()); LSsession :: redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn());
} }
} }
} }
else { else {
$GLOBALS['LSsession'] -> displayAjaxReturn ( LSsession :: displayAjaxReturn (
array( array(
'LSformErrors' => $form -> getErrors() 'LSformErrors' => $form -> getErrors()
) )
@ -75,7 +73,7 @@ if($LSsession -> startLSsession()) {
} }
} }
else if (isset($_REQUEST['ajax']) && $form -> definedError()) { else if (isset($_REQUEST['ajax']) && $form -> definedError()) {
$GLOBALS['LSsession'] -> displayAjaxReturn ( LSsession :: displayAjaxReturn (
array( array(
'LSformErrors' => $form -> getErrors() 'LSformErrors' => $form -> getErrors()
) )
@ -84,25 +82,25 @@ if($LSsession -> startLSsession()) {
} }
// Définition du Titre de la page // Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Nouveau').' : '.$object -> getLabel()); $GLOBALS['Smarty'] -> assign('pagetitle',_('Nouveau').' : '.$object -> getLabel());
$GLOBALS['LSsession'] -> setTemplate('create.tpl'); LSsession :: setTemplate('create.tpl');
$form -> display(); $form -> display();
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
else { else {
LSerror::addErrorCode('LSldapObject_01'); LSerror :: addErrorCode('LSldapObject_01');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('login.tpl'); LSsession :: setTemplate('login.tpl');
} }
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
?> ?>

View file

@ -74,10 +74,10 @@ $GLOBALS['LSerror_code']['FTP_05']= array (
// Dependance de librairie // Dependance de librairie
if (!class_exists('Net_FTP')) { if (!class_exists('Net_FTP')) {
if (!defined('NET_FTP')) { if (!defined('NET_FTP')) {
LSerror::addErrorCode('FTP_SUPPORT_02','NET_FTP'); LSerror :: addErrorCode('FTP_SUPPORT_02','NET_FTP');
$retval=false; $retval=false;
} else if(!LSsession::includeFile(NET_FTP)) { } else if(!LSsession::includeFile(NET_FTP)) {
LSerror::addErrorCode('FTP_SUPPORT_01'); LSerror :: addErrorCode('FTP_SUPPORT_01');
$retval=false; $retval=false;
} }
} }
@ -108,14 +108,14 @@ $GLOBALS['LSerror_code']['FTP_05']= array (
return $cnx; return $cnx;
} }
else { else {
LSerror::addErrorCode('FTP_01',"2"); LSerror :: addErrorCode('FTP_01',"2");
LSerror::addErrorCode('FTP_00',$do -> getMessage()); LSerror :: addErrorCode('FTP_00',$do -> getMessage());
return; return;
} }
} }
else { else {
LSerror::addErrorCode('FTP_01',"1"); LSerror :: addErrorCode('FTP_01',"1");
LSerror::addErrorCode('FTP_00',$do -> getMessage()); LSerror :: addErrorCode('FTP_00',$do -> getMessage());
return; return;
} }
} }
@ -144,15 +144,15 @@ $GLOBALS['LSerror_code']['FTP_05']= array (
foreach($dirs as $dir) { foreach($dirs as $dir) {
$do = $cnx -> mkdir($dir,true); $do = $cnx -> mkdir($dir,true);
if ($do instanceof PEAR_Error) { if ($do instanceof PEAR_Error) {
LSerror::addErrorCode('FTP_02',$dir); LSerror :: addErrorCode('FTP_02',$dir);
LSerror::addErrorCode('FTP_00',$do -> getMessage()); LSerror :: addErrorCode('FTP_00',$do -> getMessage());
return; return;
} }
if ($chmod) { if ($chmod) {
$do = $cnx -> chmod($dir,$chmod); $do = $cnx -> chmod($dir,$chmod);
if ($do instanceof PEAR_Error) { if ($do instanceof PEAR_Error) {
LSerror::addErrorCode('FTP_04',$dir); LSerror :: addErrorCode('FTP_04',$dir);
LSerror::addErrorCode('FTP_00',$do -> getMessage()); LSerror :: addErrorCode('FTP_00',$do -> getMessage());
} }
} }
} }
@ -194,8 +194,8 @@ $GLOBALS['LSerror_code']['FTP_05']= array (
} }
$do = $cnx -> rm($dir,true); $do = $cnx -> rm($dir,true);
if ($do instanceof PEAR_Error) { if ($do instanceof PEAR_Error) {
LSerror::addErrorCode('FTP_03',$dir); LSerror :: addErrorCode('FTP_03',$dir);
LSerror::addErrorCode('FTP_00',$do -> getMessage()); LSerror :: addErrorCode('FTP_00',$do -> getMessage());
return; return;
} }
} }
@ -223,8 +223,8 @@ $GLOBALS['LSerror_code']['FTP_05']= array (
} }
$do = $cnx -> rename($old,$new); $do = $cnx -> rename($old,$new);
if ($do instanceof PEAR_Error) { if ($do instanceof PEAR_Error) {
LSerror::addErrorCode('FTP_05',array('old' => $old,'new' => $new)); LSerror :: addErrorCode('FTP_05',array('old' => $old,'new' => $new));
LSerror::addErrorCode('FTP_00',$do -> getMessage()); LSerror :: addErrorCode('FTP_00',$do -> getMessage());
return; return;
} }
return true; return true;

View file

@ -52,7 +52,7 @@ $GLOBALS['LSerror_code']['MAIL_01']= array (
// Dependance de librairie // Dependance de librairie
if (!class_exists('Mail')) { if (!class_exists('Mail')) {
if(!LSsession::includeFile(PEAR_MAIL)) { if(!LSsession::includeFile(PEAR_MAIL)) {
LSerror::addErrorCode('MAIL_SUPPORT_01'); LSerror :: addErrorCode('MAIL_SUPPORT_01');
$retval=false; $retval=false;
} }
} }
@ -76,21 +76,18 @@ $GLOBALS['LSerror_code']['MAIL_01']= array (
if ($subject) { if ($subject) {
$headers["Subject"] = $subject; $headers["Subject"] = $subject;
} }
if (!isset($headers['From']) && ($GLOBALS['LSsession'] -> getEmailSender() != "")) { if (!isset($headers['From']) && (LSsession :: getEmailSender() != "")) {
$headers['From'] = $GLOBALS['LSsession'] -> getEmailSender(); $headers['From'] = LSsession :: getEmailSender();
} }
$headers["To"] = $to; $headers["To"] = $to;
$ret = $mail_obj -> send($to,$headers,$msg); $ret = $mail_obj -> send($to,$headers,$msg);
if ($ret instanceof PEAR_Error) { if ($ret instanceof PEAR_Error) {
LSerror::addErrorCode('MAIL_01'); LSerror :: addErrorCode('MAIL_01');
LSerror::addErrorCode('MAIL_00',$ret -> getMessage()); LSerror :: addErrorCode('MAIL_00',$ret -> getMessage());
return; return;
} }
return true; return true;
} }
?>

View file

@ -56,8 +56,8 @@ $retval=true;
// Dependance de librairie // Dependance de librairie
if (!function_exists('createDirsByFTP')) { if (!function_exists('createDirsByFTP')) {
if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) { if(!LSsession :: loadLSaddon('ftp')) {
LSerror::addErrorCode('MAILDIR_SUPPORT_01'); LSerror :: addErrorCode('MAILDIR_SUPPORT_01');
$retval=false; $retval=false;
} }
} }
@ -71,7 +71,7 @@ $retval=true;
foreach($MUST_DEFINE_CONST as $const) { foreach($MUST_DEFINE_CONST as $const) {
if ( (!defined($const)) || (constant($const) == "")) { if ( (!defined($const)) || (constant($const) == "")) {
LSerror::addErrorCode('MAILDIR_SUPPORT_02',$const); LSerror :: addErrorCode('MAILDIR_SUPPORT_02',$const);
$retval=false; $retval=false;
} }
} }
@ -102,7 +102,7 @@ $retval=true;
$dir.'/tmp' $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)) { 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;
} }
return true; 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)) { 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;
} }
return true; return true;
@ -155,7 +155,7 @@ $retval=true;
} }
if ($dir=="") { if ($dir=="") {
LSerror::addErrorCode('MAILDIR_04'); LSerror :: addErrorCode('MAILDIR_04');
return; return;
} }
@ -174,7 +174,7 @@ $retval=true;
*/ */
function renameMaildirByFTP($old,$new) { function renameMaildirByFTP($old,$new) {
if (!renameDirByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$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;
} }
return true; return true;

View file

@ -52,8 +52,8 @@ $GLOBALS['LSerror_code']['POSIX_01']= array (
// Dependance de librairie // Dependance de librairie
if (!function_exists('createDirsByFTP')) { if (!function_exists('createDirsByFTP')) {
if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) { if(!LSsession :: loadLSaddon('ftp')) {
LSerror::addErrorCode('POSIX_SUPPORT_02'); LSerror :: addErrorCode('POSIX_SUPPORT_02');
$retval=false; $retval=false;
} }
} }
@ -74,7 +74,7 @@ $GLOBALS['LSerror_code']['POSIX_01']= array (
foreach($MUST_DEFINE_CONST as $const) { foreach($MUST_DEFINE_CONST as $const) {
if ( (!defined($const)) || (constant($const) == "")) { if ( (!defined($const)) || (constant($const) == "")) {
LSerror::addErrorCode('POSIX_SUPPORT_O1',$const); LSerror :: addErrorCode('POSIX_SUPPORT_O1',$const);
$retval=false; $retval=false;
} }
} }
@ -147,7 +147,7 @@ $GLOBALS['LSerror_code']['POSIX_01']= array (
*/ */
function generate_homeDirectory($ldapObject) { function generate_homeDirectory($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_POSIX_UID_ATTR ]) != 'LSattribute' ) { 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; return;
} }
@ -169,7 +169,7 @@ $GLOBALS['LSerror_code']['POSIX_01']= array (
function createHomeDirectoryByFTP($ldapObject) { function createHomeDirectoryByFTP($ldapObject) {
$dir = getFData(LS_POSIX_HOMEDIRECTORY_FTP_PATH,$ldapObject,'getValue'); $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)) { 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;
} }
return true; return true;

View file

@ -57,7 +57,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
// Dependance de librairie // Dependance de librairie
if ( !class_exists('smbHash') ) { if ( !class_exists('smbHash') ) {
if ( !LSsession::includeFile(LS_LIB_DIR . 'class.smbHash.php') ) { if ( !LSsession::includeFile(LS_LIB_DIR . 'class.smbHash.php') ) {
LSerror::addErrorCode('SAMBA_SUPPORT_01'); LSerror :: addErrorCode('SAMBA_SUPPORT_01');
$retval=false; $retval=false;
} }
} }
@ -74,14 +74,14 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
foreach($MUST_DEFINE_CONST as $const) { foreach($MUST_DEFINE_CONST as $const) {
if ( (!defined($const)) || (constant($const) == "")) { if ( (!defined($const)) || (constant($const) == "")) {
LSerror::addErrorCode('SAMBA_SUPPORT_02',$const); LSerror :: addErrorCode('SAMBA_SUPPORT_02',$const);
$retval=false; $retval=false;
} }
} }
// Pour l'intégrité des SID // Pour l'intégrité des SID
if ( (LS_SAMBA_SID_BASE_USER % 2) == (LS_SAMBA_SID_BASE_GROUP % 2) ) { 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; $retval=false;
} }
@ -102,7 +102,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
*/ */
function generate_sambaUserSID($ldapObject) { function generate_sambaUserSID($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_SAMBA_UIDNUMBER_ATTR ]) != 'LSattribute' ) { 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; return;
} }
@ -128,7 +128,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
*/ */
function generate_sambaGroupSID($ldapObject) { function generate_sambaGroupSID($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_SAMBA_GIDNUMBER_ATTR ]) != 'LSattribute' ) { 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; return;
} }
@ -154,7 +154,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
*/ */
function generate_sambaPrimaryGroupSID($ldapObject) { function generate_sambaPrimaryGroupSID($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_SAMBA_GIDNUMBER_ATTR ]) != 'LSattribute' ) { 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; return;
} }
@ -176,7 +176,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
*/ */
function generate_sambaNTPassword($ldapObject) { function generate_sambaNTPassword($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_SAMBA_USERPASSWORD_ATTR ]) != 'LSattribute' ) { 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; return;
} }
@ -201,7 +201,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
*/ */
function generate_sambaLMPassword($ldapObject) { function generate_sambaLMPassword($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_SAMBA_USERPASSWORD_ATTR ]) != 'LSattribute' ) { 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; return;
} }

View file

@ -51,7 +51,7 @@ $GLOBALS['LSerror_code']['SUPANN_01']= array (
foreach($MUST_DEFINE_CONST as $const) { foreach($MUST_DEFINE_CONST as $const) {
if ( (!defined($const)) || (constant($const) == "")) { if ( (!defined($const)) || (constant($const) == "")) {
LSerror::addErrorCode('SUPANN_SUPPORT_01',$const); LSerror :: addErrorCode('SUPANN_SUPPORT_01',$const);
$retval=false; $retval=false;
} }
} }
@ -70,11 +70,11 @@ $GLOBALS['LSerror_code']['SUPANN_01']= array (
*/ */
function generate_displayName($ldapObject) { function generate_displayName($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ]) != 'LSattribute' ) { 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; return;
} }
if ( get_class($ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ]) != 'LSattribute' ) { 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; return;
} }
@ -95,11 +95,11 @@ $GLOBALS['LSerror_code']['SUPANN_01']= array (
*/ */
function generate_cn($ldapObject) { function generate_cn($ldapObject) {
if ( get_class($ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ]) != 'LSattribute' ) { 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; return;
} }
if ( get_class($ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ]) != 'LSattribute' ) { 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; return;
} }

View file

@ -80,12 +80,12 @@ class LSattr_html {
*/ */
function addToForm (&$form,$idForm,$data=NULL) { function addToForm (&$form,$idForm,$data=NULL) {
if (!$this -> LSformElement_type) { if (!$this -> LSformElement_type) {
LSerror::addErrorCode('LSattr_html_01',$this -> name); LSerror :: addErrorCode('LSattr_html_01',$this -> name);
return; return;
} }
$element=$form -> addElement($this -> LSformElement_type, $this -> name, $this -> config['label'],$this -> config, $this); $element=$form -> addElement($this -> LSformElement_type, $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) { if(!$element) {
LSerror::addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
return; return;
} }
if ($data) { if ($data) {

View file

@ -39,12 +39,12 @@ class LSattr_html_image extends LSattr_html {
function addToForm (&$form,$idForm,$data=NULL) { function addToForm (&$form,$idForm,$data=NULL) {
$element=$form -> addElement('image', $this -> name, $this -> config['label'],$this -> config, $this); $element=$form -> addElement('image', $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) { if(!$element) {
LSerror::addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
return; return;
} }
if (count($data)>1) { if (count($data)>1) {
LSerror::addErrorCode('LSattr_html_03','password'); LSerror :: addErrorCode('LSattr_html_03','password');
} }
if ($data) { if ($data) {

View file

@ -39,12 +39,12 @@ class LSattr_html_password extends LSattr_html {
function addToForm (&$form,$idForm,$data=NULL) { function addToForm (&$form,$idForm,$data=NULL) {
$element=$form -> addElement('password', $this -> name, $this -> config['label'], $this -> config, $this); $element=$form -> addElement('password', $this -> name, $this -> config['label'], $this -> config, $this);
if(!$element) { if(!$element) {
LSerror::addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
return; return;
} }
if (count($data)>1) { if (count($data)>1) {
LSerror::addErrorCode('LSattr_html_03','password'); LSerror :: addErrorCode('LSattr_html_03','password');
} }
if ($data) { if ($data) {

View file

@ -41,7 +41,7 @@ class LSattr_html_select_list extends LSattr_html{
$this -> config['text_possible_values'] = $possible_values; $this -> config['text_possible_values'] = $possible_values;
$element=$form -> addElement('select', $this -> name, $this -> config['label'],$this -> config, $this); $element=$form -> addElement('select', $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) { if(!$element) {
LSerror::addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
return; return;
} }
if ($data) { if ($data) {
@ -76,10 +76,10 @@ class LSattr_html_select_list extends LSattr_html{
foreach($this -> config['possible_values'] as $val_name => $val) { foreach($this -> config['possible_values'] as $val_name => $val) {
if($val_name=='OTHER_OBJECT') { if($val_name=='OTHER_OBJECT') {
if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) { 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; break;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($val['object_type'])) { if (!LSsession :: loadLSobject($val['object_type'])) {
return; return;
} }
$obj = new $val['object_type'](); $obj = new $val['object_type']();

View file

@ -40,7 +40,7 @@ class LSattr_html_select_object extends LSattr_html{
$this -> config['attrObject'] = $this; $this -> config['attrObject'] = $this;
$element=$form -> addElement('select_object', $this -> name, $this -> config['label'],$this -> config,$this); $element=$form -> addElement('select_object', $this -> name, $this -> config['label'],$this -> config,$this);
if(!$element) { if(!$element) {
LSerror::addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
return; return;
} }
if ($data) { if ($data) {
@ -81,11 +81,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) { if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object']; $conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) { if (!isset($conf['object_type'])) {
LSerror::addErrorCode('LSattr_html_select_object_01',$this -> name); LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
return; return;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) { if (!LSsession :: loadLSobject($conf['object_type'])) {
return; return;
} }
@ -129,11 +129,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) { if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object']; $conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) { if (!isset($conf['object_type'])) {
LSerror::addErrorCode('LSattr_html_select_object_01',$this -> name); LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name);
return; return;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) { if (!LSsession :: loadLSobject($conf['object_type'])) {
return; return;
} }

View file

@ -65,7 +65,7 @@ class LSattr_ldap_password extends LSattr_ldap {
break; break;
case 'ext_des': case 'ext_des':
if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 ) { if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 ) {
LSerror::addErrorCode(1023,'ext_des'); LSerror :: addErrorCode(1023,'ext_des');
} }
else { else {
return '{CRYPT}' . crypt( $this -> clearPassword, '_' . $this -> getSalt(8) ); return '{CRYPT}' . crypt( $this -> clearPassword, '_' . $this -> getSalt(8) );
@ -73,7 +73,7 @@ class LSattr_ldap_password extends LSattr_ldap {
break; break;
case 'blowfish': case 'blowfish':
if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 ) { if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 ) {
LSerror::addErrorCode(1023,'blowfish'); LSerror :: addErrorCode(1023,'blowfish');
} }
else { else {
return '{CRYPT}' . crypt( $this -> clearPassword, '$2a$12$' . $this -> getSalt(13) ); 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' ) ) { elseif( function_exists( 'mhash' ) ) {
return '{SHA}' . base64_encode( mhash( MHASH_SHA1, $this -> clearPassword ) ); return '{SHA}' . base64_encode( mhash( MHASH_SHA1, $this -> clearPassword ) );
} else { } else {
LSerror::addErrorCode(1023,'sha'); LSerror :: addErrorCode(1023,'sha');
} }
break; break;
case 'ssha': case 'ssha':
@ -96,7 +96,7 @@ class LSattr_ldap_password extends LSattr_ldap {
return "{SSHA}".base64_encode( mhash( MHASH_SHA1, $this -> clearPassword.$salt ).$salt ); return "{SSHA}".base64_encode( mhash( MHASH_SHA1, $this -> clearPassword.$salt ).$salt );
} }
else { else {
LSerror::addErrorCode(1023,'ssha'); LSerror :: addErrorCode(1023,'ssha');
} }
break; break;
case 'smd5': case 'smd5':
@ -106,7 +106,7 @@ class LSattr_ldap_password extends LSattr_ldap {
return "{SMD5}".base64_encode( mhash( MHASH_MD5, $password_clear.$salt ).$salt ); return "{SMD5}".base64_encode( mhash( MHASH_MD5, $password_clear.$salt ).$salt );
} }
else { else {
LSerror::addErrorCode(1023,'smd5'); LSerror :: addErrorCode(1023,'smd5');
} }
break; break;
case 'md5': case 'md5':
@ -114,7 +114,7 @@ class LSattr_ldap_password extends LSattr_ldap {
break; break;
case 'md5crypt': case 'md5crypt':
if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 ) { if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 ) {
LSerror::addErrorCode(1023,'md5crypt'); LSerror :: addErrorCode(1023,'md5crypt');
} }
else { else {
return '{CRYPT}'.crypt($this -> clearPassword,'$1$'.$this -> getSalt().'$'); return '{CRYPT}'.crypt($this -> clearPassword,'$1$'.$this -> getSalt().'$');

View file

@ -20,8 +20,8 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSattr_ldap'); LSsession :: loadLSclass('LSattr_ldap');
$GLOBALS['LSsession'] -> loadLSclass('LSattr_html'); LSsession :: loadLSclass('LSattr_html');
/** /**
* Attribut Ldap * Attribut Ldap
@ -66,14 +66,14 @@ class LSattribute {
$this -> ldapObject = $ldapObject; $this -> ldapObject = $ldapObject;
$html_type = "LSattr_html_".$config['html_type']; $html_type = "LSattr_html_".$config['html_type'];
$ldap_type = "LSattr_ldap_".$config['ldap_type']; $ldap_type = "LSattr_ldap_".$config['ldap_type'];
$GLOBALS['LSsession'] -> loadLSclass($html_type); LSsession :: loadLSclass($html_type);
$GLOBALS['LSsession'] -> loadLSclass($ldap_type); LSsession :: loadLSclass($ldap_type);
if((class_exists($html_type))&&(class_exists($ldap_type))) { if((class_exists($html_type))&&(class_exists($ldap_type))) {
$this -> html = new $html_type($name,$config,$this); $this -> html = new $html_type($name,$config,$this);
$this -> ldap = new $ldap_type($name,$config,$this); $this -> ldap = new $ldap_type($name,$config,$this);
} }
else { 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;
} }
return true; return true;
@ -92,7 +92,7 @@ class LSattribute {
function getLabel() { function getLabel() {
if (!$this -> html) { 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;
} }
return $this -> html -> getLabel(); return $this -> html -> getLabel();
@ -158,7 +158,7 @@ class LSattribute {
*/ */
function getDisplayValue() { function getDisplayValue() {
if (!$this -> ldap) { if (!$this -> ldap) {
LSerror::addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name)); LSerror :: addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
return; return;
} }
$data = $this -> ldap -> getDisplayValue($this -> data); $data = $this -> ldap -> getDisplayValue($this -> data);
@ -170,7 +170,7 @@ class LSattribute {
$result=$func($result); $result=$func($result);
} }
else { else {
LSerror::addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func)); LSerror :: addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func));
return; return;
} }
} }
@ -181,7 +181,7 @@ class LSattribute {
return $this -> config['onDisplay']($data); return $this -> config['onDisplay']($data);
} }
else { 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; return;
} }
} }
@ -207,7 +207,7 @@ class LSattribute {
function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) { function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) {
if(isset($this -> config['form'][$idForm])) { if(isset($this -> config['form'][$idForm])) {
if (!$this -> html) { 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;
} }
if($this -> myRights() == 'n') { if($this -> myRights() == 'n') {
@ -225,7 +225,7 @@ class LSattribute {
$element = $this -> html -> addToForm($form,$idForm,$data); $element = $this -> html -> addToForm($form,$idForm,$data);
if(!$element) { if(!$element) {
LSerror::addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
} }
if($this -> config['required']==1) { if($this -> config['required']==1) {
@ -240,7 +240,7 @@ class LSattribute {
if(is_array($this -> config['check_data'])) { if(is_array($this -> config['check_data'])) {
foreach ($this -> config['check_data'] as $rule => $rule_infos) { foreach ($this -> config['check_data'] as $rule => $rule_infos) {
if((!$form -> isRuleRegistered($rule))&&($rule!='')) { 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; return;
} }
if(!isset($rule_infos['msg'])) if(!isset($rule_infos['msg']))
@ -251,7 +251,7 @@ class LSattribute {
} }
} }
else { else {
LSerror::addErrorCode('LSattribute_04',$this->name); LSerror :: addErrorCode('LSattribute_04',$this->name);
} }
} }
} }
@ -314,7 +314,7 @@ class LSattribute {
function addToView(&$form) { function addToView(&$form) {
if((isset($this -> config['view'])) && ($this -> myRights() != 'n') ) { if((isset($this -> config['view'])) && ($this -> myRights() != 'n') ) {
if (!$this -> html) { 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;
} }
if($this -> data !='') { if($this -> data !='') {
@ -325,7 +325,7 @@ class LSattribute {
} }
$element = $this -> html -> addToForm($form,'view',$data); $element = $this -> html -> addToForm($form,'view',$data);
if(!$element instanceof LSformElement) { if(!$element instanceof LSformElement) {
LSerror::addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
return; return;
} }
$element -> freeze(); $element -> freeze();
@ -347,7 +347,7 @@ class LSattribute {
function refreshForm(&$form,$idForm) { function refreshForm(&$form,$idForm) {
if(isset($this -> config['form'][$idForm])&&($this -> myRights()!='n')) { if(isset($this -> config['form'][$idForm])&&($this -> myRights()!='n')) {
if (!$this -> html) { 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;
} }
$form_element = $form -> getElement($this -> name); $form_element = $form -> getElement($this -> name);
@ -504,7 +504,7 @@ class LSattribute {
$result=$func($result); $result=$func($result);
} }
else { else {
LSerror::addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func)); LSerror :: addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func));
return; return;
} }
} }
@ -514,14 +514,14 @@ class LSattribute {
$result = $this -> config['onSave']($data); $result = $this -> config['onSave']($data);
} }
else { 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; return;
} }
} }
} }
else { else {
if (!$this -> ldap) { if (!$this -> ldap) {
LSerror::addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name)); LSerror :: addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
return; return;
} }
else { else {

View file

@ -61,7 +61,7 @@ class LSform {
$this -> idForm = $idForm; $this -> idForm = $idForm;
$this -> submit = $submit; $this -> submit = $submit;
$this -> ldapObject = $ldapObject; $this -> ldapObject = $ldapObject;
$GLOBALS['LSsession'] -> loadLSclass('LSformElement'); LSsession :: loadLSclass('LSformElement');
} }
/** /**
@ -73,16 +73,16 @@ class LSform {
*/ */
function display(){ function display(){
if ($this -> idForm == 'view') { if ($this -> idForm == 'view') {
$GLOBALS['LSsession'] -> addJSscript('LSview.js'); LSsession :: addJSscript('LSview.js');
$GLOBALS['LSsession'] -> addJSscript('LSform.js'); LSsession :: addJSscript('LSform.js');
} }
else { else {
$GLOBALS['LSsession'] -> addJSscript('LSformElement_field.js'); LSsession :: addJSscript('LSformElement_field.js');
$GLOBALS['LSsession'] -> addJSscript('LSformElement.js'); LSsession :: addJSscript('LSformElement.js');
$GLOBALS['LSsession'] -> addJSscript('LSform.js'); LSsession :: addJSscript('LSform.js');
} }
$GLOBALS['LSsession'] -> addHelpInfos( LSsession :: addHelpInfos(
'LSform', 'LSform',
array( array(
'addFieldBtn' => _('Ajouter un champ pour saisir une autre valeur.'), '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']); $GLOBALS['Smarty'] -> assign('LSform_action',$_SERVER['PHP_SELF']);
$LSform_header = "\t<input type='hidden' name='validate' value='LSform'/>\n $LSform_header = "\t<input type='hidden' name='validate' value='LSform'/>\n
\t<input type='hidden' name='idForm' id='LSform_idform' value='".$this -> idForm."'/>\n \t<input type='hidden' name='idForm' id='LSform_idform' value='".$this -> idForm."'/>\n
@ -138,8 +138,8 @@ class LSform {
* @retval void * @retval void
*/ */
function displayView(){ function displayView(){
$GLOBALS['LSsession'] -> addCssFile('LSform.css'); LSsession :: addCssFile('LSform.css');
$GLOBALS['LSsession'] -> addJSscript('LSform.js'); LSsession :: addJSscript('LSform.js');
$LSform_object = array( $LSform_object = array(
'type' => $this -> ldapObject -> getType(), 'type' => $this -> ldapObject -> getType(),
'dn' => $this -> ldapObject -> getDn() 'dn' => $this -> ldapObject -> getDn()
@ -219,7 +219,7 @@ class LSform {
return; return;
if ($this -> isSubmit()) { if ($this -> isSubmit()) {
if (!$this -> getPostData()) { if (!$this -> getPostData()) {
LSerror::addErrorCode('LSform_01'); LSerror :: addErrorCode('LSform_01');
return; return;
} }
$this -> setValuesFromPostData(); $this -> setValuesFromPostData();
@ -260,10 +260,10 @@ class LSform {
} }
if (!is_array($this -> _rules[$element])) if (!is_array($this -> _rules[$element]))
continue; continue;
$GLOBALS['LSsession'] -> loadLSclass('LSformRule'); LSsession :: loadLSclass('LSformRule');
foreach($this -> _rules[$element] as $rule) { foreach($this -> _rules[$element] as $rule) {
$ruleType="LSformRule_".$rule['name']; $ruleType="LSformRule_".$rule['name'];
$GLOBALS['LSsession'] -> loadLSclass($ruleType); LSsession :: loadLSclass($ruleType);
if (! call_user_func(array( $ruleType,'validate') , $value, $rule['options'], $this -> getElement($element))) { if (! call_user_func(array( $ruleType,'validate') , $value, $rule['options'], $this -> getElement($element))) {
$retval=false; $retval=false;
$this -> setElementError($this -> elements[$element],$rule['options']['msg']); $this -> setElementError($this -> elements[$element],$rule['options']['msg']);
@ -343,7 +343,7 @@ class LSform {
function getPostData() { function getPostData() {
foreach($this -> elements as $element_name => $element) { foreach($this -> elements as $element_name => $element) {
if( !($element -> getPostData($this -> _postData)) ) { if( !($element -> getPostData($this -> _postData)) ) {
LSerror::addErrorCode('LSform_02',$element_name); LSerror :: addErrorCode('LSform_02',$element_name);
return; return;
} }
} }
@ -364,9 +364,9 @@ class LSform {
*/ */
function addElement($type,$name,$label,$params=array(),&$attr_html) { function addElement($type,$name,$label,$params=array(),&$attr_html) {
$elementType='LSformElement_'.$type; $elementType='LSformElement_'.$type;
$GLOBALS['LSsession'] -> loadLSclass($elementType); LSsession :: loadLSclass($elementType);
if (!class_exists($elementType)) { if (!class_exists($elementType)) {
LSerror::addErrorCode('LSform_05',array('type' => $type)); LSerror :: addErrorCode('LSform_05',array('type' => $type));
return; return;
} }
$element=$this -> elements[$name] = new $elementType($this,$name,$label,$params,$attr_html); $element=$this -> elements[$name] = new $elementType($this,$name,$label,$params,$attr_html);
@ -375,7 +375,7 @@ class LSform {
} }
else { else {
unset ($this -> elements[$name]); unset ($this -> elements[$name]);
LSerror::addErrorCode('LSform_06',array('element' => $name)); LSerror :: addErrorCode('LSform_06',array('element' => $name));
return; return;
} }
} }
@ -401,12 +401,12 @@ class LSform {
return true; return true;
} }
else { else {
LSerror::addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule)); LSerror :: addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule));
return; return;
} }
} }
else { else {
LSerror::addErrorCode('LSform_04',array('element' => $element)); LSerror :: addErrorCode('LSform_04',array('element' => $element));
return; return;
} }
} }
@ -440,8 +440,8 @@ class LSform {
* @param[in] $element string Le nom de l'élément conserné * @param[in] $element string Le nom de l'élément conserné
*/ */
function isRuleRegistered($rule) { function isRuleRegistered($rule) {
$GLOBALS['LSsession'] -> loadLSclass('LSformRule'); LSsession :: loadLSclass('LSformRule');
$GLOBALS['LSsession'] -> loadLSclass('LSformRule_'.$rule); LSsession :: loadLSclass('LSformRule_'.$rule);
return class_exists('LSformRule_'.$rule); return class_exists('LSformRule_'.$rule);
} }

View file

@ -267,7 +267,7 @@ class LSformElement {
if (!$template) { if (!$template) {
$template = $this -> template; $template = $this -> template;
} }
return $GLOBALS['LSsession'] -> fetchTemplate( return LSsession :: fetchTemplate(
$template, $template,
array_merge_recursive( array_merge_recursive(
$variables, $variables,

View file

@ -46,13 +46,13 @@ class LSformElement_boolean extends LSformElement {
$return = $this -> getLabelInfos(); $return = $this -> getLabelInfos();
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
// Help Infos // Help Infos
$GLOBALS['LSsession'] -> addHelpInfos( LSsession :: addHelpInfos(
'LSformElement_boolean', 'LSformElement_boolean',
array( array(
'clear' => _('Effacer le choix.') 'clear' => _('Effacer le choix.')
) )
); );
$GLOBALS['LSsession'] -> addJSscript('LSformElement_boolean.js'); LSsession :: addJSscript('LSformElement_boolean.js');
} }
$return['html'] = $this -> fetchTemplate( $return['html'] = $this -> fetchTemplate(
NULL, NULL,

View file

@ -135,7 +135,7 @@ class LSformElement_date extends LSformElement {
// value // value
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
// Help Infos // Help Infos
$GLOBALS['LSsession'] -> addHelpInfos( LSsession :: addHelpInfos(
'LSformElement_date', 'LSformElement_date',
array( array(
'calendar' => _('Sélectionner dans un calendrier.') 'calendar' => _('Sélectionner dans un calendrier.')
@ -146,15 +146,15 @@ class LSformElement_date extends LSformElement {
'format' => $this -> php2js_format($this -> getFormat()), 'format' => $this -> php2js_format($this -> getFormat()),
'firstDayOfWeek' => $this -> getFirstDayOfWeek() '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/'); LSsession :: addCssFile('theme.css',LS_LIB_DIR.'jscalendar/skins/aqua/');
$GLOBALS['LSsession'] -> addJSscript('calendar.js',LS_LIB_DIR.'jscalendar/'); LSsession :: addJSscript('calendar.js',LS_LIB_DIR.'jscalendar/');
$GLOBALS['LSsession'] -> addJSscript('calendar-en.js',LS_LIB_DIR.'jscalendar/lang/'); LSsession :: addJSscript('calendar-en.js',LS_LIB_DIR.'jscalendar/lang/');
$codeLang = strtolower($GLOBALS['LSconfig']['lang'][0].$GLOBALS['LSconfig']['lang'][1]); $codeLang = strtolower($GLOBALS['LSconfig']['lang'][0].$GLOBALS['LSconfig']['lang'][1]);
$GLOBALS['LSsession'] -> addJSscript('calendar-'.$codeLang.'.js',LS_LIB_DIR.'jscalendar/lang/'); LSsession :: addJSscript('calendar-'.$codeLang.'.js',LS_LIB_DIR.'jscalendar/lang/');
$GLOBALS['LSsession'] -> addJSscript('LSformElement_date_field.js'); LSsession :: addJSscript('LSformElement_date_field.js');
$GLOBALS['LSsession'] -> addJSscript('LSformElement_date.js'); LSsession :: addJSscript('LSformElement_date.js');
} }
$return['html'] = $this -> fetchTemplate(); $return['html'] = $this -> fetchTemplate();
return $return; return $return;

View file

@ -44,10 +44,10 @@ class LSformElement_image extends LSformElement {
* @retval array * @retval array
*/ */
function getDisplay(){ function getDisplay(){
$GLOBALS['LSsession'] -> addCssFile('LSformElement_image.css'); LSsession :: addCssFile('LSformElement_image.css');
$return = true; $return = true;
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$GLOBALS['LSsession'] -> addHelpInfos( LSsession :: addHelpInfos(
'LSformElement_date', 'LSformElement_date',
array( array(
'zoom' => _('Cliquer pour agrandir.'), 'zoom' => _('Cliquer pour agrandir.'),
@ -61,7 +61,7 @@ class LSformElement_image extends LSformElement {
} }
if (!empty($this -> values[0])) { 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( $GLOBALS['Smarty'] -> assign('LSformElement_image',array(
'img' => $img_path, 'img' => $img_path,
'id' => $id, 'id' => $id,
@ -73,7 +73,7 @@ class LSformElement_image extends LSformElement {
if ($this -> form -> definedError($this -> name)) { if ($this -> form -> definedError($this -> name)) {
$GLOBALS['Smarty'] -> assign('LSformElement_image_errors',true); $GLOBALS['Smarty'] -> assign('LSformElement_image_errors',true);
} }
$GLOBALS['LSsession'] -> addJSscript('LSformElement_image.js'); LSsession :: addJSscript('LSformElement_image.js');
} }
return $return; return $return;
} }
@ -99,7 +99,7 @@ class LSformElement_image extends LSformElement {
fclose($fp); fclose($fp);
$tmp_file = LS_TMP_DIR.$this -> name.'_'.rand().'.tmp'; $tmp_file = LS_TMP_DIR.$this -> name.'_'.rand().'.tmp';
if (move_uploaded_file($_FILES[$this -> name]['tmp_name'],$tmp_file)) { 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; $return[$this -> name][0] = $buf;
} }

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text'); LSsession :: loadLSclass('LSformElement_text');
/** /**
* Element mail d'un formulaire pour LdapSaisie * Element mail d'un formulaire pour LdapSaisie
@ -52,7 +52,7 @@ class LSformElement_mail extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl'; var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() { function getDisplay() {
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_mail', 'LSformElement_mail',
array( array(
'mail' => _("Envoyer un mail depuis l'interface.") 'mail' => _("Envoyer un mail depuis l'interface.")

View file

@ -82,7 +82,7 @@ class LSformElement_mailQuota extends LSformElement {
} }
} }
$GLOBALS['LSsession'] -> addCssFile('LSformElement_mailQuota.css'); LSsession :: addCssFile('LSformElement_mailQuota.css');
$return['html'] = $this -> fetchTemplate( $return['html'] = $this -> fetchTemplate(
NULL, NULL,

View file

@ -20,8 +20,8 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text'); LSsession :: loadLSclass('LSformElement_text');
$GLOBALS['LSsession'] -> loadLSaddon('maildir'); LSsession :: loadLSaddon('maildir');
/** /**
* Element maildir d'un formulaire pour LdapSaisie * Element maildir d'un formulaire pour LdapSaisie
@ -63,7 +63,7 @@ class LSformElement_maildir extends LSformElement_text {
var $fieldTemplate = 'LSformElement_maildir_field.tpl'; var $fieldTemplate = 'LSformElement_maildir_field.tpl';
function getDisplay() { function getDisplay() {
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_maildir', 'LSformElement_maildir',
array( 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."), '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']); $newname=getFData($this -> params['html_options']['archiveNameFormat'],$this -> _toDo['old']);
if ($newname) { if ($newname) {
if (renameMaildirByFTP($this -> _toDo['old'],$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 true;
} }
return; return;
@ -150,7 +150,7 @@ class LSformElement_maildir extends LSformElement_text {
} }
else { else {
if (removeMaildirByFTP(null,$this -> _toDo['old'])) { 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 true;
} }
return; return;
@ -158,14 +158,14 @@ class LSformElement_maildir extends LSformElement_text {
break; break;
case 'modify': case 'modify':
if (renameMaildirByFTP($this -> _toDo['old'],$this -> _toDo['new'])) { 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 true;
} }
return; return;
break; break;
case 'create': case 'create':
if (createMaildirByFTP(null,$this -> _toDo['new'])) { 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 true;
} }
return; return;

View file

@ -70,7 +70,7 @@ class LSformElement_password extends LSformElement {
$this -> sendMail = true; $this -> sendMail = true;
LSdebug ('send by config'); 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]); $msg = getFData($this -> params['html_options']['mail']['msg'],$return[$this -> name][0]);
$subject = $this -> params['html_options']['mail']['subject']; $subject = $this -> params['html_options']['mail']['subject'];
if (isset($_POST['LSformElement_password_'.$this -> name.'_msg'])) { if (isset($_POST['LSformElement_password_'.$this -> name.'_msg'])) {
@ -104,13 +104,13 @@ class LSformElement_password extends LSformElement {
* @retval array * @retval array
*/ */
function getDisplay(){ function getDisplay(){
$GLOBALS['LSsession'] -> addCssFile('LSformElement_password.css'); LSsession :: addCssFile('LSformElement_password.css');
$return = $this -> getLabelInfos(); $return = $this -> getLabelInfos();
$pwd = ""; $pwd = "";
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
// Help Infos // Help Infos
$GLOBALS['LSsession'] -> addHelpInfos( LSsession :: addHelpInfos(
'LSformElement_password', 'LSformElement_password',
array( array(
'generate' => _('Générer un mot de passe.'), 'generate' => _('Générer un mot de passe.'),
@ -134,10 +134,10 @@ class LSformElement_password extends LSformElement {
if (isset($this -> params['html_options']['mail'])) { if (isset($this -> params['html_options']['mail'])) {
$params['mail'] = $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'); LSsession :: addJSscript('LSformElement_password_field.js');
$GLOBALS['LSsession'] -> addJSscript('LSformElement_password.js'); LSsession :: addJSscript('LSformElement_password.js');
} }
$return['html'] = $this -> fetchTemplate(NULL,array('pwd' => $pwd)); $return['html'] = $this -> fetchTemplate(NULL,array('pwd' => $pwd));
return $return; return $return;
@ -151,7 +151,7 @@ class LSformElement_password extends LSformElement {
if ($this -> attr_html -> attribute -> ldapObject -> isNew()) { if ($this -> attr_html -> attribute -> ldapObject -> isNew()) {
return false; return false;
} }
return $GLOBALS['LSsession'] -> checkUserPwd($this -> attr_html -> attribute -> ldapObject,$pwd); return LSsession :: checkUserPwd($this -> attr_html -> attribute -> ldapObject,$pwd);
} }
function send($params) { function send($params) {
@ -176,7 +176,7 @@ class LSformElement_password extends LSformElement {
$this -> sendMail['subject'], $this -> sendMail['subject'],
$this -> sendMail['msg'] $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 { else {

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text'); LSsession :: loadLSclass('LSformElement_text');
/** /**
* Element RSS d'un formulaire pour LdapSaisie * Element RSS d'un formulaire pour LdapSaisie
@ -43,7 +43,7 @@ class LSformElement_rss extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl'; var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() { function getDisplay() {
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_rss', 'LSformElement_rss',
array( array(
'display' => _("Afficher la file RSS.") 'display' => _("Afficher la file RSS.")

View file

@ -46,13 +46,13 @@ class LSformElement_select extends LSformElement {
$return = $this -> getLabelInfos(); $return = $this -> getLabelInfos();
$params = array(); $params = array();
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_select', 'LSformElement_select',
array( array(
'clear' => _("Effacer la sélection.") 'clear' => _("Effacer la sélection.")
) )
); );
$GLOBALS['LSsession'] -> addJSscript('LSformElement_select.js'); LSsession :: addJSscript('LSformElement_select.js');
} }
$params['possible_values'] = $this -> params['text_possible_values']; $params['possible_values'] = $this -> params['text_possible_values'];
$return['html'] = $this -> fetchTemplate(NULL,$params); $return['html'] = $this -> fetchTemplate(NULL,$params);

View file

@ -43,14 +43,14 @@ class LSformElement_select_object extends LSformElement {
* @retval array * @retval array
*/ */
function getDisplay($refresh=NULL){ function getDisplay($refresh=NULL){
$GLOBALS['LSsession'] -> addCssFile('LSformElement_select_object.css'); LSsession :: addCssFile('LSformElement_select_object.css');
if ($refresh) { if ($refresh) {
$this -> values = $this -> getValuesFromSession(); $this -> values = $this -> getValuesFromSession();
} }
$return = $this -> getLabelInfos(); $return = $this -> getLabelInfos();
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$GLOBALS['LSsession'] -> addJSconfigParam( LSsession :: addJSconfigParam(
$this -> name, $this -> name,
array( array(
'object_type' => $this -> selectableObject, 'object_type' => $this -> selectableObject,
@ -62,7 +62,7 @@ class LSformElement_select_object extends LSformElement {
) )
); );
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_select_object', 'LSformElement_select_object',
array( array(
'searchAdd' => _("Ajout rapide"), 'searchAdd' => _("Ajout rapide"),
@ -71,15 +71,15 @@ class LSformElement_select_object extends LSformElement {
) )
); );
$GLOBALS['LSsession'] -> addJSscript('LSformElement_select_object_field.js'); LSsession :: addJSscript('LSformElement_select_object_field.js');
$GLOBALS['LSsession'] -> addJSscript('LSformElement_select_object.js'); LSsession :: addJSscript('LSformElement_select_object.js');
$GLOBALS['LSsession'] -> addJSscript('LSform.js'); LSsession :: addJSscript('LSform.js');
$GLOBALS['LSsession'] -> addJSscript('LSselect.js'); LSsession :: addJSscript('LSselect.js');
$GLOBALS['LSsession'] -> addCssFile('LSselect.css'); LSsession :: addCssFile('LSselect.css');
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js'); LSsession :: addJSscript('LSsmoothbox.js');
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css'); LSsession :: addCssFile('LSsmoothbox.css');
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js'); LSsession :: addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css'); LSsession :: addCssFile('LSconfirmBox.css');
} }
$return['html'] = $this -> fetchTemplate(NULL,array('selectableObject' => $this -> selectableObject)); $return['html'] = $this -> fetchTemplate(NULL,array('selectableObject' => $this -> selectableObject));
@ -142,7 +142,7 @@ class LSformElement_select_object extends LSformElement {
*/ */
function searchAdd ($pattern) { function searchAdd ($pattern) {
if (is_array($this -> params['selectable_object'])) { 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'](); $obj = new $this -> params['selectable_object']['object_type']();
$ret = $obj -> getSelectArray($pattern,NULL,$this -> params['selectable_object']['display_attribute']); $ret = $obj -> getSelectArray($pattern,NULL,$this -> params['selectable_object']['display_attribute']);
if (is_array($ret)) { if (is_array($ret)) {

View file

@ -43,15 +43,15 @@ class LSformElement_ssh_key extends LSformElement {
* @retval array * @retval array
*/ */
function getDisplay(){ function getDisplay(){
$GLOBALS['LSsession'] -> addCssFile('LSformElement_ssh_key.css'); LSsession :: addCssFile('LSformElement_ssh_key.css');
$return = $this -> getLabelInfos(); $return = $this -> getLabelInfos();
$params = array(); $params = array();
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$params['values_txt'] = $this -> values; $params['values_txt'] = $this -> values;
} }
else { else {
$GLOBALS['LSsession'] -> addJSscript('LSformElement_ssh_key.js'); LSsession :: addJSscript('LSformElement_ssh_key.js');
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_ssh_key', 'LSformElement_ssh_key',
array( array(
'display' => _("Afficher la clef complète.") 'display' => _("Afficher la clef complète.")

View file

@ -48,22 +48,22 @@ class LSformElement_text extends LSformElement {
// value // value
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
if (isset($this -> params['html_options'])) { 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', 'LSformElement_text',
array( array(
'generate' => _('Générer la valeur') 'generate' => _('Générer la valeur')
) )
); );
$GLOBALS['LSsession'] -> addJSscript('LSformElement_text_field.js'); LSsession :: addJSscript('LSformElement_text_field.js');
$GLOBALS['LSsession'] -> addJSscript('LSformElement_text.js'); LSsession :: addJSscript('LSformElement_text.js');
} }
foreach ($this -> JSscripts as $js) { foreach ($this -> JSscripts as $js) {
$GLOBALS['LSsession'] -> addJSscript($js); LSsession :: addJSscript($js);
} }
foreach ($this -> CSSfiles as $css) { foreach ($this -> CSSfiles as $css) {
$GLOBALS['LSsession'] -> addCssFile($css); LSsession :: addCssFile($css);
} }
$return['html'] = $this -> fetchTemplate(); $return['html'] = $this -> fetchTemplate();
return $return; return $return;

View file

@ -44,13 +44,13 @@ class LSformElement_textarea extends LSformElement {
function getDisplay(){ function getDisplay(){
$return = $this -> getLabelInfos(); $return = $this -> getLabelInfos();
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$GLOBALS['LSsession'] -> addHelpInfos( LSsession :: addHelpInfos(
'LSformElement_textarea', 'LSformElement_textarea',
array( array(
'clear' => _('Effacer') 'clear' => _('Effacer')
) )
); );
$GLOBALS['LSsession'] -> addJSscript('LSformElement_textarea.js'); LSsession :: addJSscript('LSformElement_textarea.js');
} }
$return['html'] = $this -> fetchTemplate(); $return['html'] = $this -> fetchTemplate();
return $return; return $return;

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text'); LSsession :: loadLSclass('LSformElement_text');
/** /**
* Element texte d'un formulaire pour LdapSaisie * Element texte d'un formulaire pour LdapSaisie
@ -44,7 +44,7 @@ class LSformElement_url extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl'; var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() { function getDisplay() {
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_url', 'LSformElement_url',
array( array(
'go' => _("Afficher ce site."), 'go' => _("Afficher ce site."),

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text'); LSsession :: loadLSclass('LSformElement_text');
/** /**
* Element xmpp d'un formulaire pour LdapSaisie * Element xmpp d'un formulaire pour LdapSaisie
@ -44,7 +44,7 @@ class LSformElement_xmpp extends LSformElement_text {
var $fieldTemplate = 'LSformElement_uri_field.tpl'; var $fieldTemplate = 'LSformElement_uri_field.tpl';
function getDisplay() { function getDisplay() {
$GLOBALS['LSsession'] -> addHelpInfos ( LSsession :: addHelpInfos (
'LSformElement_xmpp', 'LSformElement_xmpp',
array( array(
'chat' => _("Dialoguer avec cette personne.") 'chat' => _("Dialoguer avec cette personne.")

View file

@ -38,7 +38,7 @@ class LSformRule_alphanumeric extends LSformRule {
*/ */
function validate ($value,$options=array(),$formElement) { function validate ($value,$options=array(),$formElement) {
$regex = '/^[a-zA-Z0-9]+$/'; $regex = '/^[a-zA-Z0-9]+$/';
$GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex'); LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement); return LSformRule_regex :: validate($value,$regex,$formElement);
} }

View file

@ -69,7 +69,7 @@ class LSformRule_compare extends LSformRule {
*/ */
function validate ($values,$options=array(),$formElement) { function validate ($values,$options=array(),$formElement) {
if (!isset($options['params']['operator'])) { if (!isset($options['params']['operator'])) {
LSerror::addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator'); LSerror :: addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator');
return; return;
} }
$operator = LSformRule_compare :: _findOperator($options['params']['operator']); $operator = LSformRule_compare :: _findOperator($options['params']['operator']);

View file

@ -39,7 +39,7 @@ class LSformRule_imagefile extends LSformRule {
* @return boolean true si la valeur est valide, false sinon * @return boolean true si la valeur est valide, false sinon
*/ */
function validate ($value,$options,$formElement) { function validate ($value,$options,$formElement) {
$file = $GLOBALS['LSsession'] -> getTmpFile($value); $file = LSsession :: getTmpFile($value);
$mimetype = mime_content_type($file); $mimetype = mime_content_type($file);

View file

@ -39,7 +39,7 @@ class LSformRule_imagefilesize extends LSformRule {
* @return boolean true si la valeur est valide, false sinon * @return boolean true si la valeur est valide, false sinon
*/ */
function validate ($value,$options,$formElement) { function validate ($value,$options,$formElement) {
$file = $GLOBALS['LSsession'] -> getTmpFile($value); $file = LSsession :: getTmpFile($value);
$size = filesize($file); $size = filesize($file);

View file

@ -41,7 +41,7 @@ class LSformRule_imagesize extends LSformRule {
* @return boolean true si la valeur est valide, false sinon * @return boolean true si la valeur est valide, false sinon
*/ */
function validate ($value,$options,$formElement) { function validate ($value,$options,$formElement) {
$file = $GLOBALS['LSsession'] -> getTmpFile($value); $file = LSsession :: getTmpFile($value);
list($width, $height, $type, $attr) = getimagesize($file); list($width, $height, $type, $attr) = getimagesize($file);
if (is_int($options['params']['maxWidth'])) { if (is_int($options['params']['maxWidth'])) {

View file

@ -38,7 +38,7 @@ class LSformRule_lettersonly extends LSformRule {
*/ */
function validate ($value,$options=array(),$formElement) { function validate ($value,$options=array(),$formElement) {
$regex = '/^[a-zA-Z]+$/'; $regex = '/^[a-zA-Z]+$/';
$GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex'); LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement); return LSformRule_regex :: validate($value,$regex,$formElement);
} }

View file

@ -39,7 +39,7 @@ class LSformRule_maxlength extends LSformRule {
*/ */
function validate ($value,$options,$formElement) { function validate ($value,$options,$formElement) {
if(!isset($options['params']['limit'])) { 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;
} }
return (strlen($value)<=$options['params']['limit']); return (strlen($value)<=$options['params']['limit']);

View file

@ -39,7 +39,7 @@ class LSformRule_minlength extends LSformRule {
*/ */
function validate ($value,$options,$formElement) { function validate ($value,$options,$formElement) {
if(!isset($options['params']['limit'])) { 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;
} }
return (strlen($value)>=$options['params']['limit']); return (strlen($value)>=$options['params']['limit']);

View file

@ -38,7 +38,7 @@ class LSformRule_nonzero extends LSformRule {
*/ */
function validate ($value,$options,$formElement) { function validate ($value,$options,$formElement) {
$regex = '/^-?[1-9][0-9]*/'; $regex = '/^-?[1-9][0-9]*/';
$GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex'); LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement); return LSformRule_regex :: validate($value,$regex,$formElement);
} }

View file

@ -38,7 +38,7 @@ class LSformRule_nopunctuation extends LSformRule {
*/ */
function validate ($value,$options=array(),$formElement) { function validate ($value,$options=array(),$formElement) {
$regex = '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/'; $regex = '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/';
$GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex'); LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement); return LSformRule_regex :: validate($value,$regex,$formElement);
} }

View file

@ -38,7 +38,7 @@ class LSformRule_numeric extends LSformRule{
*/ */
function validate ($value,$options=array(),$formElement) { function validate ($value,$options=array(),$formElement) {
$regex = '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/'; $regex = '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/';
$GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex'); LSsession :: loadLSclass('LSformRule_regex');
return LSformRule_regex :: validate($value,$regex,$formElement); return LSformRule_regex :: validate($value,$regex,$formElement);
} }

View file

@ -40,7 +40,7 @@ class LSformRule_rangelength extends LSformRule {
*/ */
function validate ($value,$options=array(),$formElement) { function validate ($value,$options=array(),$formElement) {
if(!isset($options['params']['limits'])) { if(!isset($options['params']['limits'])) {
LSerror::addErrorCode('LSformRule_01',array('type' => 'rangelength', 'param' => 'limit'); LSerror :: addErrorCode('LSformRule_01',array('type' => 'rangelength', 'param' => 'limit');
return; return;
} }
$len=strlen($value); $len=strlen($value);

View file

@ -43,7 +43,7 @@ class LSformRule_regex extends LSformRule {
$regex=$option['params']['regex']; $regex=$option['params']['regex'];
} }
else { else {
LSerror::addErrorCode('LSformRule_regex_01'); LSerror :: addErrorCode('LSformRule_regex_01');
return; return;
} }
} }

View file

@ -38,7 +38,7 @@ class LSformRule_telephonenumber extends LSformRule {
*/ */
function validate($value,$option=array(),$formElement) { function validate($value,$option=array(),$formElement) {
$regex = '/^(01|02|03|04|05|06|08|09)[0-9]{8}$/'; $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); return LSformRule_regex :: validate($value,$regex,$formElement);
} }

View file

@ -63,7 +63,7 @@ class LSldap {
function connect() { function connect() {
$this -> cnx = Net_LDAP2::connect($this -> config); $this -> cnx = Net_LDAP2::connect($this -> config);
if (Net_LDAP2::isError($this -> cnx)) { if (Net_LDAP2::isError($this -> cnx)) {
LSerror::addErrorCode('LSldap_01',$this -> cnx -> getMessage()); LSerror :: addErrorCode('LSldap_01',$this -> cnx -> getMessage());
$this -> cnx = NULL; $this -> cnx = NULL;
return; return;
} }
@ -105,7 +105,7 @@ class LSldap {
function search ($filter,$basedn=NULL,$params = array()) { function search ($filter,$basedn=NULL,$params = array()) {
$ret = $this -> cnx -> search($basedn,$filter,$params); $ret = $this -> cnx -> search($basedn,$filter,$params);
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
LSerror::addErrorCode('LSldap_02',$ret -> getMessage()); LSerror :: addErrorCode('LSldap_02',$ret -> getMessage());
return; return;
} }
$retInfos=array(); $retInfos=array();
@ -136,7 +136,7 @@ class LSldap {
$filter=NULL; $filter=NULL;
$ret = $this -> cnx -> search($basedn,$filter,$params); $ret = $this -> cnx -> search($basedn,$filter,$params);
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
LSerror::addErrorCode('LSldap_02',$ret -> getMessage()); LSerror :: addErrorCode('LSldap_02',$ret -> getMessage());
return; return;
} }
return $ret -> count(); return $ret -> count();
@ -212,7 +212,7 @@ class LSldap {
} }
} }
else { else {
LSerror::addErrorCode('LSldap_03'); LSerror :: addErrorCode('LSldap_03');
return; return;
} }
} }
@ -299,8 +299,8 @@ class LSldap {
} }
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
LSerror::addErrorCode('LSldap_05',$dn); LSerror :: addErrorCode('LSldap_05',$dn);
LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); LSerror :: addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
} }
else { else {
if (!empty($dropAttr)) { if (!empty($dropAttr)) {
@ -316,15 +316,15 @@ class LSldap {
} }
$ret = $entry -> update(); $ret = $entry -> update();
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
LSerror::addErrorCode('LSldap_06'); LSerror :: addErrorCode('LSldap_06');
LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); LSerror :: addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
} }
} }
return true; return true;
} }
} }
else { else {
LSerror::addErrorCode('LSldap_04'); LSerror :: addErrorCode('LSldap_04');
return; return;
} }
} }
@ -369,7 +369,7 @@ class LSldap {
function remove($dn) { function remove($dn) {
$ret = $this -> cnx -> delete($dn,array('recursive' => true)); $ret = $this -> cnx -> delete($dn,array('recursive' => true));
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); LSerror :: addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
return; return;
} }
return true; return true;
@ -386,8 +386,8 @@ class LSldap {
function move($old,$new) { function move($old,$new) {
$ret = $this -> cnx -> move($old,$new); $ret = $this -> cnx -> move($old,$new);
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
LSerror::addErrorCode('LSldap_07'); LSerror :: addErrorCode('LSldap_07');
LSerror::addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); LSerror :: addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
return; return;
} }
return true; return true;

View file

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSattribute'); LSsession :: loadLSclass('LSattribute');
/** /**
* Base d'un objet ldap * Base d'un objet ldap
@ -64,7 +64,7 @@ class LSldapObject {
$this -> config = $GLOBALS['LSobjects'][$type_name]; $this -> config = $GLOBALS['LSobjects'][$type_name];
} }
else { else {
LSerror::addErrorCode('LSldapObject_01'); LSerror :: addErrorCode('LSldapObject_01');
return; return;
} }
} }
@ -147,7 +147,7 @@ class LSldapObject {
$spe = $this -> getDisplayNameFormat(); $spe = $this -> getDisplayNameFormat();
} }
$val = $this -> getFData($spe,&$this -> attrs,'getDisplayValue'); $val = $this -> getFData($spe,&$this -> attrs,'getDisplayValue');
if ($GLOBALS['LSsession'] -> haveSubDn() && $full) { if (LSsession :: haveSubDn() && $full) {
$val.=' ('.$this -> getSubDnName().')'; $val.=' ('.$this -> getSubDnName().')';
} }
return $val; return $val;
@ -184,7 +184,7 @@ class LSldapObject {
* @retval LSform Le formulaire crée * @retval LSform Le formulaire crée
*/ */
function getForm($idForm,$load=NULL) { function getForm($idForm,$load=NULL) {
$GLOBALS['LSsession'] -> loadLSclass('LSform'); LSsession :: loadLSclass('LSform');
$LSform = new LSform($this,$idForm); $LSform = new LSform($this,$idForm);
$this -> forms[$idForm] = array($LSform,$load); $this -> forms[$idForm] = array($LSform,$load);
@ -227,7 +227,7 @@ class LSldapObject {
* @retval LSform Le formulaire crée * @retval LSform Le formulaire crée
*/ */
function getView() { function getView() {
$GLOBALS['LSsession'] -> loadLSclass('LSform'); LSsession :: loadLSclass('LSform');
$this -> view = new LSform($this,'view'); $this -> view = new LSform($this,'view');
foreach($this -> attrs as $attr_name => $attr) { foreach($this -> attrs as $attr_name => $attr) {
$this -> attrs[$attr_name] -> addToView($this -> view); $this -> attrs[$attr_name] -> addToView($this -> view);
@ -276,7 +276,7 @@ class LSldapObject {
if(isset($this -> forms[$idForm])) if(isset($this -> forms[$idForm]))
$LSform = $this -> forms[$idForm][0]; $LSform = $this -> forms[$idForm][0];
else { else {
LSerror::addErrorCode('LSldapObject_02',$this -> getType()); LSerror :: addErrorCode('LSldapObject_02',$this -> getType());
return; return;
} }
} }
@ -289,7 +289,7 @@ class LSldapObject {
$LSform = $LSform[0]; $LSform = $LSform[0];
} }
else { else {
LSerror::addErrorCode('LSldapObject_03',$this -> getType()); LSerror :: addErrorCode('LSldapObject_03',$this -> getType());
return; return;
} }
} }
@ -307,12 +307,12 @@ class LSldapObject {
if(isset($this -> config['before_modify'])) { if(isset($this -> config['before_modify'])) {
if(function_exists($this -> config['before_modify'])) { if(function_exists($this -> config['before_modify'])) {
if(!$this -> config['before_modify']($this)) { if(!$this -> config['before_modify']($this)) {
LSerror::addErrorCode('LSldapObject_08',$this -> config['before_modify']); LSerror :: addErrorCode('LSldapObject_08',$this -> config['before_modify']);
return; return;
} }
} }
else { else {
LSerror::addErrorCode('LSldapObject_07',$this -> config['before_modify']); LSerror :: addErrorCode('LSldapObject_07',$this -> config['before_modify']);
return; return;
} }
} }
@ -335,11 +335,11 @@ class LSldapObject {
if((isset($this -> config['after_modify']))&&(!$this -> submitError)) { if((isset($this -> config['after_modify']))&&(!$this -> submitError)) {
if(function_exists($this -> config['after_modify'])) { if(function_exists($this -> config['after_modify'])) {
if(!$this -> config['after_modify']($this)) { if(!$this -> config['after_modify']($this)) {
LSerror::addErrorCode('LSldapObject_10',$this -> config['after_modify']); LSerror :: addErrorCode('LSldapObject_10',$this -> config['after_modify']);
} }
} }
else { 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 -> canBeGenerated()) {
if ($attr -> generateValue()) { if ($attr -> generateValue()) {
if (!$this -> validateAttrData($LSform, $attr)) { if (!$this -> validateAttrData($LSform, $attr)) {
LSerror::addErrorCode('LSattribute_08',$attr -> getLabel()); LSerror :: addErrorCode('LSattribute_08',$attr -> getLabel());
$retval = false; $retval = false;
} }
} }
else { else {
LSerror::addErrorCode('LSattribute_07',$attr -> getLabel()); LSerror :: addErrorCode('LSattribute_07',$attr -> getLabel());
$retval = false; $retval = false;
} }
} }
else { else {
LSerror::addErrorCode('LSattribute_06',$attr -> getLabel()); LSerror :: addErrorCode('LSattribute_06',$attr -> getLabel());
$retval = false; $retval = false;
} }
} }
@ -422,7 +422,7 @@ class LSldapObject {
foreach($vconfig as $test) { foreach($vconfig as $test) {
// Définition du basedn par défaut // Définition du basedn par défaut
if (!isset($test['basedn'])) { if (!isset($test['basedn'])) {
$test['basedn']=$GLOBALS['LSsession']->topDn; $test['basedn']=LSsession :: getTopDn();
} }
// Définition du message d'erreur // Définition du message d'erreur
@ -476,12 +476,12 @@ class LSldapObject {
} }
} }
else { 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; $retval = false;
} }
} }
else { 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; $retval = false;
} }
} }
@ -492,17 +492,17 @@ class LSldapObject {
if (!empty($dependsAttrs)) { if (!empty($dependsAttrs)) {
foreach($dependsAttrs as $dependAttr) { foreach($dependsAttrs as $dependAttr) {
if(!isset($this -> attrs[$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; continue;
} }
if($this -> attrs[$dependAttr] -> canBeGenerated()) { if($this -> attrs[$dependAttr] -> canBeGenerated()) {
if (!$this -> attrs[$dependAttr] -> generateValue()) { if (!$this -> attrs[$dependAttr] -> generateValue()) {
LSerror::addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel()); LSerror :: addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel());
$retval = false; $retval = false;
} }
} }
else { else {
LSerror::addErrorCode('LSattribute_06',$this -> attrs[$dependAttr] -> getLabel()); LSerror :: addErrorCode('LSattribute_06',$this -> attrs[$dependAttr] -> getLabel());
$retval = false; $retval = false;
} }
} }
@ -531,7 +531,7 @@ class LSldapObject {
$new = true; $new = true;
LSdebug('Rename'); LSdebug('Rename');
if (!$this -> beforeRename()) { if (!$this -> beforeRename()) {
LSerror::addErrorCode('LSldapObject_16'); LSerror :: addErrorCode('LSldapObject_16');
return; return;
} }
$oldDn = $this -> getDn(); $oldDn = $this -> getDn();
@ -543,7 +543,7 @@ class LSldapObject {
} }
$this -> dn = $newDn; $this -> dn = $newDn;
if (!$this -> afterRename($oldDn,$newDn)) { if (!$this -> afterRename($oldDn,$newDn)) {
LSerror::addErrorCode('LSldapObject_17'); LSerror :: addErrorCode('LSldapObject_17');
return; return;
} }
} }
@ -566,14 +566,14 @@ class LSldapObject {
} }
if ($new) { if ($new) {
if (!$this -> afterCreate()) { if (!$this -> afterCreate()) {
LSerror::addErrorCode('LSldapObject_21'); LSerror :: addErrorCode('LSldapObject_21');
return; return;
} }
} }
return true; return true;
} }
else { else {
LSerror::addErrorCode('LSldapObject_13'); LSerror :: addErrorCode('LSldapObject_13');
return; return;
} }
} }
@ -997,18 +997,19 @@ class LSldapObject {
} }
else { else {
$rdn_attr=$this -> config['rdn']; $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(); $rdn_val=$this -> attrs[$rdn_attr] -> getUpdateData();
if (!empty($rdn_val)) { 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 { else {
LSerror::addErrorCode('LSldapObject_12',$this -> config['rdn']); LSerror :: addErrorCode('LSldapObject_12',$this -> config['rdn']);
return; return;
} }
} }
else { else {
LSerror::addErrorCode('LSldapObject_11',$this -> getType()); LSerror :: addErrorCode('LSldapObject_11',$this -> getType());
return; return;
} }
} }
@ -1034,7 +1035,7 @@ class LSldapObject {
*/ */
function whoami() { function whoami() {
if (!$this -> _whoami) if (!$this -> _whoami)
$this -> _whoami = $GLOBALS['LSsession'] -> whoami($this -> dn); $this -> _whoami = LSsession :: whoami($this -> dn);
return $this -> _whoami; return $this -> _whoami;
} }
@ -1063,11 +1064,11 @@ class LSldapObject {
if ($this -> afterDelete()) { if ($this -> afterDelete()) {
return true; return true;
} }
LSerror::addErrorCode('LSldapObject_19'); LSerror :: addErrorCode('LSldapObject_19');
} }
} }
else { else {
LSerror::addErrorCode('LSldapObject_18'); LSerror :: addErrorCode('LSldapObject_18');
} }
return; return;
} }
@ -1098,7 +1099,7 @@ class LSldapObject {
return $this -> _subDn_value[$dn]; return $this -> _subDn_value[$dn];
} }
$subDn_value=''; $subDn_value='';
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer(); $subDnLdapServer = LSsession :: getSortSubDnLdapServer();
foreach ($subDnLdapServer as $subDn => $subDn_name) { foreach ($subDnLdapServer as $subDn => $subDn_name) {
if (isCompatibleDNs($subDn,$dn)&&($subDn!=$dn)) { if (isCompatibleDNs($subDn,$dn)&&($subDn!=$dn)) {
$subDn_value=$subDn; $subDn_value=$subDn;
@ -1117,7 +1118,7 @@ class LSldapObject {
* @return string Le nom du subDn de l'object * @return string Le nom du subDn de l'object
*/ */
function getSubDnName($dn=NULL) { function getSubDnName($dn=NULL) {
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer(); $subDnLdapServer = LSsession :: getSortSubDnLdapServer();
return $subDnLdapServer[$this -> getSubDnValue($dn)]; return $subDnLdapServer[$this -> getSubDnValue($dn)];
} }
@ -1135,7 +1136,7 @@ class LSldapObject {
$me -> loadData($this -> getDn()); $me -> loadData($this -> getDn());
foreach($this->config['LSrelation'] as $relation_name => $relation_conf) { foreach($this->config['LSrelation'] as $relation_name => $relation_conf) {
if ( isset($relation_conf['list_function']) ) { if ( isset($relation_conf['list_function']) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) { if (LSsession :: loadLSobject($relation_conf['LSobject'])) {
$obj = new $relation_conf['LSobject'](); $obj = new $relation_conf['LSobject']();
if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) { if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) {
$list = $obj -> $relation_conf['list_function']($me); $list = $obj -> $relation_conf['list_function']($me);
@ -1194,8 +1195,8 @@ class LSldapObject {
*/ */
function afterRename($oldDn,$newDn) { function afterRename($oldDn,$newDn) {
$error = 0; $error = 0;
if($GLOBALS['LSsession'] -> dn == $oldDn) { if(LSsession :: getLSuserObjectDn() == $oldDn) {
$GLOBALS['LSsession'] -> changeAuthUser($this); LSsession :: changeAuthUser($this);
} }
foreach($this -> _LSrelationsCache as $relation_name => $objInfos) { foreach($this -> _LSrelationsCache as $relation_name => $objInfos) {
@ -1274,12 +1275,12 @@ class LSldapObject {
foreach($config as $action) { foreach($config as $action) {
if(function_exists($action)) { if(function_exists($action)) {
if(!$action($this)) { if(!$action($this)) {
LSerror::addErrorCode('LSldapObject_25',$action); LSerror :: addErrorCode('LSldapObject_25',$action);
$error=true; $error=true;
} }
} }
else { else {
LSerror::addErrorCode('LSldapObject_24',$action); LSerror :: addErrorCode('LSldapObject_24',$action);
$error=true; $error=true;
} }
} }
@ -1306,10 +1307,10 @@ class LSldapObject {
function afterCreate() { function afterCreate() {
LSdebug('after'); LSdebug('after');
$error = 0; $error = 0;
if ($GLOBALS['LSsession'] -> isSubDnLSobject($this -> getType())) { if (LSsession :: isSubDnLSobject($this -> getType())) {
if (is_array($GLOBALS['LSsession'] -> ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'])) { if (is_array(LSsession :: $ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'])) {
foreach($GLOBALS['LSsession'] -> ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'] as $type) { foreach(LSsession :: $ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'] as $type) {
if ($GLOBALS['LSsession'] -> loadLSobject($type)) { if (LSsession :: loadLSobject($type)) {
if (isset($GLOBALS['LSobjects'][$type]['container_auto_create'])&&isset($GLOBALS['LSobjects'][$type]['container_dn'])) { if (isset($GLOBALS['LSobjects'][$type]['container_auto_create'])&&isset($GLOBALS['LSobjects'][$type]['container_dn'])) {
$dn = $GLOBALS['LSobjects'][$type]['container_dn'].','.$this -> getDn(); $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)) { 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) { foreach($config as $action) {
if(function_exists($action)) { if(function_exists($action)) {
if(!$action($this)) { if(!$action($this)) {
LSerror::addErrorCode('LSldapObject_23',$action); LSerror :: addErrorCode('LSldapObject_23',$action);
$error=true; $error=true;
} }
} }
else { else {
LSerror::addErrorCode('LSldapObject_22',$action); LSerror :: addErrorCode('LSldapObject_22',$action);
$error=true; $error=true;
} }
} }
@ -1369,7 +1370,7 @@ class LSldapObject {
**/ **/
function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') { function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
LSerror::addErrorCode('LSrelations_05','getObjectKeyValueInRelation'); LSerror :: addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
return; return;
} }
if ($attrValue=='dn') { if ($attrValue=='dn') {
@ -1402,7 +1403,7 @@ class LSldapObject {
**/ **/
function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') { function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
LSerror::addErrorCode('LSrelations_05','listObjectsInRelation'); LSerror :: addErrorCode('LSrelations_05','listObjectsInRelation');
return; return;
} }
if ($attrValue=='dn') { if ($attrValue=='dn') {
@ -1415,7 +1416,7 @@ class LSldapObject {
if ($val) { if ($val) {
$filter = $this -> getObjectFilter(); $filter = $this -> getObjectFilter();
$filter = '(&'.$filter.'('.$attr.'='.$val.'))'; $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; return;
} }
@ -1434,7 +1435,7 @@ class LSldapObject {
**/ **/
function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') { function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
LSerror::addErrorCode('LSrelations_05','addOneObjectInRelation'); LSerror :: addErrorCode('LSrelations_05','addOneObjectInRelation');
return; return;
} }
if ($object instanceof $objectType) { if ($object instanceof $objectType) {
@ -1484,7 +1485,7 @@ class LSldapObject {
**/ **/
function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') { function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
LSerror::addErrorCode('LSrelations_05','deleteOneObjectInRelation'); LSerror :: addErrorCode('LSrelations_05','deleteOneObjectInRelation');
return; return;
} }
if ($object instanceof $objectType) { if ($object instanceof $objectType) {
@ -1529,7 +1530,7 @@ class LSldapObject {
*/ */
function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') { function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
LSerror::addErrorCode('LSrelations_05','renameOneObjectInRelation'); LSerror :: addErrorCode('LSrelations_05','renameOneObjectInRelation');
return; return;
} }
if ($object instanceof $objectType) { if ($object instanceof $objectType) {
@ -1579,7 +1580,7 @@ class LSldapObject {
**/ **/
function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn') { function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
LSerror::addErrorCode('LSrelations_05','updateObjectsInRelation'); LSerror :: addErrorCode('LSrelations_05','updateObjectsInRelation');
return; return;
} }
$currentObjects = $this -> listObjectsInRelation($object,$attr,$objectType,$attrValue); $currentObjects = $this -> listObjectsInRelation($object,$attr,$objectType,$attrValue);

File diff suppressed because it is too large Load diff

View file

@ -89,7 +89,7 @@ function getFData($format,$data,$meth=NULL) {
$format[$i]=ereg_replace($ch[0],$value,$format[$i]); $format[$i]=ereg_replace($ch[0],$value,$format[$i]);
} }
else { else {
LSerror::addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => $ch[1])); LSerror :: addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => $ch[1]));
break; break;
} }
} }
@ -136,7 +136,7 @@ function getFData($format,$data,$meth=NULL) {
$format[$i]=ereg_replace($ch[0],$value,$format[$i]); $format[$i]=ereg_replace($ch[0],$value,$format[$i]);
} }
else { else {
LSerror::addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => get_class($data))); LSerror :: addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => get_class($data)));
break; break;
} }
} }

View file

@ -22,17 +22,15 @@
require_once 'includes/class/class.LSsession.php'; require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession(); if(LSsession :: startLSsession()) {
if($LSsession -> startLSsession()) {
// Définition du Titre de la page // Définition du Titre de la page
$GLOBALS['Smarty'] -> assign('pagetitle',_('Accueil')); $GLOBALS['Smarty'] -> assign('pagetitle',_('Accueil'));
// Template // Template
$GLOBALS['LSsession'] -> setTemplate('accueil.tpl'); LSsession :: setTemplate('accueil.tpl');
} }
// Affichage des retours d'erreurs // Affichage des retours d'erreurs
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
?> ?>

View file

@ -2,14 +2,16 @@
require_once 'includes/class/class.LSsession.php'; require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();
if (($_REQUEST['template'] != 'login')&&($_REQUEST['template'] != 'recoverPassword')) { if (($_REQUEST['template'] != 'login')&&($_REQUEST['template'] != 'recoverPassword')) {
if ( !$GLOBALS['LSsession'] -> startLSsession() ) { if ( !LSsession :: startLSsession() ) {
LSerror::addErrorCode('LSsession_22'); LSerror :: addErrorCode('LSsession_22');
$_ERRORS = true; $_ERRORS = true;
} }
} }
else {
LSsession :: initialize() or die('Error during initialization.');
}
$data=NULL; $data=NULL;
if (!isset($_ERRORS)) { if (!isset($_ERRORS)) {
switch($_REQUEST['template']) { switch($_REQUEST['template']) {
@ -17,9 +19,9 @@ if (!isset($_ERRORS)) {
switch($_REQUEST['action']) { switch($_REQUEST['action']) {
case 'onLdapServerChanged': case 'onLdapServerChanged':
if ( isset($_REQUEST['server']) ) { if ( isset($_REQUEST['server']) ) {
$GLOBALS['LSsession'] -> setLdapServer($_REQUEST['server']); LSsession :: setLdapServer($_REQUEST['server']);
$data = array(); $data = array();
if ( $GLOBALS['LSsession'] -> LSldapConnect() ) { if ( LSsession :: LSldapConnect() ) {
session_start(); session_start();
if (isset($_SESSION['LSsession_topDn'])) { if (isset($_SESSION['LSsession_topDn'])) {
$sel = $_SESSION['LSsession_topDn']; $sel = $_SESSION['LSsession_topDn'];
@ -27,13 +29,13 @@ if (!isset($_ERRORS)) {
else { else {
$sel = NULL; $sel = NULL;
} }
$list = $GLOBALS['LSsession'] -> getSubDnLdapServerOptions($sel); $list = LSsession :: getSubDnLdapServerOptions($sel);
if (is_string($list)) { if (is_string($list)) {
$data['list_topDn'] = "<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>"; $data['list_topDn'] = "<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>";
$data['subDnLabel'] = $GLOBALS['LSsession'] -> getSubDnLabel(); $data['subDnLabel'] = LSsession :: getSubDnLabel();
} }
} }
$data['recoverPassword'] = isset($GLOBALS['LSsession'] -> ldapServer['recoverPassword']); $data['recoverPassword'] = isset(LSsession::$ldapServer['recoverPassword']);
} }
break; break;
} }
@ -42,8 +44,8 @@ if (!isset($_ERRORS)) {
switch($_REQUEST['action']) { switch($_REQUEST['action']) {
case 'onLdapServerChanged': case 'onLdapServerChanged':
if ( isset($_REQUEST['server']) ) { if ( isset($_REQUEST['server']) ) {
$GLOBALS['LSsession'] -> setLdapServer($_REQUEST['server']); LSsession :: setLdapServer($_REQUEST['server']);
$data=array('recoverPassword' => isset($GLOBALS['LSsession'] -> ldapServer['recoverPassword'])); $data=array('recoverPassword' => isset(LSsession::$ldapServer['recoverPassword']));
} }
break; break;
} }
@ -52,7 +54,7 @@ if (!isset($_ERRORS)) {
switch($_REQUEST['action']) { switch($_REQUEST['action']) {
case 'onAddFieldBtnClick': case 'onAddFieldBtnClick':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['fieldId'])) ) { if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['fieldId'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype'](); $object = new $_REQUEST['objecttype']();
$object -> loadData($_REQUEST['objectdn']); $object -> loadData($_REQUEST['objectdn']);
$form = $object -> getForm($_REQUEST['idform']); $form = $object -> getForm($_REQUEST['idform']);
@ -69,7 +71,7 @@ if (!isset($_ERRORS)) {
break; break;
case 'LSformElement_select_object_refresh': case 'LSformElement_select_object_refresh':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) { if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype'](); $object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']); $form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']); $field=$form -> getElement($_REQUEST['attribute']);
@ -84,7 +86,7 @@ if (!isset($_ERRORS)) {
break; break;
case 'LSformElement_select_object_searchAdd': case 'LSformElement_select_object_searchAdd':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['pattern'])) && (isset($_REQUEST['idform'])) ) { if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['pattern'])) && (isset($_REQUEST['idform'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype'](); $object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']); $form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']); $field=$form -> getElement($_REQUEST['attribute']);
@ -94,7 +96,7 @@ if (!isset($_ERRORS)) {
break; break;
case 'generatePassword': case 'generatePassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) { if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype'](); $object = new $_REQUEST['objecttype']();
if ($object) { if ($object) {
$form = $object -> getForm($_REQUEST['idform']); $form = $object -> getForm($_REQUEST['idform']);
@ -115,7 +117,7 @@ if (!isset($_ERRORS)) {
break; break;
case 'verifyPassword': case 'verifyPassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldValue'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['objectdn'])) ) { if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldValue'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['objectdn'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype'](); $object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']); $form = $object -> getForm($_REQUEST['idform']);
$object -> loadData($_REQUEST['objectdn']); $object -> loadData($_REQUEST['objectdn']);
@ -135,12 +137,12 @@ if (!isset($_ERRORS)) {
if ((isset($_REQUEST['id'])) && (isset($_REQUEST['href'])) ) { if ((isset($_REQUEST['id'])) && (isset($_REQUEST['href'])) ) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) { if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']]; $conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType'](); $object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']]; $relationConf = $object->config['LSrelation'][$conf['relationName']];
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject'](); $objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object); $list = $objRel -> $relationConf['list_function']($object);
@ -156,24 +158,24 @@ if (!isset($_ERRORS)) {
); );
} }
else { else {
LSerror::addErrorCode('LSrelations_01',$relationName); LSerror :: addErrorCode('LSrelations_01',$relationName);
} }
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
break; break;
@ -181,12 +183,12 @@ if (!isset($_ERRORS)) {
if (isset($_REQUEST['id'])) { if (isset($_REQUEST['id'])) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) { if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']]; $conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType'](); $object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']]; $relationConf = $object->config['LSrelation'][$conf['relationName']];
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) { if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) {
if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) {
$objRel = new $relationConf['LSobject'](); $objRel = new $relationConf['LSobject']();
@ -209,33 +211,33 @@ if (!isset($_ERRORS)) {
$data['id'] = $_REQUEST['id']; $data['id'] = $_REQUEST['id'];
} }
else { else {
LSerror::addErrorCode('LSrelations_01',$relationName); LSerror :: addErrorCode('LSrelations_01',$relationName);
} }
} }
else { else {
LSerror::addErrorCode('LSrelations_03',$relationName); LSerror :: addErrorCode('LSrelations_03',$relationName);
} }
} }
else { else {
LSerror::addErrorCode('LSrelations_02',$relationName); LSerror :: addErrorCode('LSrelations_02',$relationName);
} }
} }
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
break; break;
@ -243,12 +245,12 @@ if (!isset($_ERRORS)) {
if ((isset($_REQUEST['id'])) && (isset($_REQUEST['dn']))) { if ((isset($_REQUEST['id'])) && (isset($_REQUEST['dn']))) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) { if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']]; $conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType'](); $object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']]; $relationConf = $object->config['LSrelation'][$conf['relationName']];
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject'](); $objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object); $list = $objRel -> $relationConf['list_function']($object);
@ -257,7 +259,7 @@ if (!isset($_ERRORS)) {
foreach($list as $o) { foreach($list as $o) {
if($o -> getDn() == $_REQUEST['dn']) { if($o -> getDn() == $_REQUEST['dn']) {
if (!$o -> $relationConf['remove_function']($object)) { if (!$o -> $relationConf['remove_function']($object)) {
LSerror::addErrorCode('LSrelations_03',$conf['relationName']); LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
} }
else { else {
$ok = true; $ok = true;
@ -266,7 +268,7 @@ if (!isset($_ERRORS)) {
} }
if (!$ok) { if (!$ok) {
LSdebug($_REQUEST['value']." introuvé parmi la liste"); LSdebug($_REQUEST['value']." introuvé parmi la liste");
LSerror::addErrorCode('LSrelations_03',$conf['relationName']); LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
} }
else { else {
$data=array( $data=array(
@ -275,28 +277,28 @@ if (!isset($_ERRORS)) {
} }
} }
else { else {
LSerror::addErrorCode('LSrelations_03',$conf['relationName']); LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
} }
} }
else { else {
LSerror::addErrorCode('LSrelations_01',$conf['relationName']); LSerror :: addErrorCode('LSrelations_01',$conf['relationName']);
} }
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
break; break;
@ -346,7 +348,7 @@ if (!isset($_ERRORS)) {
); );
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
break; break;
} }
@ -355,7 +357,7 @@ if (!isset($_ERRORS)) {
switch($_REQUEST['action']) { switch($_REQUEST['action']) {
case 'display': case 'display':
if (isset($_REQUEST['object']['type']) && isset($_REQUEST['object']['dn'])) { if (isset($_REQUEST['object']['type']) && isset($_REQUEST['object']['dn'])) {
if ($GLOBALS['LSsession']->loadLSobject($_REQUEST['object']['type'])) { if (LSsession ::loadLSobject($_REQUEST['object']['type'])) {
$obj = new $_REQUEST['object']['type'](); $obj = new $_REQUEST['object']['type']();
$obj -> loadData($_REQUEST['object']['dn']); $obj -> loadData($_REQUEST['object']['dn']);
$msg = $obj -> getFData($_REQUEST['msg']); $msg = $obj -> getFData($_REQUEST['msg']);
@ -385,7 +387,7 @@ if (!isset($_ERRORS)) {
break; break;
case 'send': case 'send':
if (isset($_REQUEST['infos'])) { if (isset($_REQUEST['infos'])) {
if ($GLOBALS['LSsession'] -> loadLSaddon('mail')) { if (LSsession ::loadLSaddon('mail')) {
if(sendMail($_REQUEST['infos']['mail'],$_REQUEST['infos']['subject'],$_REQUEST['infos']['msg'])) { if(sendMail($_REQUEST['infos']['mail'],$_REQUEST['infos']['subject'],$_REQUEST['infos']['msg'])) {
$data = array( $data = array(
'msgok' => _("Votre message a bien été envoyé.") 'msgok' => _("Votre message a bien été envoyé.")
@ -394,13 +396,13 @@ if (!isset($_ERRORS)) {
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
break; break;
} }
} }
$GLOBALS['LSsession'] -> displayAjaxReturn($data); LSsession :: displayAjaxReturn($data);
?> ?>

View file

@ -22,9 +22,7 @@
require_once 'includes/class/class.LSsession.php'; require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession(); if(LSsession :: startLSsession()) {
if($LSsession -> startLSsession()) {
if (isset($_POST['LSform_objecttype'])) { if (isset($_POST['LSform_objecttype'])) {
$LSobject = $_POST['LSform_objecttype']; $LSobject = $_POST['LSform_objecttype'];
@ -42,8 +40,8 @@ if($LSsession -> startLSsession()) {
if ((isset($dn)) && (isset($LSobject)) ) { if ((isset($dn)) && (isset($LSobject)) ) {
// Création d'un LSobject // Création d'un LSobject
if ($GLOBALS['LSsession'] -> loadLSobject($LSobject)) { if (LSsession :: loadLSobject($LSobject)) {
if ( $GLOBALS['LSsession'] -> canEdit($LSobject,$dn) ) { if ( LSsession :: canEdit($LSobject,$dn) ) {
$object = new $LSobject(); $object = new $LSobject();
if ($object -> loadData($dn)) { if ($object -> loadData($dn)) {
// Définition du Titre de la page // Définition du Titre de la page
@ -53,13 +51,13 @@ if($LSsession -> startLSsession()) {
// MàJ des données de l'objet LDAP // MàJ des données de l'objet LDAP
if ($object -> updateData('modify')) { if ($object -> updateData('modify')) {
if (LSerror::errorsDefined()) { if (LSerror::errorsDefined()) {
$GLOBALS['LSsession'] -> addInfo(_("L'objet a été modifié partiellement.")); LSsession :: addInfo(_("L'objet a été modifié partiellement."));
} }
else { else {
$GLOBALS['LSsession'] -> addInfo(_("L'objet a bien été modifié.")); LSsession :: addInfo(_("L'objet a bien été modifié."));
} }
if (isset($_REQUEST['ajax'])) { if (isset($_REQUEST['ajax'])) {
$GLOBALS['LSsession'] -> displayAjaxReturn ( LSsession :: displayAjaxReturn (
array( array(
'LSredirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn() 'LSredirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()
) )
@ -68,15 +66,15 @@ if($LSsession -> startLSsession()) {
} }
else { else {
if (!LSdebugDefined()) { if (!LSdebugDefined()) {
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()); LSsession :: redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn());
} }
else { else {
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
} }
} }
} }
else { else {
$GLOBALS['LSsession'] -> displayAjaxReturn ( LSsession :: displayAjaxReturn (
array( array(
'LSformErrors' => $form -> getErrors() 'LSformErrors' => $form -> getErrors()
) )
@ -84,7 +82,7 @@ if($LSsession -> startLSsession()) {
} }
} }
else if (isset($_REQUEST['ajax']) && $form -> definedError()) { else if (isset($_REQUEST['ajax']) && $form -> definedError()) {
$GLOBALS['LSsession'] -> displayAjaxReturn ( LSsession :: displayAjaxReturn (
array( array(
'LSformErrors' => $form -> getErrors() 'LSformErrors' => $form -> getErrors()
) )
@ -97,7 +95,7 @@ if($LSsession -> startLSsession()) {
'action' => 'view' 'action' => 'view'
); );
if ($GLOBALS['LSsession'] -> canRemove($LSobject,$object -> getDn())) { if (LSsession :: canRemove($LSobject,$object -> getDn())) {
$LSview_actions[] = array( $LSview_actions[] = array(
'label' => _('Supprimer'), 'label' => _('Supprimer'),
'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$object -> getDn(), 'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$object -> getDn(),
@ -105,31 +103,31 @@ if($LSsession -> startLSsession()) {
); );
} }
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js'); LSsession :: addJSscript('LSsmoothbox.js');
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css'); LSsession :: addCssFile('LSsmoothbox.css');
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions); $GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
$GLOBALS['LSsession'] -> setTemplate('modify.tpl'); LSsession :: setTemplate('modify.tpl');
$form -> display(); $form -> display();
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
} }
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('login.tpl'); LSsession :: setTemplate('login.tpl');
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
} }

View file

@ -22,25 +22,23 @@
require_once 'includes/class/class.LSsession.php'; require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession(); if(LSsession :: startLSsession()) {
if($LSsession -> startLSsession()) {
if ((isset($_GET['LSobject'])) && (isset($_GET['dn']))) { if ((isset($_GET['LSobject'])) && (isset($_GET['dn']))) {
if ($GLOBALS['LSsession'] -> loadLSobject($_GET['LSobject'])) { if (LSsession ::loadLSobject($_GET['LSobject'])) {
if ( $GLOBALS['LSsession'] -> canRemove($_GET['LSobject'],$_GET['dn']) ) { if ( LSsession :: canRemove($_GET['LSobject'],$_GET['dn']) ) {
$object = new $_GET['LSobject'](); $object = new $_GET['LSobject']();
if ($object -> loadData($_GET['dn'])) { if ($object -> loadData($_GET['dn'])) {
if (isset($_GET['valid'])) { if (isset($_GET['valid'])) {
$objectname=$object -> getDisplayName(); $objectname=$object -> getDisplayName();
$GLOBALS['Smarty'] -> assign('pagetitle',_('Suppression').' : '.$objectname); $GLOBALS['Smarty'] -> assign('pagetitle',_('Suppression').' : '.$objectname);
if ($object -> remove()) { if ($object -> remove()) {
$GLOBALS['LSsession'] -> addInfo($objectname.' '._('a bien été supprimé').'.'); LSsession :: addInfo($objectname.' '._('a bien été supprimé').'.');
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$_GET['LSobject'].'&refresh'); LSsession :: redirect('view.php?LSobject='.$_GET['LSobject'].'&refresh');
} }
else { else {
LSerror::addErrorCode('LSldapObject_15',$objectname); LSerror :: addErrorCode('LSldapObject_15',$objectname);
} }
} }
else { else {
@ -50,29 +48,29 @@ if($LSsession -> startLSsession()) {
$GLOBALS['Smarty'] -> assign('validation_url','remove.php?LSobject='.$_GET['LSobject'].'&amp;dn='.$_GET['dn'].'&amp;valid'); $GLOBALS['Smarty'] -> assign('validation_url','remove.php?LSobject='.$_GET['LSobject'].'&amp;dn='.$_GET['dn'].'&amp;valid');
$GLOBALS['Smarty'] -> assign('validation_txt',_('Valider')); $GLOBALS['Smarty'] -> assign('validation_txt',_('Valider'));
} }
$GLOBALS['LSsession'] -> setTemplate('question.tpl'); LSsession :: setTemplate('question.tpl');
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
else { else {
LSerror::addErrorCode('LSldapObject_01'); LSerror :: addErrorCode('LSldapObject_01');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('login.tpl'); LSsession :: setTemplate('login.tpl');
} }
// Affichage des retours d'erreurs // Affichage des retours d'erreurs
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
?> ?>

View file

@ -22,13 +22,11 @@
require_once 'includes/class/class.LSsession.php'; require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession(); if(LSsession :: startLSsession()) {
if($LSsession -> startLSsession()) {
if (isset($_REQUEST['LSobject'])) { if (isset($_REQUEST['LSobject'])) {
$LSobject = $_REQUEST['LSobject']; $LSobject = $_REQUEST['LSobject'];
if ( $GLOBALS['LSsession'] -> loadLSobject($LSobject) ) { if ( LSsession ::loadLSobject($LSobject) ) {
$objectList=array(); $objectList=array();
$object = new $LSobject(); $object = new $LSobject();
@ -37,18 +35,18 @@ if($LSsession -> startLSsession()) {
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) { if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter']; $filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
if (isCompatibleDNs($_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'],$GLOBALS['LSsession'] -> topDn)) { if (isCompatibleDNs($_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'],LSsession :: getTopDn())) {
$topDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['topDn']; $topDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'];
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn'])) { if (isset($_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn'])) {
$selectedTopDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn']; $selectedTopDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn'];
} }
else { else {
$selectedTopDn = $GLOBALS['LSsession'] -> topDn; $selectedTopDn = LSsession :: getTopDn();
} }
} }
else { else {
$selectedTopDn = $GLOBALS['LSsession'] -> topDn; $selectedTopDn = LSsession :: getTopDn();
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn; $topDn = $object -> config['container_dn'].','.LSsession :: getTopDn();
} }
$params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params']; $params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params'];
$pattern = $_SESSION['LSsession']['LSsearch'][$LSobject]['pattern']; $pattern = $_SESSION['LSsession']['LSsearch'][$LSobject]['pattern'];
@ -60,17 +58,17 @@ if($LSsession -> startLSsession()) {
} }
else { else {
$filter = NULL; $filter = NULL;
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn; $topDn = $object -> config['container_dn'].','.LSsession :: getTopDn();
$params = array('scope' => 'one'); $params = array('scope' => 'one');
$pattern = false; $pattern = false;
$recur = false; $recur = false;
$approx = false; $approx = false;
$selectedTopDn = $GLOBALS['LSsession'] -> topDn; $selectedTopDn = LSsession :: getTopDn();
$orderby = false; $orderby = false;
$_REQUEST['orderby']=$GLOBALS['LSobjects'][$LSobject]['orderby']; $_REQUEST['orderby']=$GLOBALS['LSobjects'][$LSobject]['orderby'];
$ordersense = 'ASC'; $ordersense = 'ASC';
$subDnLdapServer = $GLOBALS['LSsession'] -> getSubDnLdapServer(); $subDnLdapServer = LSsession :: getSubDnLdapServer();
$doSubDn = (($subDnLdapServer)&&(!$GLOBALS['LSsession']->isSubDnLSobject($LSobject))); $doSubDn = (($subDnLdapServer)&&(!LSsession :: isSubDnLSobject($LSobject)));
} }
if (isset($_REQUEST['LSview_search_submit'])) { if (isset($_REQUEST['LSview_search_submit'])) {
@ -101,25 +99,25 @@ if($LSsession -> startLSsession()) {
if (isset($_REQUEST['LSview_recur'])) { if (isset($_REQUEST['LSview_recur'])) {
$recur = true; $recur = true;
$params['scope'] = 'sub'; $params['scope'] = 'sub';
if ($GLOBALS['LSsession'] -> validSubDnLdapServer($_REQUEST['LSselect_topDn'])) { if (LSsession :: validSubDnLdapServer($_REQUEST['LSselect_topDn'])) {
$topDn = $_REQUEST['LSselect_topDn']; $topDn = $_REQUEST['LSselect_topDn'];
$selectedTopDn = $topDn; $selectedTopDn = $topDn;
} }
else { else {
$topDn = $GLOBALS['LSsession'] -> topDn; $topDn = LSsession :: getTopDn();
$selectedTopDn = $topDn; $selectedTopDn = $topDn;
} }
} }
else { else {
$recur = false; $recur = false;
$params['scope'] = 'one'; $params['scope'] = 'one';
if ($GLOBALS['LSsession'] -> validSubDnLdapServer($_REQUEST['LSselect_topDn'])) { if (LSsession :: validSubDnLdapServer($_REQUEST['LSselect_topDn'])) {
$topDn = $object -> config['container_dn'].','.$_REQUEST['LSselect_topDn']; $topDn = $object -> config['container_dn'].','.$_REQUEST['LSselect_topDn'];
$selectedTopDn = $_REQUEST['LSselect_topDn']; $selectedTopDn = $_REQUEST['LSselect_topDn'];
} }
else { else {
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn; $topDn = $object -> config['container_dn'].','.LSsession :: getTopDn();
$selectedTopDn = $GLOBALS['LSsession'] -> topDn; $selectedTopDn = LSsession :: getTopDn();
} }
} }
} }
@ -188,7 +186,7 @@ if($LSsession -> startLSsession()) {
) )
); );
if (($GLOBALS['LSsession'] -> cacheSearch()) && isset($_SESSION['LSsession']['LSsearch'][$hash]) && (!isset($_REQUEST['refresh']))) { if ((LSsession :: cacheSearch()) && isset($_SESSION['LSsession']['LSsearch'][$hash]) && (!isset($_REQUEST['refresh']))) {
// On affiche à partir du cache // On affiche à partir du cache
$searchData=$_SESSION['LSsession']['LSsearch'][$hash]; $searchData=$_SESSION['LSsession']['LSsearch'][$hash];
LSdebug('From cache'); LSdebug('From cache');
@ -208,7 +206,7 @@ if($LSsession -> startLSsession()) {
$c=0; $c=0;
foreach($list as $objDn => $objName) { foreach($list as $objDn => $objName) {
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$objDn)) { if (LSsession :: canAccess($LSobject,$objDn)) {
$c++; $c++;
unset($actions); unset($actions);
@ -230,7 +228,7 @@ if($LSsession -> startLSsession()) {
} }
$searchData['objectList']=$objectList; $searchData['objectList']=$objectList;
$searchData['LSview_actions'] = $LSview_actions; $searchData['LSview_actions'] = $LSview_actions;
if ($GLOBALS['LSsession'] -> cacheSearch()) { if (LSsession :: cacheSearch()) {
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData; $_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
} }
if ($orderby) { if ($orderby) {
@ -298,7 +296,7 @@ if($LSsession -> startLSsession()) {
$searchData['objectList'][$i]['select']=$select; $searchData['objectList'][$i]['select']=$select;
} }
$GLOBALS['LSsession'] -> addJSscript('LSview.js'); LSsession :: addJSscript('LSview.js');
$GLOBALS['Smarty']->assign('LSview_search',array( $GLOBALS['Smarty']->assign('LSview_search',array(
'action' => $_SERVER['PHP_SELF'], 'action' => $_SERVER['PHP_SELF'],
@ -315,22 +313,22 @@ if($LSsession -> startLSsession()) {
$GLOBALS['Smarty'] -> assign('LSview_actions',$searchData['LSview_actions']); $GLOBALS['Smarty'] -> assign('LSview_actions',$searchData['LSview_actions']);
$GLOBALS['Smarty'] -> assign('LSselect_multiple',$multiple); $GLOBALS['Smarty'] -> assign('LSselect_multiple',$multiple);
if (isset($_REQUEST['ajax'])) { if (isset($_REQUEST['ajax'])) {
$GLOBALS['LSsession'] -> setTemplate('select_table.tpl'); LSsession :: setTemplate('select_table.tpl');
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('select.tpl'); LSsession :: setTemplate('select.tpl');
} }
$GLOBALS['LSsession'] -> ajaxDisplay = true; LSsession :: setAjaxDisplay();
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('login.tpl'); LSsession :: setTemplate('login.tpl');
} }
// Affichage des retours d'erreurs // Affichage des retours d'erreurs
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
?> ?>

View file

@ -22,25 +22,23 @@
require_once 'includes/class/class.LSsession.php'; require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession(); if(LSsession :: startLSsession()) {
if($LSsession -> startLSsession()) {
if (isset($_REQUEST['LSobject'])) { if (isset($_REQUEST['LSobject'])) {
$LSobject = $_REQUEST['LSobject']; $LSobject = $_REQUEST['LSobject'];
$dn = $_REQUEST['dn']; $dn = $_REQUEST['dn'];
if ($GLOBALS['LSsession'] -> in_menu($LSobject)) { if (LSsession :: in_menu($LSobject)) {
if ( $LSobject == 'SELF' ) { if ( $LSobject == 'SELF' ) {
$LSobject = $GLOBALS['LSsession']-> LSuserObject -> getType(); $LSobject = LSsession :: getLSuserObject() -> getType();
$dn = $GLOBALS['LSsession']-> LSuserObject -> getValue('dn'); $dn = LSsession :: getLSuserObjectDn();
} }
if ( $GLOBALS['LSsession'] -> loadLSobject($LSobject) ) { if ( LSsession :: loadLSobject($LSobject) ) {
// Affichage d'un objet // Affichage d'un objet
if ( $dn!='' ) { if ( $dn!='' ) {
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$dn)) { if (LSsession :: canAccess($LSobject,$dn)) {
if ( $GLOBALS['LSsession'] -> canEdit($LSobject,$dn) ) { if ( LSsession :: canEdit($LSobject,$dn) ) {
$LSview_actions[] = array( $LSview_actions[] = array(
'label' => _('Modifier'), 'label' => _('Modifier'),
'url' =>'modify.php?LSobject='.$LSobject.'&amp;dn='.$dn, 'url' =>'modify.php?LSobject='.$LSobject.'&amp;dn='.$dn,
@ -48,7 +46,7 @@ if($LSsession -> startLSsession()) {
); );
} }
if ($GLOBALS['LSsession'] -> canCreate($LSobject)) { if (LSsession :: canCreate($LSobject)) {
$LSview_actions[] = array( $LSview_actions[] = array(
'label' => _('Copier'), 'label' => _('Copier'),
'url' =>'create.php?LSobject='.$LSobject.'&amp;load='.$dn, 'url' =>'create.php?LSobject='.$LSobject.'&amp;load='.$dn,
@ -56,7 +54,7 @@ if($LSsession -> startLSsession()) {
); );
} }
if ($GLOBALS['LSsession'] -> canRemove($LSobject,$dn)) { if (LSsession :: canRemove($LSobject,$dn)) {
$LSview_actions[] = array( $LSview_actions[] = array(
'label' => _('Supprimer'), 'label' => _('Supprimer'),
'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$dn, 'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$dn,
@ -64,13 +62,13 @@ if($LSsession -> startLSsession()) {
); );
} }
if ($GLOBALS['LSsession']-> LSuserObject -> getValue('dn') != $dn) { if (LSsession :: getLSuserObjectDn() != $dn) {
$object = new $LSobject(); $object = new $LSobject();
$object -> loadData($dn); $object -> loadData($dn);
$GLOBALS['Smarty'] -> assign('pagetitle',$object -> getDisplayName()); $GLOBALS['Smarty'] -> assign('pagetitle',$object -> getDisplayName());
} }
else { else {
$object = &$GLOBALS['LSsession']-> LSuserObject; $object = LSsession :: getLSuserObject();
$GLOBALS['Smarty'] -> assign('pagetitle',_('Mon compte')); $GLOBALS['Smarty'] -> assign('pagetitle',_('Mon compte'));
} }
@ -82,7 +80,7 @@ if($LSsession -> startLSsession()) {
$LSrelations=array(); $LSrelations=array();
$LSrelations_JSparams=array(); $LSrelations_JSparams=array();
foreach($object -> config['LSrelation'] as $relationName => $relationConf) { foreach($object -> config['LSrelation'] as $relationName => $relationConf) {
if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$LSobject,$relationName)) { if (LSsession :: relationCanAccess($object -> getValue('dn'),$LSobject,$relationName)) {
$return=array( $return=array(
'label' => $relationConf['label'], 'label' => $relationConf['label'],
'LSobject' => $relationConf['LSobject'] 'LSobject' => $relationConf['LSobject']
@ -105,7 +103,7 @@ if($LSsession -> startLSsession()) {
'objectType' => $object -> getType(), 'objectType' => $object -> getType(),
'objectDn' => $object -> getDn(), 'objectDn' => $object -> getDn(),
); );
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$LSobject,$relationName)) { if (LSsession :: relationCanEdit($object -> getValue('dn'),$LSobject,$relationName)) {
$return['actions'][] = array( $return['actions'][] = array(
'label' => _('Modifier'), 'label' => _('Modifier'),
'url' => 'select.php?LSobject='.$relationConf['LSobject'].'&amp;multiple=1', 'url' => 'select.php?LSobject='.$relationConf['LSobject'].'&amp;multiple=1',
@ -113,17 +111,17 @@ if($LSsession -> startLSsession()) {
); );
} }
$GLOBALS['LSsession'] -> addJSscript('LSselect.js'); LSsession :: addJSscript('LSselect.js');
$GLOBALS['LSsession'] -> addCssFile('LSselect.css'); LSsession :: addCssFile('LSselect.css');
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js'); LSsession :: addJSscript('LSsmoothbox.js');
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css'); LSsession :: addCssFile('LSsmoothbox.css');
$GLOBALS['LSsession'] -> addJSscript('LSrelation.js'); LSsession :: addJSscript('LSrelation.js');
$GLOBALS['LSsession'] -> addCssFile('LSrelation.css'); LSsession :: addCssFile('LSrelation.css');
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js'); LSsession :: addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css'); LSsession :: addCssFile('LSconfirmBox.css');
$GLOBALS['LSsession'] -> addJSscript('LSview.js'); LSsession :: addJSscript('LSview.js');
if($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if(LSsession :: loadLSobject($relationConf['LSobject'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject'](); $objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object); $list = $objRel -> $relationConf['list_function']($object);
@ -141,29 +139,29 @@ if($LSsession -> startLSsession()) {
} }
} }
else { else {
LSerror::addErrorCode('LSrelations_01',$relationName); LSerror :: addErrorCode('LSrelations_01',$relationName);
} }
$LSrelations[]=$return; $LSrelations[]=$return;
} }
else { else {
LSerror::addErrorCode('LSrelations_04',array('relation' => $relationName,'LSobject' => $relationConf['LSobject'])); LSerror :: addErrorCode('LSrelations_04',array('relation' => $relationName,'LSobject' => $relationConf['LSobject']));
} }
} }
} }
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js'); LSsession :: addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css'); LSsession :: addCssFile('LSconfirmBox.css');
$GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations); $GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations);
$GLOBALS['LSsession'] -> addJSconfigParam('LSrelations',$LSrelations_JSparams); LSsession :: addJSconfigParam('LSrelations',$LSrelations_JSparams);
} }
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions); $GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js'); LSsession :: addJSscript('LSsmoothbox.js');
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css'); LSsession :: addCssFile('LSsmoothbox.css');
$GLOBALS['LSsession'] -> setTemplate('view.tpl'); LSsession :: setTemplate('view.tpl');
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
// Affichage d'une liste d'un type d'objet // Affichage d'une liste d'un type d'objet
@ -180,10 +178,10 @@ if($LSsession -> startLSsession()) {
$pattern = $_SESSION['LSsession']['LSsearch'][$LSobject]['pattern']; $pattern = $_SESSION['LSsession']['LSsearch'][$LSobject]['pattern'];
$recur = $_SESSION['LSsession']['LSsearch'][$LSobject]['recur']; $recur = $_SESSION['LSsession']['LSsearch'][$LSobject]['recur'];
if ($recur) { if ($recur) {
$topDn = $GLOBALS['LSsession'] -> topDn; $topDn = LSsession :: getTopDn();
} }
else { else {
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn; $topDn = $object -> config['container_dn'].','.LSsession :: getTopDn();
} }
$approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx']; $approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx'];
$orderby = $_SESSION['LSsession']['LSsearch'][$LSobject]['orderby']; $orderby = $_SESSION['LSsession']['LSsearch'][$LSobject]['orderby'];
@ -192,7 +190,7 @@ if($LSsession -> startLSsession()) {
} }
else { else {
$filter = NULL; $filter = NULL;
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn; $topDn = $object -> config['container_dn'].','.LSsession :: getTopDn();
$params = array('scope' => 'one'); $params = array('scope' => 'one');
$pattern = false; $pattern = false;
$recur = false; $recur = false;
@ -200,8 +198,8 @@ if($LSsession -> startLSsession()) {
$orderby = false; $orderby = false;
$_REQUEST['orderby']=$GLOBALS['LSobjects'][$LSobject]['orderby']; $_REQUEST['orderby']=$GLOBALS['LSobjects'][$LSobject]['orderby'];
$ordersense = 'ASC'; $ordersense = 'ASC';
$subDnLdapServer = $GLOBALS['LSsession'] -> getSubDnLdapServer(); $subDnLdapServer = LSsession :: getSubDnLdapServer();
$doSubDn = (($subDnLdapServer)&&(!$GLOBALS['LSsession']->isSubDnLSobject($LSobject))); $doSubDn = (($subDnLdapServer)&&(!LSsession :: isSubDnLSobject($LSobject)));
} }
if (isset($_REQUEST['LSview_search_submit'])) { if (isset($_REQUEST['LSview_search_submit'])) {
@ -232,12 +230,12 @@ if($LSsession -> startLSsession()) {
if (isset($_REQUEST['LSview_recur'])) { if (isset($_REQUEST['LSview_recur'])) {
$recur = true; $recur = true;
$params['scope'] = 'sub'; $params['scope'] = 'sub';
$topDn = $GLOBALS['LSsession'] -> topDn; $topDn = LSsession :: getTopDn();
} }
else { else {
$recur = false; $recur = false;
$params['scope'] = 'one'; $params['scope'] = 'one';
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn; $topDn = $object -> config['container_dn'].','.LSsession :: getTopDn();
} }
} }
@ -299,13 +297,13 @@ if($LSsession -> startLSsession()) {
) )
); );
if (($GLOBALS['LSsession'] -> cacheSearch()) && isset($_SESSION['LSsession']['LSsearch'][$hash]) && (!isset($_REQUEST['refresh']))) { if ((LSsession :: cacheSearch()) && isset($_SESSION['LSsession']['LSsearch'][$hash]) && (!isset($_REQUEST['refresh']))) {
// On affiche à partir du cache // On affiche à partir du cache
$searchData=$_SESSION['LSsession']['LSsearch'][$hash]; $searchData=$_SESSION['LSsession']['LSsearch'][$hash];
LSdebug('Recherche : From cache'); LSdebug('Recherche : From cache');
if(!isset($searchData['LSview_actions']['create'])) { if(!isset($searchData['LSview_actions']['create'])) {
LSdebug('Recherche : Check Create()'); LSdebug('Recherche : Check Create()');
if ($GLOBALS['LSsession'] -> canCreate($LSobject)) { if (LSsession :: canCreate($LSobject)) {
$searchData['LSview_actions']['create'] = array ( $searchData['LSview_actions']['create'] = array (
'label' => _('Nouveau'), 'label' => _('Nouveau'),
'url' => 'create.php?LSobject='.$LSobject, 'url' => 'create.php?LSobject='.$LSobject,
@ -320,7 +318,7 @@ if($LSsession -> startLSsession()) {
} }
else { // Load else { // Load
LSdebug('Recherche : Load'); LSdebug('Recherche : Load');
if ($GLOBALS['LSsession'] -> canCreate($LSobject)) { if (LSsession :: canCreate($LSobject)) {
$LSview_actions['create'] = array ( $LSview_actions['create'] = array (
'label' => _('Nouveau'), 'label' => _('Nouveau'),
'url' => 'create.php?LSobject='.$LSobject, 'url' => 'create.php?LSobject='.$LSobject,
@ -341,7 +339,7 @@ if($LSsession -> startLSsession()) {
$nbObjects=0; $nbObjects=0;
foreach($list as $objDn => $objName) { foreach($list as $objDn => $objName) {
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$objDn)) { if (LSsession :: canAccess($LSobject,$objDn)) {
$subDn_name=false; $subDn_name=false;
if ($doSubDn) { if ($doSubDn) {
$subDn_name = $object -> getSubDnName($objDn); $subDn_name = $object -> getSubDnName($objDn);
@ -377,7 +375,7 @@ if($LSsession -> startLSsession()) {
'action' => 'view' 'action' => 'view'
); );
if ($GLOBALS['LSsession'] -> canEdit($LSobject,$searchData['objectList'][$i]['dn'])) { if (LSsession :: canEdit($LSobject,$searchData['objectList'][$i]['dn'])) {
$actions[]=array( $actions[]=array(
'label' => _('Modifier'), 'label' => _('Modifier'),
'url' => 'modify.php?LSobject='.$LSobject.'&amp;dn='.$searchData['objectList'][$i]['dn'], 'url' => 'modify.php?LSobject='.$LSobject.'&amp;dn='.$searchData['objectList'][$i]['dn'],
@ -393,7 +391,7 @@ if($LSsession -> startLSsession()) {
); );
} }
if ($GLOBALS['LSsession'] -> canRemove($LSobject,$searchData['objectList'][$i]['dn'])) { if (LSsession :: canRemove($LSobject,$searchData['objectList'][$i]['dn'])) {
$actions[] = array ( $actions[] = array (
'label' => _('Supprimer'), 'label' => _('Supprimer'),
'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$searchData['objectList'][$i]['dn'], 'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$searchData['objectList'][$i]['dn'],
@ -434,7 +432,7 @@ if($LSsession -> startLSsession()) {
$GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense); $GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense);
// Mise en cache // Mise en cache
if ($GLOBALS['LSsession'] -> cacheSearch()) { if (LSsession :: cacheSearch()) {
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData; $_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
} }
@ -453,9 +451,9 @@ if($LSsession -> startLSsession()) {
$GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']); $GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']);
} // Fin Pagination } // Fin Pagination
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js'); LSsession :: addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css'); LSsession :: addCssFile('LSconfirmBox.css');
$GLOBALS['LSsession'] -> addJSscript('LSview.js'); LSsession :: addJSscript('LSview.js');
$GLOBALS['Smarty']->assign('LSview_search',array( $GLOBALS['Smarty']->assign('LSview_search',array(
'action' => $_SERVER['PHP_SELF'], 'action' => $_SERVER['PHP_SELF'],
@ -472,22 +470,22 @@ if($LSsession -> startLSsession()) {
$GLOBALS['Smarty']->assign('LSobject_list',$searchData['objectList']); $GLOBALS['Smarty']->assign('LSobject_list',$searchData['objectList']);
$GLOBALS['Smarty']->assign('LSobject_list_objecttype',$LSobject); $GLOBALS['Smarty']->assign('LSobject_list_objecttype',$LSobject);
$GLOBALS['Smarty'] -> assign('LSview_actions',$searchData['LSview_actions']); $GLOBALS['Smarty'] -> assign('LSview_actions',$searchData['LSview_actions']);
$GLOBALS['LSsession'] -> setTemplate('viewList.tpl'); LSsession :: setTemplate('viewList.tpl');
} }
} }
} }
else { else {
LSerror::addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
} }
} }
else { else {
LSerror::addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('login.tpl'); LSsession :: setTemplate('login.tpl');
} }
// Affichage des retours d'erreurs // Affichage des retours d'erreurs
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
?> ?>