diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-10-03 10:14:54 -0700 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-10-03 10:14:54 -0700 |
commit | 01e671f4d1fc66696c3ab14c837be0dde8fd02ea (patch) | |
tree | 21c041fef6e17a41e0d3f9e965124e550f272b95 /inc/poche/Database.class.php | |
parent | 79026b73a804d1fe3715c3edf5bc2cfb1e56732c (diff) | |
parent | d47d2533accb30a69fbbb964f63793b821300974 (diff) | |
download | wallabag-01e671f4d1fc66696c3ab14c837be0dde8fd02ea.tar.gz wallabag-01e671f4d1fc66696c3ab14c837be0dde8fd02ea.tar.zst wallabag-01e671f4d1fc66696c3ab14c837be0dde8fd02ea.zip |
Merge pull request #256 from inthepoche/dev
merge 1.0.0
Diffstat (limited to 'inc/poche/Database.class.php')
-rw-r--r-- | inc/poche/Database.class.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 4d664992..0662581b 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -113,9 +113,17 @@ class Database { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | public function updateUserConfig($userId, $key, $value) { | 115 | public function updateUserConfig($userId, $key, $value) { |
116 | $sql_update = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?"; | 116 | $config = $this->getConfigUser($userId); |
117 | $params_update = array($value, $userId, $key); | 117 | |
118 | $query = $this->executeQuery($sql_update, $params_update); | 118 | if (!isset ($user_config[$key])) { |
119 | $sql = "INSERT INTO users_config (`value`, `user_id`, `name`) VALUES (?, ?, ?)"; | ||
120 | } | ||
121 | else { | ||
122 | $sql = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?"; | ||
123 | } | ||
124 | |||
125 | $params = array($value, $userId, $key); | ||
126 | $query = $this->executeQuery($sql, $params); | ||
119 | } | 127 | } |
120 | 128 | ||
121 | private function executeQuery($sql, $params) { | 129 | private function executeQuery($sql, $params) { |