mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 17:15:55 +00:00
remove $link
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
class PluginHost {
|
||||
private $link;
|
||||
private $dbh;
|
||||
private $hooks = array();
|
||||
private $plugins = array();
|
||||
private $handlers = array();
|
||||
@@ -35,9 +35,8 @@ class PluginHost {
|
||||
const KIND_SYSTEM = 2;
|
||||
const KIND_USER = 3;
|
||||
|
||||
function __construct($link) {
|
||||
$this->link = $link;
|
||||
|
||||
function __construct($dbh) {
|
||||
$this->dbh = $dbh;
|
||||
$this->storage = $_SESSION["plugin_storage"];
|
||||
|
||||
if (!$this->storage) $this->storage = array();
|
||||
@@ -48,8 +47,8 @@ class PluginHost {
|
||||
$this->plugins[$name] = $plugin;
|
||||
}
|
||||
|
||||
function get_link() {
|
||||
return $this->link;
|
||||
function get_dbh() {
|
||||
return $this->dbh;
|
||||
}
|
||||
|
||||
function get_plugins() {
|
||||
@@ -223,9 +222,9 @@ class PluginHost {
|
||||
|
||||
function load_data($force = false) {
|
||||
if ($this->owner_uid && (!$_SESSION["plugin_storage"] || $force)) {
|
||||
$plugin = db_escape_string($this->link, $plugin);
|
||||
$plugin = db_escape_string( $plugin);
|
||||
|
||||
$result = db_query($this->link, "SELECT name, content FROM ttrss_plugin_storage
|
||||
$result = db_query( "SELECT name, content FROM ttrss_plugin_storage
|
||||
WHERE owner_uid = '".$this->owner_uid."'");
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
@@ -238,29 +237,29 @@ class PluginHost {
|
||||
|
||||
private function save_data($plugin) {
|
||||
if ($this->owner_uid) {
|
||||
$plugin = db_escape_string($this->link, $plugin);
|
||||
$plugin = db_escape_string( $plugin);
|
||||
|
||||
db_query($this->link, "BEGIN");
|
||||
db_query( "BEGIN");
|
||||
|
||||
$result = db_query($this->link,"SELECT id FROM ttrss_plugin_storage WHERE
|
||||
$result = db_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($this->link, serialize($this->storage[$plugin]));
|
||||
$content = db_escape_string( serialize($this->storage[$plugin]));
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
db_query($this->link, "UPDATE ttrss_plugin_storage SET content = '$content'
|
||||
db_query( "UPDATE ttrss_plugin_storage SET content = '$content'
|
||||
WHERE owner_uid= '".$this->owner_uid."' AND name = '$plugin'");
|
||||
|
||||
} else {
|
||||
db_query($this->link, "INSERT INTO ttrss_plugin_storage
|
||||
db_query( "INSERT INTO ttrss_plugin_storage
|
||||
(name,owner_uid,content) VALUES
|
||||
('$plugin','".$this->owner_uid."','$content')");
|
||||
}
|
||||
|
||||
db_query($this->link, "COMMIT");
|
||||
db_query( "COMMIT");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +298,7 @@ class PluginHost {
|
||||
|
||||
unset($this->storage[$idx]);
|
||||
|
||||
db_query($this->link, "DELETE FROM ttrss_plugin_storage WHERE name = '$idx'
|
||||
db_query( "DELETE FROM ttrss_plugin_storage WHERE name = '$idx'
|
||||
AND owner_uid = " . $this->owner_uid);
|
||||
|
||||
$_SESSION["plugin_storage"] = $this->storage;
|
||||
|
||||
Reference in New Issue
Block a user