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.22 2006-09-21 15:25:17 jp_milcent Exp $
|
22 |
// CVS : $Id: identification.php,v 1.23 2006-11-20 17:30:40 jp_milcent 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.22 $ $Date: 2006-09-21 15:25:17 $
|
41 |
*@version $Revision: 1.23 $ $Date: 2006-11-20 17:30:40 $
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
43 |
*/
|
43 |
*/
|
Line 44... |
Line 44... |
44 |
|
44 |
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
Line 62... |
Line 62... |
62 |
// +------------------------------------------------------------------------------------------------------+
|
62 |
// +------------------------------------------------------------------------------------------------------+
|
63 |
// | CORPS du PROGRAMME |
|
63 |
// | CORPS du PROGRAMME |
|
64 |
// +------------------------------------------------------------------------------------------------------+
|
64 |
// +------------------------------------------------------------------------------------------------------+
|
Line 65... |
Line 65... |
65 |
|
65 |
|
66 |
// Si le site utilise une authentification.
|
66 |
// Si le site utilise une authentification.
|
67 |
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
|
67 |
if ($GLOBALS['_GEN_commun']['info_auth']->gsa_ce_type_auth == 1) {
|
68 |
// 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.
|
69 |
if (isset($_REQUEST['deconnexion']) || isset($_REQUEST['logout'])) {
|
69 |
if (isset($_REQUEST['deconnexion']) || isset($_REQUEST['logout'])) {
|
70 |
$_GEN_commun['pear_auth']->logout();
|
- |
|
71 |
// Le test suivant vérifie si une authentification SPIP est en cour, vois pap_initialise_auth.inc.php
|
- |
|
72 |
if (isset ($chemin_spip) && isset ($coauth) && $coauth == $auth_courante['gsab_id_auth_bdd']) {
|
70 |
$GLOBALS['_GEN_commun']['pear_auth']->logout();
|
73 |
// On place un cookie avec une duré dépassée
|
71 |
// Destruction du cookie de Papyrus
|
74 |
setcookie("spip_session", $id_session, time() - 3600*24, "/$chemin_cookie_spip/") ;
|
- |
|
75 |
setcookie("spip_admin", "@".$login, time() -3600*24, "/$chemin_cookie_spip/") ;
|
- |
|
76 |
|
- |
|
77 |
$dirname = $GLOBALS['flag_ecrire'] ? 'data/' : 'ecrire/data/';
|
- |
|
78 |
$dirname = $chemin_spip."/".$dirname ;
|
- |
|
79 |
// ne pas se zapper soi-meme
|
- |
|
80 |
if ($s = $GLOBALS['spip_session'])
|
- |
|
81 |
$fichier_session = fichier_session($s, lire_meta('alea_ephemere'));
|
- |
|
82 |
$fichier_session = $chemin_spip.'/ecrire/'.$fichier_session ;
|
- |
|
83 |
$dir = opendir($dirname);
|
- |
|
84 |
$t = time();
|
- |
|
85 |
while(($item = readdir($dir)) != '') {
|
- |
|
86 |
$chemin = "$dirname$item";
|
- |
|
87 |
if (ereg("^session_([0-9]+_)?([a-z0-9]+)\.php3$", $item, $regs)) {
|
- |
|
88 |
// Si c'est une vieille session, on jette
|
- |
|
89 |
if (($t - filemtime($chemin)) > 48 * 3600) unlink($chemin);
|
- |
|
90 |
// sinon voir si c'est une session du meme auteur
|
- |
|
91 |
else if ($regs[1] == $id_auteur.'_') {
|
- |
|
92 |
$zap_num ++;
|
- |
|
93 |
if ($zap) unlink($chemin);
|
- |
|
94 |
}
|
- |
|
95 |
}
|
- |
|
96 |
}
|
- |
|
97 |
}
|
72 |
setcookie(session_name(), session_id(), time()-3600, '/');
|
98 |
}
|
73 |
}
|
99 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
74 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
- |
|
75 |
if (isset($_REQUEST['connexion'])) {
|
- |
|
76 |
// Nous vérifions que l'utilisateur est coché "Mémoriser mon compte"
|
- |
|
77 |
if (isset($_POST['persistant']) && $_POST['persistant'] == 'o') {
|
- |
|
78 |
//echo '<pre>'.print_r($_POST, true).'</pre>';
|
- |
|
79 |
// Expiration si l'utilisateur ne referme pas son navigateur
|
- |
|
80 |
$GLOBALS['_GEN_commun']['pear_auth']->setExpire((int)IDEN_AUTH_SESSION_DUREE);
|
- |
|
81 |
// Pour que la session dure même après avoir refermer son navigateur
|
- |
|
82 |
setcookie(session_name(), session_id(), (int)IDEN_AUTH_SESSION_DUREE, '/');
|
100 |
if (isset($_REQUEST['connexion'])) {
|
83 |
}
|
101 |
$_GEN_commun['pear_auth']->login();
|
84 |
$GLOBALS['_GEN_commun']['pear_auth']->login();
|
102 |
$_SESSION['username'] = $username;
|
85 |
$_SESSION['username'] = $username;
|
103 |
}
|
86 |
}
|
Line 104... |
Line 87... |
104 |
}
|
87 |
}
|
Line 120... |
Line 103... |
120 |
{
|
103 |
{
|
121 |
// Initialisation de variable.
|
104 |
// Initialisation de variable.
|
122 |
$retour = '';
|
105 |
$retour = '';
|
123 |
$objet_pear_auth =& $GLOBALS['_GEN_commun']['pear_auth'];
|
106 |
$objet_pear_auth =& $GLOBALS['_GEN_commun']['pear_auth'];
|
124 |
$objet_pear_db =& $GLOBALS['_GEN_commun']['pear_db'];
|
107 |
$objet_pear_db =& $GLOBALS['_GEN_commun']['pear_db'];
|
125 |
$url = $GLOBALS['_GEN_commun']['url']->getURL();
|
108 |
$InfoAuthBdd =& $GLOBALS['_GEN_commun']['info_auth_bdd'];
|
126 |
$objet_url = $GLOBALS['_GEN_commun']['url'] ;
|
109 |
$objet_url =& $GLOBALS['_GEN_commun']['url'];
|
- |
|
110 |
$url = $objet_url->getURL();
|
- |
|
111 |
|
127 |
// Récupération des valeurs pour le login et le mot de passe
|
112 |
// Récupération des valeurs pour le login et le mot de passe
|
128 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
113 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
129 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
114 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
Line 130... |
Line 115... |
130 |
|
115 |
|
131 |
// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica
|
116 |
// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica
|
132 |
// Devrait être déplacer dans l'appli inscription de Tela.
|
117 |
// Devrait être déplacer dans l'appli inscription de Tela.
|
133 |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_nom_table) && $GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_nom_table == 'annuaire_tela') {
|
118 |
if (isset($InfoAuthBdd->gsab_nom_table) && $InfoAuthBdd->gsab_nom_table == 'annuaire_tela') {
|
134 |
verification_mot_de_passe($objet_pear_db, $mot_de_passe, $login);
|
119 |
verification_mot_de_passe($objet_pear_db, $mot_de_passe, $login);
|
135 |
if (isset($_POST['connexion'])) {
|
120 |
if (isset($_POST['connexion'])) {
|
136 |
$objet_pear_auth->login();
|
121 |
$objet_pear_auth->login();
|
137 |
}
|
122 |
}
|
Line 138... |
Line 123... |
138 |
}
|
123 |
}
|
139 |
|
124 |
|
140 |
if (! $objet_pear_auth->getAuth()) {
|
125 |
if (! $objet_pear_auth->getAuth()) {
|
141 |
// L'utilisateur a essayé de s'identifier mais a échoué
|
126 |
// L'utilisateur a essayé de s'identifier mais a échoué
|
142 |
if (isset($_POST['username'])) {
|
127 |
if ($login != '') {
|
143 |
$retour .= '<span class="erreur">'.IDEN_ECHEC_AUTH ;
|
128 |
$retour .= '<span class="erreur">'.IDEN_ECHEC_AUTH ;
|
144 |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription)) {
|
129 |
if (isset($InfoAuthBdd->url_inscription)) {
|
145 |
$retour .= '<a id="lien_inscription" href="'.$GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription.'">' ;
|
130 |
$retour .= '<a id="lien_inscription" href="'.$InfoAuthBdd->url_inscription.'">' ;
|
146 |
$retour .= IDEN_ICI.'</a>' ;
|
131 |
$retour .= IDEN_ICI.'</a>' ;
|
147 |
}
|
132 |
}
|
148 |
$retour .= '</span>' ;
|
133 |
$retour .= '</span>'."\n";
|
149 |
}
|
134 |
}
|
150 |
// L'utilisateur n'est pas identifié:
|
135 |
// L'utilisateur n'est pas identifié:
|
151 |
$retour .= str_repeat(' ', 16).'<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">'."\n";
|
136 |
$retour .= str_repeat(' ', 16).'<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">'."\n";
|
Line 158... |
Line 143... |
158 |
$retour .= str_repeat(' ', 20).''."\n";
|
143 |
$retour .= str_repeat(' ', 20).''."\n";
|
159 |
$retour .= str_repeat(' ', 24).'<label for="password">'.IDEN_LG_FORM_LABEL_MDP.'</label>'."\n";
|
144 |
$retour .= str_repeat(' ', 24).'<label for="password">'.IDEN_LG_FORM_LABEL_MDP.'</label>'."\n";
|
160 |
$retour .= str_repeat(' ', 24).'<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="'.IDEN_LG_FORM_VALUE_MDP.'" />'."\n";
|
145 |
$retour .= str_repeat(' ', 24).'<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="'.IDEN_LG_FORM_VALUE_MDP.'" />'."\n";
|
161 |
$retour .= str_repeat(' ', 20).''."\n";
|
146 |
$retour .= str_repeat(' ', 20).''."\n";
|
162 |
$retour .= str_repeat(' ', 20).''."\n";
|
147 |
$retour .= str_repeat(' ', 20).''."\n";
|
- |
|
148 |
$retour .= str_repeat(' ', 24).'<input type="checkbox" id="persistant" name="persistant" tabindex="3" value="o" />'."\n";
|
- |
|
149 |
$retour .= str_repeat(' ', 24).'<label id="persistant_label" for="persistant">'.'Mémoriser mon compte'.'</label>'."\n";
|
- |
|
150 |
$retour .= str_repeat(' ', 20).''."\n";
|
- |
|
151 |
$retour .= str_repeat(' ', 20).''."\n";
|
163 |
$retour .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="3" value="'.IDEN_LG_FORM_VALUE_SUBMIT.'" />'."\n";
|
152 |
$retour .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="4" value="'.IDEN_LG_FORM_VALUE_SUBMIT.'" />'."\n";
|
164 |
$retour .= str_repeat(' ', 20).''."\n";
|
153 |
$retour .= str_repeat(' ', 20).''."\n";
|
165 |
// Si l'url de la page d'inscription est stockée dans les paramêtres, nous l'affichons
|
154 |
// Si l'url de la page d'inscription est stockée dans les paramêtres, nous l'affichons
|
166 |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription)) {
|
155 |
if (isset($InfoAuthBdd->url_inscription)) {
|
167 |
$retour .= '<p><a id="lien_inscription" href="'.$GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription.'">'.
|
156 |
$retour .= '<p><a id="lien_inscription" href="'.$InfoAuthBdd->url_inscription.'">'.
|
168 |
IDEN_LG_INSCRIPTION_URL.
|
157 |
IDEN_LG_INSCRIPTION_URL.
|
169 |
'</a></p>'."\n";
|
158 |
'</a></p>'."\n";
|
170 |
}
|
159 |
}
|
171 |
$retour .= str_repeat(' ', 16).'</fieldset>'."\n";
|
160 |
$retour .= str_repeat(' ', 16).'</fieldset>'."\n";
|
172 |
$retour .= str_repeat(' ', 16).'</form>';
|
161 |
$retour .= str_repeat(' ', 16).'</form>';
|
Line 174... |
Line 163... |
174 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
163 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
175 |
// Affichage du prénom et nom d'une personne ou du nom de la structure en fonction des paramêtres
|
164 |
// Affichage du prénom et nom d'une personne ou du nom de la structure en fonction des paramêtres
|
176 |
// de l'annuaire utilisé
|
165 |
// de l'annuaire utilisé
|
177 |
$retour .= str_repeat(' ', 16).'<p id="identification_info"><span id="identification_message">'.IDEN_LG_MESSAGE.'</span> ';
|
166 |
$retour .= str_repeat(' ', 16).'<p id="identification_info"><span id="identification_message">'.IDEN_LG_MESSAGE.'</span> ';
|
178 |
// Si les intitulés des champs nom et prénoms d'une personne ou le nom d'une structure sont indiqués nous les affichons
|
167 |
// Si les intitulés des champs nom et prénoms d'une personne ou le nom d'une structure sont indiqués nous les affichons
|
179 |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom) && isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom)) {
|
168 |
if (isset($InfoAuthBdd->chp_personne_prenom) && isset($InfoAuthBdd->chp_personne_nom)) {
|
180 |
$retour .= '<span id="identification_prenom">'.
|
169 |
$retour .= '<span id="identification_prenom">'.
|
181 |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom).
|
170 |
$objet_pear_auth->getAuthData($InfoAuthBdd->chp_personne_prenom).
|
182 |
'</span> '.
|
171 |
'</span> '.
|
183 |
'<span id="identification_nom">'.
|
172 |
'<span id="identification_nom">'.
|
184 |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom).
|
173 |
$objet_pear_auth->getAuthData($InfoAuthBdd->chp_personne_nom).
|
185 |
'</span>';
|
174 |
'</span>';
|
186 |
} elseif (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_structure_nom)) {
|
175 |
} elseif (isset($InfoAuthBdd->chp_structure_nom)) {
|
187 |
$retour .= '<span id="identification_structure">'.
|
176 |
$retour .= '<span id="identification_structure">'.
|
188 |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_structure_nom).
|
177 |
$objet_pear_auth->getAuthData($InfoAuthBdd->chp_structure_nom).
|
189 |
'</span>';
|
178 |
'</span>';
|
190 |
}
|
179 |
}
|
191 |
$retour .= '</p>'."\n";
|
180 |
$retour .= '</p>'."\n";
|
192 |
$retour .= str_repeat(' ', 16).'<p id="iden_action">'."\n";
|
181 |
$retour .= str_repeat(' ', 16).'<p id="iden_action">'."\n";
|
193 |
// Si l'url de la page de modification de l'inscription est stockée dans les paramêtres, nous l'affichons
|
182 |
// Si l'url de la page de modification de l'inscription est stockée dans les paramêtres, nous l'affichons
|
194 |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription_modif)) {
|
183 |
if (isset($InfoAuthBdd->url_inscription_modif)) {
|
195 |
$retour .= str_repeat(' ', 20).'<a id="lien_inscription_modif" href="'.
|
184 |
$retour .= str_repeat(' ', 20).'<a id="lien_inscription_modif" href="'.
|
196 |
$GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription_modif.'">'.
|
185 |
$InfoAuthBdd->url_inscription_modif.'">'.
|
197 |
IDEN_LG_INSCRIPTION_URL_MODIF.
|
186 |
IDEN_LG_INSCRIPTION_URL_MODIF.
|
198 |
'</a>'."\n";
|
187 |
'</a>'."\n";
|
199 |
}
|
188 |
}
|
200 |
// Affichage du bouton de déconnexion
|
189 |
// Affichage du bouton de déconnexion
|
201 |
$objet_url->addQueryString('logout', 1);
|
190 |
$objet_url->addQueryString('logout', 1);
|
Line 213... |
Line 202... |
213 |
|
202 |
|
214 |
|
203 |
|
215 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
204 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
205 |
*
|
- |
|
206 |
* $Log: not supported by cvs2svn $
|
- |
|
207 |
* Revision 1.22 2006/09/21 15:25:17 jp_milcent
|
216 |
*
|
208 |
* Nettoyage dans l'url de la querystring logout.
|
217 |
* $Log: not supported by cvs2svn $
|
209 |
*
|
218 |
* Revision 1.21 2006/03/02 10:49:49 ddelon
|
210 |
* Revision 1.21 2006/03/02 10:49:49 ddelon
|
219 |
* Fusion branche multilinguisme dans branche principale
|
211 |
* Fusion branche multilinguisme dans branche principale
|
220 |
*
|
212 |
*
|