Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 4 → Rev 5

/trunk/papyrus/pap_initialise_auth.inc.php
New file
0,0 → 1,121
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2003 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: pap_initialise_auth.inc.php,v 1.1 2004-06-16 08:12:01 jpm Exp $
/**
* Initialisation de l'authentification.
*
* Suite à la recherche des informations depuis la base de données nous initialisons
* l'authentification des utilisateurs si le site l'utilise.
* La page contient le code initialisant l'objet PEAR créé par Net_URL contenant l'url
* courante demandée par l'utilisateur.
* Nous initialisons aussi l'identification de l'utilisateur et le démarage de la session.
*
*@package Papyrus
//Auteur original :
*@author Alexandre GRANIER <alex@tela-botanica.org>
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2004-06-16 08:12:01 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** <br> Inclusion de l'authentification de PEAR.*/
include_once 'Auth/Auth.php';
 
/** Inclusion de la bibliothèque de fonctions d'identification.
* Contient entre autre la fonction founissant le formulaire d'identification pour Auth de Pear.
* Cette inclusion n'a lieu que si le site utilise l'identification.
*/
include_once GEN_CHEMIN_PAP.'bibliotheque/fonctions/pap_identification.fonct.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// Gestion de l'identification des utilisateurs et des sessions
 
// Nour regardons à quel type d'identification nous avons à faire:
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) {
// Authentification via une base de données
$param_bdd = array ('dsn' => GEN_DSN,
'table' => $_GEN_commun['info_auth_bdd']->gsab_nom_table,
'usernamecol' => $_GEN_commun['info_auth_bdd']->gsab_nom_champ_login,
'passwordcol' => $_GEN_commun['info_auth_bdd']->gsab_nom_champ_mdp,
'cryptType' => $_GEN_commun['info_auth_bdd']->gsab_cryptage_mdp,
'db_fields' => '*');
$_GEN_commun['pear_auth'] = new Auth('DB', $param_bdd, 'GEN_afficherInfoIdentification', 1);
} else if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 2) {
// Authentification via LDAP
$param_ldap = array ( 'host' => $_GEN_commun['info_auth_ldap']->gsal_serveur,
'port' => $_GEN_commun['info_auth_ldap']->gsal_port,
'basedn' => $_GEN_commun['info_auth_ldap']->gsal_base_dn,
'userattr' => $_GEN_commun['info_auth_ldap']->gsal_uid);
$_GEN_commun['pear_auth'] = new Auth('LDAP', $param_ldap, 'GEN_afficherInfoIdentification', 1);
} else {
die('ERREUR Génésia : type identification introuvable. <br />'.
'Type identification : '.$_GEN_commun['info_auth']->gsa_ce_type_auth.'<br />'.
'Ligne n° : '. __LINE__ . '<br />'.
'Fichier : '. __FILE__ . '<br />');
}
 
$_GEN_commun['pear_auth']->setSessionname( 'gen_'.
GEN_URL_CLE_SITE.'_'.
$_GEN_commun['info_site']->gs_id_site.'_'.
GEN_URL_CLE_I18N.'_'.
$_GEN_commun['info_site']->gs_ce_i18n);
 
$_GEN_commun['pear_auth']->setExpire(3600 * 24 * 30 * 6);
 
$_GEN_commun['pear_auth']->start();
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.6 2004/05/01 11:40:21 jpm
* Suppression de code intégré dans le fichier de l'applette Identification.
*
* Revision 1.5 2004/04/28 12:04:31 jpm
* Changement du modèle de la base de données.
*
* Revision 1.4 2004/04/22 08:29:11 jpm
* Transformation de $GS_GLOBAL en $_GEN_commun.
*
* Revision 1.3 2004/04/09 16:20:33 jpm
* Gestion de l'authentification uniquement.
* Gestion des tables i18n.
*
* Revision 1.2 2004/04/02 16:29:58 jpm
* Ajout de la gestion de la déconnexion et reconnexion.
*
* Revision 1.1 2004/04/02 08:54:58 jpm
* Création du fichier qui contient l'initialisation des objets Pear, hormis la base de données.
*
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
?>