Line 17... |
Line 17... |
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.8 2005-03-10 12:50:44 alex Exp $
|
22 |
// CVS : $Id: identification.php,v 1.9 2005-03-15 14:17:46 jpm 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 :
|
Line 36... |
Line 36... |
36 |
//Auteur original :
|
36 |
//Auteur original :
|
37 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
37 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
38 |
//Autres auteurs :
|
38 |
//Autres auteurs :
|
39 |
*@author Aucun
|
39 |
*@author Aucun
|
40 |
*@copyright Tela-Botanica 2000-2004
|
40 |
*@copyright Tela-Botanica 2000-2004
|
41 |
*@version $Revision: 1.8 $ $Date: 2005-03-10 12:50:44 $
|
41 |
*@version $Revision: 1.9 $ $Date: 2005-03-15 14:17:46 $
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
43 |
*/
|
43 |
*/
|
Line 44... |
Line 44... |
44 |
|
44 |
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
46 |
// | ENTÊTE du PROGRAMME |
|
46 |
// | ENTÊTE du PROGRAMME |
|
47 |
// +------------------------------------------------------------------------------------------------------+
|
47 |
// +------------------------------------------------------------------------------------------------------+
|
48 |
$_GEN_commun['info_applette_nom_fonction'] = 'afficherFormIdentification';
|
48 |
$_GEN_commun['info_applette_nom_fonction'] = 'afficherFormIdentification';
|
49 |
$_GEN_commun['info_applette_balise'] = 'IDENTIFICATION';
|
49 |
$_GEN_commun['info_applette_balise'] = 'IDENTIFICATION';
|
- |
|
50 |
|
- |
|
51 |
/** Inclusion du fichier de configuration de cette applette.*/
|
- |
|
52 |
require_once GEN_CHEMIN_APPLETTE.'identification/configuration/iden_config.inc.php';
|
- |
|
53 |
|
- |
|
54 |
// Inclusion des fichiers de traduction de l'applette.
|
- |
|
55 |
if (file_exists(IDEN_CHEMIN_LANGUE.'iden_langue_'.$_GEN_commun['i18n'].'.inc.php')) {
|
- |
|
56 |
/** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
|
- |
|
57 |
require_once IDEN_CHEMIN_LANGUE.'iden_langue_'.$_GEN_commun['i18n'].'.inc.php';
|
- |
|
58 |
} else {
|
- |
|
59 |
/** Inclusion du fichier de traduction par défaut.*/
|
- |
|
60 |
require_once IDEN_CHEMIN_LANGUE.'iden_langue_'.IDEN_I18N_DEFAUT.'.inc.php';
|
50 |
|
61 |
}
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
62 |
// +------------------------------------------------------------------------------------------------------+
|
52 |
// | CORPS du PROGRAMME |
|
63 |
// | CORPS du PROGRAMME |
|
Line 53... |
Line 64... |
53 |
// +------------------------------------------------------------------------------------------------------+
|
64 |
// +------------------------------------------------------------------------------------------------------+
|
54 |
|
65 |
|
55 |
// Si le site utilise une authentification.
|
66 |
// Si le site utilise une authentification.
|
56 |
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
|
67 |
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
|
57 |
// Si un formulaire nous renvoie en POST une variable "deconnexion", nous délogons l'utilisateur.
|
68 |
// Si un formulaire nous renvoie en POST une variable "deconnexion", nous délogons l'utilisateur.
|
58 |
if (isset($_POST['deconnexion'])) {
|
69 |
if (isset($_REQUEST['deconnexion']) || isset($_REQUEST['logout'])) {
|
59 |
$_GEN_commun['pear_auth']->logout();
|
70 |
$_GEN_commun['pear_auth']->logout();
|
60 |
// Le test suivant vérifie si une authentification SPIP est en cour, vois pap_initialise_auth.inc.php
|
71 |
// Le test suivant vérifie si une authentification SPIP est en cour, vois pap_initialise_auth.inc.php
|
61 |
if (isset ($chemin_spip) && isset ($coauth) && $coauth == $auth_courante['gsab_id_auth_bdd']) {
|
72 |
if (isset ($chemin_spip) && isset ($coauth) && $coauth == $auth_courante['gsab_id_auth_bdd']) {
|
Line 85... |
Line 96... |
85 |
}
|
96 |
}
|
86 |
}
|
97 |
}
|
87 |
$_GEN_commun['pear_auth']->start();
|
98 |
$_GEN_commun['pear_auth']->start();
|
88 |
}
|
99 |
}
|
89 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
100 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
90 |
if (isset($_POST['connexion'])) {
|
101 |
if (isset($_REQUEST['connexion'])) {
|
91 |
$_GEN_commun['pear_auth']->login();
|
102 |
$_GEN_commun['pear_auth']->login();
|
92 |
$_SESSION['username'] = $username;
|
103 |
$_SESSION['username'] = $username;
|
93 |
}
|
104 |
}
|
94 |
}
|
105 |
}
|
Line 104... |
Line 115... |
104 |
*
|
115 |
*
|
105 |
* @param array tableau d'éventuel arguments présent dans la balise transmis à la fonction.
|
116 |
* @param array tableau d'éventuel arguments présent dans la balise transmis à la fonction.
|
106 |
* @param array tableau global de Papyrus.
|
117 |
* @param array tableau global de Papyrus.
|
107 |
* @return string formulaire de connexion ou de déconnexion.
|
118 |
* @return string formulaire de connexion ou de déconnexion.
|
108 |
*/
|
119 |
*/
|
109 |
function afficherFormIdentification($tab_arguments, $_GEN_commun)
|
120 |
function afficherFormIdentification($tab_arguments, &$_GEN_commun)
|
110 |
{
|
121 |
{
|
111 |
// Initialisation de variable.
|
122 |
// Initialisation de variable.
|
112 |
$objet_pear_auth = $_GEN_commun['pear_auth'];
|
123 |
$objet_pear_auth =& $GLOBALS['_GEN_commun']['pear_auth'];
|
113 |
$objet_pear_db = $_GEN_commun['pear_db'];
|
124 |
$objet_pear_db =& $GLOBALS['_GEN_commun']['pear_db'];
|
114 |
$url = $_GEN_commun['url']->getURL();
|
125 |
$url = $GLOBALS['_GEN_commun']['url']->getURL();
|
115 |
// Récupération des valeurs pour le login et le mot de passe
|
126 |
// Récupération des valeurs pour le login et le mot de passe
|
116 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
127 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
117 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
128 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
Line 118... |
Line 129... |
118 |
|
129 |
|
119 |
// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica
|
130 |
// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica
|
120 |
// Devrait être déplacer dans l'appli inscription de Tela.
|
131 |
// Devrait être déplacer dans l'appli inscription de Tela.
|
121 |
if (isset($_GEN_commun['info_auth_bdd']->gsab_nom_table) && $_GEN_commun['info_auth_bdd']->gsab_nom_table == 'annuaire_tela') {
|
132 |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_nom_table) && $GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_nom_table == 'annuaire_tela') {
|
122 |
verification_mot_de_passe($objet_pear_db, $mot_de_passe, $login);
|
133 |
verification_mot_de_passe($objet_pear_db, $mot_de_passe, $login);
|
123 |
if (isset($_POST['connexion'])) {
|
134 |
if (isset($_POST['connexion'])) {
|
124 |
$_GEN_commun['pear_auth']->login();
|
135 |
$objet_pear_auth->login();
|
125 |
}
|
136 |
}
|
Line 126... |
Line 137... |
126 |
}
|
137 |
}
|
127 |
|
138 |
|
128 |
if (! $objet_pear_auth->getAuth()) {
|
139 |
if (! $objet_pear_auth->getAuth()) {
|
129 |
// L'utilisateur n'est pas identifié:
|
140 |
// L'utilisateur n'est pas identifié:
|
130 |
$res = str_repeat(' ', 16).'<form id="form_connexion" action="'.$url.'" method="post">'."\n";
|
141 |
$retour = str_repeat(' ', 16).'<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">'."\n";
|
131 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
142 |
$retour .= str_repeat(' ', 16).'<fieldset>'."\n";
|
132 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
143 |
$retour .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
133 |
$res .= str_repeat(' ', 20).''."\n";
|
144 |
$retour .= str_repeat(' ', 20).''."\n";
|
134 |
$res .= str_repeat(' ', 24).'<label for="username">'.'Courriel :'.'</label>'."\n";
|
145 |
$retour .= str_repeat(' ', 24).'<label for="username">'.'Courriel :'.'</label>'."\n";
|
135 |
$res .= str_repeat(' ', 24).'<input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="'.'courriel'.'" />'."\n";
|
146 |
$retour .= str_repeat(' ', 24).'<input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="'.'courriel'.'" />'."\n";
|
136 |
$res .= str_repeat(' ', 20).''."\n";
|
147 |
$retour .= str_repeat(' ', 20).''."\n";
|
137 |
$res .= str_repeat(' ', 20).''."\n";
|
148 |
$retour .= str_repeat(' ', 20).''."\n";
|
138 |
$res .= str_repeat(' ', 24).'<label for="password">'.'Mot de passe :'.'</label>'."\n";
|
149 |
$retour .= str_repeat(' ', 24).'<label for="password">'.'Mot de passe :'.'</label>'."\n";
|
139 |
$res .= str_repeat(' ', 24).'<input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="'.'mot de passe'.'" />'."\n";
|
150 |
$retour .= str_repeat(' ', 24).'<input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="'.'mot de passe'.'" />'."\n";
|
140 |
$res .= str_repeat(' ', 20).''."\n";
|
151 |
$retour .= str_repeat(' ', 20).''."\n";
|
141 |
$res .= str_repeat(' ', 20).''."\n";
|
152 |
$retour .= str_repeat(' ', 20).''."\n";
|
142 |
$res .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="3" value="'.'ok'.'" />'."\n";
|
153 |
$retour .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="3" value="'.'ok'.'" />'."\n";
|
143 |
$res .= str_repeat(' ', 20).''."\n";
|
154 |
$retour .= str_repeat(' ', 20).''."\n";
|
144 |
$res .= str_repeat(' ', 16).'</fieldset>'."\n";
|
155 |
$retour .= str_repeat(' ', 16).'</fieldset>'."\n";
|
145 |
$res .= str_repeat(' ', 16).'</form>';
|
156 |
$retour .= str_repeat(' ', 16).'</form>';
|
- |
|
157 |
} else {
|
146 |
} else {
|
158 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
147 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
159 |
$retour = str_repeat(' ', 16).'<form id="form_deconnexion" class="form_identification" action="'.$url.'&logout=1" method="post">'."\n";
|
148 |
// Amélioré la récupération des informations sur l'utilisateur.
|
160 |
$retour .= str_repeat(' ', 16).'<fieldset>'."\n";
|
- |
|
161 |
$retour .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
- |
|
162 |
|
149 |
//$nom_utilisateur = $objet_pear_auth->getAuthData($champ_nom);
|
163 |
// Affichage du prénom et nom d'une personne ou du nom de la structure en fonction des paramêtres
|
- |
|
164 |
// de l'annuaire utilisé
|
150 |
|
165 |
$retour .= str_repeat(' ', 20).'<p><span id="identification_message">'.IDEN_LANG_MESSAGE.'</span> ';
|
- |
|
166 |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom) && isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom)) {
|
- |
|
167 |
$retour .= '<span id="identification_prenom">'.
|
151 |
$res = str_repeat(' ', 16).'<form id="form_deconnexion" action="'.$url.'&logout=1" method="post">'."\n";
|
168 |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom).
|
152 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
169 |
'</span> '.
|
- |
|
170 |
'<span id="identification_nom">'.
|
153 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
171 |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom).
|
154 |
// Il faudrait mettre dans la base de données le prénom et le nom ou chercher comment définir ces champs en fonction
|
172 |
'</span>';
|
- |
|
173 |
} elseif (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_structure_nom)) {
|
- |
|
174 |
$retour .= '<span id="identification_structure">'.
|
- |
|
175 |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_structure_nom).
|
- |
|
176 |
'</span>';
|
- |
|
177 |
}
|
- |
|
178 |
$retour .= '</p>'."\n";
|
155 |
// de l'annuaire utilisé, si on veut les afficher après le message de bienvenue.
|
179 |
|
156 |
$res .= str_repeat(' ', 20).'<p>'.'Bienvenue!'.'</p>'."\n";
|
180 |
// Affichage du bouton de déconnexion
|
157 |
$res .= str_repeat(' ', 20).'<p>'."\n";
|
181 |
$retour .= str_repeat(' ', 20).'<p>'."\n";
|
158 |
$res .= str_repeat(' ', 24).'<input type="submit" id="deconnexion" name="deconnexion" tabindex="1" value="'.'déconnexion'.'" />'."\n";
|
182 |
$retour .= str_repeat(' ', 24).'<input type="submit" id="deconnexion" name="deconnexion" tabindex="1" value="'.'déconnexion'.'" />'."\n";
|
159 |
$res .= str_repeat(' ', 20).'</p>'."\n";
|
183 |
$retour .= str_repeat(' ', 20).'</p>'."\n";
|
160 |
$res .= str_repeat(' ', 16).'</fieldset>'."\n";
|
184 |
$retour .= str_repeat(' ', 16).'</fieldset>'."\n";
|
161 |
$res .= str_repeat(' ', 16).'</form>';
|
185 |
$retour .= str_repeat(' ', 16).'</form>';
|
162 |
}
|
186 |
}
|
Line 163... |
Line 187... |
163 |
return $res ;
|
187 |
return $retour;
|
164 |
}
|
188 |
}
|
165 |
|
189 |
|
Line 170... |
Line 194... |
170 |
|
194 |
|
171 |
|
195 |
|
172 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
196 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
197 |
*
|
- |
|
198 |
* $Log: not supported by cvs2svn $
|
- |
|
199 |
* Revision 1.8 2005/03/10 12:50:44 alex
|
173 |
*
|
200 |
* remplacement de & par &
|
174 |
* $Log: not supported by cvs2svn $
|
201 |
*
|
175 |
* Revision 1.7 2005/01/07 12:43:03 alex
|
202 |
* Revision 1.7 2005/01/07 12:43:03 alex
|
176 |
* réauction de la taille des champs texte à 12
|
203 |
* réauction de la taille des champs texte à 12
|
177 |
*
|
204 |
*
|