X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=web%2Fapp%2Fenv%2Fmodules%2Fmw_env_config.php;fp=web%2Fapp%2Fenv%2Fmodules%2Fmw_env_config.php;h=4315e1d985771ae565279c59fe4480a57e8c64e6;hb=29b6377f43bf4477e04b57069cf779ac1b913bdb;hp=4357b066d11aec74a031c063466c1cef8cf102c3;hpb=a21fbfe1301f83b72d2815899ff334445b7830cf;p=mtweb diff --git a/web/app/env/modules/mw_env_config.php b/web/app/env/modules/mw_env_config.php index 4357b06..4315e1d 100644 --- a/web/app/env/modules/mw_env_config.php +++ b/web/app/env/modules/mw_env_config.php @@ -1,7 +1,6 @@ bdd = $bdd; + function load_config($bdd, $CONFIG){ + if(true){ + $this->bdd = $bdd; $this->bdd["table_prefix"] = array(); $this->CONFIG = isset($CONFIG) ? $CONFIG : array(); $this->PARAMS = array(); $xml_parser = new sxml(); $app_config_file = $this->path("app")."config.xml"; - if(file_exists($app_config_file)) - { $xml_parser->parse(file_get_contents($app_config_file)); + if(file_exists($app_config_file)){ + $xml_parser->parse(file_get_contents($app_config_file)); $app_config = $xml_parser->data["config"][0]; - if(isset($app_config["subs"]["params"])) - { foreach($app_config["subs"]["params"][0]["subs"] as $param_key => $param_elt) - { $this->PARAMS[$param_key] = $param_elt[0]["data"]; + if(isset($app_config["subs"]["params"])){ + foreach($app_config["subs"]["params"][0]["subs"] as $param_key => $param_elt){ + $this->PARAMS[$param_key] = $param_elt[0]["data"]; } } - if(isset($app_config["subs"]["config"])) - { foreach($app_config["subs"]["config"][0]["subs"] as $config_key => $config_elt) - { $this->CONFIG[$config_key] = $config_elt[0]["data"]; + if(isset($app_config["subs"]["config"])){ + foreach($app_config["subs"]["config"][0]["subs"] as $config_key => $config_elt){ + $this->CONFIG[$config_key] = $config_elt[0]["data"]; } } - if(isset($app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"])) - { $this->add_table_prefix - ( array - ( $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => $bdd["table_prefix"] + if(isset($app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"])){ + $this->add_table_prefix( + array( + $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => $bdd["table_prefix"] ) ); } } - if(($plugins = $this->plugins("ASC")) !== false) - { foreach($plugins as $plugin_name => $plugin) - { $app_config_file = $this->path("plugins").$plugin_name."/app/config.xml"; - if(file_exists($app_config_file) && $plugin["installed"] && $plugin["enabled"]) - { $xml_parser->parse(file_get_contents($app_config_file)); + if(($plugins = $this->plugins("ASC")) !== false){ + foreach($plugins as $plugin_name => $plugin){ + $app_config_file = $this->path("plugins").$plugin_name."/app/config.xml"; + if(file_exists($app_config_file) && $plugin["installed"] && $plugin["enabled"]){ + $xml_parser->parse(file_get_contents($app_config_file)); $app_config = $xml_parser->data["config"][0]; - if(isset($app_config["subs"]["params"])) - { foreach($app_config["subs"]["params"][0]["subs"] as $param_key => $param_elt) - { $this->PARAMS[$param_key] = $param_elt[0]["data"]; + if(isset($app_config["subs"]["params"])){ + foreach($app_config["subs"]["params"][0]["subs"] as $param_key => $param_elt){ + $this->PARAMS[$param_key] = $param_elt[0]["data"]; } } - if(isset($app_config["subs"]["config"])) - { foreach($app_config["subs"]["config"][0]["subs"] as $config_key => $config_elt) - { $this->CONFIG[$config_key] = $config_elt[0]["data"]; + if(isset($app_config["subs"]["config"])){ + foreach($app_config["subs"]["config"][0]["subs"] as $config_key => $config_elt){ + $this->CONFIG[$config_key] = $config_elt[0]["data"]; } } - if(isset($app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"])) - { $this->add_table_prefix - ( array - ( $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => $bdd["table_prefix"] + if(isset($app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"])){ + $this->add_table_prefix( + array( + $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => $bdd["table_prefix"] ) ); } @@ -70,40 +69,69 @@ else $this->erreur("impossible de trouver le fichier de configuration pour l'installation", true); } - function get_config_file() { return $this->config_file; } - function set_config_file($config_file) { $this->config_file = $config_file; } + function get_config_file(){ + return $this->config_file; + } + + function set_config_file($config_file){ + $this->config_file = $config_file; + } + + function get_PATHES(){ + return $this->PATHES; + } - function get_PATHES() { return $this->PATHES; } - function path($name) - { if(isset($this->PATHES[$name])) return $this->PATHES[$name]; + function path($name){ + if(isset($this->PATHES[$name])) return $this->PATHES[$name]; return ""; } - function set_PATHES($PATHES) - { foreach($PATHES as $path_name => $path_value) - { if($path_value && substr($path_value, -1) != "/") $PATHES[$path_name] .= "/"; + + function set_PATHES($PATHES){ + foreach($PATHES as $path_name => $path_value){ + if($path_value && substr($path_value, -1) != "/") $PATHES[$path_name] .= "/"; } $this->PATHES = $PATHES; } - function get_PARAMS() { return $this->PARAMS; } - function param($name) { return $this->PARAMS[$name]; } + function get_PARAMS(){ + return $this->PARAMS; + } - function get_CONFIG() { return $this->CONFIG; } - function config($name) { return $this->CONFIG[$name]; } - function set_config($config) - { if(is_array($config)) - { foreach($config as $key => $value) $this->CONFIG[$key] = $value; + function param($name){ + return $this->PARAMS[$name]; + } + + function get_CONFIG(){ + return $this->CONFIG; + } + + function config($name){ + return $this->CONFIG[$name]; + } + + function set_config($config){ + if(is_array($config)){ + foreach($config as $key => $value) $this->CONFIG[$key] = $value; return true; } return false; } - function get_bdd() { return $this->bdd; } - function bdd($name) { return $this->bdd[$name]; } - function set_bdd($key, $value) { $this->bdd[$key] = $value; } - function add_table_prefix($table_prefix) - { if(is_array($table_prefix)) - { foreach($table_prefix as $prefix_code => $prefix) $this->bdd["table_prefix"][$prefix_code] = $prefix; + function get_bdd(){ + return $this->bdd; + } + + function bdd($name){ + return $this->bdd[$name]; + } + + function set_bdd($key, $value){ + $this->bdd[$key] = $value; + } + + function add_table_prefix($table_prefix){ + if(is_array($table_prefix)){ + foreach($table_prefix as $prefix_code => $prefix) $this->bdd["table_prefix"][$prefix_code] = $prefix; return true; } return false;