Subversion Repositories Sites.tela-botanica.org

Rev

Rev 371 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 371 Rev 401
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: authentification.php,v 1.2 2004/09/03 15:51:06 tam Exp $
22
// CVS : $Id: authentification.php,v 1.2 2004/09/03 15:51:06 tam Exp $
23
/**
23
/**
24
* Titre
24
* Titre
25
*
25
*
26
* Description
26
* Description
27
*
27
*
28
*@package site_tela
28
*@package site_tela
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
30
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.2 $ $Date: 2004/09/03 15:51:06 $
34
*@version       $Revision: 1.2 $ $Date: 2004/09/03 15:51:06 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
// Le fichier authentification.php est appelé systématiquement, il peut donc contenir les inclusions de fichiers génériques.
41
// Le fichier authentification.php est appelé systématiquement, il peut donc contenir les inclusions de fichiers génériques.
42
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config_avancee.inc.php' ;
42
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config_avancee.inc.php' ;
43
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config.inc.php' ;
43
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config.inc.php' ;
44
// ATTENTION : bien inclure la racine du site /home/telabotap/www/ et le chemin de l'api PEAR /home/telabotap/www/api/pear/ dans l'include path.
44
// ATTENTION : bien inclure la racine du site /home/telabotap/www/ et le chemin de l'api PEAR /home/telabotap/www/api/pear/ dans l'include path.
45
// ATTENTION : l'ancien include_path ajouté grace à get_include_path() doit être impérativement ajouté APRÉS le chemin de l'api Pear de Papyrus!
45
// ATTENTION : l'ancien include_path ajouté grace à get_include_path() doit être impérativement ajouté APRÉS le chemin de l'api Pear de Papyrus!
46
set_include_path($_SERVER['DOCUMENT_ROOT'].PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.PAP_CHEMIN_API_PEAR.PATH_SEPARATOR.get_include_path());
46
set_include_path($_SERVER['DOCUMENT_ROOT'].PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.PAP_CHEMIN_API_PEAR.PATH_SEPARATOR.get_include_path());
-
 
47
 
47
include_once 'Auth.php' ;
48
include_once 'Auth.php' ;
48
include_once 'DB.php' ;
49
include_once 'DB.php' ;
49
include_once 'Net/URL.php' ;
50
include_once 'Net/URL.php' ;
50
 
51
 
51
$NetUrl = new Net_URL();
52
$NetUrl = new Net_URL();
52
$url = $NetUrl->getUrl();
53
$url = $NetUrl->getUrl();
53
// Connection à la base de donnée
54
// Connection à la base de donnée
54
$GLOBALS['db'] =& DB::connect(PAP_DSN) ;
55
$GLOBALS['db'] =& DB::connect(PAP_DSN) ;
55
 
56
 
56
// Cette variable contiendra le javascript de validation des formulaires
57
// Cette variable contiendra le javascript de validation des formulaires
57
$GLOBALS['javascript'] = '' ;
58
$GLOBALS['javascript'] = '' ;
58
 
59
 
59
 
60
 
60
if ($_SERVER['SCRIPT_NAME'] == '/actu/index.php') {
61
if ($_SERVER['SCRIPT_NAME'] == '/actu/index.php') {
61
    $url .= 'sommaire.php3' ;
62
    $url .= 'sommaire.php3' ;
62
}
63
}
63
function AUTH_formulaire_login ($url) {
64
function AUTH_formulaire_login ($url) {
64
	// l'url de la page en cours
65
	// l'url de la page en cours
65
	//--------------------------------------------------------------------------
66
	//--------------------------------------------------------------------------
66
	// Le formulaire
67
	// Le formulaire
67
	//--------------------------------------------------------------------------
68
	//--------------------------------------------------------------------------
68
	$res ='<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">
69
	$res ='<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">
69
				<fieldset>
70
				<fieldset>
70
					<legend>Identifiez vous</legend>
71
					<legend>Identifiez vous</legend>
71
						<label for="username">Courriel : </label>
72
						<label for="username">Courriel : </label>
72
						<input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
73
						<input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
73
						<label for="password">Mot de passe : </label>
74
						<label for="password">Mot de passe : </label>
74
						<input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
75
						<input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
75
						<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
76
						<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
76
				<p><a id="lien_inscription" href="/page:inscription">S\'inscrire...</a></p>
77
				<p><a id="lien_inscription" href="/page:inscription">S\'inscrire...</a></p>
77
				</fieldset>
78
				</fieldset>
78
			</form>' ;
79
			</form>' ;
79
	return $res;
80
	return $res;
80
}
81
}
81
 
82
 
82
$param_auth = array ('dsn' => PAP_DSN,
83
$param_auth = array ('dsn' => PAP_DSN,
83
                     'table' => 'annuaire_tela',
84
                     'table' => 'annuaire_tela',
84
                     'usernamecol' => 'U_MAIL',
85
                     'usernamecol' => 'U_MAIL',
85
                     'passwordcol' => 'U_PASSWD',
86
                     'passwordcol' => 'U_PASSWD',
86
                     'cryptType' => 'md5',
87
                     'cryptType' => 'md5',
87
                     'db_fields' => '*');
88
                     'db_fields' => '*');
88
 
-
 
-
 
89
// ATTENTION : bien définir le nom de la session avec la fonction PHP et le placer avant l'instanciation de l'objet AUTH!
-
 
90
session_name('pap-annuaire_tela');
89
$GLOBALS['identification'] = new Auth('DB', $param_auth, 'AUTH_formulaire_login');
91
$GLOBALS['identification'] = new Auth('DB', $param_auth, 'AUTH_formulaire_login');
90
//session_name('gen_annuaire_tela');
-
 
91
//$GLOBALS['identification']->_sessionName = 'gen_annuaire_tela';
-
 
92
// ATTENTION : TODO : setSessionname ne marche pas ici. Le nom de la session n'est jamais initialisé est reste PHPSESSID
-
 
93
$GLOBALS['identification']->setSessionname('gen_annuaire_tela');
92
$GLOBALS['identification']->setAdvancedSecurity(PAP_AUTH_SECURITE_AVANCEE);
94
//echo session_name().'-'.$GLOBALS['identification']->_sessionName;
-
 
95
// On débute une session
93
// On débute une session
96
$GLOBALS['identification']->start();
94
$GLOBALS['identification']->start();
97
 
-
 
-
 
95
//echo '<pre>'.print_r($GLOBALS['identification'], true).'</pre>';
98
// On teste si la variable logout existe, si oui, on deconnecte
96
// On teste si la variable logout existe, si oui, on deconnecte
99
if (isset($logout) && $logout != '' && $GLOBALS['identification']->checkAuth()) {
97
if (isset($_REQUEST['deconnexion']) || isset($_REQUEST['logout']) || $GLOBALS['identification']->checkAuth() == false) {
100
	// On place les cookies avec une durée dépassée
98
	// On place les cookies avec une durée dépassée
101
    setcookie('spip_session', '', time() - 3600, '/actu/') ;
99
    setcookie('spip_session', '', time() - 3600, '/actu/') ;
102
    setcookie('spip_admin', '', time() - 3600, '/actu/') ;
100
    setcookie('spip_admin', '', time() - 3600, '/actu/') ;
103
	$GLOBALS['identification']->logout();
101
	$GLOBALS['identification']->logout();
104
	$NetUrl->removeQueryString('logout');
102
	$NetUrl->removeQueryString('logout');
105
}
103
}
106
 
104
 
107
include_once 'spip_cookie.php' ;
105
include_once 'spip_cookie.php' ;
108
 
106
 
109
// +------------------------------------------------------------------------------------------------------+
107
// +------------------------------------------------------------------------------------------------------+
110
// |                                           LISTE de FONCTIONS                                         |
108
// |                                           LISTE de FONCTIONS                                         |
111
// +------------------------------------------------------------------------------------------------------+
109
// +------------------------------------------------------------------------------------------------------+
112
 
110
 
113
// +------------------------------------------------------------------------------------------------------+
111
// +------------------------------------------------------------------------------------------------------+
114
// |                                            PIED du PROGRAMME                                         |
112
// |                                            PIED du PROGRAMME                                         |
115
// +------------------------------------------------------------------------------------------------------+
113
// +------------------------------------------------------------------------------------------------------+
116
                                           /*Partie non obligatoire*/
114
                                           /*Partie non obligatoire*/
117
 
115
 
118
 
116
 
119
/* +--Fin du code ----------------------------------------------------------------------------------------+
117
/* +--Fin du code ----------------------------------------------------------------------------------------+
120
*
118
*
121
* $Log: authentification.php,v $
119
* $Log: authentification.php,v $
122
* Revision 1.2  2004/09/03 15:51:06  tam
120
* Revision 1.2  2004/09/03 15:51:06  tam
123
* modif
121
* modif
124
*
122
*
125
*
123
*
126
* +-- Fin du code ----------------------------------------------------------------------------------------+
124
* +-- Fin du code ----------------------------------------------------------------------------------------+
127
*/
125
*/
128
?>
126
?>