Subversion Repositories Applications.annuaire

Rev

Rev 291 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 291 Rev 293
Line 26... Line 26...
26
		$controleur = new RSSControleur();
26
		$controleur = new RSSControleur();
27
		$inscrits = $controleur->obtenirDerniersInscritsRSS($id_annuaire, $admin);
27
		$inscrits = $controleur->obtenirDerniersInscritsRSS($id_annuaire, $admin);
Line 28... Line 28...
28
 
28
 
29
		$this->envoyer($inscrits, 'text/xml',Config::get('sortie_encodage'), false);
29
		$this->envoyer($inscrits, 'text/xml',Config::get('sortie_encodage'), false);
30
	}
-
 
31
	
-
 
32
	
-
 
33
	public function authentifier() {
-
 
34
		if (!isset($_SERVER['PHP_AUTH_USER'])) {
-
 
35
			header('WWW-Authenticate: Basic realm="www.tela-botanica.org"');
-
 
36
			header('HTTP/1.0 401 Unauthorized');
-
 
37
			header('Content-type: text/html; charset=UTF-8');
-
 
38
			echo 'Accès interdit';
-
 
39
			exit;
-
 
40
		} else {
-
 
41
			if($this->verifierAcces($_SERVER['PHP_AUTH_USER'])) {
-
 
42
				return ;
-
 
43
			} else {
-
 
44
				header('WWW-Authenticate: Basic realm="www.tela-botanica.org"');
-
 
45
				header('HTTP/1.0 401 Unauthorized');
-
 
46
				header('Content-type: text/html; charset=UTF-8');
-
 
47
				echo 'Accès interdit';
-
 
48
				exit ;
-
 
49
			}
-
 
50
		}
-
 
51
	}
-
 
52
 
-
 
53
	public function verifierAcces($id) {
-
 
54
		$query = 'SELECT '.$this->config['database_ident']['ann_id'].' AS name '.
-
 
55
			'FROM '.$this->config['database_ident']['database'].'.'.$this->config['database_ident']['annuaire'].' '.
-
 
56
			'WHERE '.$this->config['database_ident']['ann_id'].' = '.$this->bdd->quote($id).' '.
-
 
57
			'	AND '.$this->config['database_ident']['ann_pwd'].' = '.$this->config['database_ident']['pass_crypt_funct'].'('.$this->bdd->quote($_SERVER['PHP_AUTH_PW']).')' ;
-
 
58
		$res = $this->bdd->query($query);
-
 
59
		
-
 
60
		if ($res == '') {
-
 
61
			return false ;
-
 
62
		}
-
 
63
 
-
 
64
		if (DB::isError($res)) {
-
 
65
			die($res->getMessage());
-
 
66
		}
-
 
67
 
-
 
68
		return true;
-
 
69
	}
30
	}
70
}
31
}
71
?>
32
?>