1 |
<?php
|
1 |
<?php
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
4 |
// | PHP version 4.1 |
|
4 |
// | PHP version 4.1 |
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
8 |
// | This library is free software; you can redistribute it and/or |
|
8 |
// | This library is free software; you can redistribute it and/or |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
10 |
// | License as published by the Free Software Foundation; either |
|
10 |
// | License as published by the Free Software Foundation; either |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
12 |
// | |
|
12 |
// | |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
// | Lesser General Public License for more details. |
|
16 |
// | Lesser General Public License for more details. |
|
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: identification.php,v 1.1 2004-06-15 15:01:41 jpm Exp $
|
22 |
// CVS : $Id: identification.php,v 1.2 2004-06-21 07:37:30 alex Exp $
|
23 |
/**
|
23 |
/**
|
24 |
* Applette : identification
|
24 |
* Applette : identification
|
25 |
*
|
25 |
*
|
26 |
* Génère un formulaire les champs nécessaires pour s'identifier.
|
26 |
* Génère un formulaire les champs nécessaires pour s'identifier.
|
27 |
* Nécessite :
|
27 |
* Nécessite :
|
28 |
* - Variable globale de Génésia.
|
28 |
* - Variable globale de Génésia.
|
29 |
* - Pear Auth
|
29 |
* - Pear Auth
|
30 |
* - Pear Net_URL
|
30 |
* - Pear Net_URL
|
31 |
*
|
31 |
*
|
- |
|
32 |
* A faire : remplacer le formulaire par un QuickForm
|
- |
|
33 |
*
|
32 |
*@package Applette
|
34 |
*@package Applette
|
33 |
*@subpackage Identification
|
35 |
*@subpackage Identification
|
34 |
//Auteur original :
|
36 |
//Auteur original :
|
35 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
37 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
36 |
//Autres auteurs :
|
38 |
//Autres auteurs :
|
37 |
*@author Aucun
|
39 |
*@author Aucun
|
38 |
*@copyright Tela-Botanica 2000-2004
|
40 |
*@copyright Tela-Botanica 2000-2004
|
39 |
*@version $Revision: 1.1 $ $Date: 2004-06-15 15:01:41 $
|
41 |
*@version $Revision: 1.2 $ $Date: 2004-06-21 07:37:30 $
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
41 |
*/
|
43 |
*/
|
42 |
|
44 |
|
43 |
// +------------------------------------------------------------------------------------------------------+
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
44 |
// | ENTÊTE du PROGRAMME |
|
46 |
// | ENTÊTE du PROGRAMME |
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
47 |
// +------------------------------------------------------------------------------------------------------+
|
46 |
$_GEN_commun['info_applette_nom_fonction'] = 'afficherFormIdentification';
|
48 |
$_GEN_commun['info_applette_nom_fonction'] = 'afficherFormIdentification';
|
47 |
$_GEN_commun['info_applette_balise'] = 'IDENTIFICATION';
|
49 |
$_GEN_commun['info_applette_balise'] = 'IDENTIFICATION';
|
48 |
|
50 |
|
49 |
// +------------------------------------------------------------------------------------------------------+
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
50 |
// | CORPS du PROGRAMME |
|
52 |
// | CORPS du PROGRAMME |
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
53 |
// +------------------------------------------------------------------------------------------------------+
|
52 |
|
54 |
|
53 |
// Si le site utilise une authentification.
|
55 |
// Si le site utilise une authentification.
|
54 |
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
|
56 |
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
|
55 |
// Si un formulaire nous renvoie en POST une variable "deconnexion", nous délogons l'utilisateur.
|
57 |
// Si un formulaire nous renvoie en POST une variable "deconnexion", nous délogons l'utilisateur.
|
56 |
if (isset($_POST['deconnexion'])) {
|
58 |
if (isset($_POST['deconnexion'])) {
|
57 |
$_GEN_commun['pear_auth']->logout();
|
59 |
$_GEN_commun['pear_auth']->logout();
|
58 |
$_GEN_commun['pear_auth']->start();
|
60 |
$_GEN_commun['pear_auth']->start();
|
59 |
}
|
61 |
}
|
60 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
62 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
61 |
if (isset($_POST['connexion'])) {
|
63 |
if (isset($_POST['connexion'])) {
|
62 |
$_GEN_commun['pear_auth']->login();
|
64 |
$_GEN_commun['pear_auth']->login();
|
63 |
$_SESSION['username'] = $username;
|
65 |
$_SESSION['username'] = $username;
|
64 |
}
|
66 |
}
|
65 |
}
|
67 |
}
|
66 |
|
68 |
|
67 |
// +------------------------------------------------------------------------------------------------------+
|
69 |
// +------------------------------------------------------------------------------------------------------+
|
68 |
// | LISTE de FONCTIONS |
|
70 |
// | LISTE de FONCTIONS |
|
69 |
// +------------------------------------------------------------------------------------------------------+
|
71 |
// +------------------------------------------------------------------------------------------------------+
|
70 |
|
72 |
|
71 |
/** Fonction afficherFormIdentification() - Retourne une formulaire pour s'identifier.
|
73 |
/** Fonction afficherFormIdentification() - Retourne une formulaire pour s'identifier.
|
72 |
*
|
74 |
*
|
73 |
* Retourne un formulaire d'identificatin ou de déconnexion suivant que l'utilisateur est
|
75 |
* Retourne un formulaire d'identificatin ou de déconnexion suivant que l'utilisateur est
|
74 |
* identifié ou pas.
|
76 |
* identifié ou pas.
|
75 |
*
|
77 |
*
|
76 |
* @param array tableau d'éventuel arguments présent dans la balise transmis à la fonction.
|
78 |
* @param array tableau d'éventuel arguments présent dans la balise transmis à la fonction.
|
77 |
* @param array tableau global de Papyrus.
|
79 |
* @param array tableau global de Papyrus.
|
78 |
* @return string formulaire de connexion ou de déconnexion.
|
80 |
* @return string formulaire de connexion ou de déconnexion.
|
79 |
*/
|
81 |
*/
|
80 |
function afficherFormIdentification($tab_arguments, $_GEN_commun)
|
82 |
function afficherFormIdentification($tab_arguments, $_GEN_commun)
|
81 |
{
|
83 |
{
|
82 |
// Initialisation de variable.
|
84 |
// Initialisation de variable.
|
83 |
$objet_pear_auth = $_GEN_commun['pear_auth'];
|
85 |
$objet_pear_auth = $_GEN_commun['pear_auth'];
|
84 |
$url = $_GEN_commun['url']->getUrl();
|
86 |
$url = $_GEN_commun['url']->getUrl();
|
85 |
// Récupération des valeurs pour le login et le mot de passe
|
87 |
// Récupération des valeurs pour le login et le mot de passe
|
86 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
88 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
87 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
89 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
88 |
|
90 |
|
89 |
// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica
|
91 |
// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica
|
90 |
// Devrait être déplacer dans l'appli inscription de Tela.
|
92 |
// Devrait être déplacer dans l'appli inscription de Tela.
|
91 |
if (isset($_GEN_commun['auth_info']->gsab_nom_table) && $_GEN_commun['auth_info']->gsab_nom_table == 'annuaire_tela') {
|
93 |
if (isset($_GEN_commun['auth_info']->gsab_nom_table) && $_GEN_commun['auth_info']->gsab_nom_table == 'annuaire_tela') {
|
92 |
verification_mot_de_passe($db, $mot_de_passe, $login);
|
94 |
verification_mot_de_passe($db, $mot_de_passe, $login);
|
93 |
}
|
95 |
}
|
94 |
|
96 |
|
95 |
if (! $objet_pear_auth->getAuth()) {
|
97 |
if (! $objet_pear_auth->getAuth()) {
|
96 |
// L'utilisateur n'est pas identifié:
|
98 |
// L'utilisateur n'est pas identifié:
|
97 |
$res = str_repeat(' ', 16).'<form id="form_connexion" action="'.$url.'" method="post">'."\n";
|
99 |
$res = str_repeat(' ', 16).'<form id="form_connexion" action="'.$url.'" method="post">'."\n";
|
98 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
100 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
99 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
101 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
100 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
102 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
101 |
$res .= str_repeat(' ', 24).'<label for="username">'.'Courriel :'.'</label>'."\n";
|
103 |
$res .= str_repeat(' ', 24).'<label for="username">'.'Courriel :'.'</label>'."\n";
|
102 |
$res .= str_repeat(' ', 24).'<input type="text" id="username" name="username" size="15" tabindex="1" value="'.'courriel'.'" />'."\n";
|
104 |
$res .= str_repeat(' ', 24).'<input type="text" id="username" name="username" size="9" maxlength="80" tabindex="1" value="'.'courriel'.'" />'."\n";
|
103 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
105 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
104 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
106 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
105 |
$res .= str_repeat(' ', 24).'<label for="password">'.'Mot de passe :'.'</label>'."\n";
|
107 |
$res .= str_repeat(' ', 24).'<label for="password">'.'Mot de passe :'.'</label>'."\n";
|
106 |
$res .= str_repeat(' ', 24).'<input type="password" id="password" name="password" size="15" tabindex="2" value="'.'mot de passe'.'" />'."\n";
|
108 |
$res .= str_repeat(' ', 24).'<input type="password" id="password" name="password" size="9" maxlength="80" tabindex="2" value="'.'mot de passe'.'" />'."\n";
|
107 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
109 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
108 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
110 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
109 |
$res .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="3" value="'.'s\'identifier'.'" />'."\n";
|
111 |
$res .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="3" value="'.'ok'.'" />'."\n";
|
110 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
112 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
111 |
$res .= str_repeat(' ', 16).'</fieldset>'."\n";
|
113 |
$res .= str_repeat(' ', 16).'</fieldset>'."\n";
|
112 |
$res .= str_repeat(' ', 16).'</form>';
|
114 |
$res .= str_repeat(' ', 16).'</form>';
|
113 |
} else {
|
115 |
} else {
|
114 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
116 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
115 |
// Amélioré la récupération des informations sur l'utilisateur.
|
117 |
// Amélioré la récupération des informations sur l'utilisateur.
|
116 |
//$nom_utilisateur = $objet_pear_auth->getAuthData($champ_nom);
|
118 |
//$nom_utilisateur = $objet_pear_auth->getAuthData($champ_nom);
|
117 |
|
119 |
|
118 |
$res = str_repeat(' ', 16).'<form id="form_deconnexion" action="'.$url.'" method="post">'."\n";
|
120 |
$res = str_repeat(' ', 16).'<form id="form_deconnexion" action="'.$url.'" method="post">'."\n";
|
119 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
121 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
120 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
122 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
121 |
// Il faudrait mettre dans la base de données le prénom et le nom ou chercher comment définir ces champs en fonction
|
123 |
// Il faudrait mettre dans la base de données le prénom et le nom ou chercher comment définir ces champs en fonction
|
122 |
// de l'annuaire utilisé, si on veut les afficher après le message de bienvenue.
|
124 |
// de l'annuaire utilisé, si on veut les afficher après le message de bienvenue.
|
123 |
$res .= str_repeat(' ', 20).'<p>'.'Bienvenue!'.'</p>'."\n";
|
125 |
$res .= str_repeat(' ', 20).'<p>'.'Bienvenue!'.'</p>'."\n";
|
124 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
126 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
125 |
$res .= str_repeat(' ', 24).'<input type="submit" id="deconnexion" name="deconnexion" tabindex="1" value="'.'se déconnecter'.'" />'."\n";
|
127 |
$res .= str_repeat(' ', 24).'<input type="submit" id="deconnexion" name="deconnexion" tabindex="1" value="'.'déconnexion'.'" />'."\n";
|
126 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
128 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
127 |
$res .= str_repeat(' ', 16).'</fieldset>'."\n";
|
129 |
$res .= str_repeat(' ', 16).'</fieldset>'."\n";
|
128 |
$res .= str_repeat(' ', 16).'</form>';
|
130 |
$res .= str_repeat(' ', 16).'</form>';
|
129 |
}
|
131 |
}
|
130 |
return $res ;
|
132 |
return $res ;
|
131 |
}
|
133 |
}
|
132 |
|
134 |
|
133 |
// +------------------------------------------------------------------------------------------------------+
|
135 |
// +------------------------------------------------------------------------------------------------------+
|
134 |
// | PIED du PROGRAMME |
|
136 |
// | PIED du PROGRAMME |
|
135 |
// +------------------------------------------------------------------------------------------------------+
|
137 |
// +------------------------------------------------------------------------------------------------------+
|
136 |
|
138 |
|
137 |
|
139 |
|
138 |
|
140 |
|
139 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
141 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
140 |
*
|
142 |
*
|
141 |
* $Log: not supported by cvs2svn $
|
143 |
* $Log: not supported by cvs2svn $
|
- |
|
144 |
* Revision 1.1 2004/06/15 15:01:41 jpm
|
- |
|
145 |
* Changement de nom et d'arborescence de Genesia en Papyrus.
|
- |
|
146 |
*
|
142 |
* Revision 1.5 2004/05/05 06:44:15 jpm
|
147 |
* Revision 1.5 2004/05/05 06:44:15 jpm
|
143 |
* Complément des commentaires indiquant les paquetages nécessaire à l'applette.
|
148 |
* Complément des commentaires indiquant les paquetages nécessaire à l'applette.
|
144 |
*
|
149 |
*
|
145 |
* Revision 1.4 2004/05/03 11:18:55 jpm
|
150 |
* Revision 1.4 2004/05/03 11:18:55 jpm
|
146 |
* Intégration de la variable globale de Génésia dans les arguments de la fonction de l'applette.
|
151 |
* Intégration de la variable globale de Génésia dans les arguments de la fonction de l'applette.
|
147 |
*
|
152 |
*
|
148 |
* Revision 1.3 2004/05/01 17:21:16 jpm
|
153 |
* Revision 1.3 2004/05/01 17:21:16 jpm
|
149 |
* Ajout d'un fieldset et d'une légende au formulaire.
|
154 |
* Ajout d'un fieldset et d'une légende au formulaire.
|
150 |
*
|
155 |
*
|
151 |
* Revision 1.2 2004/05/01 16:13:07 jpm
|
156 |
* Revision 1.2 2004/05/01 16:13:07 jpm
|
152 |
* Ajout du nom de la balise de l'applette dans le code de l'applette.
|
157 |
* Ajout du nom de la balise de l'applette dans le code de l'applette.
|
153 |
*
|
158 |
*
|
154 |
* Revision 1.1 2004/05/01 11:42:01 jpm
|
159 |
* Revision 1.1 2004/05/01 11:42:01 jpm
|
155 |
* Ajout de l'applette identification.
|
160 |
* Ajout de l'applette identification.
|
156 |
*
|
161 |
*
|
157 |
*
|
162 |
*
|
158 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
163 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
159 |
*/
|
164 |
*/
|
160 |
?>
|
165 |
?>
|