From 7ce7ec4c942e0a3567858ad0ec8e654000b49a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 6 Aug 2013 14:18:03 +0200 Subject: prepare to multi users --- inc/poche/User.class.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 inc/poche/User.class.php (limited to 'inc/poche/User.class.php') diff --git a/inc/poche/User.class.php b/inc/poche/User.class.php new file mode 100644 index 00000000..ef47730f --- /dev/null +++ b/inc/poche/User.class.php @@ -0,0 +1,33 @@ + + * @copyright 2013 + * @license http://www.wtfpl.net/ see COPYING file + */ + +class User +{ + public $id; + public $username; + public $name; + public $password; + public $email; + public $config; + + function __construct($user) + { + $this->id = $user['id']; + $this->username = $user['username']; + $this->name = $user['name']; + $this->password = $user['password']; + $this->email = $user['email']; + $this->config = $user['config']; + } + + function getConfigValue($name) { + return (isset($this->config[$name])) ? $this->config[$name] : FALSE; + } +} \ No newline at end of file -- cgit v1.2.3 From 8d3275bee488d058c6ff0efe6e81d20a584d3709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 6 Aug 2013 15:51:48 +0200 Subject: multi user --- inc/poche/User.class.php | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'inc/poche/User.class.php') diff --git a/inc/poche/User.class.php b/inc/poche/User.class.php index ef47730f..6dac7839 100644 --- a/inc/poche/User.class.php +++ b/inc/poche/User.class.php @@ -17,17 +17,34 @@ class User public $email; public $config; - function __construct($user) + function __construct($user = array()) { - $this->id = $user['id']; - $this->username = $user['username']; - $this->name = $user['name']; - $this->password = $user['password']; - $this->email = $user['email']; - $this->config = $user['config']; + if ($user != array()) { + $this->id = $user['id']; + $this->username = $user['username']; + $this->name = $user['name']; + $this->password = $user['password']; + $this->email = $user['email']; + $this->config = $user['config']; + } } - function getConfigValue($name) { + public function getId() + { + return $this->id; + } + + public function getUsername() + { + return $this->username; + } + + public function setConfig($config) + { + $this->config = $config; + } + + public function getConfigValue($name) { return (isset($this->config[$name])) ? $this->config[$name] : FALSE; } } \ No newline at end of file -- cgit v1.2.3