X-Git-Url: http://git.dj3c1t.com/index.cgi?a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fmodels%2Fusers.php;h=62b4239f734a32c95e264a0edd24cd297c1104cd;hb=5abc9d5fca28ef86dee6148bb96780d1a7b670f3;hp=e9eb8ad2be35e22bc55b4ae483f9f086a60540ab;hpb=ed558d720ebf6985290c99297f5b1d2c86d1f60a;p=mtweb diff --git a/mw/app/data/models/users.php b/mw/app/data/models/users.php index e9eb8ad..62b4239 100644 --- a/mw/app/data/models/users.php +++ b/mw/app/data/models/users.php @@ -2,24 +2,24 @@ class mw_model_users extends mw_model{ - var $roles; + public $roles; // ---------------------------------------------------------------------------- // accesseurs - function set_roles($roles){ + public function set_roles($roles){ $this->roles = $roles; } - function get_roles(){ + public function get_roles(){ return $this->roles; } - function clear_roles(){ + public function clear_roles(){ $this->roles = null; } - function get_values(){ + public function get_values(){ $values = array(); if(isset($this->roles)) $values["roles"] = $this->roles; foreach($this->attributs as $attribut_name => $attribut){ @@ -28,18 +28,18 @@ return $values; } - function set_password($password){ + public function set_password($password){ $this->attributs["password"]["value"] = $this->encode_password($password); } - function encode_password($password){ + public function encode_password($password){ return md5($password); } // ---------------------------------------------------------------------------- // validation - function valid_email($email){ + public function valid_email($email){ if(!isset($email) || !$email){ return "merci de préciser un email"; } @@ -49,14 +49,14 @@ return true; } - function valid_login($login){ + public function valid_login($login){ if(!isset($login) || !$login){ return "merci de préciser un login"; } return true; } - function valid_password($password){ + public function valid_password($password){ if(!isset($password) || ($password == $this->encode_password(""))){ return "merci de préciser un mot de passe"; } @@ -66,7 +66,7 @@ // ---------------------------------------------------------------------------- // CRUD - function insert(){ + public function insert(){ $data = $this->env->data(); $roles = $this->get_roles(); $this->clear_roles(); @@ -82,7 +82,7 @@ return $id_user; } - function load($index_name, $index_value){ + public function load($index_name, $index_value){ $data = $this->env->data(); if(parent::load($index_name, $index_value) === false) return false; if($this->get_id()){ @@ -93,7 +93,7 @@ return true; } - function update($index_name, $index_value = null){ + public function update($index_name, $index_value = null){ $data = $this->env->data(); $roles = $this->get_roles(); $this->clear_roles(); @@ -106,12 +106,10 @@ return $res; } - function delete($index_name, $index_value = null){ + public function delete($index_name, $index_value = null){ $data = $this->env->data(); if(!$data->clear_user_roles($this->get_id())) return false; return parent::delete($index_name, $index_value); } } - -?> \ No newline at end of file