ldapsaisie/trunk/index.php
Benjamin Renard 337be06f1f Gros commit avec principalement la suppression de HTML_QuickForm (qui s'est révélé trop peu
souple) remplacé par la classes LSform qui réimplemente pas mal de fonctionnalités de 
HTML_QuickForm en gérant nativement que tout les champs soit à valeurs multiples.

Dans l'état actuel, la modification et la création d'objet sont gérés.

B.Renard
2007-11-15 18:07:24 +00:00

113 lines
4.3 KiB
PHP
Raw Blame History

<pre>
<?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.
******************************************************************************/
define('LS_CONF_DIR','conf/');
define('LS_INCLUDE_DIR','includes/');
define('LS_CLASS_DIR', LS_INCLUDE_DIR .'class/');
define('LS_LIB_DIR', LS_INCLUDE_DIR .'libs/');
define('LS_ADDONS_DIR', LS_INCLUDE_DIR .'addons/');
require_once LS_CONF_DIR .'config.php';
require_once LS_CONF_DIR .'error_code.php';
require_once LS_CONF_DIR .'config.LSeepeople.php';
require_once LS_CONF_DIR .'config.LSeegroup.php';
require_once $GLOBALS['LSconfig']['NetLDAP'];
require_once LS_INCLUDE_DIR .'functions.php';
require_once LS_CLASS_DIR .'class.LSerror.php';
require_once LS_CLASS_DIR .'class.LSldap.php';
require_once LS_CLASS_DIR .'class.LSldapObject.php';
require_once LS_CLASS_DIR .'class.LSattribute.php';
require_once LS_CLASS_DIR .'class.LSattr_ldap.php';
require_once LS_CLASS_DIR .'class.LSattr_ldap_ascii.php';
require_once LS_CLASS_DIR .'class.LSattr_ldap_password.php';
require_once LS_CLASS_DIR .'class.LSattr_ldap_numeric.php';
require_once LS_CLASS_DIR .'class.LSattr_html.php';
require_once LS_CLASS_DIR .'class.LSattr_html_text.php';
require_once LS_CLASS_DIR .'class.LSattr_html_textarea.php';
require_once LS_CLASS_DIR .'class.LSattr_html_password.php';
require_once LS_CLASS_DIR .'class.LSattr_html_select_list.php';
require_once LS_CLASS_DIR .'class.LSeepeople.php';
require_once LS_CLASS_DIR .'class.LSeegroup.php';
require_once LS_CLASS_DIR .'class.LSform.php';
require_once LS_CLASS_DIR .'class.LSformElement.php';
require_once LS_CLASS_DIR .'class.LSformElement_text.php';
require_once LS_CLASS_DIR .'class.LSformElement_textarea.php';
require_once LS_CLASS_DIR .'class.LSformElement_select.php';
require_once LS_CLASS_DIR .'class.LSformElement_password.php';
require_once LS_CLASS_DIR .'class.LSformRule.php';
require_once LS_CLASS_DIR .'class.LSformRule_regex.php';
require_once LS_CLASS_DIR .'class.LSformRule_alphanumeric.php';
require_once LS_CLASS_DIR .'class.LSformRule_compare.php';
require_once LS_CLASS_DIR .'class.LSformRule_email.php';
require_once LS_CLASS_DIR .'class.LSformRule_lettersonly.php';
require_once LS_CLASS_DIR .'class.LSformRule_maxlength.php';
require_once LS_CLASS_DIR .'class.LSformRule_minlength.php';
require_once LS_CLASS_DIR .'class.LSformRule_nonzero.php';
require_once LS_CLASS_DIR .'class.LSformRule_nopunctuation.php';
require_once LS_CLASS_DIR .'class.LSformRule_numeric.php';
require_once LS_CLASS_DIR .'class.LSformRule_rangelength.php';
require_once LS_ADDONS_DIR .'LSaddons.samba.php';
LSaddon_samba_support();
require_once LS_ADDONS_DIR .'LSaddons.posix.php';
LSaddon_posix_support();
// Simulation d'une LSsession
$GLOBALS['LSsession']['topDn']='o=lsexample';
// "Activation" de la gestion des erreurs
$LSerror = new LSerror();
// Connexion <20> l'annuaire
$LSldap = new LSldap($GLOBALS['LSconfig']['ldap_config']);
// ---- les objets LDAP
// Cr<43>ation d'un LSeepeople
$eepeople = new LSeepeople($GLOBALS['LSobjects']['LSeepeople']);
// Chargement des donn<6E>es de l'objet depuis l'annuaire et <20> partir de son DN
$eepeople-> loadData('uid=eeggs,ou=people,o=lsexample');
// Cr<43>ation d'un formulaire <20> partir pour notre objet LDAP
$form=$eepeople -> getForm('test');
// Gestion de sa validation
if ($form->validate()) {
// M<>J des donn<6E>es de l'objet LDAP
$eepeople -> updateData('test');
}
// Affichage du formulaire
$form -> display();
// Affichage des retours d'erreurs
$LSerror -> display();
?>
</pre>
<?php debug_print(); ?>