X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fenv%2Fmodules%2Fmw_env_data.php;h=f0ddebabdd626e7666cf1609c124a5282416c7e4;hb=refs%2Fheads%2Fmaster;hp=e6cb0000f531689dbbeee33bf58d4c5e451f894f;hpb=441212b3fdf07852be95c4a59315aa39a7264249;p=mtweb diff --git a/mw/env/modules/mw_env_data.php b/mw/env/modules/mw_env_data.php index e6cb000..f0ddeba 100644 --- a/mw/env/modules/mw_env_data.php +++ b/mw/env/modules/mw_env_data.php @@ -2,173 +2,47 @@ class mw_env_data extends mw_env{ - var $data; + public $data; - function set_data(&$data){ + public function set_data(&$data){ $this->data = &$data; } - function data(){ + public function data(){ return isset($this->data) ? $this->data : false; } - } - - class mw_data extends empty_class{ - - function call_default($inst, $method_name, $arguments){ - return $this->call_data_auto_crud($method_name, $arguments); + public function load_data(){ + if(($plugins = $this->plugins("DESC")) === false){ + $this->erreur("Impossible de lire les plugins pour charger les modules de donnees", true); + } + $data = new mw_data(true); + foreach($plugins as $plugin_name => $plugin){ + if($plugin["installed"] && $plugin["enabled"]){ + $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/share/"); + if($this->bdd("sgbd")){ + $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); + } + } + } + $data->load_modules($this->path("mw_dir")."app/", "data/modules/share/"); + if($this->bdd("sgbd")){ + $data->load_modules($this->path("mw_dir")."app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); + } + $data->set_env($this); + $this->set_data($data); } } - class mw_sgbd{ - - var $sgbd_impl; - var $env; - - function mw_sgbd($sgbd_impl, $env){ - $this->sgbd_impl = $sgbd_impl; - $this->env = $env; - } - - function extention_ok(){ - return $this->sgbd_impl->extention_ok($this->env); - } - - function authentication_required(){ - return $this->sgbd_impl->authentication_required(); - } - - function connect($host, $base, $user, $password){ - return $this->sgbd_impl->connect($host, $base, $user, $password); - } - - function select_db($db_name){ - return $this->sgbd_impl->select_db($db_name); - } - - # --------------------------------------------------------------------------------- - # SQL - # - - function desc_table($table_name){ - if(!method_exists($this->sgbd_impl, "desc_table")) return false; - return $this->sgbd_impl->desc_table( - ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ? - str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name) - : $table_name - ); - } - - function table_exists($table_name){ - if(!method_exists($this->sgbd_impl, "table_exists")) return false; - return $this->sgbd_impl->table_exists( - ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ? - str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name) - : $table_name - ); - } - - function field_exists($table_name, $field_name){ - if(!method_exists($this->sgbd_impl, "field_exists")) return false; - return $this->sgbd_impl->field_exists( - ( - $prefix_codes = array_keys($this->env->bdd("table_prefix"))) ? - str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $table_name) - : $table_name, - $field_name - ); - } - - function query($sql){ - if(!method_exists($this->sgbd_impl, "query")) return false; - return $this->sgbd_impl->query( - ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ? - str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $sql) - : $sql - ); - } - - function insert_id(){ - if(!method_exists($this->sgbd_impl, "insert_id")) return false; - return $this->sgbd_impl->insert_id(); - } - - function fetch_assoc($rst){ - if(!method_exists($this->sgbd_impl, "fetch_assoc")) return false; - return $this->sgbd_impl->fetch_assoc($rst); - } - - function free_result($rst){ - if(!method_exists($this->sgbd_impl, "")) return false; - return $this->sgbd_impl->free_result($rst); - } - - function close(){ - if(!method_exists($this->sgbd_impl, "")) return false; - return $this->sgbd_impl->close(); - } - - # --------------------------------------------------------------------------------- - # XML - # - - function data_exists($data_path){ - if(!method_exists($this->sgbd_impl, "data_exists")) return false; - return $this->sgbd_impl->data_exists($data_path); - } - - function create_data($data_path){ - if(!method_exists($this->sgbd_impl, "create_data")) return false; - return $this->sgbd_impl->create_data($data_path); - } - - function get_data($data_path, $data_id){ - if(!method_exists($this->sgbd_impl, "get_data")) return false; - return $this->sgbd_impl->get_data($data_path, $data_id); - } - - function open_data($data_path, $FETCH = true){ - if(!method_exists($this->sgbd_impl, "open_data")) return false; - return $this->sgbd_impl->open_data($data_path, $FETCH); - } + // ------------------------------------------------------------------------------------------- + // class mw_data + // - function fetch_data($dh){ - if(!method_exists($this->sgbd_impl, "fetch_data")) return false; - return $this->sgbd_impl->fetch_data($dh); - } - - function add_data($data_path, $data, $index = null){ - if(!method_exists($this->sgbd_impl, "add_data")) return false; - return $this->sgbd_impl->add_data($data_path, $data, $index); - } - - function last_index($dh){ - if(!method_exists($this->sgbd_impl, "last_index")) return false; - return $this->sgbd_impl->last_index($dh); - } - - function set_data($data_path, $data_id, $data){ - if(!method_exists($this->sgbd_impl, "set_data")) return false; - return $this->sgbd_impl->set_data($data_path, $data_id, $data); - } - - function del_data($data_path, $data_id){ - if(!method_exists($this->sgbd_impl, "del_data")) return false; - return $this->sgbd_impl->del_data($data_path, $data_id); - } - - function close_data($dh){ - if(!method_exists($this->sgbd_impl, "close_data")) return false; - return $this->sgbd_impl->close_data($dh); - } + class mw_data extends empty_class{ - function remove_data($data_path){ - if(!method_exists($this->sgbd_impl, "remove_data")) return false; - return $this->sgbd_impl->remove_data($data_path); + public function call_default($inst, $method_name, $arguments){ + return $this->call_data_auto_crud($method_name, $arguments); } } - -?> \ No newline at end of file