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.12 2004-12-15 15:24:45 alex Exp $ |
// CVS : $Id: pap_initialise_auth.inc.php,v 1.13 2005-02-22 18:27:24 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.12 $ $Date: 2004-12-15 15:24:45 $ |
*@version $Revision: 1.13 $ $Date: 2005-02-22 18:27:24 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
153,7 → 153,7 |
$auth_courante = $GLOBALS['_PAPYRUS_']['auth'][$_GEN_commun['info_site']->gs_ce_auth] ; |
if ($auth_courante['gsa_ce_type_auth'] == 1) { |
// Authentification via une base de données |
$param_bdd = array ('dsn' => $auth_courante['gsab_dsn'], |
$GLOBALS['_PAPYRUS_']['auth']['param_bdd'] = array ('dsn' => $auth_courante['gsab_dsn'], |
'table' => $auth_courante['gsab_nom_table'], |
'usernamecol' => $auth_courante['gsab_nom_champ_login'], |
'passwordcol' => $auth_courante['gsab_nom_champ_mdp'], |
160,15 → 160,15 |
'cryptType' => $auth_courante['gsab_cryptage_mdp'], |
'db_fields' => '*'); |
// L'authentification courrante |
$_GEN_commun['pear_auth'] = new Auth('DB', $param_bdd, 'GEN_afficherInfoIdentification', 1); |
$_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 |
$param_ldap = array ( 'host' => $auth_courante['gsal_serveur'], |
$GLOBALS['_PAPYRUS_']['auth']['param_ldap'] = array ( 'host' => $auth_courante['gsal_serveur'], |
'port' => $auth_courante['gsal_port'], |
'basedn' => $auth_courante['gsal_base_dn'], |
'userattr' => $auth_courante['gsal_uid']); |
$_GEN_commun['pear_auth'] = new Auth('LDAP', $param_ldap, 'GEN_afficherInfoIdentification', 1); |
$_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 />'. |
182,7 → 182,15 |
|
$_GEN_commun['pear_auth']->start(); |
|
// +------------------------------------------------------------------------------------------------------+ |
// Gestion des sesssion WIKINI |
if (isset ($auth_courante['type_site_externe']) && $auth_courante['type_site_externe'] == '201') {// 201 = site de type "WIKINI" |
|
} |
|
// +------------------------------------------------------------------------------------------------------+ |
// Gestion des sesssion SPIP |
|
// Recherche des paramètres de SPIP |
foreach ($GLOBALS['_PAPYRUS_']['auth'] as $cle => $valeur) { |
if (isset($valeur['type_site_externe']) && $valeur['type_site_externe'] == 200) { // 200 = site de type "SPIP" |
195,26 → 203,20 |
} |
} |
} |
|
|
|
if (isset ($auth_courante['type_site_externe']) && $auth_courante['type_site_externe'] == '201') {// 201 = site de type "WIKINI" |
|
} |
|
// 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() ; |
|
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."'"; |
$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" ; |
$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'] ; |
$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/") ; |
234,11 → 236,9 |
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 ; |
|
|
$vars = array('id_auteur', 'nom', 'login', 'email', 'statut', 'lang', 'ip_change', 'hash_env'); |
|
$texte = "<"."?php\n"; |
247,7 → 247,7 |
} |
|
$texte .= "?".">\n"; |
|
|
if ($f = fopen($fichier_session, "wb")) { |
fputs($f, $texte); |
fclose($f); |
254,14 → 254,15 |
} else { |
echo 'erreur dans l ecriture de la session SPIP' ; |
} |
|
//ajouter_session($GLOBALS['auteur_session'], $id_session) ; |
|
//ajouter_session($GLOBALS['auteur_session'], $id_session) ; |
} |
|
|
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log: not supported by cvs2svn $ |
* Revision 1.12 2004/12/15 15:24:45 alex |
* suppression d'un notice |
* |
* Revision 1.11 2004/12/13 18:06:52 alex |
* authentification spip presque parfaite |
* |