www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

cms.php (1721B)


      1 <?php
      2 
      3 error_reporting(E_ALL | E_STRICT);
      4 ini_set("display_errors", 1); // Ne s'appliquera pas au fichier courant !
      5 
      6 require_once(dirname(__FILE__) . "/configuration.php");
      7 require_once(dirname(__FILE__) . "/include_tous.php");
      8 
      9 // It's not a bug, its a feature
     10 if (get_magic_quotes_runtime()) set_magic_quotes_runtime(false);
     11 
     12 class CMS {
     13     public static function page($chemin_str) {
     14 		// TODO : appeller Modules::action($chemin, $action, $paramètres);
     15 		
     16 		$chemin = new Chemin($chemin_str);
     17 		$module = Modules::get_module($chemin);
     18                 
     19 		$paramètres = array("action" => "vue");
     20 		
     21 		foreach ($module["get_post"] as $param) {
     22 			if (isset($_GET[$param])) $paramètres[$param] = self::param_get($param);
     23 			if (isset($_POST[$param])) $paramètres[$param] = self::param_post($param);
     24 		}
     25 		foreach ($module["post"] as $param) {
     26 			if (isset($_POST[$param])) $paramètres[$param] = self::param_post($param);
     27 		}
     28 		foreach ($module["file"] as $param) {
     29 			if (isset($_FILES[$param])) $paramètres[$param] = $_FILES[$param];
     30 		}
     31         
     32 		$action = $paramètres["action"];
     33 		$ret = Modules::action($chemin, $action, $paramètres);
     34 		
     35 		if (!Page::is_page($ret)) {
     36 			Erreur::fatale("Le module de " . htmlspecialchars($chemin->get()) . " n'a pas renvoyé une page mais à la place : <pre><code>" . htmlspecialchars(var_export($ret, true)) . "</code></pre>", true);
     37 		} else {
     38 			$ret->envoyer();
     39 		}
     40     }
     41 	
     42 	// Not even beneath my contempt...
     43 	public static function param_get($param) {
     44 		return get_magic_quotes_gpc() ? stripslashes($_GET[$param]) : $_GET[$param];
     45 	}
     46 	
     47 	public static function param_post($param) {
     48 		return get_magic_quotes_gpc() ? stripslashes($_POST[$param]) : $_POST[$param];
     49 	}
     50 }
     51 
     52 ?>