Subversion Repositories Sites.tela-botanica.org

Rev

Rev 369 | Blame | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU Lesser General Public                                           |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library is distributed in the hope that it will be useful,                                      |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
// | Lesser General Public License for more details.                                                      |
// |                                                                                                      |
// | You should have received a copy of the GNU Lesser General Public                                     |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: authentification.php,v 1.2 2004/09/03 15:51:06 tam Exp $
/**
* Titre
*
* Description
*
*@package site_tela
//Auteur original :
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.2 $ $Date: 2004/09/03 15:51:06 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+
// Le fichier authentification.php est appelé systématiquement, il peut donc contenir les inclusions de fichiers génériques.
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config_avancee.inc.php' ;
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config.inc.php' ;
// 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.
// 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!
set_include_path($_SERVER['DOCUMENT_ROOT'].PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.PAP_CHEMIN_API_PEAR.PATH_SEPARATOR.get_include_path());
include_once 'Auth.php' ;
include_once 'DB.php' ;
include_once 'Net/URL.php' ;

$NetUrl = new Net_URL();
$url = $NetUrl->getUrl();
// Connection à la base de donnée
$GLOBALS['db'] =& DB::connect(PAP_DSN) ;

// Cette variable contiendra le javascript de validation des formulaires
$GLOBALS['javascript'] = '' ;


if ($_SERVER['SCRIPT_NAME'] == '/actu/index.php') {
    $url .= 'sommaire.php3' ;
}
function AUTH_formulaire_login ($url) {
        // l'url de la page en cours
        //--------------------------------------------------------------------------
        // Le formulaire
        //--------------------------------------------------------------------------
        $res ='<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">
                                <fieldset>
                                        <legend>Identifiez vous</legend>
                                                <label for="username">Courriel : </label>
                                                <input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
                                                <label for="password">Mot de passe : </label>
                                                <input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
                                                <input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
                                <p><a id="lien_inscription" href="/page:inscription">S\'inscrire...</a></p>
                                </fieldset>
                        </form>' ;
        return $res;
}

$param_auth = array ('dsn' => PAP_DSN,
                     'table' => 'annuaire_tela',
                     'usernamecol' => 'U_MAIL',
                     'passwordcol' => 'U_PASSWD',
                     'cryptType' => 'md5',
                     'db_fields' => '*');

$GLOBALS['identification'] = new Auth('DB', $param_auth, 'AUTH_formulaire_login');
//session_name('gen_annuaire_tela');
//$GLOBALS['identification']->_sessionName = 'gen_annuaire_tela';
// ATTENTION : TODO : setSessionname ne marche pas ici. Le nom de la session n'est jamais initialisé est reste PHPSESSID
$GLOBALS['identification']->setSessionname('gen_annuaire_tela');
//echo session_name().'-'.$GLOBALS['identification']->_sessionName;
// On débute une session
$GLOBALS['identification']->start();

// On teste si la variable logout existe, si oui, on deconnecte
if (isset($logout) && $logout != '' && $GLOBALS['identification']->checkAuth()) {
        // On place les cookies avec une durée dépassée
    setcookie('spip_session', '', time() - 3600, '/actu/') ;
    setcookie('spip_admin', '', time() - 3600, '/actu/') ;
        $GLOBALS['identification']->logout();
        $NetUrl->removeQueryString('logout');
}

include_once 'spip_cookie.php' ;

// +------------------------------------------------------------------------------------------------------+
// |                                           LISTE de FONCTIONS                                         |
// +------------------------------------------------------------------------------------------------------+

// +------------------------------------------------------------------------------------------------------+
// |                                            PIED du PROGRAMME                                         |
// +------------------------------------------------------------------------------------------------------+
                                           /*Partie non obligatoire*/


/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: authentification.php,v $
* Revision 1.2  2004/09/03 15:51:06  tam
* modif
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>