Subversion Repositories Applications.annuaire

Compare Revisions

Ignore whitespace Rev 395 → Rev 396

/trunk/jrest/bibliotheque/JRestService.php
278,23 → 278,25
return $identifie;
}
 
protected function creerCookiePersistant($id = null, $mdp = null) {
protected function creerCookiePersistant($duree = null, $id = null, $mdp = null) {
$id = is_null($id) ? $_SERVER['PHP_AUTH_USER'] : $id;
$mdp = is_null($mdp) ? $_SERVER['PHP_AUTH_PW'] : $mdp;
$duree = (int) is_null($duree) ? time()+3600*24*30 : $duree;
 
$nomCookie = $this->config['database_ident']['nom_cookie_persistant'];
$valeurCookie = md5($mdp).$id;
$dureeCookie = (int) time()+3600*24*30;// 1 mois à partir de l'appel
setcookie($nomCookie, $valeurCookie, $dureeCookie, '/');
 
setcookie($nomCookie, $valeurCookie, $duree, '/');
}
 
protected function verifierIdentification() {
$identifie = false;
$nomCookie = $this->config['database_ident']['nom_cookie_persistant'];
if (isset($_COOKIE[$nomCookie])) {
$identifie = true;
}
return $identifie;
protected function creerCookieUtilisateur($duree = null, $id = null) {
$id = is_null($id) ? $_SERVER['PHP_AUTH_USER'] : $id;
$duree = (int) is_null($duree) ? 0 : $duree;
 
$nomCookie = $this->config['database_ident']['nom_cookie_utilisateur'];
$valeurCookie = $id;
 
setcookie($nomCookie, $valeurCookie, $duree, '/');
}
 
protected function estAutoriseMessagerie($adresse) {