Subversion Repositories eFlore/Applications.del

Rev

Rev 1567 | Rev 1794 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
700 gduche 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
 
1564 mathias 19
// Autoloader pour les namespaces, à base de routes
20
function __autoload($nom_classe) {
21
	//echo "AUTOLOAD\n";
22
	$dernierAS = strrpos($nom_classe, "\\");
23
	$ns = substr($nom_classe, 0, $dernierAS);
24
	$nom = substr($nom_classe, strrpos($nom_classe, "\\") + 1);
25
	//echo "Recherche : $nom / $ns\n";
26
	// Routes selon les namespaces
27
	$routes = array(
1567 mathias 28
			'TelaBotanica\Del\Commun' => Config::get('cheminDelCommun')
1564 mathias 29
	);
30
	if (array_key_exists($ns, $routes)) {
31
		//echo "Route trouvée: " . $routes[$ns] . "\n";
32
		$fichier_a_inclure = dirname(__FILE__) . DS . $routes[$ns] . DS . $nom . '.php';
33
		if (file_exists($fichier_a_inclure)) {
34
			include_once $fichier_a_inclure;
35
			return null;
36
		}
37
	}
38
}
39
 
700 gduche 40
// 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é.
42
// Chemin du fichier chargeant le framework requis
43
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
44
if (!file_exists($framework)) {
1589 jpm 45
	$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
46
	trigger_error($e, E_USER_ERROR);
700 gduche 47
} else {
1589 jpm 48
	// Inclusion du Framework
49
	require_once $framework;
50
	// Ajout d'information concernant cette application
51
	Framework::setCheminAppli(__FILE__);// Obligatoire
52
	Framework::setInfoAppli(Config::get('info'));
1564 mathias 53
 
1589 jpm 54
	// Initialisation et lancement du serveur
55
	$Serveur = new RestServeur();
56
	$Serveur->executer();
700 gduche 57
}
58
?>