2007-11-15 19:07:24 +01:00
|
|
|
|
<pre>
|
2007-03-29 18:10:14 +02:00
|
|
|
|
<?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.
|
|
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
2007-11-15 19:07:24 +01:00
|
|
|
|
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';
|
2007-03-29 18:10:14 +02:00
|
|
|
|
require_once $GLOBALS['LSconfig']['NetLDAP'];
|
2007-11-15 19:07:24 +01:00
|
|
|
|
|
|
|
|
|
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';
|
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
|
|
|
|
|
|
// "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']);
|
2007-11-15 19:07:24 +01:00
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
|
// Chargement des donn<6E>es de l'objet depuis l'annuaire et <20> partir de son DN
|
2007-11-15 19:07:24 +01:00
|
|
|
|
$eepeople-> loadData('uid=eeggs,ou=people,o=lsexample');
|
2007-03-29 18:10:14 +02:00
|
|
|
|
|
|
|
|
|
// 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();
|
2007-11-15 19:07:24 +01:00
|
|
|
|
?>
|
|
|
|
|
</pre>
|
|
|
|
|
<?php debug_print(); ?>
|