var $error;
var $DO_SETUP;
- function mw_app($path_file, $DO_SETUP = true){
+ function mw_app($path_file, $DO_SETUP = false){
$this->DO_SETUP = $DO_SETUP;
$this->path_file = $path_file;
$this->pathes = array();
return $this->env;
}
+ function param($name){
+ if(!isset($this->env)) return false;
+ return $this->env->param($name);
+ }
+
function init(){
- if(!$this->init_pathes()) return false;
- if(!$this->init_config()) return false;
- if(!$this->init_env()) return false;
+ if(!$this->init_pathes()) return $this->get_error();
+ if(!$this->init_config()) return $this->get_error();
+ if(!$this->init_env()) return $this->get_error();
if($this->config_file) return true;
if($this->DO_SETUP) $this->setup();
- return false;
+ return $this->get_error();
}
function init_pathes(){
$this->error("le fichier des chemins est introuvable");
return false;
}
- require_once $this->path_file;
+ require $this->path_file;
if(
!isset($PATHES)
|| !is_array($PATHES)
){
- $this->erreur("variable PATHES non defini");
+ $this->error("variable PATHES non defini");
return false;
}
foreach($PATHES as $path_name => $path_value){
function run($etat = "", $params = array(), $valid_role = true){
$env = $this->env();
if(!is_callable(array($env, "run"))) return false;
- $env->run(
- $etat ?
- $etat
- : (isset($_GET[$env->param("e")]) ? $_GET[$env->param("e")] : ""),
- $params,
- $valid_role
- );
+ $env->run($etat);
return true;
}
$this->error = $content;
}
- function show_error(){
- echo $this->error;
+ function get_error(){
+ return isset($this->error) && $this->error ? $this->error : false;
}
}