algo action_allowed
[mtweb] / mw / mw_app.php
index 4355487..38d094d 100644 (file)
     }
 
     function init_pathes(){
-      if(($n = strpos($_SERVER["REQUEST_URI"], "?")) !== false){
-        $_SERVER["REQUEST_URI"] = substr($_SERVER["REQUEST_URI"], 0, $n);
+      $REQUEST_URI = $_SERVER["REQUEST_URI"];
+      if(($n = strpos($REQUEST_URI, "?")) !== false){
+        $REQUEST_URI = substr($REQUEST_URI, 0, $n);
       }
-      $web_path = explode("/", preg_replace('#/+#','/',$_SERVER["REQUEST_URI"]));
+      $web_path = explode("/", preg_replace('#/+#','/',$REQUEST_URI));
       $this->pathes["web"] = "";
       for($i = 0; $i < count($web_path) - 1; $i++) $this->pathes["web"] .= $web_path[$i]."/";
       if(
         $this->error("dossier content introuvable");
         return false;
       }
-      if(!is_writable($this->pathes["content"])){
+      if(
+            !is_writable($this->pathes["content"])
+        ||  !is_writable($this->pathes["content"]."config")
+        ||  !is_writable($this->pathes["content"]."data")
+      ){
         $this->error("Php ne peut pas ecrire dans le dossier content");
         return false;
       }
       $env->load_versions();
       $env->load_config($this->bdd, $this->config);
       $env->init();
+      $env->loaded_plugins();
       if(($res = $env->init_data_upgrades()) !== true){
         $this->error("impossible de lire les upgrades. ".$res);
         return false;
     }
 
     function upgrade(){
+      $env = $this->env();
+      $data = $env->data();
+      $data->load_session();
       if($this->run_mod("upgrade", false)){
         $this->display();
       }