| Line 1... |
Line -... |
| 1 |
<?php
|
- |
|
| 2 |
// Encodage : UTF-8
|
- |
|
| 3 |
// Permet d'afficher le temps d'execution du service
|
- |
|
| 4 |
$temps_debut = (isset($_GET['chrono']) && $_GET['chrono'] == 1) ? microtime(true) : '';
|
- |
|
| 5 |
// +-------------------------------------------------------------------------------------------------------------------+
|
- |
|
| 6 |
/**
|
- |
|
| 7 |
* Serveur
|
- |
|
| 8 |
*
|
- |
|
| 9 |
* Description : initialise le chargement et l'exécution des services web.
|
- |
|
| 10 |
*
|
- |
|
| 11 |
//Auteur original :
|
- |
|
| 12 |
* @author auteur <aut@tela-botanica.org>
|
- |
|
| 13 |
* @copyright Tela-Botanica 1999-2008
|
- |
|
| 14 |
* @licence GPL v3 & CeCILL v2
|
- |
|
| 15 |
* @version $Id$
|
- |
|
| 16 |
*/
|
- |
|
| 17 |
// +-------------------------------------------------------------------------------------------------------------------+
|
- |
|
| 18 |
|
- |
|
| 19 |
// Le fichier autoload.inc.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
|
- |
|
| 20 |
// Sinon, rien ne sera chargé.
|
- |
|
| 21 |
// Chemin du fichier chargeant le framework requis
|
- |
|
| 22 |
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
|
- |
|
| 23 |
|
- |
|
| 24 |
if (!file_exists($framework)) {
|
- |
|
| 25 |
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
|
- |
|
| 26 |
trigger_error($e, E_USER_ERROR);
|
- |
|
| 27 |
} else {
|
- |
|
| 28 |
// Inclusion du Framework
|
- |
|
| 29 |
require_once $framework;
|
- |
|
| 30 |
// Ajout d'information concernant cette application
|
- |
|
| 31 |
Framework::setCheminAppli(__FILE__);// Obligatoire
|
- |
|
| 32 |
Framework::setInfoAppli(Config::get('info'));
|
- |
|
| 33 |
|
- |
|
| 34 |
// Transformation de l'url du handler wikini en url pour le serveur REST
|
- |
|
| 35 |
// TODO : améliorer la gestion de l'url entre le wikini et le serveur REST
|
- |
|
| 36 |
//$_SERVER['REQUEST_URI'] = Config::get('serveur.baseURL').$_GET['api'];
|
- |
|
| 37 |
//$_SERVER['QUERY_STRING'] = $_GET['params'] ? $_GET['params'] : '';
|
- |
|
| 38 |
|
- |
|
| 39 |
// Création de l'objet Wiki qui sera transmis au service via le Registre
|
- |
|
| 40 |
Registre::set('cheminApi', getcwd());
|
- |
|
| 41 |
Registre::set('cheminWiki', realpath(dirname(__FILE__).DS.'..'.DS.'..'.DS).DS);
|
- |
|
| 42 |
$wikiApi = new WikiApi(Registre::get('cheminWiki'), Registre::get('cheminApi'));
|
- |
|
| 43 |
Registre::set('wikiApi', $wikiApi);
|
- |
|
| 44 |
|
- |
|
| 45 |
// Initialisation et lancement du serveur
|
- |
|
| 46 |
$Serveur = new RestServeur();
|
- |
|
| 47 |
$Serveur->executer();
|
- |
|
| 48 |
|
- |
|
| 49 |
// Affiche le temps d'execution du service
|
- |
|
| 50 |
if (isset($_GET['chrono']) && $_GET['chrono'] == 1) {
|
- |
|
| 51 |
$temps_fin = microtime(true);
|
- |
|
| 52 |
echo 'Temps d\'execution : '.round($temps_fin - $temps_debut, 4);
|
- |
|
| 53 |
}
|
- |
|
| 54 |
}
|
- |
|
| 55 |
?>
|
- |
|
| 56 |
|
1 |
<?php
|
| - |
|
2 |
|
| - |
|
3 |
// Permet d'afficher le temps d'execution du service
|
| - |
|
4 |
$temps_debut = (isset($_GET['chrono']) && $_GET['chrono'] == 1) ? microtime(true) : '';
|
| - |
|
5 |
// +-------------------------------------------------------------------------------------------------------------------+
|
| - |
|
6 |
/**
|
| - |
|
7 |
* Serveur REST Wikini
|
| - |
|
8 |
*
|
| - |
|
9 |
* Initialise le chargement et l'exécution des services web.
|
| - |
|
10 |
* Encodage : UTF-8
|
| - |
|
11 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| - |
|
12 |
* @copyright Tela-Botanica 1999-2008
|
| - |
|
13 |
* @licence GPL v3 & CeCILL v2
|
| - |
|
14 |
*/
|
| - |
|
15 |
|
| - |
|
16 |
// Le fichier autoload.inc.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
|
| - |
|
17 |
// Sinon, rien ne sera chargé.
|
| - |
|
18 |
// Chemin du fichier chargeant le framework requis
|
| - |
|
19 |
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
|
| - |
|
20 |
|
| - |
|
21 |
if (!file_exists($framework)) {
|
| - |
|
22 |
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
|
| - |
|
23 |
trigger_error($e, E_USER_ERROR);
|
| - |
|
24 |
} else {
|
| - |
|
25 |
// Inclusion du Framework
|
| - |
|
26 |
require_once $framework;
|
| - |
|
27 |
// Ajout d'information concernant cette application
|
| - |
|
28 |
Framework::setCheminAppli(__FILE__);// Obligatoire
|
| - |
|
29 |
Framework::setInfoAppli(Config::get('info'));
|
| - |
|
30 |
|
| - |
|
31 |
// Transformation de l'url du handler wikini en url pour le serveur REST
|
| - |
|
32 |
// TODO : améliorer la gestion de l'url entre le wikini et le serveur REST
|
| - |
|
33 |
//$_SERVER['REQUEST_URI'] = Config::get('serveur.baseURL').$_GET['api'];
|
| - |
|
34 |
//$_SERVER['QUERY_STRING'] = $_GET['params'] ? $_GET['params'] : '';
|
| - |
|
35 |
|
| - |
|
36 |
// Création de l'objet Wiki qui sera transmis au service via le Registre
|
| - |
|
37 |
Registre::set('cheminApi', getcwd());
|
| - |
|
38 |
Registre::set('cheminWiki', realpath(dirname(__FILE__).DS.'..'.DS.'..'.DS).DS);
|
| - |
|
39 |
$wikiApi = new WikiApi(Registre::get('cheminWiki'), Registre::get('cheminApi'));
|
| - |
|
40 |
Registre::set('wikiApi', $wikiApi);
|
| - |
|
41 |
|
| - |
|
42 |
// Initialisation et lancement du serveur
|
| - |
|
43 |
$Serveur = new RestServeur();
|
| - |
|
44 |
$Serveur->executer();
|
| - |
|
45 |
|
| - |
|
46 |
// Affiche le temps d'execution du service
|
| - |
|
47 |
if (isset($_GET['chrono']) && $_GET['chrono'] == 1) {
|
| - |
|
48 |
$temps_fin = microtime(true);
|
| - |
|
49 |
echo 'Temps d\'execution : '.round($temps_fin - $temps_debut, 4);
|
| - |
|
50 |
}
|
| - |
|
51 |
}
|
| - |
|
52 |
?>
|
| - |
|
53 |
|
| 57 |
|
54 |
|