import mtweb.0.4.1
[mtweb] / web / app / init / 0300_data.php
1 <?php
2
3   require $this->app_file("data/mw_sgbd.php");
4   require $this->app_file("data/mw_data.php");
5   if($this->app_file_exists("data/impl/mw_".$this->bdd("sgbd").".php"))
6   { require $this->app_file("data/impl/mw_".$this->bdd("sgbd").".php");
7     if(class_exists($sgbd_impl = "mw_".$this->bdd("sgbd")))
8     { if(($plugins = $this->plugins("DESC")) !== false)
9       { $data = new mw_data(true);
10         foreach($plugins as $plugin_name => $plugin)
11         { if($plugin["installed"] && $plugin["enabled"])
12           { $data->load_modules($this->path("plugins").$plugin_name."/app/", "data/modules/share/");
13             $data->load_modules($this->path("plugins").$plugin_name."/app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/");
14           }
15         }
16         $data->load_modules($this->path("app"), "data/modules/share/");
17         $data->load_modules($this->path("app"), "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/");
18         $sgbd = new mw_sgbd
19         ( new $sgbd_impl
20           ( $this->bdd("host"),
21             $this->bdd("base"),
22             $this->bdd("user"),
23             $this->bdd("password")
24           ),
25           $this
26         );
27         if($sgbd->extention_ok())
28         { $data->set_sgbd($sgbd);
29           $data->set_env($this);
30           $this->set_data($data);
31         }
32         else $this->erreur("L'extention php ".$this->bdd("sgbd")." n'est pas install&eacute;e", true);
33       }
34       else $this->erreur("Impossible de lire les plugins pour charger les modules de donnees");
35     }
36     else $this->erreur("Impossible de trouver la classe d'implementation du sgbd ".$this->bdd("sgbd"), true);
37   }
38   else $this->erreur("Impossible de trouver le fichier d'implementation du sgbd ".$this->bdd("sgbd"), true);
39
40 ?>