Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 313 → Rev 314

/trunk/papyrus/pap_initialise_auth.inc.php
21,7 → 21,7
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// | |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: pap_initialise_auth.inc.php,v 1.15 2005-03-24 15:04:26 alex Exp $
// CVS : $Id: pap_initialise_auth.inc.php,v 1.16 2005-03-25 13:08:20 jpm Exp $
/**
* Initialisation de l'authentification.
*
37,7 → 37,7
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.15 $ $Date: 2005-03-24 15:04:26 $
*@version $Revision: 1.16 $ $Date: 2005-03-25 13:08:20 $
// +------------------------------------------------------------------------------------------------------+
*/
 
82,8 → 82,8
$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_abreviation'] = $ligne_auth->gsa_abreviation;
$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth]['gsa_ce_type_auth'] = $ligne_auth->gsa_ce_type_auth;
if ($ligne_auth->gsa_id_auth == $_GEN_commun['info_site']->gs_ce_auth) {
$_GEN_commun['info_auth'] = $ligne_auth;
if ($ligne_auth->gsa_id_auth == $GLOBALS['_GEN_commun']['info_site']->gs_ce_auth) {
$GLOBALS['_GEN_commun']['info_auth'] = $ligne_auth;
}
if ($ligne_auth->gsa_ce_auth_bdd != 0) {
97,22 → 97,21
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_auth_bdd->getMessage(), $requete_auth_bdd))
: '';
$tab_auth_bdd = $resultat_auth_bdd->fetchRow(DB_FETCHMODE_OBJECT) ;
if ($ligne_auth->gsa_id_auth == $_GEN_commun['info_site']->gs_ce_auth) {
$_GEN_commun['info_auth_bdd'] = $tab_auth_bdd ;
if ($ligne_auth->gsa_id_auth == $GLOBALS['_GEN_commun']['info_site']->gs_ce_auth) {
$GLOBALS['_GEN_commun']['info_auth_bdd'] = $tab_auth_bdd ;
// Gestion des arguments de l'authentification
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres)) {
$arguments = explode(' ', $GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres);
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i]);
if ($attr[0] != '') {
$GLOBALS['_GEN_commun']['info_auth_bdd']->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
}
$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth] = array_merge($GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth], $tab_auth_bdd);
$resultat_auth_bdd->free();
// Gestion des arguments de l'authentification
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres)) {
$arguments = explode(' ', $GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_parametres);
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i]);
if ($attr[0] != '') {
$GLOBALS['_GEN_commun']['info_auth_bdd']->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
} else if ($ligne_auth->gsa_ce_auth_ldap != 0) {
//Identification via LDAP :
$requete_auth_ldap = 'SELECT * '.
125,7 → 124,7
: '';
$tab_auth_ldap = $resultat_auth_ldap->fetchRow(DB_FETCHMODE_OBJECT);
if ($ligne_auth->gsa_id_auth == $_GEN_commun['info_site']->gs_ce_auth) {
$_GEN_commun['info_auth_ldap'] = $tab_auth_ldap;
$GLOBALS['_GEN_commun']['info_auth_ldap'] = $tab_auth_ldap;
}
$GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth] = array_merge($GLOBALS['_PAPYRUS_']['auth'][$ligne_auth->gsa_id_auth], $tab_auth_ldap);
$resultat_auth_ldap->free();
160,7 → 159,7
$resultat_auth->free();
 
// Nour regardons à quel type d'identification nous avons à faire:
$auth_courante = $GLOBALS['_PAPYRUS_']['auth'][$_GEN_commun['info_site']->gs_ce_auth] ;
$auth_courante = $GLOBALS['_PAPYRUS_']['auth'][$GLOBALS['_GEN_commun']['info_site']->gs_ce_auth] ;
if ($auth_courante['gsa_ce_type_auth'] == 1) {
// Authentification via une base de données
$GLOBALS['_PAPYRUS_']['auth']['param_bdd'] = array ('dsn' => $auth_courante['gsab_dsn'],
170,7 → 169,7
'cryptType' => $auth_courante['gsab_cryptage_mdp'],
'db_fields' => '*');
// L'authentification courrante
$_GEN_commun['pear_auth'] = new Auth('DB', $GLOBALS['_PAPYRUS_']['auth']['param_bdd'], 'GEN_afficherInfoIdentification', 1);
$GLOBALS['_GEN_commun']['pear_auth'] = new Auth('DB', $GLOBALS['_PAPYRUS_']['auth']['param_bdd'], 'GEN_afficherInfoIdentification', 1);
} else if ($auth_courante['gsa_ce_type_auth'] == 2) {
// Authentification via LDAP
178,7 → 177,7
'port' => $auth_courante['gsal_port'],
'basedn' => $auth_courante['gsal_base_dn'],
'userattr' => $auth_courante['gsal_uid']);
$_GEN_commun['pear_auth'] = new Auth('LDAP', $GLOBALS['_PAPYRUS_']['auth']['param_ldap'], 'GEN_afficherInfoIdentification', 1);
$GLOBALS['_GEN_commun']['pear_auth'] = new Auth('LDAP', $GLOBALS['_PAPYRUS_']['auth']['param_ldap'], 'GEN_afficherInfoIdentification', 1);
} else {
die('ERREUR Papyrus : type identification introuvable. <br />'.
'Type identification : '.$auth_courante['gsa_ce_type_auth'].'<br />'.
186,15 → 185,15
'Fichier : '. __FILE__ . '<br />');
}
 
