X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fmodules%2Fsql%2Fmw_data_sql_users.php;h=309e4e52606571a558f258d1f3dddbcf56ae3bc9;hb=HEAD;hp=3611968842468d9ca774b822f67747610ec10383;hpb=0df77b6e0e0eee4060e73ca0d6955bf232aa23cc;p=mtweb diff --git a/mw/app/data/modules/sql/mw_data_sql_users.php b/mw/app/data/modules/sql/mw_data_sql_users.php index 3611968..309e4e5 100644 --- a/mw/app/data/modules/sql/mw_data_sql_users.php +++ b/mw/app/data/modules/sql/mw_data_sql_users.php @@ -2,16 +2,16 @@ class mw_data_sql_users extends mw_data{ - var $users; - var $user; - var $roles; - var $actions_roles; + public $users; + public $user; + public $roles; + public $actions_roles; # ---------------------------------------------------------------------------------------- # users # - function users($start = 0, $alpha = null, $id_role = null){ + public function users($start = 0, $alpha = null, $id_role = null){ $sgbd = $this->sgbd(); $env = $this->env(); $users = array("list" => array(), "total" => 0); @@ -54,7 +54,7 @@ return $users; } - function list_user_roles($id_user){ + public function list_user_roles($id_user){ $sgbd = $this->sgbd(); $roles = array(); try{ @@ -66,21 +66,21 @@ return $roles; } - function user_by_id($id){ + public function user_by_id($id){ $env = $this->env(); $user = $env->get_model("users"); if($user->load("id", $id) === false) return false; return $user->get_values(); } - function user($login){ + public function user($login){ $env = $this->env(); $user = $env->get_model("users"); if($user->load("login", $login) === false) return false; return $user->get_values(); } - function user_exists($login){ + public function user_exists($login){ $sgbd = $this->sgbd(); $EXISTS = 0; try{ @@ -93,7 +93,7 @@ return $EXISTS; } - function add_user($login, $password, $email, $roles){ + public function add_user($login, $password, $email, $roles){ $sgbd = $this->sgbd(); $user_id = false; try{ @@ -118,7 +118,7 @@ return $user_id; } - function set_user($id, $login, $password, $email, $roles){ + public function set_user($id, $login, $password, $email, $roles){ $sgbd = $this->sgbd(); try{ $sql = @@ -137,7 +137,7 @@ return true; } - function clear_user_roles($id_user){ + public function clear_user_roles($id_user){ $sgbd = $this->sgbd(); try{ $sql = "DELETE FROM #--users_roles WHERE id_user=".$this->eq($id_user); @@ -147,7 +147,7 @@ return true; } - function add_user_role($id_user, $id_role){ + public function add_user_role($id_user, $id_role){ $sgbd = $this->sgbd(); try{ $sql = @@ -161,7 +161,7 @@ return true; } - function del_user($login){ + public function del_user($login){ if(($user = $this->user($login)) !== false){ $sgbd = $this->sgbd(); try{ @@ -180,7 +180,7 @@ # roles # - function init_roles(){ + public function init_roles(){ $sgbd = $this->sgbd(); $this->roles = array(); try{ @@ -193,12 +193,12 @@ return $this->roles; } - function roles(){ + public function roles(){ if(!isset($this->roles)) return false; return $this->roles; } - function add_role($nom, $intitule){ + public function add_role($nom, $intitule){ $sgbd = $this->sgbd(); try{ $sql = @@ -213,7 +213,7 @@ return $id_role; } - function get_role($id){ + public function get_role($id){ if($id === "0") return array( "id" => 0, "nom" => "", @@ -231,7 +231,7 @@ return $role; } - function set_role($id, $nom, $intitule){ + public function set_role($id, $nom, $intitule){ $sgbd = $this->sgbd(); try{ $sql = @@ -245,7 +245,7 @@ return true; } - function clear_role_actions($id_role){ + public function clear_role_actions($id_role){ $sgbd = $this->sgbd(); try{ $sql = "DELETE FROM #--actions_roles WHERE id_role=".$this->eq($id_role); @@ -255,7 +255,7 @@ return true; } - function clear_role_users($id_role){ + public function clear_role_users($id_role){ $sgbd = $this->sgbd(); try{ $sql = "DELETE FROM #--users_roles WHERE id_role=".$this->eq($id_role); @@ -265,7 +265,7 @@ return true; } - function add_role_action($id_role, $action){ + public function add_role_action($id_role, $action){ $sgbd = $this->sgbd(); try{ $sql = "INSERT INTO #--actions_roles(action, id_role) VALUES(".$this->eq($action).", ".$this->eq($id_role).")"; @@ -276,7 +276,7 @@ return $id_action_role; } - function del_role($id_role){ + public function del_role($id_role){ $sgbd = $this->sgbd(); try{ $sql = "DELETE FROM #--roles WHERE id=".$this->eq($id_role); @@ -286,7 +286,7 @@ return true; } - function get_user_roles(){ + public function get_user_roles(){ $user_roles = array(); $user = $this->get_session_user(); if($user && isset($user["id"])){ @@ -304,13 +304,13 @@ return $user_roles; } - function init_actions_roles(){ + public function init_actions_roles(){ if(!isset($this->roles)) return false; $this->actions_roles = $this->read_actions_roles(); return $this->actions_roles; } - function read_actions_roles($params = array()){ + public function read_actions_roles($params = array()){ $group_by_action = isset($params["group_by_action"]) ? $params["group_by_action"] : false; $sgbd = $this->sgbd(); $actions_roles = array(); @@ -330,7 +330,7 @@ return $actions_roles; } - function get_action_roles($mod, $controller = "index", $action = "index"){ + public function get_action_roles($mod, $controller = "index", $action = "index"){ $sgbd = $this->sgbd(); $roles = array(); try{ @@ -351,7 +351,7 @@ return $roles; } - function get_actions($id_role = null){ + public function get_actions($id_role = null){ $env = $this->env(); if($actions = $env->get_actions()){ if(($actions_roles = $this->read_actions_roles(array("group_by_action" => true))) !== false){ @@ -410,5 +410,3 @@ } } - -?> \ No newline at end of file