- 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,7 +82,7 @@ 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 {
@ -101,8 +99,8 @@ if($LSsession -> startLSsession()) {
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('login.tpl'); LSsession :: setTemplate('login.tpl');
} }
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
?> ?>

View file

@ -76,8 +76,8 @@ $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;
@ -90,7 +90,4 @@ $GLOBALS['LSerror_code']['MAIL_01']= array (
} }
return true; return true;
} }
?>

View file

@ -56,7 +56,7 @@ $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;
} }

View file

@ -52,7 +52,7 @@ $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;
} }

View file

@ -79,7 +79,7 @@ class LSattr_html_select_list extends LSattr_html{
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

@ -85,7 +85,7 @@ class LSattr_html_select_object extends LSattr_html{
return; return;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) { if (!LSsession :: loadLSobject($conf['object_type'])) {
return; return;
} }
@ -133,7 +133,7 @@ class LSattr_html_select_object extends LSattr_html{
return; return;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) { if (!LSsession :: loadLSobject($conf['object_type'])) {
return; return;
} }

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,8 +66,8 @@ 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);

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()
@ -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']);
@ -364,7 +364,7 @@ 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;
@ -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

@ -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

@ -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

@ -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

@ -20,7 +20,7 @@
******************************************************************************/ ******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSattribute'); LSsession :: loadLSclass('LSattribute');
/** /**
* Base d'un objet ldap * Base d'un objet ldap
@ -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);
@ -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
@ -997,10 +997,11 @@ 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']);
@ -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;
} }
@ -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) {
@ -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)) {
@ -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;
} }

File diff suppressed because it is too large Load diff

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);
@ -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']();
@ -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);
@ -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é.")
@ -401,6 +403,6 @@ if (!isset($_ERRORS)) {
} }
} }
$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,12 +103,12 @@ 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 {
@ -128,8 +126,8 @@ if($LSsession -> startLSsession()) {
} }
else { else {
$GLOBALS['LSsession'] -> setTemplate('login.tpl'); LSsession :: setTemplate('login.tpl');
$GLOBALS['LSsession'] -> displayTemplate(); LSsession :: displayTemplate();
} }

View file

@ -22,22 +22,20 @@
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);
@ -50,7 +48,7 @@ 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');
@ -70,9 +68,9 @@ if($LSsession -> startLSsession()) {
} }
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,12 +313,12 @@ 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 {
@ -328,9 +326,9 @@ if($LSsession -> startLSsession()) {
} }
} }
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);
@ -151,16 +149,16 @@ if($LSsession -> startLSsession()) {
} }
} }
$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');
@ -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,7 +470,7 @@ 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');
} }
} }
} }
@ -485,9 +483,9 @@ if($LSsession -> startLSsession()) {
} }
} }
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();
?> ?>