renommage de "status" en "role" (bdd et code) mtweb.0.7.1
authordj3c1t <dj3c1t@free.fr>
Sun, 17 Feb 2013 18:26:50 +0000 (19:26 +0100)
committerdj3c1t <dj3c1t@free.fr>
Sun, 17 Feb 2013 18:26:50 +0000 (19:26 +0100)
23 files changed:
content/data/mysql/mtweb.sql
content/data/xml/mw/actions_roles/.index [moved from content/data/xml/mw/action_status/.index with 100% similarity]
content/data/xml/mw/actions_roles/182.xml [moved from content/data/xml/mw/action_status/182.xml with 63% similarity]
content/data/xml/mw/actions_roles/187.xml [moved from content/data/xml/mw/action_status/187.xml with 58% similarity]
content/data/xml/mw/actions_roles/188.xml [moved from content/data/xml/mw/action_status/188.xml with 58% similarity]
content/data/xml/mw/users_roles/.index
content/data/xml/mw/users_roles/31.xml [moved from content/data/xml/mw/users_roles/25.xml with 100% similarity]
content/data/xml/mw/users_roles/32.xml [moved from content/data/xml/mw/users_roles/26.xml with 100% similarity]
mw/app/config.xml
mw/app/data/modules/sql/mw_data_users.php
mw/app/data/modules/xml/mw_data_users.php
mw/app/init/0500_users.php
mw/app/mods/admin/config.php
mw/app/mods/admin/users.php
mw/app/mods/users/compte.php
mw/app/mods/users/infos.php
mw/app/out/default/views/admin/users/add.php
mw/app/out/default/views/admin/users/edit.php
mw/app/out/default/views/admin/users/list.php
mw/app/out/default/views/footer.php
mw/app/out/default/views/users/identification.php
mw/app/out/default/views/users/infos/edit.php
mw/env/modules/mw_env_run.php

index dfc9068..368c36c 100644 (file)
@@ -19,21 +19,21 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 -- Structure de la table `mw_action_status`\r
 --\r
 \r
