+<?php
+
+ class mw_env_versions extends mw_env{
+
+ var $xml_parser;
+ var $versions;
+
+ function version($application){
+ return isset($this->versions[$application]) ? $this->versions[$application] : false;
+ }
+
+ function load_versions(){
+ $this->xml_parser = new sxml();
+ $app_config_file = $this->path("mw_dir")."app/config.xml";
+ if(file_exists($app_config_file)){
+ $this->_load_version("mtweb", $app_config_file);
+ }
+ if(($plugins = $this->plugins()) !== false){
+ foreach($plugins as $plugin_name => $plugin){
+ $this->load_plugin_version($plugin_name);
+ }
+ }
+ else $this->erreur("impossible de lire les fichiers de configuration pour les plugins", true);
+ }
+
+ function _load_version($app_name, $app_config_file){
+ $this->xml_parser->parse(file_get_contents($app_config_file));
+ $app_config = $this->xml_parser->data["config"][0];
+ if(isset($app_config["subs"]["version"][0]["data"])){
+ $this->versions[$app_name] = $app_config["subs"]["version"][0]["data"];
+ }
+ }
+
+ function load_plugin_version($plugin_name){
+ $app_config_file = $this->path("mw_dir")."plugins/".$plugin_name."/app/config.xml";
+ if(file_exists($app_config_file)){
+ $this->_load_version($plugin_name, $app_config_file);
+ }
+ }
+
+ }
+
+?>
\ No newline at end of file