- LdapSaisie : J'ai commencé à écrire la docummentation de LdapSaisie que

j'espère pour voir bientôt ajouté au SVN. Cela me fait mettre le doit sur
quelques problèmes de nommages, d'organisation que j'ai corrigé sur le fait :
	- Concepte de level était enfaite celui de subDn : seule le nom subDn doit
		rester.
	- Le concept de LSrights dans LSsession et config.inc.php était mal nommé.
		Il correspond plus à la définition de LSprofile en réalité. Je l'ai renommé
		ainsi.
	- Les paramètres authobject et authobject_pwdattr n'étaient pas très représentatif.
		Je les ai renommé en authObjectType et authObjectTypeAttrPwd.
- Templates : 
	-> Correction du template default dans le but de changer la couleur bleu dominante juger trop
		 flashy :). Au passage j'ai dégagé l'image de fond de #main utilisé pour colorer le menu :
		 cette méthode est moche et quitte a à faire du moche je préfère utiliser un vulgaire tableau
		 que des bidouille de ce genre.
	-> Création d'un logo pour LdapSaisie qui vient remplacer le logo Easter-Eggs utilisé jusqu'alors.
	-> Ajout d'un favicon.
- LSerror :
	-> J'ai déplacé les definitions de code d'erreur dans le contexte concerné (càd dans
		 les fichiers de définition des classes) (Feature Request #1757)
	-> J'en ai profité pour renommer les codes d'erreur avec un prefixe pour eviter les doublons
		-> J'ai donc modifié une grande partie des fichiers pour changer les codes erreurs utilisés
	-> Ajout d'une méthode getError() utilisé par getErrors()
	-> Modification de la méthode stop()
- LSformElement_password : 
 - Correction d'un bug dans la génération des mots de passe dans un	formulaire de création d'objet.
 - Ajout d'une possiblité de choisir le type de hashage du mot de passe stocké dans l'annuaire
		(Feature Request #1756)
 - Traduction des commentaires
- LSattribute : Ajout des vérifications dans les méthodes de la classe lors de l'utilisation des objets
	html et ldap.
- LSsession : 
	-> Renforcement des méthodes faisant des inclusions d'autres fichiers php.
This commit is contained in:
Benjamin Renard 2009-01-02 16:00:25 +00:00
parent 87d71e2359
commit ed5b3d97a0
37 changed files with 765 additions and 665 deletions

View file

@ -431,6 +431,9 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
'userPassword' => array (
'label' => _('Mot de passe'),
'ldap_type' => 'password',
'ldap_options' => array (
'encode' => 'md5'
),
'html_type' => 'password',
'html_options' => array(
'generationTool' => true,

View file

@ -1,276 +0,0 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
$GLOBALS['LSerror_code'] = array (
'-1' => array (
'msg' => _("Erreur inconnue!")
),
0 => array(
'msg' => "%{msg}"
),
// LSldap
1 => array (
'msg' => _("LSldap : Erreur durant la connexion au serveur LDAP (%{msg}).")
),
2 => array (
'msg' => _("LSldap : Erreur durant la recherche LDAP (%{msg}).")
),
3 => array (
'msg' => _("LSldap : Type d'objet inconnu.")
),
4 => array (
'msg' => _("LSldap : Erreur durant la récupération de l'entrée Ldap.")
),
5 => array (
'msg' => _("LSldap : Erreur durant la mise à jour de l'entrée Ldap (DN : %{dn}).")
),
6 => array (
'msg' => _("LSldap : Erreur durant la suppression des attributs vides.")
),
7 => array (
'msg' => _("LSldap : Erreur durant le changement du DN de l'objet.")
),
// LSldapObject
21 => array (
'msg' => _("LSldapObject : Type d'objet inconnu.")
),
22 => array (
'msg' => _("LSldapObject : Formulaire de mise jour inconnu par l'objet %{msg}.")
),
23 => array (
'msg' => _("LSldapObject : Aucun formulaire n'existe dans l'objet %{msg}.")
),
24 => array (
'msg' => _("LSldapObject : La fonction %{func} pour valider l'attribut %{attr} de l'objet %{obj} est inconnue.")
),
25 => array (
'msg' => _("LSldapObject : Des données de configuration sont manquant pour la validation de l'attribut %{attr} de l'objet %{obj}.")
),
26 => array (
'msg' => _("LSldapObject : Erreur de configuration : L'objet %{obj} ne possède pas d'attribut %{attr}.")
),
27 => array (
'msg' => _("LSldapObject : La fonction %{func} devant être executée avant la modification n'existe pas.")
),
28 => array (
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée avant la modification a échouée.")
),
29 => array (
'msg' => _("LSldapObject : La fonction %{func} devant être executée après la modification n'existe pas.")
),
30 => array (
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée après la modification a échouée.")
),
31 => array (
'msg' => _("LSldapObject : Il manque des informations de configuration du type d'objet %{obj} pour la création du nouveau DN.")
),
32 => array (
'msg' => _("LSldapObject : L'attribut %{attr} de l'objet n'est pas encore définis. Il est impossible de generer un nouveau DN.")
),
33 => array (
'msg' => _("LSldapObject : Sans DN, l'objet n'a put être modifié.")
),
34 => array (
'msg' => _("LSldapObject : L'attribut %{attr_depend} dépendant de l'attribut %{attr} n'existe pas.")
),
35 => array (
'msg' => _("LSldapObject : Erreur durant la suppression de %{objectname}.")
),
36 => array (
'msg' => _("LSldapObject : Erreur durant les actions avant renomage.")
),
37 => array (
'msg' => _("LSldapObject : Erreur durant les actions aprês renomage.")
),
38 => array (
'msg' => _("LSldapObject : Erreur durant les actions avant suppression.")
),
39 => array (
'msg' => _("LSldapObject : Erreur durant les actions aprês suppresion.")
),
301 => array (
'msg' => _("LSldapObject : Erreur durant les actions aprês la création. L'objet est pour autant créé.")
),
302 => array (
'msg' => _("LSldapObject : La fonction %{fonction} devant être éxecutée aprês la création de l'objet n'existe pas.")
),
303 => array (
'msg' => _("LSldapObject : Erreur durant l'exection de la fonction %{fonction} devant être éxecutée aprês la création de l'objet.")
),
304 => array (
'msg' => _("LSldapObject : La fonction %{fonction} devant être éxecutée aprês la suppression de l'objet n'existe pas.")
),
305 => array (
'msg' => _("LSldapObject : Erreur durant l'exection de la fonction %{fonction} devant être éxecutée aprês la suppression de l'objet.")
),
306 => array (
'msg' => _("LSldapObject : La fonction %{func} devant être executée après la modification de l'attribut %{attr} n'existe pas.")
),
307 => array (
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée après la modification de l'attribut %{attr} a échouée.")
),
308 => array (
'msg' => _("LSldapObject : La fonction %{func} devant être executée avant la modification de l'attribut %{attr} n'existe pas.")
),
309 => array (
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée avant la modification de l'attribut %{attr} a échouée.")
),
// LSattribute
41 => array (
'msg' => _("LSattribute : Attribut %{attr} : Type d'attribut (ldap // html) inconnu (ldap = %{ldap} | html = %{html}).")
),
42 => array (
'msg' => _("LSattribute : La fonction %{func} pour afficher l'attribut %{attr} est inconnue.")
),
43 => array (
'msg' => _("LSattribute : La règle %{rule} pour valider l'attribut %{attr} est inconnue.")
),
44 => array (
'msg' => _("LSattribute : Les données de configuration pour vérifié l'attribut %{attr} sont incorrects.")
),
45 => array (
'msg' => _("LSattribute : La fonction %{func} pour sauver l'attribut %{attr} est inconnue.")
),
46 => array (
'msg' => _("LSattribute : La valeur de l'attribut %{attr} ne peut pas être générée.")
),
47 => array (
'msg' => _("LSattribute : La valeur de l'attribut %{attr} n'a pas put être générée.")
),
48 => array (
'msg' => _("LSattribute : La génération de l'attribut %{attr} n'a pas retourné une valeur correcte.")
),
// LSattr_html
101 => array (
'msg' => _("LSattr_html : La fonction addToForm() du type html de l'attribut %{attr} n'est pas définie.")
),
102 => array (
'msg' => _("LSattr_html_select_list : Des données de configuration sont manquante pour la génération de la liste deroulante de l'attribut %{attr}.")
),
103 => array (
'msg' => _("LSattr_html_%{type} : Les données multiples ne sont pas gérés pour ce type d'attribut.")
),
// LSform
201 => array(
'msg' => _("LSform : Erreur durant la recupération des valeurs du formulaire.")
),
202 => array(
'msg' => _("LSform : Erreur durant la récupération de la valeur du formulaire du champ '%{element}'.")
),
203 => array(
'msg' => _("LSform : Les données du champ %{element} ne sont pas valides.")
),
204 => array(
'msg' => _("LSform : Le champ %{element} n'existe pas.")
),
205 => array(
'msg' => _("LSfom : Type de champ inconnu (%{type}).")
),
206 => array(
'msg' => _("LSform : Erreur durant la création de l'élement '%{element}'.")
),
207 => array(
'msg' => _("LSform : Aucune valeur de rentrée pour le champs '%{element}'.")
),
801 => array(
'msg' => _("LSformRule : Aucune regex n'a été fournis pour la validation des données.")
),
// functions
901 => array (
'msg' => _("Functions 'getFData' : La methode %{meth} de l'objet %{obj} n'existe pas.")
),
// LSsession
1001 => array (
'msg' => _("LSsession : La constante %{const} n'est pas définie.")
),
1002 => array (
'msg' => _("LSsession : Le support %{addon} n'est pas assuré. Vérifier la compatibilité du système et la configuration de l'addon")
),
1003 => array (
'msg' => _("LSsession : Données de configuration du serveur LDAP invalide. Impossible d'établir une connexion.")
),
1004 => array (
'msg' => _("LSsession : Impossible de charger l'objets de type %{type} : type inconnu.")
),
1005 => array (
'msg' => _("LSsession : Impossible d'effecture l'authentification : Type d'objet d'authentification inconnu (%{type}).")
),
1006 => array (
'msg' => _("LSsession : Identifiant ou mot de passe incorrect.")
),
1007 => array (
'msg' => _("LSsession : Impossible de vous identifier : Duplication d'authentité.")
),
1008 => array (
'msg' => _("LSsession : Impossible d'inclure le moteur de rendu Smarty.")
),
1009 => array (
'msg' => _("LSsession : Impossible de se connecter au Serveur LDAP.")
),
1010 => array (
'msg' => _("LSsession : Impossible de charger la classe des objets d'authentification.")
),
1011 => array (
'msg' => _("LSsession : Vous n'êtes pas authorisé à effectuer cette action.")
),
1012 => array (
'msg' => _("LSsession : Des informations sont manquantes pour l'affichage de cette page.")
),
1013 => array (
'msg' => _("LSrelations : La fonction de listage pour la relation %{relation} est inconnu.")
),
1014 => array (
'msg' => _("LSrelations : La fonction de mise à jour pour la relation %{relation} est inconnu.")
),
1015 => array (
'msg' => _("LSrelations : Une erreur s'est produite durant la mise a jour de la relation %{relation}.")
),
1016 => array (
'msg' => _("LSrelations : L'objet %{LSobject} de la relation %{relation} est inconnu.")
),
1017 => array (
'msg' => _("LSsession : Impossible de créer correctement la liste des niveaux. Vérifier la configuration.")
),
1018 => array (
'msg' => _("LSsession : La récupération de mot de passe est désactivée pour ce serveur LDAP.")
),
1019 => array (
'msg' => _("LSsession : Des informations sont manquantes pour la récupération de votre mot de passe. Contactez l'administrateur du systême.")
),
1020 => array (
'msg' => _("LSsession : Erreur durant la récupération de votre mot de passe. Contactez l'administrateur du systême.")
),
1021 => array (
'msg' => _("LSrelation : Des paramètres sont manquants dans l'invocation des méthodes de manipulations de relations standarts (Méthode : %{meth}).")
),
1022 => array(
'msg' => _("LSsession : problème durant l'initialisation.")
)
);
?>

View file

@ -25,7 +25,7 @@ $GLOBALS['LSconfig'] = array(
'NetLDAP2' => '/usr/share/php/Net/LDAP2.php',
'Smarty' => '/var/www/tmp/Smarty-2.6.18/libs/Smarty.class.php',
'lang' => 'fr_FR.UTF8',
'cacheLSrights' => true,
'cacheLSprofiles' => true,
'cacheSubDn' => true,
'cacheSearch' => true,
'ldap_servers' => array (
@ -43,7 +43,7 @@ $GLOBALS['LSconfig'] = array(
'filter' => '(objectClass=*)',
'scope' => 'sub'
),
'LSrights' => array (
'LSprofiles' => array (
'admin' => array (
'o=ls' => array (
'uid=eeggs,ou=people,o=ls' => NULL
@ -68,9 +68,9 @@ $GLOBALS['LSconfig'] = array(
)
)
),
'cacheLSrights' => true,
'cacheLSprofiles' => true,
'cacheSearch' => true,
'authobject' => 'LSeepeople',
'authObjectType' => 'LSeepeople',
'authobject_pwdattr' => 'userPassword',
'LSaccess' => array(
'LSeepeople',
@ -89,11 +89,7 @@ $GLOBALS['LSconfig'] = array(
'msg' => "Votre nouveau mot de passe : %{mdp}"
)
),
'emailSender' => 'noreply@ls.com',
'LSobjects' => array (
'LSeepeople',
'LSeegroup'
)
'emailSender' => 'noreply@ls.com'
),
array (
'name' => 'LSexample - multi-sociétés',
@ -109,7 +105,7 @@ $GLOBALS['LSconfig'] = array(
'filter' => '(objectClass=*)',
'scope' => 'sub'
),
'LSrights' => array(
'LSprofiles' => array(
'admin' => array (
'o=ls' => array (
'uid=eeggs,ou=people,o=ls' => NULL,
@ -120,8 +116,8 @@ $GLOBALS['LSconfig'] = array(
)
)
),
'authobject' => 'LSeepeople',
'levelLabel' => _('Société'),
'authObjectType' => 'LSeepeople',
'subDnLabel' => _('Société'),
'subDn' => array(
'== Toutes ==' => array(
'dn' => 'o=ls',
@ -140,9 +136,9 @@ $GLOBALS['LSconfig'] = array(
)
)
),
'cacheLSrights' => true,
'cacheLSprofiles' => true,
'cacheSearch' => true,
'authobject_pwdattr' => 'userPassword',
'authObjectTypeAttrPwd' => 'userPassword',
'recoverPassword' => array(
'mailAttr' => 'mail',
'passwordAttr' => 'userPassword',
@ -157,12 +153,7 @@ $GLOBALS['LSconfig'] = array(
'msg' => "Votre nouveau mot de passe : %{mdp}"
)
),
'emailSender' => 'noreply@lsexample.net',
'LSobjects' => array (
'LSeepeople',
'LSeegroup',
'LSeecompany'
)
'emailSender' => 'noreply@lsexample.net'
)
)
);

View file

@ -89,15 +89,15 @@ if($LSsession -> startLSsession()) {
$form -> display();
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(21);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_01');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}

View file

@ -5,7 +5,7 @@ div.LSformElement_image {
float: right;
clear: both;
margin: 2em;
background-color: #52bce5;
background-color: #0072B8;
width: 160px;
padding: 5px;
text-align: center;
@ -16,6 +16,7 @@ img.LSformElement_image {
width: 150px;
border: 1px solid #fff;
margin: 5px;
background-color: #fff;
}
div.LSformElement_image_errors {

View file

@ -31,12 +31,6 @@ a img {
border: none;
}
hr {
visibility: hidden;
clear: both;
height: 0px;
}
.btn {
cursor: pointer;
margin: 2px;
@ -47,27 +41,32 @@ hr {
*/
#main {
width: 1000px;
height: 600px;
margin: auto;
border: 1px solid #52bce5;
background: #fff url(../../images/default/fd_menu.png) repeat-y scroll left top;
min-height: 500px;
border: 1px solid #0072b8;
border-collapse: collapse;
}
#left {
float: left;
vertical-align: top;
background-color: #0072b8;
width: 160px;
}
#right {
margin: 0;
float: left;
width: 840px;
vertical-align: top;
}
#logo {
margin: auto;
width: 142px;
margin-left: 9px;
margin-top: 9px;
background-color: #fff;
border: 1px solid #0072b8;
-moz-border-radius: 15px;
padding-top: 30px;
padding-bottom: 30px;
}
#status {
@ -76,8 +75,10 @@ hr {
font-size: 0.7em;
color: #fff;
text-align: right;
background-color: #52bce5;
background-color: #0072b8;
padding: 0.3em;
height: 1em;
vertical-align: top;
}
#user_name {
@ -125,7 +126,7 @@ a.menu {
table.LSobject-list {
margin-left: 1em;
margin-top: 0.5em;
border: 1px solid #52bce5;
border: 1px solid #0072b8;
width: 805px;
border-collapse: collapse;
clear: both;
@ -135,7 +136,7 @@ table.LSobject-list {
* th
*/
th.LSobject-list {
background-color: #52bce5;
background-color: #0072b8;
color: #fff;
}
@ -169,7 +170,7 @@ tr.LSobject-list-bis {
* td
*/
td.LSobject-list {
border: 1px solid #52bce5;
border: 1px solid #0072b8;
padding: 0.1em;
}
@ -211,7 +212,7 @@ p.LSobject-list-page {
}
a.LSobject-list-page {
color: #52bce5;
color: #0072b8;
text-decoration: none;
}
@ -298,6 +299,6 @@ input[type='text'].LSview_search {
input[type='submit'].LSview_search {
border: 1px solid #0072b8;
width: 8em;
background-color: #52bce5;
background-color: #0072b8;
color: #fff;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

@ -80,12 +80,12 @@ class LSattr_html {
*/
function addToForm (&$form,$idForm,$data=NULL) {
if (!$this -> LSformElement_type) {
$GLOBALS['LSerror'] -> addErrorCode(101,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSattr_html_01',$this -> name);
return;
}
$element=$form -> addElement($this -> LSformElement_type, $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return;
}
if ($data) {
@ -106,4 +106,15 @@ class LSattr_html {
}
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['LSattr_html_01'] = array (
'msg' => _("LSattr_html : The method addToForm() of the HTML type of the attribute %{attr} is not defined.")
);
// 02 : not yet used
$GLOBALS['LSerror_code']['LSattr_html_03'] = array (
'msg' => _("LSattr_html_%{type} : The multiple data are not supported for this field type.")
);
?>

View file

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

View file

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

View file

@ -37,15 +37,11 @@ class LSattr_html_select_list extends LSattr_html{
* @retval LSformElement L'element du formulaire ajouté
*/
function addToForm (&$form,$idForm,$data=NULL) {
/*if (count($data)>1) {
$GLOBALS['LSerror'] -> addErrorCode(103,'select_list');
return;
}*/
$possible_values=$this -> getPossibleValues();
$this -> config['text_possible_values'] = $possible_values;
$element=$form -> addElement('select', $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return;
}
if ($data) {
@ -80,11 +76,10 @@ class LSattr_html_select_list extends LSattr_html{
foreach($this -> config['possible_values'] as $val_name => $val) {
if($val_name=='OTHER_OBJECT') {
if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) {
$GLOBALS['LSerror'] -> addErrorCode(102,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_list_01',$this -> name);
break;
}
if (!$GLOBALS['LSsession'] -> loadLSobject($val['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$val['object_type']);
return;
}
$obj = new $val['object_type']();
@ -129,4 +124,10 @@ class LSattr_html_select_list extends LSattr_html{
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['LSattr_html_select_list_01'] = array (
'msg' => _("LSattr_html_select_list : Configuration data are missing to generate the select list of the attribute %{attr}.")
);
?>

View file

@ -40,7 +40,7 @@ class LSattr_html_select_object extends LSattr_html{
$this -> config['attrObject'] = $this;
$element=$form -> addElement('select_object', $this -> name, $this -> config['label'],$this -> config,$this);
if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return;
}
if ($data) {
@ -81,12 +81,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(102,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_object_01',$this -> name);
return;
}
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$conf['object_type']);
return;
}
@ -130,12 +129,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(102,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_object_01',$this -> name);
return;
}
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$conf['object_type']);
return;
}
@ -194,4 +192,11 @@ class LSattr_html_select_object extends LSattr_html{
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['LSattr_html_select_object_01'] = array (
'msg' => _("LSattr_html_select_object : LSobject type is undefined (attribute : %{attr}).")
);
?>

View file

@ -21,7 +21,7 @@
******************************************************************************/
/**
* Type d'attribut Ldap password
* Ldap attribute type password
*
*/
class LSattr_ldap_password extends LSattr_ldap {
@ -29,34 +29,107 @@ class LSattr_ldap_password extends LSattr_ldap {
var $clearPassword = NULL;
/**
* Retourne la valeur d'affichage de l'attribut après traitement lié à son type ldap
* Return the display value of this attribute
*
* @param[in] $data mixed La valeur de l'attribut
* @param[in] $data mixed The value of this attribute
*
* @retval mixed La valeur d'affichage de l'attribut
* @retval mixed The display value of this attribute
*/
function getDisplayValue($data) {
return '********';
}
/**
* Retourne la valeur de l'attribut après traitement lié à son type ldap
* Return the value of this attribute to be stocked
*
* @param[in] $data mixed La valeur de l'attribut
* Note : Password encoding was strongly inspired of the project phpLdapAdmin.
* URL : http://phpldapadmin.sourceforge.net/
*
* @retval mixed La valeur traitée de l'attribut
* @param[in] $data mixed The attribute value
*
* @retval mixed The value of this attribute to be stocked
*/
function getUpdateData($data) {
$this -> clearPassword = $data[0];
return '{CRYPT}'.crypt($data[0],'$1$'.$this -> getSalt().'$');
if (!$this -> config['ldap_options']['encode']) {
$this -> config['ldap_options']['encode'] = 'md5crypt';
}
switch($this -> config['ldap_options']['encode']) {
case 'crypt':
if ($this -> config['ldap_options']['no_random_crypt_salt']) {
return '{CRYPT}' . crypt($this -> clearPassword,substr($this -> clearPassword,0,2));
}
else {
return '{CRYPT}' . crypt($this -> clearPassword,$this -> getSalt(2));
}
break;
case 'ext_des':
if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 ) {
$GLOBALS['LSerror'] -> addErrorCode(1023,'ext_des');
}
else {
return '{CRYPT}' . crypt( $this -> clearPassword, '_' . $this -> getSalt(8) );
}
break;
case 'blowfish':
if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 ) {
$GLOBALS['LSerror'] -> addErrorCode(1023,'blowfish');
}
else {
return '{CRYPT}' . crypt( $this -> clearPassword, '$2a$12$' . $this -> getSalt(13) );
}
break;
case 'sha':
if( function_exists('sha1') ) {
return '{SHA}' . base64_encode( pack( 'H*' , sha1( $this -> clearPassword ) ) );
}
elseif( function_exists( 'mhash' ) ) {
return '{SHA}' . base64_encode( mhash( MHASH_SHA1, $this -> clearPassword ) );
} else {
$GLOBALS['LSerror'] -> addErrorCode(1023,'sha');
}
break;
case 'ssha':
if( function_exists( 'mhash' ) && function_exists( 'mhash_keygen_s2k' ) ) {
mt_srand( (double) microtime() * 1000000 );
$salt = mhash_keygen_s2k( MHASH_SHA1, $this -> clearPassword, substr( pack( "h*", md5( mt_rand() ) ), 0, 8 ), 4 );
return "{SSHA}".base64_encode( mhash( MHASH_SHA1, $this -> clearPassword.$salt ).$salt );
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1023,'ssha');
}
break;
case 'smd5':
if( function_exists( 'mhash' ) && function_exists( 'mhash_keygen_s2k' ) ) {
mt_srand( (double) microtime() * 1000000 );
$salt = mhash_keygen_s2k( MHASH_MD5, $password_clear, substr( pack( "h*", md5( mt_rand() ) ), 0, 8 ), 4 );
return "{SMD5}".base64_encode( mhash( MHASH_MD5, $password_clear.$salt ).$salt );
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1023,'smd5');
}
break;
case 'md5':
return '{MD5}' . base64_encode( pack( 'H*' , md5( $this -> clearPassword ) ) );
break;
case 'md5crypt':
if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 ) {
$GLOBALS['LSerror'] -> addErrorCode(1023,'md5crypt');
}
else {
return '{CRYPT}'.crypt($this -> clearPassword,'$1$'.$this -> getSalt().'$');
}
break;
}
return $this -> clearPassword;
}
/**
* Retourne une salt (chaine de caractère aléatoire) de la longueur passée en paramètre
* Return salt (random string)
*
* @param[in] integer La longueur de la salt (par defaut : 8)
* @param[in] integer Number of caracters in this salt
*
* @retval string La salt
* @retval string A salt
*/
function getSalt($length=8) {
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
@ -69,13 +142,19 @@ class LSattr_ldap_password extends LSattr_ldap {
}
/**
* Retourne le mot de passe en texte clair
* Return the password in clear text
*
* @retval string Le mot de passe en texte clair
* @retval string The password in clear text
*/
function getClearPassword() {
return $this -> clearPassword;
}
}
/**
* Error Codes
**/
$GLOBALS['LSerror_code'][1023] = array(
'msg' => _("LSattr_ldap_password : Encoding type %{type} is not supported. This password will be stocked in clear text.")
);
?>

View file

@ -73,7 +73,7 @@ class LSattribute {
$this -> ldap = new $ldap_type($name,$config,$this);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(41,array('attr' => $name,'html'=>$config['html_type'],'ldap'=>$config['ldap_type']));
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_01',array('attr' => $name,'html'=>$config['html_type'],'ldap'=>$config['ldap_type']));
return;
}
return true;
@ -91,6 +91,10 @@ class LSattribute {
*/
function getLabel() {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
return $this -> html -> getLabel();
}
@ -153,6 +157,10 @@ class LSattribute {
* @retval string La valeur d'affichage de l'attribut
*/
function getDisplayValue() {
if (!$this -> ldap) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
return;
}
$data = $this -> ldap -> getDisplayValue($this -> data);
if ($this -> config['onDisplay']) {
if (is_array($this -> config['onDisplay'])) {
@ -162,7 +170,7 @@ class LSattribute {
$result=$func($result);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(42,array('attr' => $this->name,'func' => $func));
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func));
return;
}
}
@ -173,7 +181,7 @@ class LSattribute {
return $this -> config['onDisplay']($data);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(42,array('attr' => $this->name,'func' => $this -> config['onDisplay']));
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $this -> config['onDisplay']));
return;
}
}
@ -182,7 +190,7 @@ class LSattribute {
}
/**
* Ajoute l'attribut au formualaire
* Ajoute l'attribut au formulaire
*
* Cette méthode ajoute l'attribut au formulaire $form si l'identifiant de celui-ci
* ($idForm) est connu dans la configuration de l'objet.
@ -198,6 +206,10 @@ class LSattribute {
*/
function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) {
if(isset($this -> config['form'][$idForm])) {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
if($this -> myRights() == 'n') {
return true;
}
@ -213,7 +225,7 @@ class LSattribute {
$element = $this -> html -> addToForm($form,$idForm,$data);
if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
}
if($this -> config['required']==1) {
@ -228,7 +240,7 @@ class LSattribute {
if(is_array($this -> config['check_data'])) {
foreach ($this -> config['check_data'] as $rule => $rule_infos) {
if((!$form -> isRuleRegistered($rule))&&($rule!='')) {
$GLOBALS['LSerror'] -> addErrorCode(43,array('attr' => $this->name,'rule' => $rule));
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_03',array('attr' => $this->name,'rule' => $rule));
return;
}
if(!isset($rule_infos['msg']))
@ -239,7 +251,7 @@ class LSattribute {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(44,$this->name);
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_04',$this->name);
}
}
}
@ -301,6 +313,10 @@ class LSattribute {
*/
function addToView(&$form) {
if((isset($this -> config['view'])) && ($this -> myRights() != 'n') ) {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
if($this -> data !='') {
$data=$this -> getFormVal();
}
@ -309,7 +325,7 @@ class LSattribute {
}
$element = $this -> html -> addToForm($form,'view',$data);
if(!$element instanceof LSformElement) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
$GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return;
}
$element -> freeze();
@ -330,6 +346,10 @@ class LSattribute {
*/
function refreshForm(&$form,$idForm) {
if(isset($this -> config['form'][$idForm])&&($this -> myRights()!='n')) {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
$form_element = $form -> getElement($this -> name);
if ($form_element) {
$values = $this -> html -> refreshForm($this -> getFormVal());
@ -484,7 +504,7 @@ class LSattribute {
$result=$func($result);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(45,array('attr' => $this->name,'func' => $func));
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func));
return;
}
}
@ -494,14 +514,20 @@ class LSattribute {
$result = $this -> config['onSave']($data);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(45,array('attr' => $this->name,'func' => $this -> config['onSave']));
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $this -> config['onSave']));
return;
}
}
}
else {
if (!$this -> ldap) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
return;
}
else {
$result = $this -> ldap -> getUpdateData($data);
}
}
$this -> _finalUpdateData = $result;
return $result;
}
@ -657,4 +683,35 @@ class LSattribute {
}
/**
* Error Codes
**/
$GLOBALS['LSerror_code']['LSattribute_01'] = array (
'msg' => _("LSattribute : Attribute %{attr} : LDAP or HTML types unknow (LDAP = %{ldap} & HTML = %{html}).")
);
$GLOBALS['LSerror_code']['LSattribute_02'] = array (
'msg' => _("LSattribute : The function %{func} to display the attribute %{attr} is unknow.")
);
$GLOBALS['LSerror_code']['LSattribute_03'] = array (
'msg' => _("LSattribute : The rule %{rule} to validate the attribute %{attr} is unknow.")
);
$GLOBALS['LSerror_code']['LSattribute_04'] = array (
'msg' => _("LSattribute : Configuration data to verify the attribute %{attr} are incorrect.")
);
$GLOBALS['LSerror_code']['LSattribute_05'] = array (
'msg' => _("LSattribute : The function %{func} to save the attribute %{attr} is unknow.")
);
$GLOBALS['LSerror_code']['LSattribute_06'] = array (
'msg' => _("LSattribute : The value of the attribute %{attr} can't be generated.")
);
$GLOBALS['LSerror_code']['LSattribute_07'] = array (
'msg' => _("LSattribute : Generation of the attribute %{attr} failed.")
);
$GLOBALS['LSerror_code']['LSattribute_08'] = array (
'msg' => _("LSattribute : Generation of the attribute %{attr} did not return a correct value.")
);
$GLOBALS['LSerror_code']['LSattribute_09'] = array (
'msg' => _("LSattribute : The attr_%{type} of the attribute %{name} is not yet defined.")
);
?>

View file

@ -58,36 +58,42 @@ class LSerror {
$this -> errors[]=array($code,$msg);
}
/**
* Affiche les erreurs et arrête l'execution du code
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retval void
*/
function stop(){
$this -> display();
exit(1);
}
/**
* Affiche les erreurs
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $return boolean True pour que le texte d'erreurs soit retourné
*
* @retval void
*/
function display() {
function display($return=False) {
$errors = $this -> getErrors();
if ($errors) {
if ($return) {
return $errors;
}
$GLOBALS['Smarty'] -> assign('LSerrors',$errors);
}
/*if(!empty($this -> errors)) {
print "<h3>"._('Erreurs')."</h3>\n";
foreach ($this -> errors as $error) {
echo "(Code ".$error[0].") ".getFData($GLOBALS['LSerror_code'][$error[0]]['msg'],$error[1])."<br />\n";
}
}*/
/**
* Print errors and stop LdapSaisie
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $code Error code (Goto : addErrorCode())
* @param[in] $msg Error msg (Goto : addErrorCode())
*
* @retval void
*/
function stop($code=-1,$msg='') {
if(!empty($this -> errors)) {
print "<h1>"._('Errors')."</h1>\n";
print $this -> display(true);
}
print "<h1>"._('Stop')."</h1>\n";
exit ($this -> getError(array($code,$msg)));
}
/**
@ -100,13 +106,24 @@ class LSerror {
function getErrors() {
if(!empty($this -> errors)) {
foreach ($this -> errors as $error) {
$txt.="(Code ".$error[0].") ".getFData($GLOBALS['LSerror_code'][$error[0]]['msg'],$error[1])."<br />\n";
$txt.=$this -> getError($error);
}
return $txt;
}
return;
}
/**
* Retourne le texte d'une erreur
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retvat string Le texte des erreurs
*/
function getError($error) {
return "(Code ".$error[0].") ".getFData($GLOBALS['LSerror_code'][$error[0]]['msg'],$error[1])."<br />\n";
}
/**
* Définir si il y a des erreurs
*
@ -119,4 +136,14 @@ class LSerror {
}
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['-1'] = array (
'msg' => _("Unknow error!")
);
$GLOBALS['LSerror_code'][0] = array (
'msg' => "%{msg}"
);
?>

View file

@ -219,7 +219,7 @@ class LSform {
return;
if ($this -> isSubmit()) {
if (!$this -> getPostData()) {
$GLOBALS['LSerror'] -> addErrorCode(201);
$GLOBALS['LSerror'] -> addErrorCode('LSform_01');
return;
}
$this -> setValuesFromPostData();
@ -343,7 +343,7 @@ class LSform {
function getPostData() {
foreach($this -> elements as $element_name => $element) {
if( !($element -> getPostData($this -> _postData)) ) {
$GLOBALS['LSerror'] -> addErrorCode(202,$element_name);
$GLOBALS['LSerror'] -> addErrorCode('LSform_02',$element_name);
return;
}
}
@ -366,7 +366,7 @@ class LSform {
$elementType='LSformElement_'.$type;
$GLOBALS['LSsession'] -> loadLSclass($elementType);
if (!class_exists($elementType)) {
$GLOBALS['LSerror'] -> addErrorCode(205,array('type' => $type));
$GLOBALS['LSerror'] -> addErrorCode('LSform_05',array('type' => $type));
return;
}
$element=$this -> elements[$name] = new $elementType($this,$name,$label,$params,$attr_html);
@ -375,7 +375,7 @@ class LSform {
}
else {
unset ($this -> elements[$name]);
$GLOBALS['LSerror'] -> addErrorCode(206,array('element' => $name));
$GLOBALS['LSerror'] -> addErrorCode('LSform_06',array('element' => $name));
return;
}
}
@ -401,12 +401,12 @@ class LSform {
return true;
}
else {
$GLOBALS['LSerror'] -> addErrorCode(43,array('attr' => $element,'rule'=>$rule));
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule));
return;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(204,array('element' => $element));
$GLOBALS['LSerror'] -> addErrorCode('LSform_04',array('element' => $element));
return;
}
}
@ -519,4 +519,31 @@ class LSform {
}
/**
* Error Codes
*/
$GLOBALS['LSerror_code']['LSform_01'] = array(
'msg' => _("LSform : Error during the recovery of the values of the form.")
);
$GLOBALS['LSerror_code']['LSform_02'] = array(
'msg' => _("LSform : Error durring the recovery of the value of the field '%{element}'.")
);
// No longer used
/*$GLOBALS['LSerror_code'][203] = array(
'msg' => _("LSform : Data of the field %{element} are not validate.")
);*/
$GLOBALS['LSerror_code']['LSform_04'] = array(
'msg' => _("LSform : The field %{element} doesn't exist.")
);
$GLOBALS['LSerror_code']['LSform_05'] = array(
'msg' => _("LSfom : Field type unknow (%{type}).")
);
$GLOBALS['LSerror_code']['LSform_06'] = array(
'msg' => _("LSform : Error during the creation of the element '%{element}'.")
);
// No longer used
/*$GLOBALS['LSerror_code'][207] = array(
'msg' => _("LSform : No value has been entered into the field '%{element}'.")
);*/
?>

View file

@ -149,9 +149,6 @@ class LSformElement_select_object extends LSformElement {
return $ret;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$this -> params['selectable_object']['object_type']);
}
}
return array();
}

View file

@ -50,4 +50,10 @@ class LSformRule {
}
}
/**
* Error Codes
**/
$GLOBALS['LSerror_code']['LSformRule_01'] = array (
'msg' => _("LSformRule_%{type} : Parameter %{param} is not found.")
);
?>

View file

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

View file

@ -39,7 +39,7 @@ class LSformRule_maxlength extends LSformRule {
*/
function validate ($value,$options,$formElement) {
if(!isset($options['params']['limit'])) {
$GLOBALS['LSerror'] -> addErrorCode(302);
$GLOBALS['LSerror'] -> addErrorCode('LSformRule_01',array('type' => 'maxlength', 'param' => 'limit');
return;
}
return (strlen($value)<=$options['params']['limit']);

View file

@ -39,7 +39,7 @@ class LSformRule_minlength extends LSformRule {
*/
function validate ($value,$options,$formElement) {
if(!isset($options['params']['limit'])) {
$GLOBALS['LSerror'] -> addErrorCode(302);
$GLOBALS['LSerror'] -> addErrorCode('LSformRule_01',array('type' => 'minlength', 'param' => 'limit');
return;
}
return (strlen($value)>=$options['params']['limit']);

View file

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

View file

@ -43,7 +43,7 @@ class LSformRule_regex extends LSformRule {
$regex=$option['params']['regex'];
}
else {
$GLOBALS['LSerror'] -> addErrorCode(801);
$GLOBALS['LSerror'] -> addErrorCode('LSformRule_regex_01');
return;
}
}
@ -58,4 +58,11 @@ class LSformRule_regex extends LSformRule {
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['LSformRule_regex_01'] = array(
'msg' => _("LSformRule_regex : Regex has not been configured to validate data.")
);
?>

View file

@ -63,7 +63,7 @@ class LSldap {
function connect() {
$this -> cnx = Net_LDAP2::connect($this -> config);
if (Net_LDAP2::isError($this -> cnx)) {
$GLOBALS['LSerror'] -> addErrorCode(1,$this -> cnx -> getMessage());
$GLOBALS['LSerror'] -> addErrorCode('LSldap_01',$this -> cnx -> getMessage());
$this -> cnx = NULL;
return;
}
@ -105,7 +105,7 @@ class LSldap {
function search ($filter,$basedn=NULL,$params = array()) {
$ret = $this -> cnx -> search($basedn,$filter,$params);
if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(2,$ret -> getMessage());
$GLOBALS['LSerror'] -> addErrorCode('LSldap_02',$ret -> getMessage());
return;
}
$retInfos=array();
@ -136,7 +136,7 @@ class LSldap {
$filter=NULL;
$ret = $this -> cnx -> search($basedn,$filter,$params);
if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(2,$ret -> getMessage());
$GLOBALS['LSerror'] -> addErrorCode('LSldap_02',$ret -> getMessage());
return;
}
return $ret -> count();
@ -212,7 +212,7 @@ class LSldap {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(3);
$GLOBALS['LSerror'] -> addErrorCode('LSldap_03');
return;
}
}
@ -299,7 +299,7 @@ class LSldap {
}
if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(5,$dn);
$GLOBALS['LSerror'] -> addErrorCode('LSldap_05',$dn);
$GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
}
else {
@ -316,7 +316,7 @@ class LSldap {
}
$ret = $entry -> update();
if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(6);
$GLOBALS['LSerror'] -> addErrorCode('LSldap_06');
$GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
}
}
@ -324,7 +324,7 @@ class LSldap {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(4);
$GLOBALS['LSerror'] -> addErrorCode('LSldap_04');
return;
}
}
@ -386,7 +386,7 @@ class LSldap {
function move($old,$new) {
$ret = $this -> cnx -> move($old,$new);
if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(7);
$GLOBALS['LSerror'] -> addErrorCode('LSldap_07');
$GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
return;
}
@ -394,4 +394,28 @@ class LSldap {
}
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['LSldap_01'] = array (
'msg' => _("LSldap : Error during the LDAP server connection (%{msg}).")
);
$GLOBALS['LSerror_code']['LSldap_02'] = array (
'msg' => _("LSldap : Error during the LDAP search (%{msg}).")
);
$GLOBALS['LSerror_code']['LSldap_03'] = array (
'msg' => _("LSldap : Object type unkown.")
);
$GLOBALS['LSerror_code']['LSldap_04'] = array (
'msg' => _("LSldap : Error during fecthing the LDAP entry.")
);
$GLOBALS['LSerror_code']['LSldap_05'] = array (
'msg' => _("LSldap : Error during changing the LDAP entry (DN : %{dn}).")
);
$GLOBALS['LSerror_code']['LSldap_06'] = array (
'msg' => _("LSldap : Error during deleting the empty attributes.")
);
$GLOBALS['LSerror_code']['LSldap_07'] = array (
'msg' => _("LSldap : Error during changing the DN of the object.")
);
?>

View file

@ -64,7 +64,7 @@ class LSldapObject {
$this -> config = $GLOBALS['LSobjects'][$type_name];
}
else {
$GLOBALS['LSerror'] -> addErrorCode(21);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_01');
return;
}
}
@ -276,7 +276,7 @@ class LSldapObject {
if(isset($this -> forms[$idForm]))
$LSform = $this -> forms[$idForm][0];
else {
$GLOBALS['LSerror'] -> addErrorCode(22,$this -> getType());
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_02',$this -> getType());
return;
}
}
@ -289,7 +289,7 @@ class LSldapObject {
$LSform = $LSform[0];
}
else {
$GLOBALS['LSerror'] -> addErrorCode(23,$this -> getType());
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_03',$this -> getType());
return;
}
}
@ -307,12 +307,12 @@ class LSldapObject {
if(isset($this -> config['before_modify'])) {
if(function_exists($this -> config['before_modify'])) {
if(!$this -> config['before_modify']($this)) {
$GLOBALS['LSerror'] -> addErrorCode(28,$this -> config['before_modify']);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_08',$this -> config['before_modify']);
return;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(27,$this -> config['before_modify']);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_07',$this -> config['before_modify']);
return;
}
}
@ -333,12 +333,12 @@ class LSldapObject {
if((isset($this -> config['after_modify']))&&(!$this -> submitError)) {
if(function_exists($this -> config['after_modify'])) {
if(!$this -> config['after_modify']($this)) {
$GLOBALS['LSerror'] -> addErrorCode(30,$this -> config['after_modify']);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_10',$this -> config['after_modify']);
return;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(29,$this -> config['after_modify']);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_09',$this -> config['after_modify']);
return;
}
}
@ -378,17 +378,17 @@ class LSldapObject {
if ( $attr -> canBeGenerated()) {
if ($attr -> generateValue()) {
if (!$this -> validateAttrData($LSform, $attr)) {
$GLOBALS['LSerror'] -> addErrorCode(48,$attr -> getLabel());
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_08',$attr -> getLabel());
$retval = false;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(47,$attr -> getLabel());
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_07',$attr -> getLabel());
$retval = false;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(46,$attr -> getLabel());
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_06',$attr -> getLabel());
$retval = false;
}
}
@ -476,12 +476,12 @@ class LSldapObject {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(24,array('attr' => $attr->name,'obj' => $this->getType(),'func' => $test['function']));
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_04',array('attr' => $attr->name,'obj' => $this->getType(),'func' => $test['function']));
$retval = false;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(25,array('attr' => $attr->name,'obj' => $this->getType()));
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_05',array('attr' => $attr->name,'obj' => $this->getType()));
$retval = false;
}
}
@ -492,17 +492,17 @@ class LSldapObject {
if (!empty($dependsAttrs)) {
foreach($dependsAttrs as $dependAttr) {
if(!isset($this -> attrs[$dependAttr])){
$GLOBALS['LSerror'] -> addErrorCode(34,array('attr_depend' => $dependAttr, 'attr' => $attr -> getLabel()));
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_14',array('attr_depend' => $dependAttr, 'attr' => $attr -> getLabel()));
continue;
}
if($this -> attrs[$dependAttr] -> canBeGenerated()) {
if (!$this -> attrs[$dependAttr] -> generateValue()) {
$GLOBALS['LSerror'] -> addErrorCode(47,$this -> attrs[$dependAttr] -> getLabel());
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel());
$retval = false;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(46,$this -> attrs[$dependAttr] -> getLabel());
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_06',$this -> attrs[$dependAttr] -> getLabel());
$retval = false;
}
}
@ -531,7 +531,7 @@ class LSldapObject {
$new = true;
LSdebug('Rename');
if (!$this -> beforeRename()) {
$GLOBALS['LSerror'] -> addErrorCode(36);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_16');
return;
}
$oldDn = $this -> getDn();
@ -543,7 +543,7 @@ class LSldapObject {
}
$this -> dn = $newDn;
if (!$this -> afterRename($oldDn,$newDn)) {
$GLOBALS['LSerror'] -> addErrorCode(37);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_17');
return;
}
}
@ -566,14 +566,14 @@ class LSldapObject {
}
if ($new) {
if (!$this -> afterCreate()) {
$GLOBALS['LSerror'] -> addErrorCode(301);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_21');
return;
}
}
return true;
}
else {
$GLOBALS['LSerror'] -> addErrorCode(33);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_13');
return;
}
}
@ -1003,12 +1003,12 @@ class LSldapObject {
return $rdn_attr.'='.$rdn_val[0].','.$this -> config['container_dn'].','.$GLOBALS['LSsession']->topDn;
}
else {
$GLOBALS['LSerror'] -> addErrorCode(32,$this -> config['rdn']);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_12',$this -> config['rdn']);
return;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(31,$this -> getType());
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_11',$this -> getType());
return;
}
}
@ -1063,11 +1063,11 @@ class LSldapObject {
if ($this -> afterDelete()) {
return true;
}
$GLOBALS['LSerror'] -> addErrorCode(39);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_19');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(38);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_18');
}
return;
}
@ -1159,7 +1159,6 @@ class LSldapObject {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relation_conf['LSobject']);
return;
}
}
@ -1267,12 +1266,12 @@ class LSldapObject {
foreach($config as $action) {
if(function_exists($action)) {
if(!$action($this)) {
$GLOBALS['LSerror'] -> addErrorCode(305,$action);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_25',$action);
$error=true;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(304,$action);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_24',$action);
$error=true;
}
}
@ -1312,7 +1311,6 @@ class LSldapObject {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$type);
$error=1;
}
}
@ -1329,12 +1327,12 @@ class LSldapObject {
foreach($config as $action) {
if(function_exists($action)) {
if(!$action($this)) {
$GLOBALS['LSerror'] -> addErrorCode(303,$action);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_23',$action);
$error=true;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(302,$action);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_22',$action);
$error=true;
}
}
@ -1357,7 +1355,7 @@ class LSldapObject {
**/
function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'getObjectKeyValueInRelation');
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
return;
}
if ($attrValue=='dn') {
@ -1390,7 +1388,7 @@ class LSldapObject {
**/
function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'listObjectsInRelation');
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','listObjectsInRelation');
return;
}
if ($attrValue=='dn') {
@ -1422,7 +1420,7 @@ class LSldapObject {
**/
function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'addOneObjectInRelation');
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','addOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@ -1472,7 +1470,7 @@ class LSldapObject {
**/
function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'deleteOneObjectInRelation');
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','deleteOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@ -1517,7 +1515,7 @@ class LSldapObject {
*/
function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'renameOneObjectInRelation');
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','renameOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@ -1567,7 +1565,7 @@ class LSldapObject {
**/
function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'updateObjectsInRelation');
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','updateObjectsInRelation');
return;
}
$currentObjects = $this -> listObjectsInRelation($object,$attr,$objectType,$attrValue);
@ -1654,4 +1652,96 @@ class LSldapObject {
}
/**
* Error Codes
**/
$GLOBALS['LSerror_code']['LSldapObject_01'] = array (
'msg' => _("LSldapObject : Object type unknow.")
);
$GLOBALS['LSerror_code']['LSldapObject_02'] = array (
'msg' => _("LSldapObject : Update form is not defined for the object %{obj}.")
);
$GLOBALS['LSerror_code']['LSldapObject_03'] = array (
'msg' => _("LSldapObject : No form exist for the object %{obj}.")
);
$GLOBALS['LSerror_code']['LSldapObject_04'] = array (
'msg' => _("LSldapObject : The function %{func} to validate the attribute %{attr} the object %{obj} is unknow.")
);
$GLOBALS['LSerror_code']['LSldapObject_05'] = array (
'msg' => _("LSldapObject : Configuration data are missing to validate the attribute %{attr} of the object %{obj}.")
);
/* No longer used
$GLOBALS['LSerror_code'][26] = array (
'msg' => _("LSldapObject : Configuration error : The object %{obj} doesn't had attribute %{attr}.")
);
*/
$GLOBALS['LSerror_code']['LSldapObject_07'] = array (
'msg' => _("LSldapObject : The function %{func} to be executed before changing the object doesn't exist.")
);
$GLOBALS['LSerror_code']['LSldapObject_08'] = array (
'msg' => _("LSldapObject : The execution of the function %{func} to be executed before changing the object failed.")
);
$GLOBALS['LSerror_code']['LSldapObject_09'] = array (
'msg' => _("LSldapObject : The function %{func} to be executed after changing the object doesn't exist.")
);
$GLOBALS['LSerror_code']['LSldapObject_10'] = array (
'msg' => _("LSldapObject : The execution of the function %{func} to be executed after changing the object failed.")
);
$GLOBALS['LSerror_code']['LSldapObject_11'] = array (
'msg' => _("LSldapObject : Some configuration data of the object type %{obj} are missing to generate the DN of the new object.")
);
$GLOBALS['LSerror_code']['LSldapObject_12'] = array (
'msg' => _("LSldapObject : The attibute %{attr} of the object is not yet defined. Impossible to generate DN.")
);
$GLOBALS['LSerror_code']['LSldapObject_13'] = array (
'msg' => _("LSldapObject : Without DN, the object could not be changed.")
);
$GLOBALS['LSerror_code']['LSldapObject_14'] = array (
'msg' => _("LSldapObject : The attribute %{attr_depend} depending on the attribute %{attr} doesn't exist.")
);
$GLOBALS['LSerror_code']['LSldapObject_15'] = array (
'msg' => _("LSldapObject : Error during deleting the object %{objectname}.")
);
$GLOBALS['LSerror_code']['LSldapObject_16'] = array (
'msg' => _("LSldapObject : Error during actions to be executed before renaming the objet.")
);
$GLOBALS['LSerror_code']['LSldapObject_17'] = array (
'msg' => _("LSldapObject : Error during actions to be executed after renaming the objet.")
);
$GLOBALS['LSerror_code']['LSldapObject_18'] = array (
'msg' => _("LSldapObject : Error during actions to be executed before deleting the objet.")
);
$GLOBALS['LSerror_code']['LSldapObject_19'] = array (
'msg' => _("LSldapObject : Error during actions to be executed after deleting the objet.")
);
// 20 : not used
$GLOBALS['LSerror_code']['LSldapObject_21'] = array (
'msg' => _("LSldapObject : Error during the actions to be executed after creating the object. It was created anyway.")
);
$GLOBALS['LSerror_code']['LSldapObject_22'] = array (
'msg' => _("LSldapObject : The function %{func} to be generated before creating the object doesn't exist.")
);
$GLOBALS['LSerror_code']['LSldapObject_23'] = array (
'msg' => _("LSldapObject : Error during the execution of the function %{func} to be generated after deleting the object.")
);
$GLOBALS['LSerror_code']['LSldapObject_24'] = array (
'msg' => _("LSldapObject : The function %{func} to be generated after deleting the object doesn't exist.")
);
$GLOBALS['LSerror_code']['LSldapObject_25'] = array (
'msg' => _("LSldapObject : Error during the execution of the function %{func} to be generated after creating the object.")
);
/* Not yet used
$GLOBALS['LSerror_code'][306] = array (
'msg' => _("LSldapObject : The function %{func} to be executed after changing the attribute %{attr} is unknow.")
);
$GLOBALS['LSerror_code'][307] = array (
'msg' => _("LSldapObject : The execution of the function %{func} to be executed after changing the attribute %{attr} failed.")
);
$GLOBALS['LSerror_code'][308] = array (
'msg' => _("LSldapObject : The function %{func} to be executed before changing the attribute %{attr} is unknow.")
);
$GLOBALS['LSerror_code'][309] = array (
'msg' => _("LSldapObject : The execution of the function %{func} to be executed before changing the attribute %{attr} failed.")
);
*/
?>

View file

@ -42,7 +42,7 @@ class LSsession {
var $_JSconfigParams = array();
var $CssFiles = array();
var $template = NULL;
var $LSrights = array();
var $LSprofiles = array();
var $LSaccess = array();
var $tmp_file = array();
var $_subDnLdapServer = array();
@ -88,7 +88,7 @@ class LSsession {
return true;
}
else {
die($GLOBALS['LSerror_code'][1008]['msg']);
die($GLOBALS['LSerror_code']['LSsession_08']['msg']);
return;
}
return true;
@ -96,6 +96,7 @@ class LSsession {
else {
return;
}
}
/**
@ -108,8 +109,9 @@ class LSsession {
* @retval boolean true si l'initialisation a réussi, false sinon.
*/
function startLSerror() {
if(!$this -> loadLSclass('LSerror'))
if(!$this -> loadLSclass('LSerror')) {
return;
}
$GLOBALS['LSerror'] = new LSerror();
return true;
}
@ -129,7 +131,7 @@ class LSsession {
return true;
if($type!='')
$type=$type.'.';
return include_once LS_CLASS_DIR .'class.'.$type.$class.'.php';
return @include_once LS_CLASS_DIR .'class.'.$type.$class.'.php';
}
/**
@ -140,11 +142,16 @@ class LSsession {
* @retval boolean true si le chargement a réussi, false sinon.
*/
function loadLSobject($object) {
$error = 0;
$this -> loadLSclass('LSldapObject');
if (!$this -> loadLSclass($object,'LSobjects')) {
return;
$error = 1;
}
if (!require_once( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) {
$error = 1;
}
if ($error) {
$GLOBALS['LSerror'] -> addErrorCode('LSsession_04',$object);
return;
}
return true;
@ -162,7 +169,7 @@ class LSsession {
function loadLSaddon($addon) {
if(require_once LS_ADDONS_DIR .'LSaddons.'.$addon.'.php') {
if (!call_user_func('LSaddon_'. $addon .'_support')) {
$GLOBALS['LSerror'] -> addErrorCode(1002,$addon);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_02',$addon);
return;
}
return true;
@ -180,7 +187,7 @@ class LSsession {
*/
function loadLSaddons() {
if(!is_array($GLOBALS['LSaddons']['loads'])) {
$GLOBALS['LSerror'] -> addErrorCode(1001,"LSaddons['loads']");
$GLOBALS['LSerror'] -> addErrorCode('LSsession_01',"LSaddons['loads']");
return;
}
@ -230,9 +237,9 @@ class LSsession {
$this -> ldapServerId = $_SESSION['LSsession']['ldapServerId'];
$this -> tmp_file = $_SESSION['LSsession']['tmp_file'];
if ( $this -> cacheLSrights() && !isset($_REQUEST['LSsession_refresh']) ) {
if ( $this -> cacheLSprofiles() && !isset($_REQUEST['LSsession_refresh']) ) {
$this -> ldapServer = $_SESSION['LSsession']['ldapServer'];
$this -> LSrights = $_SESSION['LSsession']['LSrights'];
$this -> LSprofiles = $_SESSION['LSsession']['LSprofiles'];
$this -> LSaccess = $_SESSION['LSsession']['LSaccess'];
if (!$this -> LSldapConnect())
return;
@ -241,22 +248,21 @@ class LSsession {
$this -> setLdapServer($this -> ldapServerId);
if (!$this -> LSldapConnect())
return;
$this -> loadLSrights();
$this -> loadLSprofiles();
}
if ( $this -> cacheSudDn() && (!isset($_REQUEST['LSsession_refresh'])) ) {
$this -> _subDnLdapServer = $_SESSION['LSsession_subDnLdapServer'];
}
if (!$this -> loadLSobject($this -> ldapServer['authobject'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$this -> ldapServer['authobject']);
if (!$this -> loadLSobject($this -> ldapServer['authObjectType'])) {
return;
}
$this -> LSuserObject = new $this -> ldapServer['authobject']();
$this -> LSuserObject = new $this -> ldapServer['authObjectType']();
$this -> LSuserObject -> loadData($this -> dn);
if ( !$this -> cacheLSrights() || isset($_REQUEST['LSsession_refresh']) ) {
if ( !$this -> cacheLSprofiles() || isset($_REQUEST['LSsession_refresh']) ) {
$this -> loadLSaccess();
}
@ -296,8 +302,8 @@ class LSsession {
}
$_SESSION['LSsession_topDn']=$this -> topDn;
if ( $this -> loadLSobject($this -> ldapServer['authobject']) ) {
$authobject = new $this -> ldapServer['authobject']();
if ( $this -> loadLSobject($this -> ldapServer['authObjectType']) ) {
$authobject = new $this -> ldapServer['authObjectType']();
$find=true;
if (isset($_GET['recoveryHash'])) {
$filter=$this -> ldapServer['recoverPassword']['recoveryHashAttr']."=".$_GET['recoveryHash'];
@ -317,11 +323,11 @@ class LSsession {
if ($nbresult==0) {
// identifiant incorrect
LSdebug('identifiant incorrect');
$GLOBALS['LSerror'] -> addErrorCode(1006);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_06');
}
else if ($nbresult>1) {
// duplication d'authentité
$GLOBALS['LSerror'] -> addErrorCode(1007);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_07');
}
else {
if (isset($_GET['LSsession_recoverPassword'])) {
@ -382,24 +388,24 @@ class LSsession {
else {
// Problème durant l'envoie du mail
LSdebug("Problème durant l'envoie du mail");
$GLOBALS['LSerror'] -> addErrorCode(1020);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_20',7);
}
}
else {
// Erreur durant la mise à jour de l'objet
LSdebug("Erreur durant la mise à jour de l'objet");
$GLOBALS['LSerror'] -> addErrorCode(1020);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_20',6);
}
}
else {
// Erreur durant la validation du formulaire de modification de perte de password
LSdebug("Erreur durant la validation du formulaire de modification de perte de password");
$GLOBALS['LSerror'] -> addErrorCode(1020);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_20',5);
}
}
// 2nd étape : génération du mot de passe + envoie par mail
else {
$attr=$user -> attrs[$this -> ldapServer['authobject_pwdattr']];
$attr=$user -> attrs[$this -> ldapServer['authObjectTypeAttrPwd']];
if ($attr instanceof LSattribute) {
$mdp = generatePassword($attr -> config['html_options']['chars'],$attr -> config['html_options']['lenght']);
LSdebug('Nvx mpd : '.$mdp);
@ -407,7 +413,7 @@ class LSsession {
$lostPasswdForm -> setPostData(
array(
$this -> ldapServer['recoverPassword']['recoveryHashAttr'] => array(''),
$this -> ldapServer['authobject_pwdattr'] => array($mdp)
$this -> ldapServer['authObjectTypeAttrPwd'] => array($mdp)
)
,true
);
@ -427,35 +433,35 @@ class LSsession {
else {
// Problème durant l'envoie du mail
LSdebug("Problème durant l'envoie du mail");
$GLOBALS['LSerror'] -> addErrorCode(1020);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_20',4);
}
}
else {
// Erreur durant la mise à jour de l'objet
LSdebug("Erreur durant la mise à jour de l'objet");
$GLOBALS['LSerror'] -> addErrorCode(1020);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_20',3);
}
}
else {
// Erreur durant la validation du formulaire de modification de perte de password
LSdebug("Erreur durant la validation du formulaire de modification de perte de password");
$GLOBALS['LSerror'] -> addErrorCode(1020);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_20',2);
}
}
else {
// l'attribut password n'existe pas
LSdebug("L'attribut password n'existe pas");
$GLOBALS['LSerror'] -> addErrorCode(1020);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_20',1);
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1019);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_19');
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1018);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_18');
}
}
else {
@ -464,25 +470,25 @@ class LSsession {
$this -> LSuserObject = $result[0];
$this -> dn = $result[0]->getValue('dn');
$this -> rdn = $_POST['LSsession_user'];
$this -> loadLSrights();
$this -> loadLSprofiles();
$this -> loadLSaccess();
$GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getDisplayValue());
$_SESSION['LSsession']=get_object_vars($this);
return true;
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1006);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_06');
LSdebug('mdp incorrect');
}
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1010);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_10');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1009);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_09');
}
}
if ($this -> ldapServerId) {
@ -504,12 +510,12 @@ class LSsession {
*
* @param[in] $object Mixed L'objet Ldap du nouvel utilisateur
* le type doit correspondre à
* $this -> ldapServer['authobject']
* $this -> ldapServer['authObjectType']
*
* @retval boolean True en cas de succès, false sinon
*/
function changeAuthUser($object) {
if ($object instanceof $this -> ldapServer['authobject']) {
if ($object instanceof $this -> ldapServer['authObjectType']) {
$this -> dn = $object -> getDn();
$rdn = $object -> getValue('rdn');
if(is_array($rdn)) {
@ -518,7 +524,7 @@ class LSsession {
$this -> rdn = $rdn;
$this -> LSuserObject = $object;
if($this -> loadLSrights()) {
if($this -> loadLSprofiles()) {
$this -> loadLSaccess();
$_SESSION['LSsession']=get_object_vars($this);
return true;
@ -568,7 +574,7 @@ class LSsession {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1003);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_03');
return;
}
}
@ -582,7 +588,12 @@ class LSsession {
if ($this -> cacheSudDn() && isset($this -> _subDnLdapServer[$this -> ldapServerId])) {
return $this -> _subDnLdapServer[$this -> ldapServerId];
}
if ( is_array($this ->ldapServer['subDn']) ) {
if (!isset($this ->ldapServer['subDn'])) {
return;
}
if ( !is_array($this ->ldapServer['subDn']) ) {
return;
}
$return=array();
foreach($this ->ldapServer['subDn'] as $subDn_name => $subDn_config) {
if ($subDn_name == 'LSobject') {
@ -601,20 +612,17 @@ class LSsession {
$return=array_merge($return,$tbl_return);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1017);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_17',3);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1017);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_17',2);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name);
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1017);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_17',1);
}
}
else {
@ -629,10 +637,6 @@ class LSsession {
}
return $return;
}
else {
return;
}
}
/**
* Retourne la liste de subDn du serveur Ldap utilise
@ -893,6 +897,7 @@ class LSsession {
// Css
$this -> addCssFile("LSdefault.css");
$Css_txt='';
foreach ($this -> CssFiles as $file) {
if (!$file['path']) {
$file['path']=LS_CSS_DIR.'/';
@ -901,13 +906,15 @@ class LSsession {
}
$GLOBALS['Smarty'] -> assign('LSsession_css',$Css_txt);
if (isset($this -> LSaccess[$this -> topDn])) {
$GLOBALS['Smarty'] -> assign('LSaccess',$this -> LSaccess[$this -> topDn]);
}
// Niveau
$listTopDn = $this -> getSubDnLdapServer();
if (is_array($listTopDn)) {
asort($listTopDn);
$GLOBALS['Smarty'] -> assign('label_level',$this -> getLevelLabel());
$GLOBALS['Smarty'] -> assign('label_level',$this -> getSubDnLabel());
$GLOBALS['Smarty'] -> assign('_refresh',_('Rafraîchir'));
$LSsession_topDn_index = array();
$LSsession_topDn_name = array();
@ -999,11 +1006,15 @@ class LSsession {
*
* @retval boolean True si le chargement à réussi, false sinon.
**/
function loadLSrights() {
if (is_array($this -> ldapServer['LSrights'])) {
foreach ($this -> ldapServer['LSrights'] as $profile => $profileInfos) {
function loadLSprofiles() {
if (is_array($this -> ldapServer['LSprofiles'])) {
foreach ($this -> ldapServer['LSprofiles'] as $profile => $profileInfos) {
if (is_array($profileInfos)) {
foreach ($profileInfos as $topDn => $rightsInfos) {
/*
* If $topDn == 'LSobject', we search for each LSobject type to find
* all items on witch the user will have powers.
*/
if ($topDn == 'LSobjects') {
if (is_array($rightsInfos)) {
foreach ($rightsInfos as $LSobject => $listInfos) {
@ -1017,16 +1028,13 @@ class LSsession {
}
$list = $object -> search($filter,$listInfos['basedn'],$listInfos['params']);
foreach($list as $obj) {
$this -> LSrights[$profile][] = $obj['dn'];
$this -> LSprofiles[$profile][] = $obj['dn'];
}
}
else {
LSdebug('Impossible de créer l\'objet de type : '.$LSobject);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
}
}
}
else {
@ -1045,7 +1053,7 @@ class LSsession {
$val = $this -> LSuserObject -> getFData($valKey);
if (is_array($listDns)) {
if (in_array($val,$listDns)) {
$this -> LSrights[$profile][] = $topDn;
$this -> LSprofiles[$profile][] = $topDn;
}
}
}
@ -1057,27 +1065,24 @@ class LSsession {
LSdebug('Impossible de créer l\'objet de type : '.$conf['LSobject']);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$conf['LSobject']);
}
}
else {
if ($this -> dn == $dn) {
$this -> LSrights[$profile][] = $topDn;
$this -> LSprofiles[$profile][] = $topDn;
}
}
}
}
else {
if ( $this -> dn == $rightsInfos ) {
$this -> LSrights[$profile][] = $topDn;
$this -> LSprofiles[$profile][] = $topDn;
}
}
} // fin else ($topDn == 'LSobjects')
} // fin foreach($profileInfos)
} // fin is_array($profileInfos)
} // fin foreach LSrights
LSdebug($this -> LSrights);
} // fin foreach LSprofiles
LSdebug($this -> LSprofiles);
return true;
}
else {
@ -1112,9 +1117,6 @@ class LSsession {
$access[$type] = $GLOBALS['LSobjects'][$type]['label'];
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$type);
}
}
}
foreach($tbl as $dn => $dn_name) {
@ -1123,9 +1125,6 @@ class LSsession {
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$objectType);
}
}
}
}
@ -1139,9 +1138,6 @@ class LSsession {
$access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label'];
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name);
}
}
}
$LSaccess[$config['dn']]=$access;
@ -1158,9 +1154,6 @@ class LSsession {
$access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label'];
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name);
}
}
$LSaccess[$this -> topDn] = $access;
}
@ -1187,8 +1180,8 @@ class LSsession {
* @retval boolean True si l'utilisateur est du profil sur l'objet, false sinon.
*/
function isProfile($dn,$profile) {
if (is_array($this -> LSrights[$profile])) {
foreach($this -> LSrights[$profile] as $topDn) {
if (is_array($this -> LSprofiles[$profile])) {
foreach($this -> LSprofiles[$profile] as $topDn) {
if($dn == $topDn) {
return true;
}
@ -1210,7 +1203,7 @@ class LSsession {
function whoami($dn) {
$retval = array('user');
foreach($this -> LSrights as $profile => $infos) {
foreach($this -> LSprofiles as $profile => $infos) {
if($this -> isProfile($dn,$profile)) {
$retval[]=$profile;
}
@ -1235,7 +1228,6 @@ class LSsession {
*/
function canAccess($LSobject,$dn=NULL,$right=NULL,$attr=NULL) {
if (!$this -> loadLSobject($LSobject)) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
return;
}
if ($dn) {
@ -1498,8 +1490,8 @@ class LSsession {
*
* @retval boolean True si le cache des droits est activé, false sinon.
*/
function cacheLSrights() {
return ( ($GLOBALS['LSconfig']['cacheLSrights']) || ($this -> ldapServer['cacheLSrights']) );
function cacheLSprofiles() {
return ( ($GLOBALS['LSconfig']['cacheLSprofiles']) || ($this -> ldapServer['cacheLSprofiles']) );
}
/**
@ -1531,8 +1523,8 @@ class LSsession {
*
* @retval string Le label des niveaux pour le serveur ldap dourant
*/
function getLevelLabel() {
return ($this -> ldapServer['levelLabel']!='')?$this -> ldapServer['levelLabel']:_('Niveau');
function getSubDnLabel() {
return ($this -> ldapServer['subDnLabel']!='')?$this -> ldapServer['subDnLabel']:_('Niveau');
}
/**
@ -1651,4 +1643,79 @@ class LSsession {
}
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['LSsession_01'] = array (
'msg' => _("LSsession : The constant %{const} is not defined.")
);
$GLOBALS['LSerror_code']['LSsession_02'] = array (
'msg' => _("LSsession : The %{addon} support is uncertain. Verify system compatibility and the add-on configuration.")
);
$GLOBALS['LSerror_code']['LSsession_03'] = array (
'msg' => _("LSsession : LDAP server's configuration data are invalid. Impossible d'établir une connexion.")
);
$GLOBALS['LSerror_code']['LSsession_04'] = array (
'msg' => _("LSsession : Failed to load LSobject type %{type} : unknon type.")
);
// no longer used
/*$GLOBALS['LSerror_code'][1005] = array (
'msg' => _("LSsession : Object type use for authentication is unknow (%{type}).")
);*/
$GLOBALS['LSerror_code']['LSsession_06'] = array (
'msg' => _("LSsession : Login or password incorrect.")
);
$GLOBALS['LSerror_code']['LSsession_07'] = array (
'msg' => _("LSsession : Impossible to identify you : Duplication of identities.")
);
$GLOBALS['LSerror_code']['LSsession_08'] = array (
'msg' => _("LSsession : Can't load Smarty template engine.")
);
$GLOBALS['LSerror_code']['LSsession_09'] = array (
'msg' => _("LSsession : Can't connect to LDAP server.")
);
$GLOBALS['LSerror_code']['LSsession_10'] = array (
'msg' => _("LSsession : Impossible to load authentification objects's class.")
);
$GLOBALS['LSerror_code']['LSsession_11'] = array (
'msg' => _("LSsession : Your are not authorized to do this action.")
);
$GLOBALS['LSerror_code']['LSsession_12'] = array (
'msg' => _("LSsession : Some informations are missing to display this page.")
);
// 13 -> 16 : not yet used
$GLOBALS['LSerror_code']['LSsession_17'] = array (
'msg' => _("LSsession : Error during creation of list of levels. Contact administrators. (Code : %{code})")
);
$GLOBALS['LSerror_code']['LSsession_18'] = array (
'msg' => _("LSsession : The password recovery is disabled for this LDAP server.")
);
$GLOBALS['LSerror_code']['LSsession_19'] = array (
'msg' => _("LSsession : Some informations are missing to recover your password. Contact administrators.")
);
$GLOBALS['LSerror_code']['LSsession_20'] = array (
'msg' => _("LSsession : Error during password recovery. Contact administrators.(Step : %{step})")
);
// 21 : not yet used
$GLOBALS['LSerror_code']['LSsession_22'] = array(
'msg' => _("LSsession : problem during initialisation.")
);
// LSrelations
$GLOBALS['LSerror_code']['LSrelations_01'] = array (
'msg' => _("LSrelations : The listing function for the relation %{relation} is unknow.")
);
$GLOBALS['LSerror_code']['LSrelations_02'] = array (
'msg' => _("LSrelations : The update function of the relation %{relation} is unknow.")
);
$GLOBALS['LSerror_code']['LSrelations_03'] = array (
'msg' => _("LSrelations : Error during relation update of the relation %{relation}.")
);
$GLOBALS['LSerror_code']['LSrelations_04'] = array (
'msg' => _("LSrelations : Object type %{LSobject} unknow (Relation : %{relation}).")
);
$GLOBALS['LSerror_code']['LSrelations_05'] = array (
'msg' => _("LSrelation : Some parameters are missing in the invocation of the methods of handling relations standard (Methode : %{meth}).")
);
?>

View file

@ -89,7 +89,7 @@ function getFData($format,$data,$meth=NULL) {
$format[$i]=ereg_replace($ch[0],$value,$format[$i]);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(901,array('meth' => $meth,'obj' => $ch[1]));
$GLOBALS['LSerror'] -> addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => $ch[1]));
break;
}
}
@ -136,7 +136,7 @@ function getFData($format,$data,$meth=NULL) {
$format[$i]=ereg_replace($ch[0],$value,$format[$i]);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(901,array('meth' => $meth,'obj' => get_class($data)));
$GLOBALS['LSerror'] -> addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => get_class($data)));
break;
}
}
@ -148,6 +148,12 @@ function getFData($format,$data,$meth=NULL) {
}
return $format;
}
/*
* Error Codes
*/
$GLOBALS['LSerror_code']['fct_getFData_01'] = array (
'msg' => _("Function 'getFData' : The method %{meth} of the object %{obj} doesn't exist.")
);
function getFieldInFormat($format) {
$fields=array();
@ -183,6 +189,7 @@ function return_data($data) {
return $data;
}
$GLOBALS['LSdebug']['fields']=array();
function LSdebug($data,$dump=false) {
if ($dump) {
ob_start();

View file

@ -42,7 +42,7 @@ var LSsession_login = new Class({
if (data.list_topDn) {
$('LSsession_topDn').getParent().set('html',data.list_topDn);
LSdebug($('LSsession_topDn').innerHTML);
$('LSsession_topDn_label').set('html',data.levelLabel);
$('LSsession_topDn_label').set('html',data.subDnLabel);
$$('.loginform-level').each(function(el) {
el.setStyle('display','block');
});

View file

@ -7,7 +7,7 @@ $GLOBALS['LSsession'] = new LSsession();
if (($_REQUEST['template'] != 'login')&&($_REQUEST['template'] != 'recoverPassword')) {
if ( !$GLOBALS['LSsession'] -> startLSsession() ) {
$GLOBALS['LSerror'] -> addErrorCode(1022);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_22');
$_ERRORS = true;
}
}
@ -22,10 +22,16 @@ if (!isset($_ERRORS)) {
$data = array();
if ( $GLOBALS['LSsession'] -> LSldapConnect() ) {
session_start();
$list = $GLOBALS['LSsession'] -> getSubDnLdapServerOptions($_SESSION['LSsession_topDn']);
if (isset($_SESSION['LSsession_topDn'])) {
$sel = $_SESSION['LSsession_topDn'];
}
else {
$sel = NULL;
}
$list = $GLOBALS['LSsession'] -> getSubDnLdapServerOptions($sel);
if (is_string($list)) {
$data['list_topDn'] = "<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>";
$data['levelLabel'] = $GLOBALS['LSsession'] -> getLevelLabel();
$data['subDnLabel'] = $GLOBALS['LSsession'] -> getSubDnLabel();
}
}
$data['recoverPassword'] = isset($GLOBALS['LSsession'] -> ldapServer['recoverPassword']);
@ -60,9 +66,6 @@ if (!isset($_ERRORS)) {
);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
case 'LSformElement_select_object_refresh':
@ -78,9 +81,6 @@ if (!isset($_ERRORS)) {
);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
case 'LSformElement_select_object_searchAdd':
@ -91,9 +91,6 @@ if (!isset($_ERRORS)) {
$field=$form -> getElement($_REQUEST['attribute']);
$data['objects'] = $field -> searchAdd($_REQUEST['pattern']);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
case 'generatePassword':
@ -101,7 +98,6 @@ if (!isset($_ERRORS)) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
if ($object) {
if ($object -> loadData($_REQUEST['objectdn'])) {
$form = $object -> getForm($_REQUEST['idform']);
if ($form) {
$field=$form -> getElement($_REQUEST['attribute']);
@ -117,10 +113,6 @@ if (!isset($_ERRORS)) {
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
case 'verifyPassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldValue'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['objectdn'])) ) {
@ -134,9 +126,6 @@ if (!isset($_ERRORS)) {
'verifyPassword' => $val
);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}
}
break;
}
@ -168,27 +157,24 @@ if (!isset($_ERRORS)) {
);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1013,$relationName);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$relationName);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relationConf['LSobject']);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
break;
@ -224,36 +210,33 @@ if (!isset($_ERRORS)) {
$data['id'] = $_REQUEST['id'];
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1013,$relationName);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$relationName);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1015,$relationName);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$relationName);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1014,$relationName);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_02',$relationName);
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relationConf['LSobject']);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
break;
@ -275,7 +258,7 @@ if (!isset($_ERRORS)) {
foreach($list as $o) {
if($o -> getDn() == $_REQUEST['dn']) {
if (!$o -> $relationConf['remove_function']($object)) {
$GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$conf['relationName']);
}
else {
$ok = true;
@ -284,7 +267,7 @@ if (!isset($_ERRORS)) {
}
if (!$ok) {
LSdebug($_REQUEST['value']." introuvé parmi la liste");
$GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$conf['relationName']);
}
else {
$data=array(
@ -293,32 +276,28 @@ if (!isset($_ERRORS)) {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']);
$GLOBALS['LSerror'] -> addErrorCode(1);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_03',$conf['relationName']);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1013,$conf['relationName']);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$conf['relationName']);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relationConf['LSobject']);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
break;
@ -368,7 +347,7 @@ if (!isset($_ERRORS)) {
);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
break;
}
@ -383,9 +362,6 @@ if (!isset($_ERRORS)) {
$msg = $obj -> getFData($_REQUEST['msg']);
$subject = $obj -> getFData($_REQUEST['subject']);
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['object']['type']);
}
}
else {
$msg = $_REQUEST['msg'];
@ -419,7 +395,7 @@ if (!isset($_ERRORS)) {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
break;

View file

@ -114,19 +114,16 @@ if($LSsession -> startLSsession()) {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}

View file

@ -41,7 +41,7 @@ if($LSsession -> startLSsession()) {
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$_GET['LSobject'].'&refresh');
}
else {
$GLOBALS['LSerror'] -> addErrorCode(35,$objectname);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_15',$objectname);
}
}
else {
@ -54,19 +54,19 @@ if($LSsession -> startLSsession()) {
$GLOBALS['LSsession'] -> setTemplate('question.tpl');
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(21);
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_01');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}

View file

@ -323,12 +323,9 @@ if($LSsession -> startLSsession()) {
}
$GLOBALS['LSsession'] -> ajaxDisplay = true;
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {

View file

@ -1,5 +1,5 @@
</div>
<hr class='spacer' />
</div>
</td>
</tr>
</table>
</body>
</html>

View file

@ -4,6 +4,7 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle}{/if}</title>
<link rel="icon" type="image/png" href="images/default/favicon.png" />
<link rel="stylesheet" type="text/css" href="{$LS_CSS_DIR}/login.css" media="screen" title="Normal" />
{$LSsession_css}
{$LSsession_js}

View file

@ -1,9 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle}{/if}</title>
<link rel="icon" type="image/png" href="images/default/favicon.png" />
<link rel="stylesheet" type="text/css" href="{$LS_CSS_DIR}/base.css" title="Normal" />
<link rel="stylesheet" type="text/css" href="{$LS_CSS_DIR}/base_print.css" media='print' title="Normal" />
{$LSsession_css}
@ -22,8 +24,10 @@
<div id='LSdebug_infos'>{if $LSdebug != ''}{$LSdebug}{/if}</div>
</div>
<div id='main'>
<div id='left'>
<table id='main'>
<tr>
<td rowspan=2 id='left'>
<a href='index.php'><img src='{$LS_IMAGES_DIR}/logo.png' alt='Logo' id='logo'/></a>
{if $LSsession_subDn!=""}
@ -41,11 +45,14 @@
<li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{$label}</a></li>
{/foreach}
</ul>
</div>
<div id='right'>
<p id='status'>
</td>
<td id='status'>
Connecté en tant que <span id='user_name'>{$LSsession_username}</span> <a href='index.php?LSsession_logout'><img src='{$LS_IMAGES_DIR}/logout.png' alt='Logout' title='Logout' /></a>
</p>
</td>
</tr>
<tr>
<td id='right'>

View file

@ -142,12 +142,12 @@ if($LSsession -> startLSsession()) {
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1013,$relationName);
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_01',$relationName);
}
$LSrelations[]=$return;
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1016,array('relation' => $relationName,'LSobject' => $relationConf['LSobject']));
$GLOBALS['LSerror'] -> addErrorCode('LSrelations_04',array('relation' => $relationName,'LSobject' => $relationConf['LSobject']));
}
}
}
@ -164,7 +164,7 @@ if($LSsession -> startLSsession()) {
$GLOBALS['LSsession'] -> setTemplate('view.tpl');
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
// Affichage d'une liste d'un type d'objet
@ -476,16 +476,13 @@ if($LSsession -> startLSsession()) {
$GLOBALS['LSsession'] -> setTemplate('viewList.tpl');
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_11');
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1011);
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1012);
$GLOBALS['LSerror'] -> addErrorCode('LSsession_12');
}
}
else {