Subversion Repositories Applications.annuaire

Compare Revisions

Ignore whitespace Rev 393 → Rev 394

/trunk/jrest/bibliotheque/JRestService.php
171,6 → 171,12
return $methode;
}
 
protected function traiterNomMethodePut($nom) {
$methode = 'create';
$methode .= str_replace(' ', '', ucwords(str_replace('-', ' ', strtolower($nom))));
return $methode;
}
 
protected function traiterParametresUrl($params_attendu, $params, $pourBDD = true) {
$sortie = array();
foreach ($params_attendu as $num => $nom) {
243,7 → 249,7
echo 'Accès interdit';
exit;
} else {
if($this->verifierAcces($_SERVER['PHP_AUTH_USER'])) {
if ($this->verifierAcces()) {
return ;
} else {
header('WWW-Authenticate: Basic realm="www.tela-botanica.org"');
255,29 → 261,47
}
}
 
protected function verifierAcces($id) {
$query = 'SELECT '.$this->config['database_ident']['ann_id'].' AS name '.
protected function verifierAcces($id = null, $mdp = null) {
$id = is_null($id) ? $_SERVER['PHP_AUTH_USER'] : $id;
$mdp = is_null($mdp) ? $_SERVER['PHP_AUTH_PW'] : $mdp;
 
$requete = 'SELECT '.$this->config['database_ident']['ann_id'].' AS courriel '.
'FROM '.$this->config['database_ident']['database'].'.'.$this->config['database_ident']['annuaire'].' '.
'WHERE '.$this->config['database_ident']['ann_id'].' = '.$this->bdd->quote($id).' '.
' AND '.$this->config['database_ident']['ann_pwd'].' = '.$this->config['database_ident']['pass_crypt_funct'].'('.$this->bdd->quote($_SERVER['PHP_AUTH_PW']).')' ;
$res = $this->bdd->query($query);
' AND '.$this->config['database_ident']['ann_pwd'].' = '.$this->config['database_ident']['pass_crypt_funct'].'('.$this->bdd->quote($mdp).')' ;
$resultat = $this->bdd->query($requete)->fetch();
 
if ($res == '') {
return false ;
$identifie = false;
if (isset($resultat['courriel'])) {
$identifie = true;
}
return $identifie;
}
 
if (DB::isError($res)) {
die($res->getMessage());
}
protected function creerCookiePersistant($id = null, $mdp = null) {
$id = is_null($id) ? $_SERVER['PHP_AUTH_USER'] : $id;
$mdp = is_null($mdp) ? $_SERVER['PHP_AUTH_PW'] : $mdp;
 
return true;
$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, '/');
}
 
protected function verifierIdentification() {
$identifie = false;
$nomCookie = $this->config['database_ident']['nom_cookie_persistant'];
if (isset($_COOKIE[$nomCookie])) {
$identifie = true;
}
return $identifie;
}
 
protected function estAutoriseMessagerie($adresse) {
$utilisateurs_messagerie = explode(',', $this->config['messagerie']['utilisateurs_autorises']);
return in_array($adresse, $utilisateurs_messagerie);
}
 
//+----------------------------------------------------------------------------------------------------------------+
// GESTION DES SQUELETTES PHP