Rev 17 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/*vim: set expandtab tabstop=4 shiftwidth=4: */// +------------------------------------------------------------------------------------------------------+// | PHP version 4.1 |// +------------------------------------------------------------------------------------------------------+// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |// +------------------------------------------------------------------------------------------------------+// | This library is free software; you can redistribute it and/or |// | modify it under the terms of the GNU Lesser General Public |// | License as published by the Free Software Foundation; either |// | version 2.1 of the License, or (at your option) any later version. |// | |// | This library 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 |// | Lesser General Public License for more details. |// | |// | You should have received a copy of the GNU Lesser General Public |// | License along with this library; if not, write to the Free Software |// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |// +------------------------------------------------------------------------------------------------------+// CVS : $Id: identification.php,v 1.1 2004-06-15 15:01:41 jpm Exp $/*** Applette : identification** Génère un formulaire les champs nécessaires pour s'identifier.* Nécessite :* - Variable globale de Génésia.* - Pear Auth* - Pear Net_URL**@package Applette*@subpackage Identification//Auteur original :*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>//Autres auteurs :*@author Aucun*@copyright Tela-Botanica 2000-2004*@version $Revision: 1.1 $ $Date: 2004-06-15 15:01:41 $// +------------------------------------------------------------------------------------------------------+*/// +------------------------------------------------------------------------------------------------------+// | ENTÊTE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+$_GEN_commun['info_applette_nom_fonction'] = 'afficherFormIdentification';$_GEN_commun['info_applette_balise'] = 'IDENTIFICATION';// +------------------------------------------------------------------------------------------------------+// | CORPS du PROGRAMME |// +------------------------------------------------------------------------------------------------------+// Si le site utilise une authentification.if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {// Si un formulaire nous renvoie en POST une variable "deconnexion", nous délogons l'utilisateur.if (isset($_POST['deconnexion'])) {$_GEN_commun['pear_auth']->logout();$_GEN_commun['pear_auth']->start();}// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.if (isset($_POST['connexion'])) {$_GEN_commun['pear_auth']->login();$_SESSION['username'] = $username;}}// +------------------------------------------------------------------------------------------------------+// | LISTE de FONCTIONS |// +------------------------------------------------------------------------------------------------------+/** Fonction afficherFormIdentification() - Retourne une formulaire pour s'identifier.** Retourne un formulaire d'identificatin ou de déconnexion suivant que l'utilisateur est* identifié ou pas.** @param array tableau d'éventuel arguments présent dans la balise transmis à la fonction.* @param array tableau global de Papyrus.* @return string formulaire de connexion ou de déconnexion.*/function afficherFormIdentification($tab_arguments, $_GEN_commun){// Initialisation de variable.$objet_pear_auth = $_GEN_commun['pear_auth'];$url = $_GEN_commun['url']->getUrl();// Récupération des valeurs pour le login et le mot de passe$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];$login = (! isset($_POST['username'])) ? '' : $_POST['username'];// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica// Devrait être déplacer dans l'appli inscription de Tela.if (isset($_GEN_commun['auth_info']->gsab_nom_table) && $_GEN_commun['auth_info']->gsab_nom_table == 'annuaire_tela') {verification_mot_de_passe($db, $mot_de_passe, $login);}if (! $objet_pear_auth->getAuth()) {// L'utilisateur n'est pas identifié:$res = str_repeat(' ', 16).'<form id="form_connexion" action="'.$url.'" method="post">'."\n";$res .= str_repeat(' ', 16).'<fieldset>'."\n";$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";$res .= str_repeat(' ', 20).'<p>'."\n";$res .= str_repeat(' ', 24).'<label for="username">'.'Courriel :'.'</label>'."\n";$res .= str_repeat(' ', 24).'<input type="text" id="username" name="username" size="15" tabindex="1" value="'.'courriel'.'" />'."\n";$res .= str_repeat(' ', 20).'</p>'."\n";$res .= str_repeat(' ', 20).'<p>'."\n";$res .= str_repeat(' ', 24).'<label for="password">'.'Mot de passe :'.'</label>'."\n";$res .= str_repeat(' ', 24).'<input type="password" id="password" name="password" size="15" tabindex="2" value="'.'mot de passe'.'" />'."\n";$res .= str_repeat(' ', 20).'</p>'."\n";$res .= str_repeat(' ', 20).'<p>'."\n";$res .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="3" value="'.'s\'identifier'.'" />'."\n";$res .= str_repeat(' ', 20).'</p>'."\n";$res .= str_repeat(' ', 16).'</fieldset>'."\n";$res .= str_repeat(' ', 16).'</form>';} else {// L'utilisateur est identifié. Nous affichons ses informations.// Amélioré la récupération des informations sur l'utilisateur.//$nom_utilisateur = $objet_pear_auth->getAuthData($champ_nom);$res = str_repeat(' ', 16).'<form id="form_deconnexion" action="'.$url.'" method="post">'."\n";$res .= str_repeat(' ', 16).'<fieldset>'."\n";$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";// Il faudrait mettre dans la base de données le prénom et le nom ou chercher comment définir ces champs en fonction// de l'annuaire utilisé, si on veut les afficher après le message de bienvenue.$res .= str_repeat(' ', 20).'<p>'.'Bienvenue!'.'</p>'."\n";$res .= str_repeat(' ', 20).'<p>'."\n";$res .= str_repeat(' ', 24).'<input type="submit" id="deconnexion" name="deconnexion" tabindex="1" value="'.'se déconnecter'.'" />'."\n";$res .= str_repeat(' ', 20).'</p>'."\n";$res .= str_repeat(' ', 16).'</fieldset>'."\n";$res .= str_repeat(' ', 16).'</form>';}return $res ;}// +------------------------------------------------------------------------------------------------------+// | PIED du PROGRAMME |// +------------------------------------------------------------------------------------------------------+/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: not supported by cvs2svn $* Revision 1.5 2004/05/05 06:44:15 jpm* Complément des commentaires indiquant les paquetages nécessaire à l'applette.** Revision 1.4 2004/05/03 11:18:55 jpm* Intégration de la variable globale de Génésia dans les arguments de la fonction de l'applette.** Revision 1.3 2004/05/01 17:21:16 jpm* Ajout d'un fieldset et d'une légende au formulaire.** Revision 1.2 2004/05/01 16:13:07 jpm* Ajout du nom de la balise de l'applette dans le code de l'applette.** Revision 1.1 2004/05/01 11:42:01 jpm* Ajout de l'applette identification.*** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>