19,7 → 19,7 |
// | 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: identification.php,v 1.22 2006-09-21 15:25:17 jp_milcent Exp $ |
// CVS : $Id: identification.php,v 1.23 2006-11-20 17:30:40 jp_milcent Exp $ |
/** |
* Applette : identification |
* |
38,7 → 38,7 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.22 $ $Date: 2006-09-21 15:25:17 $ |
*@version $Revision: 1.23 $ $Date: 2006-11-20 17:30:40 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
64,41 → 64,24 |
// +------------------------------------------------------------------------------------------------------+ |
|
// Si le site utilise une authentification. |
if ($_GEN_commun['info_auth']->gsa_ce_type_auth == 1) { |
if ($GLOBALS['_GEN_commun']['info_auth']->gsa_ce_type_auth == 1) { |
// Si un formulaire nous renvoie en POST une variable "deconnexion", nous délogons l'utilisateur. |
if (isset($_REQUEST['deconnexion']) || isset($_REQUEST['logout'])) { |
$_GEN_commun['pear_auth']->logout(); |
// Le test suivant vérifie si une authentification SPIP est en cour, vois pap_initialise_auth.inc.php |
if (isset ($chemin_spip) && isset ($coauth) && $coauth == $auth_courante['gsab_id_auth_bdd']) { |
// On place un cookie avec une duré dépassée |
setcookie("spip_session", $id_session, time() - 3600*24, "/$chemin_cookie_spip/") ; |
setcookie("spip_admin", "@".$login, time() -3600*24, "/$chemin_cookie_spip/") ; |
|
$dirname = $GLOBALS['flag_ecrire'] ? 'data/' : 'ecrire/data/'; |
$dirname = $chemin_spip."/".$dirname ; |
// ne pas se zapper soi-meme |
if ($s = $GLOBALS['spip_session']) |
$fichier_session = fichier_session($s, lire_meta('alea_ephemere')); |
$fichier_session = $chemin_spip.'/ecrire/'.$fichier_session ; |
$dir = opendir($dirname); |
$t = time(); |
while(($item = readdir($dir)) != '') { |
$chemin = "$dirname$item"; |
if (ereg("^session_([0-9]+_)?([a-z0-9]+)\.php3$", $item, $regs)) { |
// Si c'est une vieille session, on jette |
if (($t - filemtime($chemin)) > 48 * 3600) unlink($chemin); |
// sinon voir si c'est une session du meme auteur |
else if ($regs[1] == $id_auteur.'_') { |
$zap_num ++; |
if ($zap) unlink($chemin); |
} |
} |
} |
} |
$GLOBALS['_GEN_commun']['pear_auth']->logout(); |
// Destruction du cookie de Papyrus |
setcookie(session_name(), session_id(), time()-3600, '/'); |
} |
// Si un formulaire nous renvoie en POST une variable "connexion", nous logons l'utilisateur. |
if (isset($_REQUEST['connexion'])) { |
$_GEN_commun['pear_auth']->login(); |
// Nous vérifions que l'utilisateur est coché "Mémoriser mon compte" |
if (isset($_POST['persistant']) && $_POST['persistant'] == 'o') { |
//echo '<pre>'.print_r($_POST, true).'</pre>'; |
// Expiration si l'utilisateur ne referme pas son navigateur |
$GLOBALS['_GEN_commun']['pear_auth']->setExpire((int)IDEN_AUTH_SESSION_DUREE); |
// Pour que la session dure même après avoir refermer son navigateur |
setcookie(session_name(), session_id(), (int)IDEN_AUTH_SESSION_DUREE, '/'); |
} |
$GLOBALS['_GEN_commun']['pear_auth']->login(); |
$_SESSION['username'] = $username; |
} |
} |
122,8 → 105,10 |
$retour = ''; |
$objet_pear_auth =& $GLOBALS['_GEN_commun']['pear_auth']; |
$objet_pear_db =& $GLOBALS['_GEN_commun']['pear_db']; |
$url = $GLOBALS['_GEN_commun']['url']->getURL(); |
$objet_url = $GLOBALS['_GEN_commun']['url'] ; |
$InfoAuthBdd =& $GLOBALS['_GEN_commun']['info_auth_bdd']; |
$objet_url =& $GLOBALS['_GEN_commun']['url']; |
$url = $objet_url->getURL(); |
|
// Récupération des valeurs pour le login et le mot de passe |
$mot_de_passe = (! isset($_POST['password'])) ? '' : $_POST['password']; |
$login = (! isset($_POST['username'])) ? '' : $_POST['username']; |
130,7 → 115,7 |
|
// ATTENTION : Partie à supprimer une fois les mise à jour effectué dans l'annuaire de Tela Botanica |
// Devrait être déplacer dans l'appli inscription de Tela. |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_nom_table) && $GLOBALS['_GEN_commun']['info_auth_bdd']->gsab_nom_table == 'annuaire_tela') { |
if (isset($InfoAuthBdd->gsab_nom_table) && $InfoAuthBdd->gsab_nom_table == 'annuaire_tela') { |
verification_mot_de_passe($objet_pear_db, $mot_de_passe, $login); |
if (isset($_POST['connexion'])) { |
$objet_pear_auth->login(); |
139,13 → 124,13 |
|
if (! $objet_pear_auth->getAuth()) { |
// L'utilisateur a essayé de s'identifier mais a échoué |
if (isset($_POST['username'])) { |
if ($login != '') { |
$retour .= '<span class="erreur">'.IDEN_ECHEC_AUTH ; |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription)) { |
$retour .= '<a id="lien_inscription" href="'.$GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription.'">' ; |
if (isset($InfoAuthBdd->url_inscription)) { |
$retour .= '<a id="lien_inscription" href="'.$InfoAuthBdd->url_inscription.'">' ; |
$retour .= IDEN_ICI.'</a>' ; |
} |
$retour .= '</span>' ; |
$retour .= '</span>'."\n"; |
} |
// L'utilisateur n'est pas identifié: |
$retour .= str_repeat(' ', 16).'<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">'."\n"; |
160,11 → 145,15 |
$retour .= str_repeat(' ', 24).'<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="'.IDEN_LG_FORM_VALUE_MDP.'" />'."\n"; |
$retour .= str_repeat(' ', 20).''."\n"; |
$retour .= str_repeat(' ', 20).''."\n"; |
$retour .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="3" value="'.IDEN_LG_FORM_VALUE_SUBMIT.'" />'."\n"; |
$retour .= str_repeat(' ', 24).'<input type="checkbox" id="persistant" name="persistant" tabindex="3" value="o" />'."\n"; |
$retour .= str_repeat(' ', 24).'<label id="persistant_label" for="persistant">'.'Mémoriser mon compte'.'</label>'."\n"; |
$retour .= str_repeat(' ', 20).''."\n"; |
$retour .= str_repeat(' ', 20).''."\n"; |
$retour .= str_repeat(' ', 24).'<input type="submit" id="connexion" name="connexion" tabindex="4" value="'.IDEN_LG_FORM_VALUE_SUBMIT.'" />'."\n"; |
$retour .= str_repeat(' ', 20).''."\n"; |
// Si l'url de la page d'inscription est stockée dans les paramêtres, nous l'affichons |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription)) { |
$retour .= '<p><a id="lien_inscription" href="'.$GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription.'">'. |
if (isset($InfoAuthBdd->url_inscription)) { |
$retour .= '<p><a id="lien_inscription" href="'.$InfoAuthBdd->url_inscription.'">'. |
IDEN_LG_INSCRIPTION_URL. |
'</a></p>'."\n"; |
} |
176,24 → 165,24 |
// de l'annuaire utilisé |
$retour .= str_repeat(' ', 16).'<p id="identification_info"><span id="identification_message">'.IDEN_LG_MESSAGE.'</span> '; |
// Si les intitulés des champs nom et prénoms d'une personne ou le nom d'une structure sont indiqués nous les affichons |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom) && isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom)) { |
if (isset($InfoAuthBdd->chp_personne_prenom) && isset($InfoAuthBdd->chp_personne_nom)) { |
$retour .= '<span id="identification_prenom">'. |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom). |
$objet_pear_auth->getAuthData($InfoAuthBdd->chp_personne_prenom). |
'</span> '. |
'<span id="identification_nom">'. |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom). |
$objet_pear_auth->getAuthData($InfoAuthBdd->chp_personne_nom). |
'</span>'; |
} elseif (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_structure_nom)) { |
} elseif (isset($InfoAuthBdd->chp_structure_nom)) { |
$retour .= '<span id="identification_structure">'. |
$objet_pear_auth->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_structure_nom). |
$objet_pear_auth->getAuthData($InfoAuthBdd->chp_structure_nom). |
'</span>'; |
} |
$retour .= '</p>'."\n"; |
$retour .= str_repeat(' ', 16).'<p id="iden_action">'."\n"; |
// Si l'url de la page de modification de l'inscription est stockée dans les paramêtres, nous l'affichons |
if (isset($GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription_modif)) { |
if (isset($InfoAuthBdd->url_inscription_modif)) { |
$retour .= str_repeat(' ', 20).'<a id="lien_inscription_modif" href="'. |
$GLOBALS['_GEN_commun']['info_auth_bdd']->url_inscription_modif.'">'. |
$InfoAuthBdd->url_inscription_modif.'">'. |
IDEN_LG_INSCRIPTION_URL_MODIF. |
'</a>'."\n"; |
} |
215,6 → 204,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.22 2006/09/21 15:25:17 jp_milcent |
* Nettoyage dans l'url de la querystring logout. |
* |
* Revision 1.21 2006/03/02 10:49:49 ddelon |
* Fusion branche multilinguisme dans branche principale |
* |