-CREATE TABLE IF NOT EXISTS `mw_action_status` (\r
-  `id` int(11) NOT NULL AUTO_INCREMENT,\r
-  `action` varchar(255) NOT NULL,\r
-  `id_status` int(11) NOT NULL,\r
-  PRIMARY KEY (`id`)\r
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=116 ;\r
-\r
---\r
--- Contenu de la table `mw_action_status`\r
---\r
-\r
-INSERT INTO `mw_action_status` (`id`, `action`, `id_status`) VALUES\r
-(115, 'users/identification', 0),\r
-(111, 'users', 2),\r
-(113, 'admin', 1);\r
+CREATE TABLE IF NOT EXISTS `mw_actions_roles` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `action` varchar(255) NOT NULL,
+  `id_role` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;
+
+--
+-- Contenu de la table `mw_actions_roles`
+--
+
+INSERT INTO `mw_actions_roles` (`id`, `action`, `id_role`) VALUES
+(13, 'admin', 1),
+(14, 'users', 2),
+(15, 'users/identification', 0);
 \r
 -- --------------------------------------------------------\r
 \r
similarity index 63%
rename from content/data/xml/mw/action_status/182.xml
rename to content/data/xml/mw/actions_roles/182.xml
index 5e172e6..102f239 100644 (file)
@@ -1,4 +1,4 @@
 <tuple>
   <action><![CDATA[users/identification]]></action>
-  <id_status><![CDATA[0]]></id_status>
+  <id_role><![CDATA[0]]></id_role>
 </tuple>
similarity index 58%
rename from content/data/xml/mw/action_status/187.xml
rename to content/data/xml/mw/actions_roles/187.xml
index 1f4af7e..6f5c251 100644 (file)
@@ -1,4 +1,4 @@
 <tuple>
   <action><![CDATA[admin]]></action>
-  <id_status><![CDATA[1]]></id_status>
+  <id_role><![CDATA[1]]></id_role>
 </tuple>
similarity index 58%
rename from content/data/xml/mw/action_status/188.xml
rename to content/data/xml/mw/actions_roles/188.xml
index d36ab48..92faaf5 100644 (file)
@@ -1,4 +1,4 @@
 <tuple>
   <action><![CDATA[users]]></action>
-  <id_status><![CDATA[2]]></id_status>
+  <id_role><![CDATA[2]]></id_role>
 </tuple>
index 978b4e8..1758ddd 100644 (file)
@@ -1 +1 @@
-26
\ No newline at end of file
+32
\ No newline at end of file
index e73c769..7d3d91c 100644 (file)
@@ -14,7 +14,7 @@
     <e>e</e>
     <id>id</id>
     <user>user</user>
-    <status>status</status>
+    <role>role</role>
     <from>from</from>
     <start>start</start>
     <alpha>alpha</alpha>
index 0a1cf54..a1d76bd 100644 (file)
@@ -3,15 +3,15 @@
   class mw_data_users extends mw_data{
 
     var $users;
-    var $_user;
-    var $user_status;
-    var $action_status;
+    var $user;
+    var $roles;
+    var $actions_roles;
 
     # ----------------------------------------------------------------------------------------
     #                                                                                    users
     #
 
-    function users($start = 0, $alpha = null, $status = null){
+    function users($start = 0, $alpha = null, $id_role = null){
       $sgbd = $this->sgbd();
       $env = $this->env();
       $users = array("list" => array(), "total" => 0);
         $FROM = " FROM #--users";
         $WHERE = "";
         $WHERE .= (isset($alpha) ? ($WHERE ? " AND" : " WHERE")." LEFT(login, 1)=".$this->eq($alpha) : "");
-        if(isset($status)){
-          $SELECT .= ", #--users_roles.id_role as status";
+        if(isset($id_role)){
+          $SELECT .= ", #--users_roles.id_role";
           $FROM .=
            " LEFT JOIN #--users_roles ON ("
           ." #--users_roles.id_user=#--users.id"
-          ." AND #--users_roles.id_role=".$this->eq($status)
+          ." AND #--users_roles.id_role=".$this->eq($id_role)
           .")";
           $WHERE .= ($WHERE ? " AND" : " WHERE")." mw_users_roles.id_role IS NOT NULL";
         }
@@ -40,8 +40,8 @@
           while($v_rst = $sgbd->fetch_assoc($rst)) $users["list"][$v_rst["id"]] = $v_rst;
           $sgbd->free_result($rst);
           foreach($users["list"] as $id_user => $user){
-            if(($status = $this->list_user_status($id_user)) !== false){
-              $users["list"][$id_user]["status"] = $status;
+            if(($roles = $this->list_user_roles($id_user)) !== false){
+              $users["list"][$id_user]["roles"] = $roles;
             }
             else{
               $users = false;
       return $users;
     }
 
-    function list_user_status($id_user){
+    function list_user_roles($id_user){
       $sgbd = $this->sgbd();
-      $status = array();
+      $roles = array();
       try{
         $rst = $sgbd->query("SELECT id_role FROM #--users_roles WHERE id_user=".$this->eq($id_user));
-        while($v_rst = $sgbd->fetch_assoc($rst)) $status[] = $v_rst["id_role"];
+        while($v_rst = $sgbd->fetch_assoc($rst)) $roles[] = $v_rst["id_role"];
         $sgbd->free_result($rst);
       }
-      catch(Exception $e) { $status = false; }
-      return $status;
+      catch(Exception $e) { $roles = false; }
+      return $roles;
     }
 
     function user_by_id($id){
@@ -74,7 +74,7 @@
         $rst = $sgbd->query($sql);
         if($v_rst = $sgbd->fetch_assoc($rst)) $user = $v_rst;
         $sgbd->free_result($rst);
-        if(($status = $this->list_user_status($user["id"])) !== false) $user["status"] = $status;
+        if(($roles = $this->list_user_roles($user["id"])) !== false) $user["roles"] = $roles;
         else $user = false;
       }
       catch(Exception $e) { $user = false; }
@@ -90,7 +90,7 @@
         if($v_rst = $sgbd->fetch_assoc($rst)) $user = $v_rst;
         $sgbd->free_result($rst);
         if($user){
-          if(($status = $this->list_user_status($user["id"])) !== false) $user["status"] = $status;
+          if(($roles = $this->list_user_roles($user["id"])) !== false) $user["roles"] = $roles;
           else $user = false;
         }
       }
       return $EXISTS;
     }
 
-    function add_user($login, $password, $email, $status){
+    function add_user($login, $password, $email, $roles){
       $sgbd = $this->sgbd();
       $user_id = false;
       try{
         .")";
         $sgbd->query($sql);
         $user_id = $sgbd->insert_id();
-        foreach($status as $id_role){
+        foreach($roles as $id_role){
           $sql =
            "INSERT INTO #--users_roles(id_user, id_role) VALUES"
           ."( ".$user_id
       return $user_id;
     }
 
-    function set_user($id, $login, $password, $email, $status){
+    function set_user($id, $login, $password, $email, $roles){
       $sgbd = $this->sgbd();
       try{
         $sql =
         $sgbd->query($sql);
         $sql = "DELETE FROM #--users_roles WHERE id_user=".$this->eq($id);
         $sgbd->query($sql);
-        foreach($status as $id_role){
+        foreach($roles as $id_role){
           $sql =
            "INSERT INTO #--users_roles(id_user, id_role) VALUES"
           ."( ".$this->eq($id)
       if(($user = $this->user($login)) !== false){
         $sgbd = $this->sgbd();
         try{
-          $sql = "DELETE FROM #--users WHERE login=".$this->eq($login)." AND id=".$user["id"];
-          $sgbd->query($sql);
           $sql = "DELETE FROM #--users_roles WHERE id_user=".$user["id"];
           $sgbd->query($sql);
+          $sql = "DELETE FROM #--users WHERE login=".$this->eq($login)." AND id=".$user["id"];
+          $sgbd->query($sql);
         }
         catch(Exception $e) { return false; }
       }
     }
 
     # ----------------------------------------------------------------------------------------
-    #                                                                                   status
+    #                                                                                    roles
     #
 
-    function init_user_status($status = array()){
+    function init_roles(){
       $sgbd = $this->sgbd();
-      $this->user_status = array();
+      $this->roles = array();
       try{
         $sql = "SELECT * FROM #--roles";
         $rst = $sgbd->query($sql);
-        while($v_rst = $sgbd->fetch_assoc($rst)) $this->user_status[$v_rst["id"]] = $v_rst;
+        while($v_rst = $sgbd->fetch_assoc($rst)) $this->roles[$v_rst["id"]] = $v_rst;
         $sgbd->free_result($rst);
       }
-      catch(Exception $e) { $this->user_status = false; }
-      return $this->user_status;
+      catch(Exception $e) { $this->roles = false; }
+      return $this->roles;
+    }
+
+    function roles(){
+      if(!isset($this->roles)) return false;
+      return $this->roles;
     }
 
     function add_role($nom, $intitule){
     function clear_role_actions($id_role){
       $sgbd = $this->sgbd();
       try{
-        $sql = "DELETE FROM #--action_status WHERE id_status=".$this->eq($id_role);
+        $sql = "DELETE FROM #--actions_roles WHERE id_role=".$this->eq($id_role);
         $sgbd->query($sql);
       }
       catch(Exception $e) { return false; }
     function add_role_action($id_role, $action){
       $sgbd = $this->sgbd();
       try{
-        $sql = "INSERT INTO #--action_status(action, id_status) VALUES(".$this->eq($action).", ".$this->eq($id_role).")";
+        $sql = "INSERT INTO #--actions_roles(action, id_role) VALUES(".$this->eq($action).", ".$this->eq($id_role).")";
         $sgbd->query($sql);
-        $id_action_status = $sgbd->insert_id();
+        $id_action_role = $sgbd->insert_id();
       }
-      catch(Exception $e) { $id_action_status = false; }
-      return $id_action_status;
+      catch(Exception $e) { $id_action_role = false; }
+      return $id_action_role;
     }
 
     function del_role($id_role){
       return true;
     }
 
-    function status(){
-      if(!isset($this->user_status)) return false;
-      return $this->user_status;
-    }
-
-    function get_user_status(){
-      $user_status = array();
+    function get_user_roles(){
+      $user_roles = array();
       $user = $this->get_session_user();
       if($user && isset($user["id"])){
         $sgbd = $this->sgbd();
         try{
           $sql = "SELECT id_role FROM #--users_roles WHERE id_user=".$this->eq($user["id"]);
           $rst = $sgbd->query($sql);
-          while($v_rst = $sgbd->fetch_assoc($rst)) $user_status[] = $v_rst["id_role"];
+          while($v_rst = $sgbd->fetch_assoc($rst)) $user_roles[] = $v_rst["id_role"];
           $sgbd->free_result($rst);
         }
         catch(Exception $_e){ return false; }
       }
-      else $user_status[] = 0;
-      if(!$user_status) $user_status[] = 0;
-      return $user_status;
+      else $user_roles[] = 0;
+      if(!$user_roles) $user_roles[] = 0;
+      return $user_roles;
     }
 
-    function init_action_status($status = array()){
-      if(!isset($this->user_status)) return false;
-      $this->action_status = $this->read_action_status();
-      return $this->action_status;
+    function init_actions_roles(){
+      if(!isset($this->roles)) return false;
+      $this->actions_roles = $this->read_actions_roles();
+      return $this->actions_roles;
     }
 
-    function read_action_status($params = array()){
+    function read_actions_roles($params = array()){
       $group_by_action = isset($params["group_by_action"]) ? $params["group_by_action"] : false;
       $sgbd = $this->sgbd();
-      $action_status = array();
+      $actions_roles = array();
       try{
-        $sql = "SELECT * FROM #--action_status";
+        $sql = "SELECT * FROM #--actions_roles";
         $rst = $sgbd->query($sql);
         while($v_rst = $sgbd->fetch_assoc($rst)){
           if($group_by_action){
-            if(!isset($action_status[$v_rst["action"]])) $action_status[$v_rst["action"]] = array();
-            $action_status[$v_rst["action"]][] = $v_rst["id_status"];
+            if(!isset($actions_roles[$v_rst["action"]])) $actions_roles[$v_rst["action"]] = array();
+            $actions_roles[$v_rst["action"]][] = $v_rst["id_role"];
           }
-          else $action_status[$v_rst["id"]] = $v_rst;
+          else $actions_roles[$v_rst["id"]] = $v_rst;
         }
         $sgbd->free_result($rst);
       }
-      catch(Exception $e) { $action_status = false; }
-      return $action_status;
+      catch(Exception $e) { $actions_roles = false; }
+      return $actions_roles;
     }
 
-    function get_action_status($mod, $controller = "index", $action = "index", $set_status = array()){
+    function get_action_roles($mod, $controller = "index", $action = "index"){
       $sgbd = $this->sgbd();
-      $status = array();
+      $roles = array();
       try{
         $sql =
-         "SELECT action, id_status"
-        ." FROM #--action_status"
+         "SELECT action, id_role"
+        ." FROM #--actions_roles"
         ." WHERE action=".$this->eq($mod)
         ." OR action=".$this->eq($mod."/".$controller)
         ." OR action=".$this->eq($mod."/".$controller."/".$action);
         $rst = $sgbd->query($sql);
         while($v_rst = $sgbd->fetch_assoc($rst)){
-          if(!isset($status[$v_rst["action"]])) $status[$v_rst["action"]] = array();
-          $status[$v_rst["action"]][$v_rst["id_status"]] = true;
+          if(!isset($roles[$v_rst["action"]])) $roles[$v_rst["action"]] = array();
+          $roles[$v_rst["action"]][$v_rst["id_role"]] = true;
         }
         $sgbd->free_result($rst);
       }
-      catch(Exception $e) { $status = false; }
-      return $status;
+      catch(Exception $e) { $roles = false; }
+      return $roles;
     }
 
     function get_actions($id_role = null){
       $env = $this->env();
       if($actions = $env->get_actions()){
-        if(($action_status = $this->read_action_status(array("group_by_action" => true))) !== false){
+        if(($actions_roles = $this->read_actions_roles(array("group_by_action" => true))) !== false){
           foreach($actions as $module_name => $module){
             if(isset($id_role)) $actions[$module_name]["module_allowed"] =
-                isset($action_status[$module_name])
-            &&  in_array($id_role, $action_status[$module_name]);
+                isset($actions_roles[$module_name])
+            &&  in_array($id_role, $actions_roles[$module_name]);
             $actions[$module_name]["is_public"] =
-                isset($action_status[$module_name])
-            &&  in_array(0, $action_status[$module_name]);
+                isset($actions_roles[$module_name])
+            &&  in_array(0, $actions_roles[$module_name]);
             foreach($module["controleurs"] as $controleur_name => $controleur){
               if(isset($id_role)) $actions[$module_name]["controleurs"][$controleur_name]["controleur_allowed"] =
-                  isset($action_status[$module_name."/".$controleur_name])
-              &&  in_array($id_role, $action_status[$module_name."/".$controleur_name]);
+                  isset($actions_roles[$module_name."/".$controleur_name])
+              &&  in_array($id_role, $actions_roles[$module_name."/".$controleur_name]);
               $actions[$module_name]["controleurs"][$controleur_name]["is_public"] =
-                  isset($action_status[$module_name."/".$controleur_name])
-              &&  in_array(0, $action_status[$module_name."/".$controleur_name]);
+                  isset($actions_roles[$module_name."/".$controleur_name])
+              &&  in_array(0, $actions_roles[$module_name."/".$controleur_name]);
               foreach($controleur["als"] as $index_als => $al){
                 if($al["actions"]){
                   if(isset($id_role)){
                     $HAS_ACTION_NOT_ALLOWED = false;
                     foreach($al["actions"] as $action_name){
                       if(
-                          !isset($action_status[$module_name."/".$controleur_name."/".$action_name])
-                      ||  !in_array($id_role, $action_status[$module_name."/".$controleur_name."/".$action_name])
+                          !isset($actions_roles[$module_name."/".$controleur_name."/".$action_name])
+                      ||  !in_array($id_role, $actions_roles[$module_name."/".$controleur_name."/".$action_name])
                       ){
                         $HAS_ACTION_NOT_ALLOWED = true;
                         break;
                   $HAS_ACTION_NOT_ALLOWED = false;
                   foreach($al["actions"] as $action_name){
                     if(
-                        !isset($action_status[$module_name."/".$controleur_name."/".$action_name])
-                    ||  !in_array(0, $action_status[$module_name."/".$controleur_name."/".$action_name])
+                        !isset($actions_roles[$module_name."/".$controleur_name."/".$action_name])
+                    ||  !in_array(0, $actions_roles[$module_name."/".$controleur_name."/".$action_name])
                     ){
                       $HAS_ACTION_NOT_ALLOWED = true;
                       break;
           $user = array();
         }
       }
-      $this->_user = $user;
+      $this->user = $user;
       return $user;
     }
 
     }
 
     function get_session_user(){
-      return $this->_user;
+      return $this->user;
     }
 
     # ----------------------------------------------------------------------------------------
 
     function check_user_uploads_dir($user = null){
       $env = $this->env();
-      $user_dir = $env->path("content")."uploads/".(isset($user) ? $user : $this->_user["id"]);
+      if((!isset($user) || !$user) && !isset($this->user["id"])) return false;
+      $user_dir = $env->path("content")."uploads/".(isset($user) && $user ? $user : $this->user["id"]);
       if(!file_exists($user_dir)) @mkdir($user_dir);
       return file_exists($user_dir);
     }
index 2f70095..a5e5e9c 100644 (file)
@@ -3,24 +3,43 @@
   class mw_data_users extends mw_data{
 
     var $users;
-    var $_user;
-    var $user_status;
-    var $action_status;
+    var $user;
+    var $roles;
+    var $actions_roles;
 
     # ----------------------------------------------------------------------------------------
     #                                                                                    users
     #
 
-    function users($start = 0, $alpha = null, $status = null){
+    function users($start = 0, $alpha = null, $id_role = null){
       $sgbd = $this->sgbd();
       $env = $this->env();
       $users = array("list" => array(), "total" => 0);
+      if(isset($id_role)){
+        $role_users = array();
+        if($rst = $sgbd->open_data("users_roles")){
+          while($v_rst = $sgbd->fetch_data($rst)){
+            if(isset($v_rst)){
+              if(($v_rst["id_user"]) && isset($v_rst["id_role"]) && $v_rst["id_role"] == $id_role){
+                $role_users[] = $v_rst["id_user"];
+              }
+            }
+            else{
+              $role_users = false;
+              break;
+            }
+          }
+          $sgbd->close_data($rst);
+        }
+        else $role_users = false;
+        if($role_users === false) return false;
+      }
       $res = array();
       if($rst = $sgbd->open_data("users")){
         while($v_rst = $sgbd->fetch_data($rst)){
           if(isset($v_rst)){
             if(!isset($alpha) || (isset($v_rst["login"]) && strtolower(substr($v_rst["login"], 0, 1)) == strtolower($alpha))){
-              if(!isset($status) || (isset($v_rst["status"]) && $v_rst["status"] == $status)){
+              if(!isset($id_role) || in_array($id_role, $role_users)){
                 $res[$v_rst["id"]] = $v_rst;
                 $users["total"]++;
               }
@@ -43,8 +62,8 @@
             }
           }
           foreach($users["list"] as $id_user => $user){
-            if(($status = $this->list_user_status($id_user)) !== false){
-              $users["list"][$id_user]["status"] = $status;
+            if(($roles = $this->list_user_roles($id_user)) !== false){
+              $users["list"][$id_user]["roles"] = $roles;
             }
             else{
               $users = false;
       return $users;
     }
 
-    function list_user_status($id_user){
+    function list_user_roles($id_user){
       $sgbd = $this->sgbd();
-      $status = array();
+      $roles = array();
       if($rst = $sgbd->open_data("users_roles")){
         while($v_rst = $sgbd->fetch_data($rst)){
           if(isset($v_rst)){
             if(isset($v_rst["id_role"]) && isset($v_rst["id_user"]) && $v_rst["id_user"] == $id_user){
-              $status[] = $v_rst["id_role"];
+              $roles[] = $v_rst["id_role"];
             }
           }
           else{
-            $status = false;
+            $roles = false;
             break;
           }
         }
         $sgbd->close_data($rst);
       }
-      else $status = false;
-      return $status;
+      else $roles = false;
+      return $roles;
     }
 
     function user_by_id($id){
       $sgbd = $this->sgbd();
       if(($user = $sgbd->get_data("users", $id)) !== false){
         $this->users[$id] = $user;
-        if(($status = $this->list_user_status($user["id"])) !== false) $user["status"] = $status;
+        if(($roles = $this->list_user_roles($user["id"])) !== false) $user["roles"] = $roles;
         else $user = false;
       }
       return $user;
         }
         $sgbd->close_data($rst);
         if($user){
-          if(($status = $this->list_user_status($user["id"])) !== false) $user["status"] = $status;
+          if(($roles = $this->list_user_roles($user["id"])) !== false) $user["roles"] = $roles;
           else $user = false;
         }
       }
       return $EXISTS;
     }
 
-    function add_user($login, $password, $email, $status){
+    function add_user($login, $password, $email, $roles){
       $sgbd = $this->sgbd();
       if(
         (
         ) === false
       ) return false;
       $OK = true;
-      foreach($status as $id_role){
+      foreach($roles as $id_role){
         $OK = $sgbd->add_data(
           "users_roles",
           array(
       return $id_user;
     }
 
-    function set_user($id, $login, $password, $email, $status){
+    function set_user($id, $login, $password, $email, $roles){
       $sgbd = $this->sgbd();
       if(
         !$sgbd->set_data(
         if(!$OK) return false;
       }
       else return false;
-      foreach($status as $id_role){
+      foreach($roles as $id_role){
         $OK = $sgbd->add_data(
           "users_roles",
           array(
     }
 
     # ----------------------------------------------------------------------------------------
-    #                                                                                   status
+    #                                                                                    roles
     #
 
-    function init_user_status($status = array()){
+    function init_roles(){
       $sgbd = $this->sgbd();
-      $this->user_status = array();
+      $this->roles = array();
       if($rst = $sgbd->open_data("roles")){
         while($v_rst = $sgbd->fetch_data($rst)){
           if(isset($v_rst)){
-            $this->user_status[$v_rst["id"]] = $v_rst;
+            $this->roles[$v_rst["id"]] = $v_rst;
           }
           else{
-            $this->user_status = false;
+            $this->roles = false;
             break;
           }
         }
         $sgbd->close_data($rst);
       }
-      else $this->user_status = false;
-      return $this->user_status;
+      else $this->roles = false;
+      return $this->roles;
+    }
+
+    function roles(){
+      if(!isset($this->roles)) return false;
+      return $this->roles;
     }
 
     function add_role($nom, $intitule){
 
     function clear_role_actions($id_role){
       $sgbd = $this->sgbd();
-      if($rst = $sgbd->open_data("action_status")){
+      if($rst = $sgbd->open_data("actions_roles")){
         $OK = true;
         while($v_rst = $sgbd->fetch_data($rst)){
           if(isset($v_rst)){
-            if(isset($v_rst["id"]) && isset($v_rst["id_status"]) && $v_rst["id_status"] == $id_role){
-              if(!$sgbd->del_data("action_status", $v_rst["id"])){
+            if(isset($v_rst["id"]) && isset($v_rst["id_role"]) && $v_rst["id_role"] == $id_role){
+              if(!$sgbd->del_data("actions_roles", $v_rst["id"])){
                 $OK = false;
                 break;
               }
 
     function add_role_action($id_role, $action){
       $sgbd = $this->sgbd();
-      $id_action_status = $sgbd->add_data(
-        "action_status",
+      $id_action_role = $sgbd->add_data(
+        "actions_roles",
         array(
           "action" => $action,
-          "id_status" => $id_role
+          "id_role" => $id_role
         )
       );
-      if(!isset($id_action_status)) return false;
-      return $id_action_status;
+      if(!isset($id_action_role)) return false;
+      return $id_action_role;
     }
 
     function del_role($id_role){
       return $sgbd->del_data("roles", $id_role) ? true : false;
     }
 
-    function status(){
-      if(!isset($this->user_status)) return false;
-      return $this->user_status;
-    }
-
-    function get_user_status(){
-      $user_status = array();
+    function get_user_roles(){
+      $user_roles = array();
       $user = $this->get_session_user();
       if($user && isset($user["id"])){
         $sgbd = $this->sgbd();
           while($v_rst = $sgbd->fetch_data($rst)){
             if(isset($v_rst)){
               if(isset($v_rst["id_role"]) && isset($v_rst["id_user"]) && $v_rst["id_user"] == $user["id"]){
-                $user_status[] = $v_rst["id_role"];
+                $user_roles[] = $v_rst["id_role"];
               }
             }
             else{
-              $user_status = false;
+              $user_roles = false;
               break;
             }
           }
           $sgbd->close_data($rst);
         }
-        else $user_status = false;
-        if($user_status === false) return false;
+        else $user_roles = false;
+        if($user_roles === false) return false;
       }
-      else $user_status[] = 0;
-      if(!$user_status) $user_status[] = 0;
-      return $user_status;
+      else $user_roles[] = 0;
+      if(!$user_roles) $user_roles[] = 0;
+      return $user_roles;
     }
 
-    function init_action_status($status = array()){
-      if(!isset($this->user_status)) return false;
-      $this->action_status = $this->read_action_status();
-      return $this->action_status;
+    function init_actions_roles(){
+      if(!isset($this->roles)) return false;
+      $this->actions_roles = $this->read_actions_roles();
+      return $this->actions_roles;
     }
 
-    function read_action_status($params = array()){
-      if(!isset($this->user_status)) return false;
+    function read_actions_roles($params = array()){
+      if(!isset($this->roles)) return false;
       $group_by_action = isset($params["group_by_action"]) ? $params["group_by_action"] : false;
       $sgbd = $this->sgbd();
-      $action_status = array();
-      if($rst = $sgbd->open_data("action_status")){
+      $actions_roles = array();
+      if($rst = $sgbd->open_data("actions_roles")){
         while($v_rst = $sgbd->fetch_data($rst)){
           if(isset($v_rst)){
-            if(isset($v_rst["action"]) && isset($v_rst["id_status"])){
+            if(isset($v_rst["action"]) && isset($v_rst["id_role"])){
               if($group_by_action){
-                if(!isset($action_status[$v_rst["action"]])) $action_status[$v_rst["action"]] = array();
-                $action_status[$v_rst["action"]][] = $v_rst["id_status"];
+                if(!isset($actions_roles[$v_rst["action"]])) $actions_roles[$v_rst["action"]] = array();
+                $actions_roles[$v_rst["action"]][] = $v_rst["id_role"];
               }
-              else $action_status[$v_rst["id"]] = $v_rst;
+              else $actions_roles[$v_rst["id"]] = $v_rst;
             }
           }
           else{
-            $action_status = false;
+            $actions_roles = false;
             break;
           }
         }
         $sgbd->close_data($rst);
       }
-      else $action_status = false;
-      return $action_status;
+      else $actions_roles = false;
+      return $actions_roles;
     }
 
-    function get_action_status($mod, $controller = "index", $action = "index", $set_status = array()){
+    function get_action_roles($mod, $controller = "index", $action = "index"){
       $sgbd = $this->sgbd();
-      $status = array();
-      if($rst = $sgbd->open_data("action_status")){
-        while($status !==false && $v_rst = $sgbd->fetch_data($rst)){
-          if(isset($v_rst) && isset($v_rst["action"]) && isset($v_rst["id_status"])){
+      $roles = array();
+      if($rst = $sgbd->open_data("actions_roles")){
+        while($roles !==false && $v_rst = $sgbd->fetch_data($rst)){
+          if(isset($v_rst) && isset($v_rst["action"]) && isset($v_rst["id_role"])){
             if(
                  $v_rst["action"] == $mod
               || $v_rst["action"] == $mod."/".$controller
               || $v_rst["action"] == $mod."/".$controller."/".$action
             ){
-              if(!isset($status[$v_rst["action"]])) $status[$v_rst["action"]] = array();
-              $status[$v_rst["action"]][$v_rst["id_status"]] = true;
+              if(!isset($roles[$v_rst["action"]])) $roles[$v_rst["action"]] = array();
+              $roles[$v_rst["action"]][$v_rst["id_role"]] = true;
             }
           }
-          else $status = false;
+          else $roles = false;
         }
         $sgbd->close_data($rst);
       }
-      else $status = false;
-      return $status;
+      else $roles = false;
+      return $roles;
     }
 
     function get_actions($id_role = null){
       $env = $this->env();
       if($actions = $env->get_actions()){
-        if(($action_status = $this->read_action_status(array("group_by_action" => true))) !== false){
+        if(($actions_roles = $this->read_actions_roles(array("group_by_action" => true))) !== false){
           foreach($actions as $module_name => $module){
             if(isset($id_role)) $actions[$module_name]["module_allowed"] =
-                isset($action_status[$module_name])
-            &&  in_array($id_role, $action_status[$module_name]);
+                isset($actions_roles[$module_name])
+            &&  in_array($id_role, $actions_roles[$module_name]);
             $actions[$module_name]["is_public"] =
-                isset($action_status[$module_name])
-            &&  in_array(0, $action_status[$module_name]);
+                isset($actions_roles[$module_name])
+            &&  in_array(0, $actions_roles[$module_name]);
             foreach($module["controleurs"] as $controleur_name => $controleur){
               if(isset($id_role)) $actions[$module_name]["controleurs"][$controleur_name]["controleur_allowed"] =
-                  isset($action_status[$module_name."/".$controleur_name])
-              &&  in_array($id_role, $action_status[$module_name."/".$controleur_name]);
+                  isset($actions_roles[$module_name."/".$controleur_name])
+              &&  in_array($id_role, $actions_roles[$module_name."/".$controleur_name]);
               $actions[$module_name]["controleurs"][$controleur_name]["is_public"] =
-                  isset($action_status[$module_name."/".$controleur_name])
-              &&  in_array(0, $action_status[$module_name."/".$controleur_name]);
+                  isset($actions_roles[$module_name."/".$controleur_name])
+              &&  in_array(0, $actions_roles[$module_name."/".$controleur_name]);
               foreach($controleur["als"] as $index_als => $al){
                 if($al["actions"]){
                   if(isset($id_role)){
                     $HAS_ACTION_NOT_ALLOWED = false;
                     foreach($al["actions"] as $action_name){
                       if(
-                          !isset($action_status[$module_name."/".$controleur_name."/".$action_name])
-                      ||  !in_array($id_role, $action_status[$module_name."/".$controleur_name."/".$action_name])
+                          !isset($actions_roles[$module_name."/".$controleur_name."/".$action_name])
+                      ||  !in_array($id_role, $actions_roles[$module_name."/".$controleur_name."/".$action_name])
                       ){
                         $HAS_ACTION_NOT_ALLOWED = true;
                         break;
                   $HAS_ACTION_NOT_ALLOWED = false;
                   foreach($al["actions"] as $action_name){
                     if(
-                        !isset($action_status[$module_name."/".$controleur_name."/".$action_name])
-                    ||  !in_array(0, $action_status[$module_name."/".$controleur_name."/".$action_name])
+                        !isset($actions_roles[$module_name."/".$controleur_name."/".$action_name])
+                    ||  !in_array(0, $actions_roles[$module_name."/".$controleur_name."/".$action_name])
                     ){
                       $HAS_ACTION_NOT_ALLOWED = true;
                       break;
           $user = array();
         }
       }
-      $this->_user = $user;
+      $this->user = $user;
       return $user;
     }
 
     }
 
     function get_session_user(){
-      return $this->_user;
+      return $this->user;
     }
 
     # ----------------------------------------------------------------------------------------
 
     function check_user_uploads_dir($user = null){
       $env = $this->env();
-      $user_dir = $env->path("content")."uploads/".(isset($user) ? $user : $this->_user["id"]);
+      if((!isset($user) || !$user) && !isset($this->user["id"])) return false;
+      $user_dir = $env->path("content")."uploads/".(isset($user) && $user ? $user : $this->user["id"]);
       if(!file_exists($user_dir)) @mkdir($user_dir);
       return file_exists($user_dir);
     }
index bf06a97..9d91387 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
   if($data->load_session() !== false){
-    if($data->init_user_status($this->config("user_status")) !== false){
-      if($data->init_action_status($this->config("action_status")) === false){
+    if($data->init_roles() !== false){
+      if($data->init_actions_roles() === false){
         $this->erreur("Impossible de charger les statuts des actions", true);
       }
     }
index 20b34dc..7fc320a 100644 (file)
@@ -2,11 +2,6 @@
 
   class mw_admin_config extends mw_mod{
 
-    var $groupes;
-    var $albums;
-    var $status;
-    var $album_status_id;
-
     function index(&$env){
       $data = $env->data();
       if(($CONFIG = $env->get_CONFIG()) !== false){
index 95dfed0..302096b 100644 (file)
@@ -2,11 +2,11 @@
 
   class mw_admin_users extends mw_mod{
 
-    var $status;
+    var $roles;
 
     function validate(&$env){
       $data = $env->data();
-      if(($this->status = $data->status()) === false) return "impossible de lire la liste des statuts";
+      if(($this->roles = $data->roles()) === false) return "impossible de lire la liste des statuts";
       return true;
     }
 
 
     function index(&$env){
       $data = $env->data();
-      if($this->status) $env->set_out("status", $this->status);
+      if($this->roles) $env->set_out("roles", $this->roles);
       else{
-        $env->erreur("impossible de lire la liste des status");
+        $env->erreur("impossible de lire la liste des roles");
         return;
       }
       if(
         ( $users = $data->users(
             isset($_GET[$env->param("start")]) ? $_GET[$env->param("start")] : 0,
             isset($_GET[$env->param("alpha")]) ? $_GET[$env->param("alpha")] : null,
-            isset($_GET[$env->param("status")]) ? $_GET[$env->param("status")] : null
+            isset($_GET[$env->param("role")]) ? $_GET[$env->param("role")] : null
           )
         ) !== false
       ){
 
     function add(&$env){
       $data = $env->data();
-      if($this->status){
-        $env->set_out("status", $this->status);
+      if($this->roles){
+        $env->set_out("roles", $this->roles);
         $user = array(
           "login" => "",
           "email" => "",
-          "status" => array()
+          "roles" => array()
         );
         if($_POST){
           $VALID = true;
             $env->message("merci de preciser un mot de passe");
             $VALID = false;
           }
-          $user["status"] = array();
+          $user["roles"] = array();
           foreach($_POST as $key => $value){
-            if(substr($key, 0, 7) == "status_"){
-              $id_role = substr($key, 7);
+            if(substr($key, 0, 5) == "role_"){
+              $id_role = substr($key, 5);
               if(preg_match("/^[0-9]+$/", $id_role)){
-                $user["status"][] = $id_role;
+                $user["roles"][] = $id_role;
               }
             }
           }
@@ -93,7 +93,7 @@
                 $user["login"],
                 $user["password"],
                 $user["email"],
-                $user["status"]
+                $user["roles"]
               )
             ){
               $env->redirect(
         }
         $env->set_out("user", $user);
       }
-      else $env->erreur("impossible de lire la liste des status");
+      else $env->erreur("impossible de lire la liste des roles");
     }
 
     function edit(&$env){
       $data = $env->data();
-      if($this->status){
-        $env->set_out("status", $this->status);
+      if($this->roles){
+        $env->set_out("roles", $this->roles);
         if($user = $data->user($_GET[$env->param("id")])){
           if($_POST){
             $VALID = true;
               }
               if($VALID) $user["password"] = md5($_POST["password"]);
             }
-            $user["status"] = array();
+            $user["roles"] = array();
             foreach($_POST as $key => $value){
-              if(substr($key, 0, 7) == "status_"){
-                $id_role = substr($key, 7);
-                if(preg_match("/^[0-9]+$/", $id_role) && isset($this->status[$id_role])){
-                  $user["status"][] = $id_role;
+              if(substr($key, 0, 5) == "role_"){
+                $id_role = substr($key, 5);
+                if(preg_match("/^[0-9]+$/", $id_role) && isset($this->roles[$id_role])){
+                  $user["roles"][] = $id_role;
                 }
               }
             }
                   $user["login"],
                   $user["password"],
                   $user["email"],
-                  $user["status"]
+                  $user["roles"]
                 )
               )
               $env->redirect(
         }
         else $env->erreur("Impossible de lire les informations de cet utilisateur");
       }
-      else $env->erreur("impossible de lire la liste des status");
+      else $env->erreur("impossible de lire la liste des roles");
     }
 
     function del(&$env){
 
     function roles(&$env){
       $data = $env->data();
-      $roles = $data->status();
+      $roles = $data->roles();
       $id_role = isset($_GET[$env->param("id")]) && $_GET[$env->param("id")] ? $_GET[$env->param("id")] : 0;
       $env->set_out("id_role", $id_role);
       if(!isset($roles) || $roles === false){
         $env->erreur("impossible de supprimer les actions du role");
         return;
       }
-      $action_status = array();
+      $action_roles = array();
       $als = array();
       foreach($_POST as $key => $value){
-        if(substr($key, 0, 7) == "module_" && ($action = substr($key, 7))) $action_status[$action] = $role["id"];
-        elseif(substr($key, 0, 11) == "controleur_" && ($action = substr($key, 11))) $action_status[$action] = $role["id"];
+        if(substr($key, 0, 7) == "module_" && ($action = substr($key, 7))) $action_roles[$action] = $role["id"];
+        elseif(substr($key, 0, 11) == "controleur_" && ($action = substr($key, 11))) $action_roles[$action] = $role["id"];
         elseif(substr($key, 0, 3) == "al_" && ($al_index = substr($key, 3))) $als[] = $al_index;
       }
       foreach($als as $al_index){
         $al_prefix = "action_".$al_index."_";
         $al_prefix_length = strlen($al_prefix);
         foreach($_POST as $key => $value){
-          if(substr($key, 0, $al_prefix_length) == $al_prefix) $action_status[$value] = $role["id"];
+          if(substr($key, 0, $al_prefix_length) == $al_prefix) $action_roles[$value] = $role["id"];
         }
       }
-      foreach($action_status as $action => $id_role){
+      foreach($action_roles as $action => $id_role){
         if(!$data->add_role_action($id_role, $action)){
           $env->erreur("impossible d'enregistrer les actions du role");
           return;
index 20f6142..8e0e6c8 100644 (file)
@@ -2,22 +2,22 @@
 
   class mw_users_compte extends mw_mod{
 
-    var $status;
+    var $roles;
     var $user;
 
     var $validation_result;
 
     function validate(&$env){
       $this->validation_result = true;
-      $this->validate_status($env);
-      $this->validate_user($env);
+      if($this->validation_result === true) $this->validate_roles($env);
+      if($this->validation_result === true) $this->validate_user($env);
       return $this->validation_result;
     }
 
-    function validate_status(&$env){
+    function validate_roles(&$env){
       $data = $env->data();
-      if(($this->status = $data->status()) !== false) $this->validation_result = true;
-      else $this->validation_result = "impossible de lire la liste des statuts";
+      if(($this->roles = $data->roles()) !== false) $this->validation_result = true;
+      else $this->validation_result = "impossible de lire la liste des roles";
     }
 
     function validate_user(&$env){
index d3583af..ad919a5 100644 (file)
@@ -48,7 +48,7 @@
                 $user["login"],
                 $user["password"],
                 $user["email"],
-                $user["status"]
+                $user["roles"]
               )
             )
             $env->redirect(
@@ -59,7 +59,7 @@
           }
         }
         $env->set_out("user", $user);
-        $env->set_out("status", $this->users_compte_mod->status);
+        $env->set_out("roles", $this->users_compte_mod->roles);
       }
       else $env->erreur("Impossible de lire les informations de l'utilisateur");
     }
index 7e840df..f2fdce2 100644 (file)
         </div>
       </li>
       <li>
-        <label for="status">r&ocirc;le</label>
+        <label>r&ocirc;le</label>
         <div class="form_input">
           <ul>
-            <?php foreach($this->out["status"] as $id_status => $status) : ?>
+            <?php foreach($this->out["roles"] as $id_role => $role) : ?>
               <li>
-                <input type="checkbox" name="status_<?php echo $id_status; ?>"<?php
-                  echo in_array($id_status, $this->out["user"]["status"]) ? " checked" : "";
+                <input type="checkbox" name="role_<?php echo $id_role; ?>"<?php
+                  echo in_array($id_role, $this->out["user"]["roles"]) ? " checked" : "";
                 ?> />
-                <?php echo $status["intitule"]; ?>
+                <?php echo $role["intitule"]; ?>
               </li>
             <?php endforeach; ?>
           </ul>
index f00600b..abac7f2 100644 (file)
         </div>
       </li>
       <li>
-        <label for="status">r&ocirc;le</label>
+        <label>r&ocirc;le</label>
         <div class="form_input">
           <ul>
-            <?php foreach($this->out["status"] as $id_status => $status) : ?>
+            <?php foreach($this->out["roles"] as $id_role => $role) : ?>
               <li>
-                <input type="checkbox" name="status_<?php echo $id_status; ?>"<?php
-                  echo in_array($id_status, $this->out["user"]["status"]) ? " checked" : "";
+                <input type="checkbox" name="role_<?php echo $id_role; ?>"<?php
+                  echo in_array($id_role, $this->out["user"]["roles"]) ? " checked" : "";
                 ?> />
-                <?php echo $status["intitule"]; ?>
+                <?php echo $role["intitule"]; ?>
               </li>
             <?php endforeach; ?>
           </ul>
index 2640b96..884cec2 100644 (file)
@@ -7,7 +7,7 @@
 <?php
 
   $users_params = array();
-  if(isset($_GET[$this->param("status")])) $users_params["status"] = $_GET[$this->param("status")];
+  if(isset($_GET[$this->param("role")])) $users_params["role"] = $_GET[$this->param("role")];
 
 ?>
 <ul class="filters">
   </li>
   <?php
 
-    if($this->out["status"]) :
+    if($this->out["roles"]) :
       if(isset($_GET[$this->param("alpha")])) $users_params["alpha"] = $_GET[$this->param("alpha")];
       else unset($users_params["alpha"]);
-      unset($users_params["status"]);
+      unset($users_params["role"]);
 
 ?>
   <li>
     <select onchange="document.location=this.options[this.selectedIndex].value;">
-      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("status")] ? "" : " selected=\"selected\""; ?>>Tous les status</option>
-      <?php foreach($this->out["status"] as $user_status) : $users_params["status"] = $user_status["id"]; ?>
-      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("status")] == $user_status["id"] ? " selected=\"selected\"" : ""; ?>><?php echo $user_status["nom"]; ?></option>
+      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("role")] ? "" : " selected=\"selected\""; ?>>Tous les roles</option>
+      <?php foreach($this->out["roles"] as $role) : $users_params["role"] = $role["id"]; ?>
+      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("role")] == $role["id"] ? " selected=\"selected\"" : ""; ?>><?php echo $role["intitule"]; ?></option>
       <?php endforeach; ?>
     </select>
   </li>
@@ -58,7 +58,7 @@
     <?php
 
       $role = "";
-      foreach($user["status"] as $id_role) $role .= ($role ? ", " : "").$this->out["status"][$id_role]["intitule"];
+      foreach($user["roles"] as $id_role) $role .= ($role ? ", " : "").$this->out["roles"][$id_role]["intitule"];
 
     ?>
     <?php echo $role; ?>
index 12f5305..54725cf 100644 (file)
@@ -1,15 +1,15 @@
 <ul>
-<?php if($this->config("contact_form") && $this->status_ok("forms/contact")) : ?>
+<?php if($this->config("contact_form") && $this->action_allowed("forms/contact")) : ?>
   <li><a href="<?php echo $this->url("forms/contact"); ?>">contact</a></li>
 <?php endif; ?>
 <?php if(!($user = $this->user())) : ?>
   <li><a href="<?php echo $this->url("users/identification"); ?>">s'identifier</a></li>
 <?php else : ?>
   <li>Bienvenue <strong><?php echo $user["login"]; ?></strong></li>
-  <?php if($this->status_ok("users/infos")) : ?>
+  <?php if($this->action_allowed("users/infos")) : ?>
   <li><a href="<?php echo $this->url("users/infos"); ?>">compte</a></li>
   <?php endif; ?>
-<?php if($this->status_ok("admin")) : ?>
+<?php if($this->action_allowed("admin")) : ?>
   <li><a href="<?php echo $this->url("admin"); ?>">admin</a></li>
 <?php endif; ?>
   <li><a href="<?php echo $this->url("users/identification/logout"); ?>">deconnexion</a></li>
index 33be85d..dd81a74 100644 (file)
 <?php else : ?>
   Bienvenue <b><?php echo $user["login"]; ?></b>
   <ul>
+<?php if($this->action_allowed("users/compte")) : ?>
     <li><a href="<?php echo $this->url("users/compte"); ?>">compte</a></li>
+<?php endif; ?>
     <li><a href="<?php echo $this->url("users/identification/logout"); ?>">deconnexion</a></li>
-<?php if($this->status_ok("admin")) : ?>
+<?php if($this->action_allowed("admin")) : ?>
     <li><a href="<?php echo $this->url("admin"); ?>">admin</a></li>
 <?php endif; ?>
   </ul>
index 80c2717..8ae1843 100644 (file)
         </div>
       </li>
       <li>
-        <label for="status_name">r&ocirc;le</label>
+        <label>r&ocirc;le</label>
         <div class="form_input">
           <?php
             $role = "";
-            foreach($this->out["user"]["status"] as $id_role){
-              $role .= ($role ? ", " : "").$this->out["status"][$id_role]["intitule"];
+            foreach($this->out["user"]["roles"] as $id_role){
+              $role .= ($role ? ", " : "").$this->out["roles"][$id_role]["intitule"];
             }
             echo $role;
           ?>
index 31242f5..d4b63ab 100644 (file)
@@ -9,12 +9,12 @@
       return $data->get_session_user();
     }
 
-    function set_etat($etat, $valid_status = true){
+    function set_etat($etat, $valid_role = true){
       if(($this->etat = $this->valid_etat($etat)) !== false){
-        if(!$valid_status || $this->status_ok($this->etat, false)){
+        if(!$valid_role || $this->action_allowed($this->etat, false)){
           return $this->etat;
         }
-        else $this->erreur("Vous n'avez pas le statut requis pour effectuer cette action");
+        else $this->erreur("Vous n'avez pas le role requis pour effectuer cette action");
       }
       else $this->erreur("etat invalide");
       return false;
       return $this->valid_etat($this->etat);
     }
 
-    function status_ok($etat, $CHECK_FORMAT = true){
+    function action_allowed($etat, $CHECK_FORMAT = true){
       $data = $this->data();
       if($CHECK_FORMAT) $etat = $this->valid_etat($etat);
       if($etat === false){
         $this->erreur("etat invalide");
         return false;
       }
-      if(($user_status = $data->get_user_status()) === false){
+      if(($user_roles = $data->get_user_roles()) === false){
         $this->erreur("Impossible de lire les roles de l'utilisateur courant");
         return false;
       }
-      if(!$user_status){
+      if(!$user_roles){
         $this->erreur("L'utilisateur courant n'a aucun role");
         return false;
       }
       if(
         (
-          $action_status = $data->get_action_status(
+          $action_roles = $data->get_action_roles(
             $etat["mod"],
             $etat["controller"],
             $etat["action"]
           )
         ) === false
       ){
-        $this->erreur("Impossible de lire les status des actions en base");
+        $this->erreur("Impossible de lire les roles des actions en base");
         return false;
       }
-      foreach($user_status as $id_role){
+      foreach($user_roles as $id_role){
         $OK = $this->config("default_allow");
         $action = $etat["mod"];
-        if(isset($action_status[$action])){
+        if(isset($action_roles[$action])){
           $OK =
-               (isset($action_status[$action][0]) && $action_status[$action][0])
-            || (isset($action_status[$action][$id_role]) && $action_status[$action][$id_role]);
+               (isset($action_roles[$action][0]) && $action_roles[$action][0])
+            || (isset($action_roles[$action][$id_role]) && $action_roles[$action][$id_role]);
         }
         if(!$OK){
           $action = $etat["mod"]."/".$etat["controller"];
-          if(isset($action_status[$action])){
+          if(isset($action_roles[$action])){
             $OK =
-                 (isset($action_status[$action][0]) && $action_status[$action][0])
-              || (isset($action_status[$action][$id_role]) && $action_status[$action][$id_role]);
+                 (isset($action_roles[$action][0]) && $action_roles[$action][0])
+              || (isset($action_roles[$action][$id_role]) && $action_roles[$action][$id_role]);
           }
         }
         if(!$OK){
           $action = $etat["mod"]."/".$etat["controller"]."/".$etat["action"];
-          if(isset($action_status[$action])){
+          if(isset($action_roles[$action])){
             $OK =
-                 (isset($action_status[$action][0]) && $action_status[$action][0])
-              || (isset($action_status[$action][$id_role]) && $action_status[$action][$id_role]);
+                 (isset($action_roles[$action][0]) && $action_roles[$action][0])
+              || (isset($action_roles[$action][$id_role]) && $action_roles[$action][$id_role]);
           }
         }
         if($OK) break;
       return $OK;
     }
 
-    function run($etat, $valid_status = true, $params = array(), $method = "GET"){
-      if($this->set_etat($etat, $valid_status)){
+    function run($etat, $valid_role = true, $params = array(), $method = "GET"){
+      if($this->set_etat($etat, $valid_role)){
         $controller_file = "mods/".$this->etat("mod")."/".$this->etat("controller").".php";
         if($this->app_file_exists($controller_file = "mods/".$this->etat("mod")."/".$this->etat("controller").".php", "DESC")){
           if(!class_exists("mw_mod")) require $this->app_file("mods/mw_mod.php");