Subversion Repositories eFlore/Applications.cel

Rev

Rev 420 | Rev 427 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 420 Rev 424
Line 30... Line 30...
30
	 */
30
	 */
31
	public function __construct($fichier_ini = 'widget.ini.php') {
31
	public function __construct($fichier_ini = 'widget.ini.php') {
32
		// Chargement de la configuration
32
		// Chargement de la configuration
33
		self::$config = parse_ini_file($fichier_ini, TRUE);
33
		self::$config = parse_ini_file($fichier_ini, TRUE);
Line -... Line 34...
-
 
34
		
-
 
35
		// Paramêtres de config dynamiques
-
 
36
		self::$config['chemins']['baseURLAbsoluDyn'] = 'http://'.$_SERVER['SERVER_NAME'].self::$config['chemins']['baseURL'].'%s';
34
		
37
		
35
		// Gestion de la mémoire maximum allouée aux services
38
		// Gestion de la mémoire maximum allouée aux services
Line -... Line 39...
-
 
39
		ini_set('memory_limit', self::$config['parametres']['limiteMemoire']);
-
 
40
		
-
 
41
		// Réglages de PHP
-
 
42
		setlocale(LC_ALL, self::$config['parametres']['locale']);
36
		ini_set('memory_limit', self::$config['parametres']['limiteMemoire']);
43
		date_default_timezone_set(self::$config['parametres']['fuseauHoraire']);
37
		
44
		
Line 38... Line 45...
38
		// Gestion des erreurs
45
		// Gestion des erreurs
39
		error_reporting(self::$config['parametres']['erreurNiveau']);
46
		error_reporting(self::$config['parametres']['erreurNiveau']);
Line 59... Line 66...
59
		if (strlen($_SERVER['QUERY_STRING']) == 0) {
66
		if (strlen($_SERVER['QUERY_STRING']) == 0) {
60
			$len = strlen($_SERVER['REQUEST_URI']);
67
			$len = strlen($_SERVER['REQUEST_URI']);
61
		} else {
68
		} else {
62
			$len = -(strlen($_SERVER['QUERY_STRING']) + 1);
69
			$len = -(strlen($_SERVER['QUERY_STRING']) + 1);
63
		}
70
		}
64
		$url = substr($_SERVER['REQUEST_URI'], strlen(self::$config['parametres']['baseURL']), $len);
71
		$url = substr($_SERVER['REQUEST_URI'], strlen(self::$config['chemins']['baseURL']), $len);
65
		$url_morceaux = explode('/', $url);
72
		$url_morceaux = explode('/', $url);
66
		return $url_morceaux;
73
		return $url_morceaux;
67
	}
74
	}
Line 68... Line 75...
68
	
75
	
Line 90... Line 97...
90
	public static function chargerClasse($classe) {
97
	public static function chargerClasse($classe) {
91
		if (class_exists($classe)) {
98
		if (class_exists($classe)) {
92
			return null;
99
			return null;
93
		}
100
		}
Line 94... Line 101...
94
		
101
		
95
		$chemins = array('', self::$config['parametres']['bibliothequeDossier']);
102
		$chemins = array('', self::$config['chemins']['bibliothequeDossier']);
96
		foreach ($chemins as $chemin) {
103
		foreach ($chemins as $chemin) {
97
			$chemin = $chemin.$classe.'.php';
104
			$chemin = $chemin.$classe.'.php';
98
			if (file_exists($chemin)) {
105
			if (file_exists($chemin)) {
99
				require_once $chemin;
106
				require_once $chemin;
Line 106... Line 113...
106
	 * Execute the request.
113
	 * Execute the request.
107
	 */
114
	 */
108
	function executer() {
115
	function executer() {
109
		if (!is_null($this->widget)) {
116
		if (!is_null($this->widget)) {
110
			$classe_widget = ucfirst($this->widget);
117
			$classe_widget = ucfirst($this->widget);
111
			$fichier_widget = self::$config['parametres']['widgetDossier'].strtolower($this->widget).DIRECTORY_SEPARATOR.$classe_widget.'.php';
118
			$fichier_widget = self::$config['chemins']['widgetDossier'].strtolower($this->widget).DIRECTORY_SEPARATOR.$classe_widget.'.php';
112
			if (file_exists($fichier_widget))  {
119
			if (file_exists($fichier_widget))  {
113
				include_once $fichier_widget;
120
				include_once $fichier_widget;
114
				if (class_exists($classe_widget)) {
121
				if (class_exists($classe_widget)) {
115
					$widget = new $classe_widget(self::$config, $this->parametres);
122
					$widget = new $classe_widget(self::$config, $this->parametres);
116
					$widget->executer();
123
					$widget->executer();