Subversion Repositories eFlore/Applications.del

Rev

Rev 1683 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1020 aurelien 1
<?php
2
// Encodage : UTF-8
3
// +-------------------------------------------------------------------------------------------------------------------+
4
/**
5
* Initialise le chargement et l'exécution des scripts
6
*
7
* Lancer ce fichier en ligne de commande avec :
8
* <code>/opt/lampp/bin/php cli.php mon_script -a test</code>
9
*
10
//Auteur original :
11
* @author       Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
* @author       Delphine CAUQUIL <delphine@tela-botanica.org>
13
* @copyright    Tela-Botanica 1999-2008
14
* @licence      GPL v3 & CeCILL v2
15
* @version      $Id$
16
*/
17
// +-------------------------------------------------------------------------------------------------------------------+
18
 
1565 mathias 19
 
20
 
21
// Autoloader pour les namespaces, à base de routes
22
function __autoload($nom_classe) {
23
	//echo "AUTOLOAD\n";
24
	$dernierAS = strrpos($nom_classe, "\\");
25
	$ns = substr($nom_classe, 0, $dernierAS);
26
	$nom = substr($nom_classe, strrpos($nom_classe, "\\") + 1);
27
	//echo "Recherche : $nom / $ns\n";
28
	// Routes selon les namespaces
29
	$routes = array(
1567 mathias 30
		'TelaBotanica\Del\Commun' => Config::get('cheminDelCommun')
1565 mathias 31
	);
32
	if (array_key_exists($ns, $routes)) {
33
		//echo "Route trouvée: " . $routes[$ns] . "\n";
34
		$fichier_a_inclure = dirname(__FILE__) . DS . $routes[$ns] . DS . $nom . '.php';
35
		if (file_exists($fichier_a_inclure)) {
36
			include_once $fichier_a_inclure;
37
			return null;
38
		}
39
	}
40
}
41
 
1020 aurelien 42
// Le fichier Framework.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
43
// Sinon, rien ne sera chargé.
44
// Chemin du fichier chargeant le framework requis
45
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
46
if (!file_exists($framework)) {
1683 jpm 47
	$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
48
	trigger_error($e, E_USER_ERROR);
1020 aurelien 49
} else {
1683 jpm 50
	// Inclusion du Framework
51
	require_once $framework;
1020 aurelien 52
 
1683 jpm 53
	// Ajout d'information concernant cette application
54
	Framework::setCheminAppli(__FILE__);// Obligatoire
55
	Framework::setInfoAppli(Config::get('info'));
1020 aurelien 56
 
1683 jpm 57
	// Initialisation et lancement du script appelé en ligne de commande
58
	Cli::executer();
1020 aurelien 59
}
60
?>