| 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.5 2004-09-23 14:31:12 jpm Exp $
|
22 |
// CVS : $Id: identification.php,v 1.6 2004-12-13 18:07:09 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 :
|
| 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.5 $ $Date: 2004-09-23 14:31:12 $
|
41 |
*@version $Revision: 1.6 $ $Date: 2004-12-13 18:07:09 $
|
| 42 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
| 43 |
*/
|
43 |
*/
|
| Line 44... |
Line 44... |
| 44 |
|
44 |
|
| 45 |
// +------------------------------------------------------------------------------------------------------+
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 54... |
Line 54... |
| 54 |
|
54 |
|
| 55 |
// Si le site utilise une authentification.
|
55 |
// Si le site utilise une authentification.
|
| 56 |
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
|
56 |
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.
|
57 |
// Si un formulaire nous renvoie en POST une variable "deconnexion", nous délogons l'utilisateur.
|
| 58 |
if (isset($_POST['deconnexion'])) {
|
58 |
if (isset($_POST['deconnexion'])) {
|
| - |
|
59 |
$_GEN_commun['pear_auth']->logout();
|
| - |
|
60 |
// 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']) {
|
| - |
|
62 |
// On place un cookie avec une duré dépassée
|
| - |
|
63 |
setcookie("spip_session", $id_session, time() - 3600*24, "/$chemin_cookie_spip/") ;
|
| - |
|
64 |
setcookie("spip_admin", "@".$login, time() -3600*24, "/$chemin_cookie_spip/") ;
|
| - |
|
65 |
|
| - |
|
66 |
$dirname = $GLOBALS['flag_ecrire'] ? "data/" : "ecrire/data/";
|
| - |
|
67 |
$dirname = $chemin_spip."/".$dirname ;
|
| - |
|
68 |
// ne pas se zapper soi-meme
|
| - |
|
69 |
if ($s = $GLOBALS['spip_session'])
|
| - |
|
70 |
$fichier_session = fichier_session($s, lire_meta('alea_ephemere'));
|
| - |
|
71 |
$fichier_session = $chemin_spip."/ecrire/".$fichier_session ;
|
| - |
|
72 |
$dir = opendir($dirname);
|
| - |
|
73 |
$t = time();
|
| - |
|
74 |
while(($item = readdir($dir)) != '') {
|
| - |
|
75 |
$chemin = "$dirname$item";
|
| - |
|
76 |
if (ereg("^session_([0-9]+_)?([a-z0-9]+)\.php3$", $item, $regs)) {
|
| - |
|
77 |
// Si c'est une vieille session, on jette
|
| - |
|
78 |
if (($t - filemtime($chemin)) > 48 * 3600) unlink($chemin);
|
| - |
|
79 |
// sinon voir si c'est une session du meme auteur
|
| - |
|
80 |
else if ($regs[1] == $id_auteur.'_') {
|
| - |
|
81 |
$zap_num ++;
|
| - |
|
82 |
if ($zap) unlink($chemin);
|
| - |
|
83 |
}
|
| - |
|
84 |
}
|
| - |
|
85 |
}
|
| 59 |
$_GEN_commun['pear_auth']->logout();
|
86 |
}
|
| 60 |
$_GEN_commun['pear_auth']->start();
|
87 |
$_GEN_commun['pear_auth']->start();
|
| 61 |
}
|
88 |
}
|
| 62 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
89 |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur.
|
| 63 |
if (isset($_POST['connexion'])) {
|
90 |
if (isset($_POST['connexion'])) {
|
| Line 82... |
Line 109... |
| 82 |
function afficherFormIdentification($tab_arguments, $_GEN_commun)
|
109 |
function afficherFormIdentification($tab_arguments, $_GEN_commun)
|
| 83 |
{
|
110 |
{
|
| 84 |
// Initialisation de variable.
|
111 |
// Initialisation de variable.
|
| 85 |
$objet_pear_auth = $_GEN_commun['pear_auth'];
|
112 |
$objet_pear_auth = $_GEN_commun['pear_auth'];
|
| 86 |
$objet_pear_db = $_GEN_commun['pear_db'];
|
113 |
$objet_pear_db = $_GEN_commun['pear_db'];
|
| 87 |
$url = $_GEN_commun['url']->getUrl();
|
114 |
$url = $_GEN_commun['url']->getURL();
|
| 88 |
// Récupération des valeurs pour le login et le mot de passe
|
115 |
// Récupération des valeurs pour le login et le mot de passe
|
| 89 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
116 |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password'];
|
| 90 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
117 |
$login = (! isset($_POST['username'])) ? '' : $_POST['username'];
|
| Line 91... |
Line 118... |
| 91 |
|
118 |
|
| Line 119... |
Line 146... |
| 119 |
} else {
|
146 |
} else {
|
| 120 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
147 |
// L'utilisateur est identifié. Nous affichons ses informations.
|
| 121 |
// Amélioré la récupération des informations sur l'utilisateur.
|
148 |
// Amélioré la récupération des informations sur l'utilisateur.
|
| 122 |
//$nom_utilisateur = $objet_pear_auth->getAuthData($champ_nom);
|
149 |
//$nom_utilisateur = $objet_pear_auth->getAuthData($champ_nom);
|
| Line 123... |
Line 150... |
| 123 |
|
150 |
|
| 124 |
$res = str_repeat(' ', 16).'<form id="form_deconnexion" action="'.$url.'" method="post">'."\n";
|
151 |
$res = str_repeat(' ', 16).'<form id="form_deconnexion" action="'.$url.'&logout=1" method="post">'."\n";
|
| 125 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
152 |
$res .= str_repeat(' ', 16).'<fieldset>'."\n";
|
| 126 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
153 |
$res .= str_repeat(' ', 20).'<legend>'.'Identification'.'</legend>'."\n";
|
| 127 |
// Il faudrait mettre dans la base de données le prénom et le nom ou chercher comment définir ces champs en fonction
|
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
|
| 128 |
// de l'annuaire utilisé, si on veut les afficher après le message de bienvenue.
|
155 |
// de l'annuaire utilisé, si on veut les afficher après le message de bienvenue.
|
| Line 143... |
Line 170... |
| 143 |
|
170 |
|
| 144 |
|
171 |
|
| 145 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
172 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| - |
|
173 |
*
|
| - |
|
174 |
* $Log: not supported by cvs2svn $
|
| - |
|
175 |
* Revision 1.5 2004/09/23 14:31:12 jpm
|
| 146 |
*
|
176 |
* Correction bogue sur l'identification de l'annuaire_tela.
|
| 147 |
* $Log: not supported by cvs2svn $
|
177 |
*
|
| 148 |
* Revision 1.4 2004/09/23 10:53:44 jpm
|
178 |
* Revision 1.4 2004/09/23 10:53:44 jpm
|
| 149 |
* Suppression de l'attribut size. Gestion via les css.
|
179 |
* Suppression de l'attribut size. Gestion via les css.
|
| 150 |
*
|
180 |
*
|