| 1 | aurelien | 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 | if (!file_exists($framework)) {
 | 
        
           |  |  | 24 |     $e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
 | 
        
           |  |  | 25 |     trigger_error($e, E_USER_ERROR);
 | 
        
           |  |  | 26 | } else {
 | 
        
           |  |  | 27 |     // Inclusion du Framework
 | 
        
           |  |  | 28 |     require_once $framework;
 | 
        
           |  |  | 29 |     // Ajout d'information concernant cette application
 | 
        
           |  |  | 30 |     Framework::setCheminAppli(__FILE__);// Obligatoire
 | 
        
           |  |  | 31 |     Framework::setInfoAppli(Config::get('info'));
 | 
        
           |  |  | 32 |   | 
        
           |  |  | 33 |     // Initialisation et lancement du serveur
 | 
        
           |  |  | 34 |     $Serveur = new RestServeur();
 | 
        
           |  |  | 35 |     $Serveur->executer();
 | 
        
           |  |  | 36 |   | 
        
           |  |  | 37 |     // Affiche le temps d'execution du service
 | 
        
           |  |  | 38 |     if (isset($_GET['chrono']) && $_GET['chrono'] == 1) {
 | 
        
           |  |  | 39 |         $temps_fin = microtime(true);
 | 
        
           |  |  | 40 |         echo 'Temps d\'execution : '.round($temps_fin - $temps_debut, 4);
 | 
        
           |  |  | 41 |     }
 | 
        
           |  |  | 42 | }
 | 
        
           |  |  | 43 | ?>
 |