1 |
<?php
|
1 |
<?php
|
- |
|
2 |
/**
|
- |
|
3 |
* Initialise le chargement et l'exécution des services web.
|
- |
|
4 |
*
|
- |
|
5 |
* @category DEL
|
2 |
// Encodage : UTF-8
|
6 |
* @package Services
|
- |
|
7 |
* @subpackage Bibliotheque
|
- |
|
8 |
* @version 0.1
|
- |
|
9 |
* @author Mathias CHOUET <mathias@tela-botanica.org>
|
- |
|
10 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
- |
|
11 |
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
|
- |
|
12 |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
|
- |
|
13 |
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
|
- |
|
14 |
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
|
- |
|
15 |
*/
|
- |
|
16 |
|
3 |
// Permet d'afficher le temps d'execution du service
|
17 |
// Permet d'afficher le temps d'execution du service
|
4 |
$temps_debut = (isset($_GET['chrono']) && $_GET['chrono'] == 1) ? microtime(true) : '';
|
18 |
$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 |
|
19 |
// Autoloader pour les namespaces, à base de routes
|
20 |
// Autoloader pour les namespaces, à base de routes
|
20 |
function __autoload($nom_classe) {
|
21 |
function __autoload($nom_classe) {
|
21 |
//echo "AUTOLOAD\n";
|
22 |
//echo "AUTOLOAD\n";
|
22 |
$dernierAS = strrpos($nom_classe, "\\");
|
23 |
$dernierAS = strrpos($nom_classe, "\\");
|
23 |
$ns = substr($nom_classe, 0, $dernierAS);
|
24 |
$ns = substr($nom_classe, 0, $dernierAS);
|
24 |
$nom = substr($nom_classe, strrpos($nom_classe, "\\") + 1);
|
25 |
$nom = substr($nom_classe, strrpos($nom_classe, "\\") + 1);
|
25 |
//echo "Recherche : $nom / $ns\n";
|
26 |
//echo "Recherche : $nom / $ns\n";
|
26 |
// Routes selon les namespaces
|
27 |
// Routes selon les namespaces
|
27 |
$routes = array(
|
- |
|
28 |
'TelaBotanica\Del\Commun' => Config::get('cheminDelCommun')
|
28 |
$routes = array('TelaBotanica\Del\Commun' => Config::get('cheminDelCommun'));
|
29 |
);
|
- |
|
30 |
if (array_key_exists($ns, $routes)) {
|
29 |
if (array_key_exists($ns, $routes)) {
|
31 |
//echo "Route trouvée: " . $routes[$ns] . "\n";
|
30 |
//echo "Route trouvée: " . $routes[$ns] . "\n";
|
32 |
$fichier_a_inclure = dirname(__FILE__) . DS . $routes[$ns] . DS . $nom . '.php';
|
31 |
$fichier_a_inclure = dirname(__FILE__) . DS . $routes[$ns] . DS . $nom . '.php';
|
33 |
if (file_exists($fichier_a_inclure)) {
|
32 |
if (file_exists($fichier_a_inclure)) {
|
34 |
include_once $fichier_a_inclure;
|
33 |
include_once $fichier_a_inclure;
|
35 |
return null;
|
34 |
return null;
|
36 |
}
|
35 |
}
|
37 |
}
|
36 |
}
|
38 |
}
|
37 |
}
|
39 |
|
38 |
|
40 |
// Le fichier autoload.inc.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
|
39 |
// Le fichier autoload.inc.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
|
41 |
// Sinon, rien ne sera chargé.
|
40 |
// Sinon, rien ne sera chargé.
|
42 |
// Chemin du fichier chargeant le framework requis
|
41 |
// Chemin du fichier chargeant le framework requis
|
43 |
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
|
42 |
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
|
44 |
if (!file_exists($framework)) {
|
43 |
if (!file_exists($framework)) {
|
45 |
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
|
44 |
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
|
46 |
trigger_error($e, E_USER_ERROR);
|
45 |
trigger_error($e, E_USER_ERROR);
|
47 |
} else {
|
46 |
} else {
|
48 |
// Inclusion du Framework
|
47 |
// Inclusion du Framework
|
49 |
require_once $framework;
|
48 |
require_once $framework;
|
50 |
// Ajout d'information concernant cette application
|
49 |
// Ajout d'information concernant cette application
|
51 |
Framework::setCheminAppli(__FILE__);// Obligatoire
|
50 |
Framework::setCheminAppli(__FILE__);// Obligatoire
|
52 |
Framework::setInfoAppli(Config::get('info'));
|
51 |
Framework::setInfoAppli(Config::get('info'));
|
53 |
|
52 |
|
54 |
// Initialisation et lancement du serveur
|
53 |
// Initialisation et lancement du serveur
|
55 |
$Serveur = new RestServeur();
|
54 |
$Serveur = new RestServeur();
|
56 |
$Serveur->executer();
|
55 |
$Serveur->executer();
|
57 |
}
|
- |
|
58 |
?>
|
- |
|
59 |
|
56 |
}
|
- |
|
57 |
|
60 |
|
58 |
|