From 2ff0191d4033a2e45ca57e478ff81132c132ed1f Mon Sep 17 00:00:00 2001 From: dj3c1t Date: Sun, 17 Feb 2013 19:26:50 +0100 Subject: [PATCH] renommage de "status" en "role" (bdd et code) --- content/data/mysql/mtweb.sql | 30 ++-- .../xml/mw/{action_status => actions_roles}/.index | 0 .../mw/{action_status => actions_roles}/182.xml | 2 +- .../mw/{action_status => actions_roles}/187.xml | 2 +- .../mw/{action_status => actions_roles}/188.xml | 2 +- content/data/xml/mw/users_roles/.index | 2 +- content/data/xml/mw/users_roles/{25.xml => 31.xml} | 0 content/data/xml/mw/users_roles/{26.xml => 32.xml} | 0 mw/app/config.xml | 2 +- mw/app/data/modules/sql/mw_data_users.php | 161 ++++++++--------- mw/app/data/modules/xml/mw_data_users.php | 198 ++++++++++++--------- mw/app/init/0500_users.php | 4 +- mw/app/mods/admin/config.php | 5 - mw/app/mods/admin/users.php | 58 +++--- mw/app/mods/users/compte.php | 12 +- mw/app/mods/users/infos.php | 4 +- mw/app/out/default/views/admin/users/add.php | 10 +- mw/app/out/default/views/admin/users/edit.php | 10 +- mw/app/out/default/views/admin/users/list.php | 14 +- mw/app/out/default/views/footer.php | 6 +- mw/app/out/default/views/users/identification.php | 4 +- mw/app/out/default/views/users/infos/edit.php | 6 +- mw/env/modules/mw_env_run.php | 40 ++--- 23 files changed, 295 insertions(+), 277 deletions(-) rename content/data/xml/mw/{action_status => actions_roles}/.index (100%) rename content/data/xml/mw/{action_status => actions_roles}/182.xml (63%) rename content/data/xml/mw/{action_status => actions_roles}/187.xml (58%) rename content/data/xml/mw/{action_status => actions_roles}/188.xml (58%) rename content/data/xml/mw/users_roles/{25.xml => 31.xml} (100%) rename content/data/xml/mw/users_roles/{26.xml => 32.xml} (100%) diff --git a/content/data/mysql/mtweb.sql b/content/data/mysql/mtweb.sql index dfc9068..368c36c 100644 --- a/content/data/mysql/mtweb.sql +++ b/content/data/mysql/mtweb.sql @@ -19,21 +19,21 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- Structure de la table `mw_action_status` -- -CREATE TABLE IF NOT EXISTS `mw_action_status` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `action` varchar(255) NOT NULL, - `id_status` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=116 ; - --- --- Contenu de la table `mw_action_status` --- - -INSERT INTO `mw_action_status` (`id`, `action`, `id_status`) VALUES -(115, 'users/identification', 0), -(111, 'users', 2), -(113, 'admin', 1); +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); -- -------------------------------------------------------- diff --git a/content/data/xml/mw/action_status/.index b/content/data/xml/mw/actions_roles/.index similarity index 100% rename from content/data/xml/mw/action_status/.index rename to content/data/xml/mw/actions_roles/.index diff --git a/content/data/xml/mw/action_status/182.xml b/content/data/xml/mw/actions_roles/182.xml 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 --- a/content/data/xml/mw/action_status/182.xml +++ b/content/data/xml/mw/actions_roles/182.xml @@ -1,4 +1,4 @@ - + diff --git a/content/data/xml/mw/action_status/187.xml b/content/data/xml/mw/actions_roles/187.xml 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 --- a/content/data/xml/mw/action_status/187.xml +++ b/content/data/xml/mw/actions_roles/187.xml @@ -1,4 +1,4 @@ - + diff --git a/content/data/xml/mw/action_status/188.xml b/content/data/xml/mw/actions_roles/188.xml 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 --- a/content/data/xml/mw/action_status/188.xml +++ b/content/data/xml/mw/actions_roles/188.xml @@ -1,4 +1,4 @@ - + diff --git a/content/data/xml/mw/users_roles/.index b/content/data/xml/mw/users_roles/.index index 978b4e8..1758ddd 100644 --- a/content/data/xml/mw/users_roles/.index +++ b/content/data/xml/mw/users_roles/.index @@ -1 +1 @@ -26 \ No newline at end of file +32 \ No newline at end of file diff --git a/content/data/xml/mw/users_roles/25.xml b/content/data/xml/mw/users_roles/31.xml similarity index 100% rename from content/data/xml/mw/users_roles/25.xml rename to content/data/xml/mw/users_roles/31.xml diff --git a/content/data/xml/mw/users_roles/26.xml b/content/data/xml/mw/users_roles/32.xml similarity index 100% rename from content/data/xml/mw/users_roles/26.xml rename to content/data/xml/mw/users_roles/32.xml diff --git a/mw/app/config.xml b/mw/app/config.xml index e73c769..7d3d91c 100644 --- a/mw/app/config.xml +++ b/mw/app/config.xml @@ -14,7 +14,7 @@ e id user - status + role from start alpha diff --git a/mw/app/data/modules/sql/mw_data_users.php b/mw/app/data/modules/sql/mw_data_users.php index 0a1cf54..a1d76bd 100644 --- a/mw/app/data/modules/sql/mw_data_users.php +++ b/mw/app/data/modules/sql/mw_data_users.php @@ -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); @@ -20,12 +20,12 @@ $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; @@ -54,16 +54,16 @@ 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; } } @@ -111,7 +111,7 @@ return $EXISTS; } - function add_user($login, $password, $email, $status){ + function add_user($login, $password, $email, $roles){ $sgbd = $this->sgbd(); $user_id = false; try{ @@ -123,7 +123,7 @@ .")"; $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 @@ -136,7 +136,7 @@ return $user_id; } - function set_user($id, $login, $password, $email, $status){ + function set_user($id, $login, $password, $email, $roles){ $sgbd = $this->sgbd(); try{ $sql = @@ -148,7 +148,7 @@ $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) @@ -165,10 +165,10 @@ 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; } } @@ -177,20 +177,25 @@ } # ---------------------------------------------------------------------------------------- - # 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){ @@ -243,7 +248,7 @@ 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; } @@ -263,12 +268,12 @@ 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){ @@ -281,102 +286,97 @@ 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; @@ -389,8 +389,8 @@ $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; @@ -463,7 +463,7 @@ $user = array(); } } - $this->_user = $user; + $this->user = $user; return $user; } @@ -484,7 +484,7 @@ } function get_session_user(){ - return $this->_user; + return $this->user; } # ---------------------------------------------------------------------------------------- @@ -493,7 +493,8 @@ 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); } diff --git a/mw/app/data/modules/xml/mw_data_users.php b/mw/app/data/modules/xml/mw_data_users.php index 2f70095..a5e5e9c 100644 --- a/mw/app/data/modules/xml/mw_data_users.php +++ b/mw/app/data/modules/xml/mw_data_users.php @@ -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; @@ -58,25 +77,25 @@ 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){ @@ -85,7 +104,7 @@ $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; @@ -106,7 +125,7 @@ } $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; } } @@ -139,7 +158,7 @@ return $EXISTS; } - function add_user($login, $password, $email, $status){ + function add_user($login, $password, $email, $roles){ $sgbd = $this->sgbd(); if( ( @@ -154,7 +173,7 @@ ) === false ) return false; $OK = true; - foreach($status as $id_role){ + foreach($roles as $id_role){ $OK = $sgbd->add_data( "users_roles", array( @@ -168,7 +187,7 @@ 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( @@ -198,7 +217,7 @@ if(!$OK) return false; } else return false; - foreach($status as $id_role){ + foreach($roles as $id_role){ $OK = $sgbd->add_data( "users_roles", array( @@ -237,26 +256,31 @@ } # ---------------------------------------------------------------------------------------- - # 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){ @@ -301,12 +325,12 @@ 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; } @@ -343,15 +367,15 @@ 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){ @@ -359,13 +383,8 @@ 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(); @@ -373,106 +392,106 @@ 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; @@ -485,8 +504,8 @@ $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; @@ -559,7 +578,7 @@ $user = array(); } } - $this->_user = $user; + $this->user = $user; return $user; } @@ -580,7 +599,7 @@ } function get_session_user(){ - return $this->_user; + return $this->user; } # ---------------------------------------------------------------------------------------- @@ -589,7 +608,8 @@ 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); } diff --git a/mw/app/init/0500_users.php b/mw/app/init/0500_users.php index bf06a97..9d91387 100644 --- a/mw/app/init/0500_users.php +++ b/mw/app/init/0500_users.php @@ -1,8 +1,8 @@ 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); } } diff --git a/mw/app/mods/admin/config.php b/mw/app/mods/admin/config.php index 20b34dc..7fc320a 100644 --- a/mw/app/mods/admin/config.php +++ b/mw/app/mods/admin/config.php @@ -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){ diff --git a/mw/app/mods/admin/users.php b/mw/app/mods/admin/users.php index 95dfed0..302096b 100644 --- a/mw/app/mods/admin/users.php +++ b/mw/app/mods/admin/users.php @@ -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; } @@ -16,16 +16,16 @@ 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 ){ @@ -36,12 +36,12 @@ 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; @@ -78,12 +78,12 @@ $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( @@ -106,13 +106,13 @@ } $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; @@ -132,12 +132,12 @@ } 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; } } } @@ -148,7 +148,7 @@ $user["login"], $user["password"], $user["email"], - $user["status"] + $user["roles"] ) ) $env->redirect( @@ -162,7 +162,7 @@ } 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){ @@ -201,7 +201,7 @@ 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){ @@ -271,21 +271,21 @@ $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; diff --git a/mw/app/mods/users/compte.php b/mw/app/mods/users/compte.php index 20f6142..8e0e6c8 100644 --- a/mw/app/mods/users/compte.php +++ b/mw/app/mods/users/compte.php @@ -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){ diff --git a/mw/app/mods/users/infos.php b/mw/app/mods/users/infos.php index d3583af..ad919a5 100644 --- a/mw/app/mods/users/infos.php +++ b/mw/app/mods/users/infos.php @@ -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"); } diff --git a/mw/app/out/default/views/admin/users/add.php b/mw/app/out/default/views/admin/users/add.php index 7e840df..f2fdce2 100644 --- a/mw/app/out/default/views/admin/users/add.php +++ b/mw/app/out/default/views/admin/users/add.php @@ -14,15 +14,15 @@
  • - +
      - out["status"] as $id_status => $status) : ?> + out["roles"] as $id_role => $role) : ?>
    • - out["user"]["status"]) ? " checked" : ""; + out["user"]["roles"]) ? " checked" : ""; ?> /> - +
    diff --git a/mw/app/out/default/views/admin/users/edit.php b/mw/app/out/default/views/admin/users/edit.php index f00600b..abac7f2 100644 --- a/mw/app/out/default/views/admin/users/edit.php +++ b/mw/app/out/default/views/admin/users/edit.php @@ -18,15 +18,15 @@
  • - +
      - out["status"] as $id_status => $status) : ?> + out["roles"] as $id_role => $role) : ?>
    • - out["user"]["status"]) ? " checked" : ""; + out["user"]["roles"]) ? " checked" : ""; ?> /> - +
    diff --git a/mw/app/out/default/views/admin/users/list.php b/mw/app/out/default/views/admin/users/list.php index 2640b96..884cec2 100644 --- a/mw/app/out/default/views/admin/users/list.php +++ b/mw/app/out/default/views/admin/users/list.php @@ -7,7 +7,7 @@ param("status")])) $users_params["status"] = $_GET[$this->param("status")]; + if(isset($_GET[$this->param("role")])) $users_params["role"] = $_GET[$this->param("role")]; ?>
      @@ -22,17 +22,17 @@ 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"]); ?>
    • @@ -58,7 +58,7 @@ out["status"][$id_role]["intitule"]; + foreach($user["roles"] as $id_role) $role .= ($role ? ", " : "").$this->out["roles"][$id_role]["intitule"]; ?> diff --git a/mw/app/out/default/views/footer.php b/mw/app/out/default/views/footer.php index 12f5305..54725cf 100644 --- a/mw/app/out/default/views/footer.php +++ b/mw/app/out/default/views/footer.php @@ -1,15 +1,15 @@
        -config("contact_form") && $this->status_ok("forms/contact")) : ?> +config("contact_form") && $this->action_allowed("forms/contact")) : ?>
      • ">contact
      • user())) : ?>
      • ">s'identifier
      • Bienvenue
      • - status_ok("users/infos")) : ?> + action_allowed("users/infos")) : ?>
      • ">compte
      • -status_ok("admin")) : ?> +action_allowed("admin")) : ?>
      • ">admin
      • ">deconnexion
      • diff --git a/mw/app/out/default/views/users/identification.php b/mw/app/out/default/views/users/identification.php index 33be85d..dd81a74 100644 --- a/mw/app/out/default/views/users/identification.php +++ b/mw/app/out/default/views/users/identification.php @@ -30,9 +30,11 @@ Bienvenue diff --git a/mw/app/out/default/views/users/infos/edit.php b/mw/app/out/default/views/users/infos/edit.php index 80c2717..8ae1843 100644 --- a/mw/app/out/default/views/users/infos/edit.php +++ b/mw/app/out/default/views/users/infos/edit.php @@ -10,12 +10,12 @@
  • - +
    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; ?> diff --git a/mw/env/modules/mw_env_run.php b/mw/env/modules/mw_env_run.php index 31242f5..d4b63ab 100644 --- a/mw/env/modules/mw_env_run.php +++ b/mw/env/modules/mw_env_run.php @@ -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; @@ -75,55 +75,55 @@ 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; @@ -131,8 +131,8 @@ 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"); -- 2.1.4