$_GEN_commun['pear_auth']->setSessionname( 'gen_'.$_GEN_commun['info_auth']->gsa_abreviation);
$GLOBALS['_GEN_commun']['pear_auth']->setSessionname( 'gen_'.$GLOBALS['_GEN_commun']['info_auth']->gsa_abreviation);
 
// Pour que la session dure même après avoir refermer son navigateur
session_set_cookie_params(3600 * 24 * 30 * 6);
 
// Expiration si l'utilisateur ne referme pas son navigateur
$_GEN_commun['pear_auth']->setExpire(3600 * 24 * 30 * 6);// 6 mois
$GLOBALS['_GEN_commun']['pear_auth']->setExpire(3600 * 24 * 30 * 6);// 6 mois
 
$_GEN_commun['pear_auth']->start();
$GLOBALS['_GEN_commun']['pear_auth']->start();
 
// +------------------------------------------------------------------------------------------------------+
// Gestion des sesssion WIKINI
218,40 → 217,39
}
}
// Début initialisation de la gestion SPIP
if (isset ($chemin_spip) && isset ($coauth) && $coauth == $auth_courante['gsab_id_auth_bdd']&& $_GEN_commun['pear_auth']->getAuth()) {
$login = $_GEN_commun['pear_auth']->getUsername() ;
if (isset ($chemin_spip) && isset ($coauth) && $coauth == $auth_courante['gsab_id_auth_bdd']&& $GLOBALS['_GEN_commun']['pear_auth']->getAuth()) {
$login = $GLOBALS['_GEN_commun']['pear_auth']->getUsername() ;
setcookie('spip_admin', '@'.$login, time()+3600*24*30, '/'.$chemin_cookie_spip.'/');
 
setcookie('spip_admin', '@'.$login, time() + 3600 * 24 * 30, '/'.$chemin_cookie_spip.'/');
$query = 'SELECT * FROM spip_auteurs WHERE login = "'.$login.'"';
$result = $db->query($query);
$GLOBALS['auteur_session'] = $result->fetchRow(DB_FETCHMODE_ASSOC);
$GLOBALS['auteur_session']['statut'] = '1comite';
$GLOBALS['auteur_session']['lang'] = 'fr';
 
$userid = $GLOBALS['auteur_session']['id_auteur'];
$GLOBALS['__auteur_session__'] = $GLOBALS['auteur_session'];
if (!$HTTP_COOKIE_VARS["spip_session"]) {
$id_session = $GLOBALS['auteur_session']['id_auteur']."_".(md5 (uniqid (rand ())));
setcookie("spip_session", $id_session, time()+3600*24*30, "/$chemin_cookie_spip/") ;
 
setcookie("spip_session", $id_session, time() + 3600 * 24 * 30, "/$chemin_cookie_spip/") ;
} else {
$id_session = preg_replace("/[0-9]+_/", $userid."_", $HTTP_COOKIE_VARS["spip_session"]) ;
setcookie("spip_session", $id_session, time()+3600*24*30, "/$chemin_cookie_spip/") ;
setcookie('spip_session', $id_session, time() + 3600 * 24 * 30, "/$chemin_cookie_spip/") ;
}
set_include_path(get_include_path().":".$chemin_spip) ;
 
include_once 'ecrire/inc_db_mysql.php3' ;
set_include_path(get_include_path().':'.$chemin_spip);
include_once ("ecrire/inc_version.php3");
ob_flush() ; // Nécessaire car spip utilise un ob_start() et cela cause un plantage
include_once 'ecrire/inc_db_mysql.php3';
include_once 'ecrire/inc_version.php3';
ob_flush();// Nécessaire car spip utilise un ob_start() et cela cause un plantage
include_ecrire ("inc_meta.php3");
include_ecrire ("inc_session.php3");
include_ecrire ('inc_meta.php3');
include_ecrire ('inc_session.php3');
$fichier_session = fichier_session($id_session, lire_meta('alea_ephemere'));
$fichier_session = $chemin_spip."/ecrire/".$fichier_session ;
$fichier_session = $chemin_spip.'/ecrire/'.$fichier_session ;
$vars = array('id_auteur', 'nom', 'login', 'email', 'statut', 'lang', 'ip_change', 'hash_env');
274,6 → 272,9
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.15 2005/03/24 15:04:26 alex
* ajout d'un appel à session_set_cookie_params pour allonger la durée de la session
*
* Revision 1.14 2005/03/15 14:20:01 jpm
* Gestion des arguments de l'identification courante.
*