diff options
author | Tobias Hößl <tobias@hoessl.eu> | 2012-02-28 21:19:02 +0000 |
---|---|---|
committer | Tobias Hößl <tobias@hoessl.eu> | 2012-02-28 21:19:02 +0000 |
commit | 3d249f0eddb058f74b33d8205202b17ab7555aa6 (patch) | |
tree | 112e38aa464e5830832ff92a93e10f2566cbe27e /library | |
parent | 36a1a43f06dc2a0d55463c83154cce55fa3948ad (diff) | |
parent | 733f830be4b554c83361e877a5f1108767a815fc (diff) | |
download | volse-hubzilla-3d249f0eddb058f74b33d8205202b17ab7555aa6.tar.gz volse-hubzilla-3d249f0eddb058f74b33d8205202b17ab7555aa6.tar.bz2 volse-hubzilla-3d249f0eddb058f74b33d8205202b17ab7555aa6.zip |
Merge remote branch 'upstream/master'
Diffstat (limited to 'library')
-rw-r--r-- | library/spam/b8/storage/storage_frndc.php | 60 |
1 files changed, 5 insertions, 55 deletions
diff --git a/library/spam/b8/storage/storage_frndc.php b/library/spam/b8/storage/storage_frndc.php index 2b9374f67..7702c108b 100644 --- a/library/spam/b8/storage/storage_frndc.php +++ b/library/spam/b8/storage/storage_frndc.php @@ -147,58 +147,8 @@ class b8_storage_frndc extends b8_storage_base public function connect() { - return TRUE; - - # Are we already connected? - if($this->connected === TRUE) - return TRUE; - - # Are we using an existing passed resource? - if($this->config['connection'] === FALSE) { - # ... yes we are, but the connection is not a resource, so return an error - $this->connected = FALSE; - return self::DATABASE_CONNECTION_BAD_RESOURCE; - } - - elseif($this->config['connection'] === NULL) { - - # ... no we aren't so we have to connect. - - if($this->_connection = mysql_connect($this->config['host'], $this->config['user'], $this->config['pass'])) { - if(mysql_select_db($this->config['database'], $this->_connection) === FALSE) { - $this->connected = FALSE; - return self::DATABASE_SELECT_ERROR . ": " . mysql_error(); - } - } - else { - $this->connected = FALSE; - return self::DATABASE_CONNECTION_ERROR; - } - - } - - else { - # ... yes we are - $this->_connection = $this->config['connection']; - } - - # Just in case ... - if($this->_connection === NULL) { - $this->connected = FALSE; - return self::DATABASE_CONNECTION_FAIL; - } - - # Check to see if the wordlist table exists - if(mysql_query('DESCRIBE ' . $this->config['table_name'], $this->_connection) === FALSE) { - $this->connected = FALSE; - return self::DATABASE_TABLE_ACCESS_FAIL . ": " . mysql_error(); - } - - # Everything is okay and connected $this->connected = TRUE; - - # Let's see if this is a b8 database and the version is okay - return $this->check_database(); + return TRUE; } @@ -235,7 +185,7 @@ class b8_storage_frndc extends b8_storage_base # ... and fetch the data $result = q(' - SELECT token, count + SELECT * FROM ' . $this->config['table_name'] . ' WHERE ' . $where . ' AND uid = ' . $uid ); @@ -256,7 +206,7 @@ class b8_storage_frndc extends b8_storage_base $token = dbesc($token); $count = dbesc($count); $uid = dbesc($uid); - array_push($this->_puts, '("' . $token . '", "' . $count . '", '"' . $uid .'")'); + array_push($this->_puts, '("' . $token . '", "' . $count . '", "' . $uid .'")'); } /** @@ -273,7 +223,7 @@ class b8_storage_frndc extends b8_storage_base $token = dbesc($token); $count = dbesc($count); $uid = dbesc($uid); - array_push($this->_puts, '("' . $token . '", "' . $count . '", '"' . $uid .'")'); + array_push($this->_puts, '("' . $token . '", "' . $count . '", "' . $uid .'")'); } /** @@ -325,7 +275,7 @@ class b8_storage_frndc extends b8_storage_base if(count($this->_updates) > 0) { // this still needs work - $result = q("select * from " . $this->config['table_name'] . ' where token = '; + $result = q("select * from " . $this->config['table_name'] . ' where token = '); $result = q(' |