Subversion Repositories Applications.annuaire

Compare Revisions

Ignore whitespace Rev 292 → Rev 293

/trunk/jrest/services/TestLoginMdp.php
1,21 → 1,21
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
* Service
*
* @category php 5.2
* @package Annuaire::Services
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class TestLoginMdp extends JRestService {
 
Class TestLoginMdp extends JRestService {
 
public function getElement($uid){
 
if(!isset($uid[0]) || $uid[0] == '' || !isset($uid[1]) || $uid[1] == '') {
if (!isset($uid[0]) || $uid[0] == '' || !isset($uid[1]) || $uid[1] == '') {
$this->envoyer(false);
return;
}
/trunk/jrest/services/UtilisateurExiste.php
1,20 → 1,20
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
* Service vérifiant que l'utilisateur dont le courriel est passé en paramètre existe dans l'annuaire.
*
* @category php 5.2
* @package Annuaire::Services
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class UtilisateurExiste extends JRestService {
 
Class UtilisateurExiste extends JRestService {
 
public function getElement($uid){
 
$mail_utilisateur = $uid[0];
$id_annuaire = Config::get('annuaire_defaut');
 
24,4 → 24,4
$this->envoyer($existe);
}
}
?>
?>
/trunk/jrest/services/NbInscrits.php
1,32 → 1,32
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
* Service
*
* @category php 5.2
* @package Annuaire::Services
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class NbInscrits extends JRestService {
 
Class NbInscrits extends JRestService {
 
public function getRessource() {
$this->getElement(array());
}
public function getElement($uid){
 
$id_annuaire = Config::get('annuaire_defaut');
if(isset($uid[0])) {
if (isset($uid[0])) {
$id_annuaire = $uid[0];
}
$json = true;
if(isset($uid[1]) && $uid[1] == 'html') {
if (isset($uid[1]) && $uid[1] == 'html') {
$json = false;
}
 
33,19 → 33,19
$controleur = new AnnuaireControleur();
$valeurs = $controleur->chargerNombreAnnuaireListeInscrits($id_annuaire);
if(!$json) {
$valeurs = '<html>
</head>
<meta content="text/html; charset='.Config::get('sortie_encodage').'" http-equiv="Content-Type">
</head>'.
'<body>
<div id="contenu">'.$valeurs.'
</div>
</body>'.
'</html>';
if (!$json) {
$valeurs =
'<html>'."\n".
' </head>'."\n".
' <meta content="text/html; charset='.Config::get('sortie_encodage').'" http-equiv="Content-Type">'."\n".
' </head>'."\n".
' <body>'."\n".
' <div id="contenu">'.$valeurs.'</div>'."\n".
' </body>'."\n".
'</html>';
}
 
$this->envoyer($valeurs,'text/html',Config::get('sortie_encodage'),$json);
$this->envoyer($valeurs, 'text/html', Config::get('sortie_encodage'), $json);
}
}
?>
/trunk/jrest/services/ModificationsRss.php
1,70 → 1,28
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
* Service
*
* @category php 5.2
* @package Annuaire::Services
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class ModificationsRss extends JRestService {
 
Class ModificationsRss extends JRestService {
 
public function getElement($uid){
$id_annuaire = (isset($uid[0])) ? $uid[0] : Config::get('annuaire_defaut');
$this->authentifier();
 
$id_annuaire = (isset($uid[0])) ? $uid[0] : Config::get('annuaire_defaut');
$this->authentifier();
 
$controleur = new RSSControleur();
$controleur = new RSSControleur();
$modifications = $controleur->obtenirDernieresModificationsProfil($id_annuaire);
 
$this->envoyer($modifications, 'text/xml',Config::get('sortie_encodage'), false);
}
public function authentifier() {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="www.tela-botanica.org"');
header('HTTP/1.0 401 Unauthorized');
header('Content-type: text/html; charset=UTF-8');
echo 'Accès interdit';
exit;
} else {
if($this->verifierAcces($_SERVER['PHP_AUTH_USER'])) {
return ;
}
else
{
header('WWW-Authenticate: Basic realm="www.tela-botanica.org"');
header('HTTP/1.0 401 Unauthorized');
header('Content-type: text/html; charset=UTF-8');
echo 'Accès interdit';
exit ;
}
}
}
 
public function verifierAcces($id) {
$query="SELECT ".$this->config['database_ident']['ann_id']." as name 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);
if($res == "") {
return false ;
}
 
if (DB::isError($res)) {
die($res->getMessage());
}
 
return true ;
 
}
}
?>
/trunk/jrest/services/TelaUtilisateurs.php
1,15 → 1,18
<?php
// declare(encoding='UTF-8');
/**
* Encodage en entrée : utf8
* Encodage en sortie : utf8
*
* @author Grégoire Duché <jpm@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright 2009
* Service fournissant le nom de visiteur journalier sur le
* site tela-botanica.org grâce aux stats de Google Analytics.
*
* @category php 5.2
* @package Annuaire::Services
* @author Grégoire DUCHÉ <gregoire@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
 
class TelaUtilisateurs extends JRestService {
/**
19,22 → 22,20
$this->getElement(array());
}
/**
* Utilise l'API google pour donner le nombre de visiteurs
* et compte le nombre d'inscrits.
*/
public function getElement($params = array()) {
/**
* Utilise l'API google pour donner le nombre de visiteurs
* et compte le nombre d'inscrits.
* */
// Utilisation du fichier de configuration pour récupérer les identifiants de google analytics
$email_google = $this->config['google']['email_google'];
$password_google = $this->config['google']['password_google'];
$id_site_google = $this->config['google']['id_site_google'];
 
include_once '../services/GoogleAnalyticsAPI.php';
$ga = new GoogleAnalyticsAPI($email_google, $password_google, $id_site_google, date('Y-m-d', time() - 60 * 600), date('Y-m-d', time()));
 
$id_annuaire = Config::get('annuaire_defaut');
if(isset($uid[0])) {
if (isset($uid[0])) {
$id_annuaire = $uid[0];
}
 
/trunk/jrest/services/StatistiquesAnnuaire.php
1,27 → 1,28
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
* Service
*
* @category php 5.2
* @package Annuaire::Services
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class StatistiquesAnnuaire extends JRestService {
 
Class StatistiquesAnnuaire extends JRestService {
 
public function getElement($uid){
 
if(!isset($uid[0])) {
if (!isset($uid[0])) {
$id_annuaire = $uid[0];
} else {
$id_annuaire = Config::get('annuaire_defaut');
}
if(isset($uid[1])) {
if (isset($uid[1])) {
$type_stat = $uid[1];
} else {
$type_stat = '';
30,33 → 31,25
$controleur = new StatistiqueControleur();
switch($type_stat) {
case 'annees' :
$graph = $controleur->obtenirStatistiquesParAnnees($id_annuaire);
break;
break;
case 'continents' :
$graph = $controleur->obtenirStatistiquesInscritsParContinents($id_annuaire);
break;
break;
case 'europe' :
$graph = $controleur->obtenirStatistiquesInscritsEurope($id_annuaire);
break;
break;
case 'modification' :
$graph = $controleur->obtenirStatistiquesModificationsProfil($id_annuaire);
break;
break;
default:
$graph = $controleur->obtenirStatistiquesParCritere($id_annuaire,$type_stat, '');
break;
}
// Envoi d'une image png
header("Content-type: image/png charset=utf-8\n\n");
imagepng ($graph);
 
//$this->envoyer($valeurs);
imagepng($graph);
}
}
?>
/trunk/jrest/services/InscritsRss.php
28,44 → 28,5
 
$this->envoyer($inscrits, 'text/xml',Config::get('sortie_encodage'), false);
}
public function authentifier() {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="www.tela-botanica.org"');
header('HTTP/1.0 401 Unauthorized');
header('Content-type: text/html; charset=UTF-8');
echo 'Accès interdit';
exit;
} else {
if($this->verifierAcces($_SERVER['PHP_AUTH_USER'])) {
return ;
} else {
header('WWW-Authenticate: Basic realm="www.tela-botanica.org"');
header('HTTP/1.0 401 Unauthorized');
header('Content-type: text/html; charset=UTF-8');
echo 'Accès interdit';
exit ;
}
}
}
 
public function verifierAcces($id) {
$query = 'SELECT '.$this->config['database_ident']['ann_id'].' AS name '.
'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);
if ($res == '') {
return false ;
}
 
if (DB::isError($res)) {
die($res->getMessage());
}
 
return true;
}
}
?>