diff options
author | Andrew Dolgov <[email protected]> | 2013-04-17 20:12:14 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-04-17 20:12:14 +0400 |
commit | d9c85e0f112034ca3e3f4d34213f6dcccf9d54e1 (patch) | |
tree | 27a3613e3c79d4e1fe7d1174e04c1288db4836f1 /classes/pluginhost.php | |
parent | b4b45b4534e87026f7f07167cb78e44456144179 (diff) |
classes: use OO DB interface
Diffstat (limited to 'classes/pluginhost.php')
-rw-r--r-- | classes/pluginhost.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 0fbf0422e..c10f789b5 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -222,12 +222,12 @@ class PluginHost { function load_data($force = false) { if ($this->owner_uid && (!$_SESSION["plugin_storage"] || $force)) { - $plugin = db_escape_string($plugin); + $plugin = $this->dbh->escape_string($plugin); - $result = db_query("SELECT name, content FROM ttrss_plugin_storage + $result = $this->dbh->query("SELECT name, content FROM ttrss_plugin_storage WHERE owner_uid = '".$this->owner_uid."'"); - while ($line = db_fetch_assoc($result)) { + while ($line = $this->dbh->fetch_assoc($result)) { $this->storage[$line["name"]] = unserialize($line["content"]); } @@ -237,29 +237,29 @@ class PluginHost { private function save_data($plugin) { if ($this->owner_uid) { - $plugin = db_escape_string($plugin); + $plugin = $this->dbh->escape_string($plugin); - db_query("BEGIN"); + $this->dbh->query("BEGIN"); - $result = db_query("SELECT id FROM ttrss_plugin_storage WHERE + $result = $this->dbh->query("SELECT id FROM ttrss_plugin_storage WHERE owner_uid= '".$this->owner_uid."' AND name = '$plugin'"); if (!isset($this->storage[$plugin])) $this->storage[$plugin] = array(); - $content = db_escape_string(serialize($this->storage[$plugin])); + $content = $this->dbh->escape_string(serialize($this->storage[$plugin])); - if (db_num_rows($result) != 0) { - db_query("UPDATE ttrss_plugin_storage SET content = '$content' + if ($this->dbh->num_rows($result) != 0) { + $this->dbh->query("UPDATE ttrss_plugin_storage SET content = '$content' WHERE owner_uid= '".$this->owner_uid."' AND name = '$plugin'"); } else { - db_query("INSERT INTO ttrss_plugin_storage + $this->dbh->query("INSERT INTO ttrss_plugin_storage (name,owner_uid,content) VALUES ('$plugin','".$this->owner_uid."','$content')"); } - db_query("COMMIT"); + $this->dbh->query("COMMIT"); } } @@ -298,7 +298,7 @@ class PluginHost { unset($this->storage[$idx]); - db_query("DELETE FROM ttrss_plugin_storage WHERE name = '$idx' + $this->dbh->query("DELETE FROM ttrss_plugin_storage WHERE name = '$idx' AND owner_uid = " . $this->owner_uid); $_SESSION["plugin_storage"] = $this->storage; |