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

View file

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

View file

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

View file

@ -31,12 +31,6 @@ a img {
border: none; border: none;
} }
hr {
visibility: hidden;
clear: both;
height: 0px;
}
.btn { .btn {
cursor: pointer; cursor: pointer;
margin: 2px; margin: 2px;
@ -47,27 +41,32 @@ hr {
*/ */
#main { #main {
width: 1000px; width: 1000px;
height: 600px;
margin: auto; margin: auto;
border: 1px solid #52bce5; border: 1px solid #0072b8;
background: #fff url(../../images/default/fd_menu.png) repeat-y scroll left top; border-collapse: collapse;
min-height: 500px;
} }
#left { #left {
float: left; vertical-align: top;
background-color: #0072b8;
width: 160px; width: 160px;
} }
#right { #right {
margin: 0; vertical-align: top;
float: left;
width: 840px;
} }
#logo { #logo {
margin: auto; margin: auto;
width: 142px; width: 142px;
margin-left: 9px; margin-left: 9px;
margin-top: 9px;
background-color: #fff;
border: 1px solid #0072b8;
-moz-border-radius: 15px;
padding-top: 30px;
padding-bottom: 30px;
} }
#status { #status {
@ -76,8 +75,10 @@ hr {
font-size: 0.7em; font-size: 0.7em;
color: #fff; color: #fff;
text-align: right; text-align: right;
background-color: #52bce5; background-color: #0072b8;
padding: 0.3em; padding: 0.3em;
height: 1em;
vertical-align: top;
} }
#user_name { #user_name {
@ -125,7 +126,7 @@ a.menu {
table.LSobject-list { table.LSobject-list {
margin-left: 1em; margin-left: 1em;
margin-top: 0.5em; margin-top: 0.5em;
border: 1px solid #52bce5; border: 1px solid #0072b8;
width: 805px; width: 805px;
border-collapse: collapse; border-collapse: collapse;
clear: both; clear: both;
@ -135,7 +136,7 @@ table.LSobject-list {
* th * th
*/ */
th.LSobject-list { th.LSobject-list {
background-color: #52bce5; background-color: #0072b8;
color: #fff; color: #fff;
} }
@ -169,7 +170,7 @@ tr.LSobject-list-bis {
* td * td
*/ */
td.LSobject-list { td.LSobject-list {
border: 1px solid #52bce5; border: 1px solid #0072b8;
padding: 0.1em; padding: 0.1em;
} }
@ -211,7 +212,7 @@ p.LSobject-list-page {
} }
a.LSobject-list-page { a.LSobject-list-page {
color: #52bce5; color: #0072b8;
text-decoration: none; text-decoration: none;
} }
@ -298,6 +299,6 @@ input[type='text'].LSview_search {
input[type='submit'].LSview_search { input[type='submit'].LSview_search {
border: 1px solid #0072b8; border: 1px solid #0072b8;
width: 8em; width: 8em;
background-color: #52bce5; background-color: #0072b8;
color: #fff; 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) { function addToForm (&$form,$idForm,$data=NULL) {
if (!$this -> LSformElement_type) { if (!$this -> LSformElement_type) {
$GLOBALS['LSerror'] -> addErrorCode(101,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_01',$this -> name);
return; return;
} }
$element=$form -> addElement($this -> LSformElement_type, $this -> name, $this -> config['label'],$this -> config, $this); $element=$form -> addElement($this -> LSformElement_type, $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) { if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return; return;
} }
if ($data) { 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) { function addToForm (&$form,$idForm,$data=NULL) {
$element=$form -> addElement('image', $this -> name, $this -> config['label'],$this -> config, $this); $element=$form -> addElement('image', $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) { if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return; return;
} }
if (count($data)>1) { if (count($data)>1) {
$GLOBALS['LSerror'] -> addErrorCode(103,'password'); $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_03','password');
} }
if ($data) { if ($data) {

View file

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

View file

@ -37,15 +37,11 @@ class LSattr_html_select_list extends LSattr_html{
* @retval LSformElement L'element du formulaire ajouté * @retval LSformElement L'element du formulaire ajouté
*/ */
function addToForm (&$form,$idForm,$data=NULL) { function addToForm (&$form,$idForm,$data=NULL) {
/*if (count($data)>1) {
$GLOBALS['LSerror'] -> addErrorCode(103,'select_list');
return;
}*/
$possible_values=$this -> getPossibleValues(); $possible_values=$this -> getPossibleValues();
$this -> config['text_possible_values'] = $possible_values; $this -> config['text_possible_values'] = $possible_values;
$element=$form -> addElement('select', $this -> name, $this -> config['label'],$this -> config, $this); $element=$form -> addElement('select', $this -> name, $this -> config['label'],$this -> config, $this);
if(!$element) { if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return; return;
} }
if ($data) { if ($data) {
@ -80,11 +76,10 @@ class LSattr_html_select_list extends LSattr_html{
foreach($this -> config['possible_values'] as $val_name => $val) { foreach($this -> config['possible_values'] as $val_name => $val) {
if($val_name=='OTHER_OBJECT') { if($val_name=='OTHER_OBJECT') {
if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) { if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) {
$GLOBALS['LSerror'] -> addErrorCode(102,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_list_01',$this -> name);
break; break;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($val['object_type'])) { if (!$GLOBALS['LSsession'] -> loadLSobject($val['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$val['object_type']);
return; return;
} }
$obj = new $val['object_type'](); $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; $this -> config['attrObject'] = $this;
$element=$form -> addElement('select_object', $this -> name, $this -> config['label'],$this -> config,$this); $element=$form -> addElement('select_object', $this -> name, $this -> config['label'],$this -> config,$this);
if(!$element) { if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return; return;
} }
if ($data) { if ($data) {
@ -81,12 +81,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) { if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object']; $conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) { if (!isset($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(102,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_object_01',$this -> name);
return; return;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) { if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$conf['object_type']);
return; return;
} }
@ -130,12 +129,11 @@ class LSattr_html_select_object extends LSattr_html{
if (isset($this -> config['selectable_object'])) { if (isset($this -> config['selectable_object'])) {
$conf=$this -> config['selectable_object']; $conf=$this -> config['selectable_object'];
if (!isset($conf['object_type'])) { if (!isset($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(102,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSattr_html_select_object_01',$this -> name);
return; return;
} }
if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) { if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$conf['object_type']);
return; 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 { class LSattr_ldap_password extends LSattr_ldap {
@ -29,34 +29,107 @@ class LSattr_ldap_password extends LSattr_ldap {
var $clearPassword = NULL; 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) { function getDisplayValue($data) {
return '********'; 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/
*
* @param[in] $data mixed The attribute value
* *
* @retval mixed La valeur traitée de l'attribut * @retval mixed The value of this attribute to be stocked
*/ */
function getUpdateData($data) { function getUpdateData($data) {
$this -> clearPassword = $data[0]; $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) { function getSalt($length=8) {
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz"; $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() { function getClearPassword() {
return $this -> clearPassword; 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); $this -> ldap = new $ldap_type($name,$config,$this);
} }
else { 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;
} }
return true; return true;
@ -91,6 +91,10 @@ class LSattribute {
*/ */
function getLabel() { function getLabel() {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
return $this -> html -> getLabel(); return $this -> html -> getLabel();
} }
@ -153,6 +157,10 @@ class LSattribute {
* @retval string La valeur d'affichage de l'attribut * @retval string La valeur d'affichage de l'attribut
*/ */
function getDisplayValue() { function getDisplayValue() {
if (!$this -> ldap) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
return;
}
$data = $this -> ldap -> getDisplayValue($this -> data); $data = $this -> ldap -> getDisplayValue($this -> data);
if ($this -> config['onDisplay']) { if ($this -> config['onDisplay']) {
if (is_array($this -> config['onDisplay'])) { if (is_array($this -> config['onDisplay'])) {
@ -162,7 +170,7 @@ class LSattribute {
$result=$func($result); $result=$func($result);
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(42,array('attr' => $this->name,'func' => $func)); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func));
return; return;
} }
} }
@ -173,7 +181,7 @@ class LSattribute {
return $this -> config['onDisplay']($data); return $this -> config['onDisplay']($data);
} }
else { 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; 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 * Cette méthode ajoute l'attribut au formulaire $form si l'identifiant de celui-ci
* ($idForm) est connu dans la configuration de l'objet. * ($idForm) est connu dans la configuration de l'objet.
@ -198,6 +206,10 @@ class LSattribute {
*/ */
function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) { function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) {
if(isset($this -> config['form'][$idForm])) { if(isset($this -> config['form'][$idForm])) {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
if($this -> myRights() == 'n') { if($this -> myRights() == 'n') {
return true; return true;
} }
@ -213,7 +225,7 @@ class LSattribute {
$element = $this -> html -> addToForm($form,$idForm,$data); $element = $this -> html -> addToForm($form,$idForm,$data);
if(!$element) { if(!$element) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
} }
if($this -> config['required']==1) { if($this -> config['required']==1) {
@ -228,7 +240,7 @@ class LSattribute {
if(is_array($this -> config['check_data'])) { if(is_array($this -> config['check_data'])) {
foreach ($this -> config['check_data'] as $rule => $rule_infos) { foreach ($this -> config['check_data'] as $rule => $rule_infos) {
if((!$form -> isRuleRegistered($rule))&&($rule!='')) { if((!$form -> isRuleRegistered($rule))&&($rule!='')) {
$GLOBALS['LSerror'] -> addErrorCode(43,array('attr' => $this->name,'rule' => $rule)); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_03',array('attr' => $this->name,'rule' => $rule));
return; return;
} }
if(!isset($rule_infos['msg'])) if(!isset($rule_infos['msg']))
@ -239,7 +251,7 @@ class LSattribute {
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(44,$this->name); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_04',$this->name);
} }
} }
} }
@ -300,7 +312,11 @@ class LSattribute {
* @retval boolean true si l'ajout a fonctionner ou qu'il n'est pas nécessaire, false sinon * @retval boolean true si l'ajout a fonctionner ou qu'il n'est pas nécessaire, false sinon
*/ */
function addToView(&$form) { function addToView(&$form) {
if((isset($this -> config['view'])) && ($this -> myRights() != 'n')) { if((isset($this -> config['view'])) && ($this -> myRights() != 'n') ) {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
if($this -> data !='') { if($this -> data !='') {
$data=$this -> getFormVal(); $data=$this -> getFormVal();
} }
@ -309,7 +325,7 @@ class LSattribute {
} }
$element = $this -> html -> addToForm($form,'view',$data); $element = $this -> html -> addToForm($form,'view',$data);
if(!$element instanceof LSformElement) { if(!$element instanceof LSformElement) {
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name); $GLOBALS['LSerror'] -> addErrorCode('LSform_06',$this -> name);
return; return;
} }
$element -> freeze(); $element -> freeze();
@ -330,6 +346,10 @@ class LSattribute {
*/ */
function refreshForm(&$form,$idForm) { function refreshForm(&$form,$idForm) {
if(isset($this -> config['form'][$idForm])&&($this -> myRights()!='n')) { if(isset($this -> config['form'][$idForm])&&($this -> myRights()!='n')) {
if (!$this -> html) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
return;
}
$form_element = $form -> getElement($this -> name); $form_element = $form -> getElement($this -> name);
if ($form_element) { if ($form_element) {
$values = $this -> html -> refreshForm($this -> getFormVal()); $values = $this -> html -> refreshForm($this -> getFormVal());
@ -484,7 +504,7 @@ class LSattribute {
$result=$func($result); $result=$func($result);
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(45,array('attr' => $this->name,'func' => $func)); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func));
return; return;
} }
} }
@ -494,13 +514,19 @@ class LSattribute {
$result = $this -> config['onSave']($data); $result = $this -> config['onSave']($data);
} }
else { 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; return;
} }
} }
} }
else { else {
$result = $this -> ldap -> getUpdateData($data); if (!$this -> ldap) {
$GLOBALS['LSerror'] -> addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
return;
}
else {
$result = $this -> ldap -> getUpdateData($data);
}
} }
$this -> _finalUpdateData = $result; $this -> _finalUpdateData = $result;
return $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); $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 * Affiche les erreurs
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @param[in] $return boolean True pour que le texte d'erreurs soit retourné
*
* @retval void * @retval void
*/ */
function display() { function display($return=False) {
$errors = $this -> getErrors(); $errors = $this -> getErrors();
if ($errors) { if ($errors) {
if ($return) {
return $errors;
}
$GLOBALS['Smarty'] -> assign('LSerrors',$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() { function getErrors() {
if(!empty($this -> errors)) { if(!empty($this -> errors)) {
foreach ($this -> errors as $error) { 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 $txt;
} }
return; 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 * 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; return;
if ($this -> isSubmit()) { if ($this -> isSubmit()) {
if (!$this -> getPostData()) { if (!$this -> getPostData()) {
$GLOBALS['LSerror'] -> addErrorCode(201); $GLOBALS['LSerror'] -> addErrorCode('LSform_01');
return; return;
} }
$this -> setValuesFromPostData(); $this -> setValuesFromPostData();
@ -343,7 +343,7 @@ class LSform {
function getPostData() { function getPostData() {
foreach($this -> elements as $element_name => $element) { foreach($this -> elements as $element_name => $element) {
if( !($element -> getPostData($this -> _postData)) ) { if( !($element -> getPostData($this -> _postData)) ) {
$GLOBALS['LSerror'] -> addErrorCode(202,$element_name); $GLOBALS['LSerror'] -> addErrorCode('LSform_02',$element_name);
return; return;
} }
} }
@ -366,7 +366,7 @@ class LSform {
$elementType='LSformElement_'.$type; $elementType='LSformElement_'.$type;
$GLOBALS['LSsession'] -> loadLSclass($elementType); $GLOBALS['LSsession'] -> loadLSclass($elementType);
if (!class_exists($elementType)) { if (!class_exists($elementType)) {
$GLOBALS['LSerror'] -> addErrorCode(205,array('type' => $type)); $GLOBALS['LSerror'] -> addErrorCode('LSform_05',array('type' => $type));
return; return;
} }
$element=$this -> elements[$name] = new $elementType($this,$name,$label,$params,$attr_html); $element=$this -> elements[$name] = new $elementType($this,$name,$label,$params,$attr_html);
@ -375,7 +375,7 @@ class LSform {
} }
else { else {
unset ($this -> elements[$name]); unset ($this -> elements[$name]);
$GLOBALS['LSerror'] -> addErrorCode(206,array('element' => $name)); $GLOBALS['LSerror'] -> addErrorCode('LSform_06',array('element' => $name));
return; return;
} }
} }
@ -401,12 +401,12 @@ class LSform {
return true; return true;
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(43,array('attr' => $element,'rule'=>$rule)); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_03',array('attr' => $element,'rule'=>$rule));
return; return;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(204,array('element' => $element)); $GLOBALS['LSerror'] -> addErrorCode('LSform_04',array('element' => $element));
return; 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; return $ret;
} }
} }
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$this -> params['selectable_object']['object_type']);
}
} }
return array(); 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) { function validate ($values,$options=array(),$formElement) {
if (!isset($options['params']['operator'])) { if (!isset($options['params']['operator'])) {
$GLOBALS['LSerror'] -> addErrorCode(303); $GLOBALS['LSerror'] -> addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator');
return; return;
} }
$operator = LSformRule_compare :: _findOperator($options['params']['operator']); $operator = LSformRule_compare :: _findOperator($options['params']['operator']);

View file

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

View file

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

View file

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

View file

@ -43,7 +43,7 @@ class LSformRule_regex extends LSformRule {
$regex=$option['params']['regex']; $regex=$option['params']['regex'];
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(801); $GLOBALS['LSerror'] -> addErrorCode('LSformRule_regex_01');
return; 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() { function connect() {
$this -> cnx = Net_LDAP2::connect($this -> config); $this -> cnx = Net_LDAP2::connect($this -> config);
if (Net_LDAP2::isError($this -> cnx)) { if (Net_LDAP2::isError($this -> cnx)) {
$GLOBALS['LSerror'] -> addErrorCode(1,$this -> cnx -> getMessage()); $GLOBALS['LSerror'] -> addErrorCode('LSldap_01',$this -> cnx -> getMessage());
$this -> cnx = NULL; $this -> cnx = NULL;
return; return;
} }
@ -105,7 +105,7 @@ class LSldap {
function search ($filter,$basedn=NULL,$params = array()) { function search ($filter,$basedn=NULL,$params = array()) {
$ret = $this -> cnx -> search($basedn,$filter,$params); $ret = $this -> cnx -> search($basedn,$filter,$params);
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(2,$ret -> getMessage()); $GLOBALS['LSerror'] -> addErrorCode('LSldap_02',$ret -> getMessage());
return; return;
} }
$retInfos=array(); $retInfos=array();
@ -136,7 +136,7 @@ class LSldap {
$filter=NULL; $filter=NULL;
$ret = $this -> cnx -> search($basedn,$filter,$params); $ret = $this -> cnx -> search($basedn,$filter,$params);
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(2,$ret -> getMessage()); $GLOBALS['LSerror'] -> addErrorCode('LSldap_02',$ret -> getMessage());
return; return;
} }
return $ret -> count(); return $ret -> count();
@ -212,7 +212,7 @@ class LSldap {
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(3); $GLOBALS['LSerror'] -> addErrorCode('LSldap_03');
return; return;
} }
} }
@ -299,7 +299,7 @@ class LSldap {
} }
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(5,$dn); $GLOBALS['LSerror'] -> addErrorCode('LSldap_05',$dn);
$GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); $GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
} }
else { else {
@ -316,7 +316,7 @@ class LSldap {
} }
$ret = $entry -> update(); $ret = $entry -> update();
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(6); $GLOBALS['LSerror'] -> addErrorCode('LSldap_06');
$GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); $GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
} }
} }
@ -324,7 +324,7 @@ class LSldap {
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(4); $GLOBALS['LSerror'] -> addErrorCode('LSldap_04');
return; return;
} }
} }
@ -386,7 +386,7 @@ class LSldap {
function move($old,$new) { function move($old,$new) {
$ret = $this -> cnx -> move($old,$new); $ret = $this -> cnx -> move($old,$new);
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
$GLOBALS['LSerror'] -> addErrorCode(7); $GLOBALS['LSerror'] -> addErrorCode('LSldap_07');
$GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage()); $GLOBALS['LSerror'] -> addErrorCode(0,'NetLdap-Error : '.$ret->getMessage());
return; 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]; $this -> config = $GLOBALS['LSobjects'][$type_name];
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(21); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_01');
return; return;
} }
} }
@ -276,7 +276,7 @@ class LSldapObject {
if(isset($this -> forms[$idForm])) if(isset($this -> forms[$idForm]))
$LSform = $this -> forms[$idForm][0]; $LSform = $this -> forms[$idForm][0];
else { else {
$GLOBALS['LSerror'] -> addErrorCode(22,$this -> getType()); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_02',$this -> getType());
return; return;
} }
} }
@ -289,7 +289,7 @@ class LSldapObject {
$LSform = $LSform[0]; $LSform = $LSform[0];
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(23,$this -> getType()); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_03',$this -> getType());
return; return;
} }
} }
@ -307,12 +307,12 @@ class LSldapObject {
if(isset($this -> config['before_modify'])) { if(isset($this -> config['before_modify'])) {
if(function_exists($this -> config['before_modify'])) { if(function_exists($this -> config['before_modify'])) {
if(!$this -> config['before_modify']($this)) { if(!$this -> config['before_modify']($this)) {
$GLOBALS['LSerror'] -> addErrorCode(28,$this -> config['before_modify']); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_08',$this -> config['before_modify']);
return; return;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(27,$this -> config['before_modify']); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_07',$this -> config['before_modify']);
return; return;
} }
} }
@ -333,12 +333,12 @@ class LSldapObject {
if((isset($this -> config['after_modify']))&&(!$this -> submitError)) { if((isset($this -> config['after_modify']))&&(!$this -> submitError)) {
if(function_exists($this -> config['after_modify'])) { if(function_exists($this -> config['after_modify'])) {
if(!$this -> config['after_modify']($this)) { if(!$this -> config['after_modify']($this)) {
$GLOBALS['LSerror'] -> addErrorCode(30,$this -> config['after_modify']); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_10',$this -> config['after_modify']);
return; return;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(29,$this -> config['after_modify']); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_09',$this -> config['after_modify']);
return; return;
} }
} }
@ -378,17 +378,17 @@ class LSldapObject {
if ( $attr -> canBeGenerated()) { if ( $attr -> canBeGenerated()) {
if ($attr -> generateValue()) { if ($attr -> generateValue()) {
if (!$this -> validateAttrData($LSform, $attr)) { if (!$this -> validateAttrData($LSform, $attr)) {
$GLOBALS['LSerror'] -> addErrorCode(48,$attr -> getLabel()); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_08',$attr -> getLabel());
$retval = false; $retval = false;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(47,$attr -> getLabel()); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_07',$attr -> getLabel());
$retval = false; $retval = false;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(46,$attr -> getLabel()); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_06',$attr -> getLabel());
$retval = false; $retval = false;
} }
} }
@ -476,12 +476,12 @@ class LSldapObject {
} }
} }
else { 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; $retval = false;
} }
} }
else { 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; $retval = false;
} }
} }
@ -492,17 +492,17 @@ class LSldapObject {
if (!empty($dependsAttrs)) { if (!empty($dependsAttrs)) {
foreach($dependsAttrs as $dependAttr) { foreach($dependsAttrs as $dependAttr) {
if(!isset($this -> attrs[$dependAttr])){ if(!isset($this -> attrs[$dependAttr])){
$GLOBALS['LSerror'] -> addErrorCode(34,array('attr_depend' => $dependAttr, 'attr' => $attr -> getLabel())); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_14',array('attr_depend' => $dependAttr, 'attr' => $attr -> getLabel()));
continue; continue;
} }
if($this -> attrs[$dependAttr] -> canBeGenerated()) { if($this -> attrs[$dependAttr] -> canBeGenerated()) {
if (!$this -> attrs[$dependAttr] -> generateValue()) { if (!$this -> attrs[$dependAttr] -> generateValue()) {
$GLOBALS['LSerror'] -> addErrorCode(47,$this -> attrs[$dependAttr] -> getLabel()); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel());
$retval = false; $retval = false;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(46,$this -> attrs[$dependAttr] -> getLabel()); $GLOBALS['LSerror'] -> addErrorCode('LSattribute_06',$this -> attrs[$dependAttr] -> getLabel());
$retval = false; $retval = false;
} }
} }
@ -531,7 +531,7 @@ class LSldapObject {
$new = true; $new = true;
LSdebug('Rename'); LSdebug('Rename');
if (!$this -> beforeRename()) { if (!$this -> beforeRename()) {
$GLOBALS['LSerror'] -> addErrorCode(36); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_16');
return; return;
} }
$oldDn = $this -> getDn(); $oldDn = $this -> getDn();
@ -543,7 +543,7 @@ class LSldapObject {
} }
$this -> dn = $newDn; $this -> dn = $newDn;
if (!$this -> afterRename($oldDn,$newDn)) { if (!$this -> afterRename($oldDn,$newDn)) {
$GLOBALS['LSerror'] -> addErrorCode(37); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_17');
return; return;
} }
} }
@ -566,14 +566,14 @@ class LSldapObject {
} }
if ($new) { if ($new) {
if (!$this -> afterCreate()) { if (!$this -> afterCreate()) {
$GLOBALS['LSerror'] -> addErrorCode(301); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_21');
return; return;
} }
} }
return true; return true;
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(33); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_13');
return; return;
} }
} }
@ -1003,12 +1003,12 @@ class LSldapObject {
return $rdn_attr.'='.$rdn_val[0].','.$this -> config['container_dn'].','.$GLOBALS['LSsession']->topDn; return $rdn_attr.'='.$rdn_val[0].','.$this -> config['container_dn'].','.$GLOBALS['LSsession']->topDn;
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(32,$this -> config['rdn']); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_12',$this -> config['rdn']);
return; return;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(31,$this -> getType()); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_11',$this -> getType());
return; return;
} }
} }
@ -1063,11 +1063,11 @@ class LSldapObject {
if ($this -> afterDelete()) { if ($this -> afterDelete()) {
return true; return true;
} }
$GLOBALS['LSerror'] -> addErrorCode(39); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_19');
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(38); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_18');
} }
return; return;
} }
@ -1159,7 +1159,6 @@ class LSldapObject {
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$relation_conf['LSobject']);
return; return;
} }
} }
@ -1267,12 +1266,12 @@ class LSldapObject {
foreach($config as $action) { foreach($config as $action) {
if(function_exists($action)) { if(function_exists($action)) {
if(!$action($this)) { if(!$action($this)) {
$GLOBALS['LSerror'] -> addErrorCode(305,$action); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_25',$action);
$error=true; $error=true;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(304,$action); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_24',$action);
$error=true; $error=true;
} }
} }
@ -1312,7 +1311,6 @@ class LSldapObject {
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$type);
$error=1; $error=1;
} }
} }
@ -1329,12 +1327,12 @@ class LSldapObject {
foreach($config as $action) { foreach($config as $action) {
if(function_exists($action)) { if(function_exists($action)) {
if(!$action($this)) { if(!$action($this)) {
$GLOBALS['LSerror'] -> addErrorCode(303,$action); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_23',$action);
$error=true; $error=true;
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(302,$action); $GLOBALS['LSerror'] -> addErrorCode('LSldapObject_22',$action);
$error=true; $error=true;
} }
} }
@ -1357,7 +1355,7 @@ class LSldapObject {
**/ **/
function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') { function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'getObjectKeyValueInRelation'); $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
return; return;
} }
if ($attrValue=='dn') { if ($attrValue=='dn') {
@ -1390,7 +1388,7 @@ class LSldapObject {
**/ **/
function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') { function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'listObjectsInRelation'); $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','listObjectsInRelation');
return; return;
} }
if ($attrValue=='dn') { if ($attrValue=='dn') {
@ -1422,7 +1420,7 @@ class LSldapObject {
**/ **/
function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') { function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'addOneObjectInRelation'); $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','addOneObjectInRelation');
return; return;
} }
if ($object instanceof $objectType) { if ($object instanceof $objectType) {
@ -1472,7 +1470,7 @@ class LSldapObject {
**/ **/
function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') { function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'deleteOneObjectInRelation'); $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','deleteOneObjectInRelation');
return; return;
} }
if ($object instanceof $objectType) { if ($object instanceof $objectType) {
@ -1517,7 +1515,7 @@ class LSldapObject {
*/ */
function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') { function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'renameOneObjectInRelation'); $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','renameOneObjectInRelation');
return; return;
} }
if ($object instanceof $objectType) { if ($object instanceof $objectType) {
@ -1567,7 +1565,7 @@ class LSldapObject {
**/ **/
function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn') { function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) { if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'updateObjectsInRelation'); $GLOBALS['LSerror'] -> addErrorCode('LSrelations_05','updateObjectsInRelation');
return; return;
} }
$currentObjects = $this -> listObjectsInRelation($object,$attr,$objectType,$attrValue); $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 $_JSconfigParams = array();
var $CssFiles = array(); var $CssFiles = array();
var $template = NULL; var $template = NULL;
var $LSrights = array(); var $LSprofiles = array();
var $LSaccess = array(); var $LSaccess = array();
var $tmp_file = array(); var $tmp_file = array();
var $_subDnLdapServer = array(); var $_subDnLdapServer = array();
@ -88,7 +88,7 @@ class LSsession {
return true; return true;
} }
else { else {
die($GLOBALS['LSerror_code'][1008]['msg']); die($GLOBALS['LSerror_code']['LSsession_08']['msg']);
return; return;
} }
return true; return true;
@ -96,6 +96,7 @@ class LSsession {
else { else {
return; return;
} }
} }
/** /**
@ -108,8 +109,9 @@ class LSsession {
* @retval boolean true si l'initialisation a réussi, false sinon. * @retval boolean true si l'initialisation a réussi, false sinon.
*/ */
function startLSerror() { function startLSerror() {
if(!$this -> loadLSclass('LSerror')) if(!$this -> loadLSclass('LSerror')) {
return; return;
}
$GLOBALS['LSerror'] = new LSerror(); $GLOBALS['LSerror'] = new LSerror();
return true; return true;
} }
@ -129,7 +131,7 @@ class LSsession {
return true; return true;
if($type!='') if($type!='')
$type=$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. * @retval boolean true si le chargement a réussi, false sinon.
*/ */
function loadLSobject($object) { function loadLSobject($object) {
$error = 0;
$this -> loadLSclass('LSldapObject'); $this -> loadLSclass('LSldapObject');
if (!$this -> loadLSclass($object,'LSobjects')) { if (!$this -> loadLSclass($object,'LSobjects')) {
return; $error = 1;
} }
if (!require_once( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) { if (!require_once( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) {
$error = 1;
}
if ($error) {
$GLOBALS['LSerror'] -> addErrorCode('LSsession_04',$object);
return; return;
} }
return true; return true;
@ -162,7 +169,7 @@ class LSsession {
function loadLSaddon($addon) { function loadLSaddon($addon) {
if(require_once LS_ADDONS_DIR .'LSaddons.'.$addon.'.php') { if(require_once LS_ADDONS_DIR .'LSaddons.'.$addon.'.php') {
if (!call_user_func('LSaddon_'. $addon .'_support')) { if (!call_user_func('LSaddon_'. $addon .'_support')) {
$GLOBALS['LSerror'] -> addErrorCode(1002,$addon); $GLOBALS['LSerror'] -> addErrorCode('LSsession_02',$addon);
return; return;
} }
return true; return true;
@ -180,7 +187,7 @@ class LSsession {
*/ */
function loadLSaddons() { function loadLSaddons() {
if(!is_array($GLOBALS['LSaddons']['loads'])) { if(!is_array($GLOBALS['LSaddons']['loads'])) {
$GLOBALS['LSerror'] -> addErrorCode(1001,"LSaddons['loads']"); $GLOBALS['LSerror'] -> addErrorCode('LSsession_01',"LSaddons['loads']");
return; return;
} }
@ -230,9 +237,9 @@ class LSsession {
$this -> ldapServerId = $_SESSION['LSsession']['ldapServerId']; $this -> ldapServerId = $_SESSION['LSsession']['ldapServerId'];
$this -> tmp_file = $_SESSION['LSsession']['tmp_file']; $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 -> ldapServer = $_SESSION['LSsession']['ldapServer'];
$this -> LSrights = $_SESSION['LSsession']['LSrights']; $this -> LSprofiles = $_SESSION['LSsession']['LSprofiles'];
$this -> LSaccess = $_SESSION['LSsession']['LSaccess']; $this -> LSaccess = $_SESSION['LSsession']['LSaccess'];
if (!$this -> LSldapConnect()) if (!$this -> LSldapConnect())
return; return;
@ -241,22 +248,21 @@ class LSsession {
$this -> setLdapServer($this -> ldapServerId); $this -> setLdapServer($this -> ldapServerId);
if (!$this -> LSldapConnect()) if (!$this -> LSldapConnect())
return; return;
$this -> loadLSrights(); $this -> loadLSprofiles();
} }
if ( $this -> cacheSudDn() && (!isset($_REQUEST['LSsession_refresh'])) ) { if ( $this -> cacheSudDn() && (!isset($_REQUEST['LSsession_refresh'])) ) {
$this -> _subDnLdapServer = $_SESSION['LSsession_subDnLdapServer']; $this -> _subDnLdapServer = $_SESSION['LSsession_subDnLdapServer'];
} }
if (!$this -> loadLSobject($this -> ldapServer['authobject'])) { if (!$this -> loadLSobject($this -> ldapServer['authObjectType'])) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$this -> ldapServer['authobject']);
return; return;
} }
$this -> LSuserObject = new $this -> ldapServer['authobject'](); $this -> LSuserObject = new $this -> ldapServer['authObjectType']();
$this -> LSuserObject -> loadData($this -> dn); $this -> LSuserObject -> loadData($this -> dn);
if ( !$this -> cacheLSrights() || isset($_REQUEST['LSsession_refresh']) ) { if ( !$this -> cacheLSprofiles() || isset($_REQUEST['LSsession_refresh']) ) {
$this -> loadLSaccess(); $this -> loadLSaccess();
} }
@ -296,8 +302,8 @@ class LSsession {
} }
$_SESSION['LSsession_topDn']=$this -> topDn; $_SESSION['LSsession_topDn']=$this -> topDn;
if ( $this -> loadLSobject($this -> ldapServer['authobject']) ) { if ( $this -> loadLSobject($this -> ldapServer['authObjectType']) ) {
$authobject = new $this -> ldapServer['authobject'](); $authobject = new $this -> ldapServer['authObjectType']();
$find=true; $find=true;
if (isset($_GET['recoveryHash'])) { if (isset($_GET['recoveryHash'])) {
$filter=$this -> ldapServer['recoverPassword']['recoveryHashAttr']."=".$_GET['recoveryHash']; $filter=$this -> ldapServer['recoverPassword']['recoveryHashAttr']."=".$_GET['recoveryHash'];
@ -317,11 +323,11 @@ class LSsession {
if ($nbresult==0) { if ($nbresult==0) {
// identifiant incorrect // identifiant incorrect
LSdebug('identifiant incorrect'); LSdebug('identifiant incorrect');
$GLOBALS['LSerror'] -> addErrorCode(1006); $GLOBALS['LSerror'] -> addErrorCode('LSsession_06');
} }
else if ($nbresult>1) { else if ($nbresult>1) {
// duplication d'authentité // duplication d'authentité
$GLOBALS['LSerror'] -> addErrorCode(1007); $GLOBALS['LSerror'] -> addErrorCode('LSsession_07');
} }
else { else {
if (isset($_GET['LSsession_recoverPassword'])) { if (isset($_GET['LSsession_recoverPassword'])) {
@ -382,24 +388,24 @@ class LSsession {
else { else {
// Problème durant l'envoie du mail // Problème durant l'envoie du mail
LSdebug("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 { else {
// Erreur durant la mise à jour de l'objet // Erreur durant la mise à jour de l'objet
LSdebug("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 { else {
// Erreur durant la validation du formulaire de modification de perte de password // 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"); 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 // 2nd étape : génération du mot de passe + envoie par mail
else { else {
$attr=$user -> attrs[$this -> ldapServer['authobject_pwdattr']]; $attr=$user -> attrs[$this -> ldapServer['authObjectTypeAttrPwd']];
if ($attr instanceof LSattribute) { if ($attr instanceof LSattribute) {
$mdp = generatePassword($attr -> config['html_options']['chars'],$attr -> config['html_options']['lenght']); $mdp = generatePassword($attr -> config['html_options']['chars'],$attr -> config['html_options']['lenght']);
LSdebug('Nvx mpd : '.$mdp); LSdebug('Nvx mpd : '.$mdp);
@ -407,7 +413,7 @@ class LSsession {
$lostPasswdForm -> setPostData( $lostPasswdForm -> setPostData(
array( array(
$this -> ldapServer['recoverPassword']['recoveryHashAttr'] => array(''), $this -> ldapServer['recoverPassword']['recoveryHashAttr'] => array(''),
$this -> ldapServer['authobject_pwdattr'] => array($mdp) $this -> ldapServer['authObjectTypeAttrPwd'] => array($mdp)
) )
,true ,true
); );
@ -427,35 +433,35 @@ class LSsession {
else { else {
// Problème durant l'envoie du mail // Problème durant l'envoie du mail
LSdebug("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 { else {
// Erreur durant la mise à jour de l'objet // Erreur durant la mise à jour de l'objet
LSdebug("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 { else {
// Erreur durant la validation du formulaire de modification de perte de password // 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"); LSdebug("Erreur durant la validation du formulaire de modification de perte de password");
$GLOBALS['LSerror'] -> addErrorCode(1020); $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',2);
} }
} }
else { else {
// l'attribut password n'existe pas // l'attribut password n'existe pas
LSdebug("L'attribut password n'existe pas"); LSdebug("L'attribut password n'existe pas");
$GLOBALS['LSerror'] -> addErrorCode(1020); $GLOBALS['LSerror'] -> addErrorCode('LSsession_20',1);
} }
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1019); $GLOBALS['LSerror'] -> addErrorCode('LSsession_19');
} }
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1018); $GLOBALS['LSerror'] -> addErrorCode('LSsession_18');
} }
} }
else { else {
@ -464,25 +470,25 @@ class LSsession {
$this -> LSuserObject = $result[0]; $this -> LSuserObject = $result[0];
$this -> dn = $result[0]->getValue('dn'); $this -> dn = $result[0]->getValue('dn');
$this -> rdn = $_POST['LSsession_user']; $this -> rdn = $_POST['LSsession_user'];
$this -> loadLSrights(); $this -> loadLSprofiles();
$this -> loadLSaccess(); $this -> loadLSaccess();
$GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getDisplayValue()); $GLOBALS['Smarty'] -> assign('LSsession_username',$this -> LSuserObject -> getDisplayValue());
$_SESSION['LSsession']=get_object_vars($this); $_SESSION['LSsession']=get_object_vars($this);
return true; return true;
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1006); $GLOBALS['LSerror'] -> addErrorCode('LSsession_06');
LSdebug('mdp incorrect'); LSdebug('mdp incorrect');
} }
} }
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1010); $GLOBALS['LSerror'] -> addErrorCode('LSsession_10');
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1009); $GLOBALS['LSerror'] -> addErrorCode('LSsession_09');
} }
} }
if ($this -> ldapServerId) { if ($this -> ldapServerId) {
@ -504,12 +510,12 @@ class LSsession {
* *
* @param[in] $object Mixed L'objet Ldap du nouvel utilisateur * @param[in] $object Mixed L'objet Ldap du nouvel utilisateur
* le type doit correspondre à * le type doit correspondre à
* $this -> ldapServer['authobject'] * $this -> ldapServer['authObjectType']
* *
* @retval boolean True en cas de succès, false sinon * @retval boolean True en cas de succès, false sinon
*/ */
function changeAuthUser($object) { function changeAuthUser($object) {
if ($object instanceof $this -> ldapServer['authobject']) { if ($object instanceof $this -> ldapServer['authObjectType']) {
$this -> dn = $object -> getDn(); $this -> dn = $object -> getDn();
$rdn = $object -> getValue('rdn'); $rdn = $object -> getValue('rdn');
if(is_array($rdn)) { if(is_array($rdn)) {
@ -518,7 +524,7 @@ class LSsession {
$this -> rdn = $rdn; $this -> rdn = $rdn;
$this -> LSuserObject = $object; $this -> LSuserObject = $object;
if($this -> loadLSrights()) { if($this -> loadLSprofiles()) {
$this -> loadLSaccess(); $this -> loadLSaccess();
$_SESSION['LSsession']=get_object_vars($this); $_SESSION['LSsession']=get_object_vars($this);
return true; return true;
@ -568,7 +574,7 @@ class LSsession {
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1003); $GLOBALS['LSerror'] -> addErrorCode('LSsession_03');
return; return;
} }
} }
@ -582,56 +588,54 @@ class LSsession {
if ($this -> cacheSudDn() && isset($this -> _subDnLdapServer[$this -> ldapServerId])) { if ($this -> cacheSudDn() && isset($this -> _subDnLdapServer[$this -> ldapServerId])) {
return $this -> _subDnLdapServer[$this -> ldapServerId]; return $this -> _subDnLdapServer[$this -> ldapServerId];
} }
if ( is_array($this ->ldapServer['subDn']) ) { if (!isset($this ->ldapServer['subDn'])) {
$return=array(); return;
foreach($this ->ldapServer['subDn'] as $subDn_name => $subDn_config) { }
if ($subDn_name == 'LSobject') { if ( !is_array($this ->ldapServer['subDn']) ) {
if (is_array($subDn_config)) { return;
foreach($subDn_config as $LSobject_name => $LSoject_config) { }
if ($LSoject_config['topDn']) { $return=array();
$topDn = $LSoject_config['topDn']; foreach($this ->ldapServer['subDn'] as $subDn_name => $subDn_config) {
} if ($subDn_name == 'LSobject') {
else { if (is_array($subDn_config)) {
$topDn = NULL; foreach($subDn_config as $LSobject_name => $LSoject_config) {
} if ($LSoject_config['topDn']) {
if( $this -> loadLSobject($LSobject_name) ) { $topDn = $LSoject_config['topDn'];
if ($subdnobject = new $LSobject_name()) { }
$tbl_return = $subdnobject -> getSelectArray(NULL,$topDn); else {
if (is_array($tbl_return)) { $topDn = NULL;
$return=array_merge($return,$tbl_return); }
} if( $this -> loadLSobject($LSobject_name) ) {
else { if ($subdnobject = new $LSobject_name()) {
$GLOBALS['LSerror'] -> addErrorCode(1017); $tbl_return = $subdnobject -> getSelectArray(NULL,$topDn);
} if (is_array($tbl_return)) {
$return=array_merge($return,$tbl_return);
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1017); $GLOBALS['LSerror'] -> addErrorCode('LSsession_17',3);
} }
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name); $GLOBALS['LSerror'] -> addErrorCode('LSsession_17',2);
} }
} }
} }
else {
$GLOBALS['LSerror'] -> addErrorCode(1017);
}
} }
else { else {
if ((isCompatibleDNs($subDn_config['dn'],$this -> ldapServer['ldap_config']['basedn']))&&($subDn_config['dn']!="")) { $GLOBALS['LSerror'] -> addErrorCode('LSsession_17',1);
$return[$subDn_config['dn']] = $subDn_name;
}
} }
} }
if ($this -> cacheSudDn()) { else {
$this -> _subDnLdapServer[$this -> ldapServerId]=$return; if ((isCompatibleDNs($subDn_config['dn'],$this -> ldapServer['ldap_config']['basedn']))&&($subDn_config['dn']!="")) {
$_SESSION['LSsession_subDnLdapServer'] = $this -> _subDnLdapServer; $return[$subDn_config['dn']] = $subDn_name;
}
} }
return $return;
} }
else { if ($this -> cacheSudDn()) {
return; $this -> _subDnLdapServer[$this -> ldapServerId]=$return;
$_SESSION['LSsession_subDnLdapServer'] = $this -> _subDnLdapServer;
} }
return $return;
} }
/** /**
@ -893,6 +897,7 @@ class LSsession {
// Css // Css
$this -> addCssFile("LSdefault.css"); $this -> addCssFile("LSdefault.css");
$Css_txt='';
foreach ($this -> CssFiles as $file) { foreach ($this -> CssFiles as $file) {
if (!$file['path']) { if (!$file['path']) {
$file['path']=LS_CSS_DIR.'/'; $file['path']=LS_CSS_DIR.'/';
@ -901,13 +906,15 @@ class LSsession {
} }
$GLOBALS['Smarty'] -> assign('LSsession_css',$Css_txt); $GLOBALS['Smarty'] -> assign('LSsession_css',$Css_txt);
$GLOBALS['Smarty'] -> assign('LSaccess',$this -> LSaccess[$this -> topDn]); if (isset($this -> LSaccess[$this -> topDn])) {
$GLOBALS['Smarty'] -> assign('LSaccess',$this -> LSaccess[$this -> topDn]);
}
// Niveau // Niveau
$listTopDn = $this -> getSubDnLdapServer(); $listTopDn = $this -> getSubDnLdapServer();
if (is_array($listTopDn)) { if (is_array($listTopDn)) {
asort($listTopDn); asort($listTopDn);
$GLOBALS['Smarty'] -> assign('label_level',$this -> getLevelLabel()); $GLOBALS['Smarty'] -> assign('label_level',$this -> getSubDnLabel());
$GLOBALS['Smarty'] -> assign('_refresh',_('Rafraîchir')); $GLOBALS['Smarty'] -> assign('_refresh',_('Rafraîchir'));
$LSsession_topDn_index = array(); $LSsession_topDn_index = array();
$LSsession_topDn_name = array(); $LSsession_topDn_name = array();
@ -999,11 +1006,15 @@ class LSsession {
* *
* @retval boolean True si le chargement à réussi, false sinon. * @retval boolean True si le chargement à réussi, false sinon.
**/ **/
function loadLSrights() { function loadLSprofiles() {
if (is_array($this -> ldapServer['LSrights'])) { if (is_array($this -> ldapServer['LSprofiles'])) {
foreach ($this -> ldapServer['LSrights'] as $profile => $profileInfos) { foreach ($this -> ldapServer['LSprofiles'] as $profile => $profileInfos) {
if (is_array($profileInfos)) { if (is_array($profileInfos)) {
foreach ($profileInfos as $topDn => $rightsInfos) { 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 ($topDn == 'LSobjects') {
if (is_array($rightsInfos)) { if (is_array($rightsInfos)) {
foreach ($rightsInfos as $LSobject => $listInfos) { foreach ($rightsInfos as $LSobject => $listInfos) {
@ -1017,16 +1028,13 @@ class LSsession {
} }
$list = $object -> search($filter,$listInfos['basedn'],$listInfos['params']); $list = $object -> search($filter,$listInfos['basedn'],$listInfos['params']);
foreach($list as $obj) { foreach($list as $obj) {
$this -> LSrights[$profile][] = $obj['dn']; $this -> LSprofiles[$profile][] = $obj['dn'];
} }
} }
else { else {
LSdebug('Impossible de créer l\'objet de type : '.$LSobject); LSdebug('Impossible de créer l\'objet de type : '.$LSobject);
} }
} }
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
}
} }
} }
else { else {
@ -1045,7 +1053,7 @@ class LSsession {
$val = $this -> LSuserObject -> getFData($valKey); $val = $this -> LSuserObject -> getFData($valKey);
if (is_array($listDns)) { if (is_array($listDns)) {
if (in_array($val,$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']); LSdebug('Impossible de créer l\'objet de type : '.$conf['LSobject']);
} }
} }
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$conf['LSobject']);
}
} }
else { else {
if ($this -> dn == $dn) { if ($this -> dn == $dn) {
$this -> LSrights[$profile][] = $topDn; $this -> LSprofiles[$profile][] = $topDn;
} }
} }
} }
} }
else { else {
if ( $this -> dn == $rightsInfos ) { if ( $this -> dn == $rightsInfos ) {
$this -> LSrights[$profile][] = $topDn; $this -> LSprofiles[$profile][] = $topDn;
} }
} }
} // fin else ($topDn == 'LSobjects') } // fin else ($topDn == 'LSobjects')
} // fin foreach($profileInfos) } // fin foreach($profileInfos)
} // fin is_array($profileInfos) } // fin is_array($profileInfos)
} // fin foreach LSrights } // fin foreach LSprofiles
LSdebug($this -> LSrights); LSdebug($this -> LSprofiles);
return true; return true;
} }
else { else {
@ -1112,9 +1117,6 @@ class LSsession {
$access[$type] = $GLOBALS['LSobjects'][$type]['label']; $access[$type] = $GLOBALS['LSobjects'][$type]['label'];
} }
} }
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$type);
}
} }
} }
foreach($tbl as $dn => $dn_name) { 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']; $access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label'];
} }
} }
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name);
}
} }
} }
$LSaccess[$config['dn']]=$access; $LSaccess[$config['dn']]=$access;
@ -1158,9 +1154,6 @@ class LSsession {
$access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label']; $access[$objectType] = $GLOBALS['LSobjects'][$objectType]['label'];
} }
} }
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject_name);
}
} }
$LSaccess[$this -> topDn] = $access; $LSaccess[$this -> topDn] = $access;
} }
@ -1187,8 +1180,8 @@ class LSsession {
* @retval boolean True si l'utilisateur est du profil sur l'objet, false sinon. * @retval boolean True si l'utilisateur est du profil sur l'objet, false sinon.
*/ */
function isProfile($dn,$profile) { function isProfile($dn,$profile) {
if (is_array($this -> LSrights[$profile])) { if (is_array($this -> LSprofiles[$profile])) {
foreach($this -> LSrights[$profile] as $topDn) { foreach($this -> LSprofiles[$profile] as $topDn) {
if($dn == $topDn) { if($dn == $topDn) {
return true; return true;
} }
@ -1210,7 +1203,7 @@ class LSsession {
function whoami($dn) { function whoami($dn) {
$retval = array('user'); $retval = array('user');
foreach($this -> LSrights as $profile => $infos) { foreach($this -> LSprofiles as $profile => $infos) {
if($this -> isProfile($dn,$profile)) { if($this -> isProfile($dn,$profile)) {
$retval[]=$profile; $retval[]=$profile;
} }
@ -1235,7 +1228,6 @@ class LSsession {
*/ */
function canAccess($LSobject,$dn=NULL,$right=NULL,$attr=NULL) { function canAccess($LSobject,$dn=NULL,$right=NULL,$attr=NULL) {
if (!$this -> loadLSobject($LSobject)) { if (!$this -> loadLSobject($LSobject)) {
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
return; return;
} }
if ($dn) { if ($dn) {
@ -1498,8 +1490,8 @@ class LSsession {
* *
* @retval boolean True si le cache des droits est activé, false sinon. * @retval boolean True si le cache des droits est activé, false sinon.
*/ */
function cacheLSrights() { function cacheLSprofiles() {
return ( ($GLOBALS['LSconfig']['cacheLSrights']) || ($this -> ldapServer['cacheLSrights']) ); return ( ($GLOBALS['LSconfig']['cacheLSprofiles']) || ($this -> ldapServer['cacheLSprofiles']) );
} }
/** /**
@ -1531,8 +1523,8 @@ class LSsession {
* *
* @retval string Le label des niveaux pour le serveur ldap dourant * @retval string Le label des niveaux pour le serveur ldap dourant
*/ */
function getLevelLabel() { function getSubDnLabel() {
return ($this -> ldapServer['levelLabel']!='')?$this -> ldapServer['levelLabel']:_('Niveau'); 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]); $format[$i]=ereg_replace($ch[0],$value,$format[$i]);
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(901,array('meth' => $meth,'obj' => $ch[1])); $GLOBALS['LSerror'] -> addErrorCode('fct_getFData_01',array('meth' => $meth,'obj' => $ch[1]));
break; break;
} }
} }
@ -136,7 +136,7 @@ function getFData($format,$data,$meth=NULL) {
$format[$i]=ereg_replace($ch[0],$value,$format[$i]); $format[$i]=ereg_replace($ch[0],$value,$format[$i]);
} }
else { else {
$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; break;
} }
} }
@ -148,6 +148,12 @@ function getFData($format,$data,$meth=NULL) {
} }
return $format; 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) { function getFieldInFormat($format) {
$fields=array(); $fields=array();
@ -183,6 +189,7 @@ function return_data($data) {
return $data; return $data;
} }
$GLOBALS['LSdebug']['fields']=array();
function LSdebug($data,$dump=false) { function LSdebug($data,$dump=false) {
if ($dump) { if ($dump) {
ob_start(); ob_start();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>LdapSaisie{if $pagetitle != ''} - {$pagetitle}{/if}</title> <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.css" title="Normal" />
<link rel="stylesheet" type="text/css" href="{$LS_CSS_DIR}/base_print.css" media='print' title="Normal" /> <link rel="stylesheet" type="text/css" href="{$LS_CSS_DIR}/base_print.css" media='print' title="Normal" />
{$LSsession_css} {$LSsession_css}
@ -22,30 +24,35 @@
<div id='LSdebug_infos'>{if $LSdebug != ''}{$LSdebug}{/if}</div> <div id='LSdebug_infos'>{if $LSdebug != ''}{$LSdebug}{/if}</div>
</div> </div>
<div id='main'>
<div id='left'> <table id='main'>
<a href='index.php'><img src='{$LS_IMAGES_DIR}/logo.png' alt='Logo' id='logo'/></a> <tr>
<td rowspan=2 id='left'>
{if $LSsession_subDn!=""} <a href='index.php'><img src='{$LS_IMAGES_DIR}/logo.png' alt='Logo' id='logo'/></a>
<form action="index.php" method='post' id='LSsession_topDn_form'>
<label>{$label_level} {if $LSsession_subDn!=""}
<a href="index.php?LSsession_refresh"><img src='{$LS_IMAGES_DIR}/refresh.png' alt='{$_refresh}' title='{$_refresh}' /></a> <form action="index.php" method='post' id='LSsession_topDn_form'>
<select name='LSsession_topDn' id='LSsession_topDn'> <label>{$label_level}
{html_options values=$LSsession_subDn_indexes output=$LSsession_subDn_names selected=$LSsession_subDn} <a href="index.php?LSsession_refresh"><img src='{$LS_IMAGES_DIR}/refresh.png' alt='{$_refresh}' title='{$_refresh}' /></a>
</select> <select name='LSsession_topDn' id='LSsession_topDn'>
</label> {html_options values=$LSsession_subDn_indexes output=$LSsession_subDn_names selected=$LSsession_subDn}
</form> </select>
{/if} </label>
<ul class='menu'> </form>
{foreach from=$LSaccess item=label key=LSobject_type} {/if}
<li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{$label}</a></li> <ul class='menu'>
{/foreach} {foreach from=$LSaccess item=label key=LSobject_type}
</ul> <li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{$label}</a></li>
</div> {/foreach}
<div id='right'> </ul>
</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>
</td>
</tr>
<tr>
<td id='right'>
<p 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>

View file

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