aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-03-03 15:41:08 -0800
committerFriendika <info@friendika.com>2011-03-03 15:41:08 -0800
commitb8757fb45624d038e1f072fa40fb439608532164 (patch)
treeac25604bd4ed5c730ff9bd43d89b478de60e7406
parentbfdf4bddc984838bc1bccccfe1c2b7ddebe43e92 (diff)
downloadvolse-hubzilla-b8757fb45624d038e1f072fa40fb439608532164.tar.gz
volse-hubzilla-b8757fb45624d038e1f072fa40fb439608532164.tar.bz2
volse-hubzilla-b8757fb45624d038e1f072fa40fb439608532164.zip
make sure db queries never get called if the database isn't open
-rw-r--r--boot.php2
-rw-r--r--include/dba.php15
2 files changed, 10 insertions, 7 deletions
diff --git a/boot.php b/boot.php
index 3cf01b4a0..a97f85814 100644
--- a/boot.php
+++ b/boot.php
@@ -3,7 +3,7 @@
set_time_limit(0);
define ( 'BUILD_ID', 1039 );
-define ( 'FRIENDIKA_VERSION', '2.10.0908' );
+define ( 'FRIENDIKA_VERSION', '2.10.0909' );
define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
define ( 'EOL', "<br />\r\n" );
diff --git a/include/dba.php b/include/dba.php
index b05a1cabf..b89648bca 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -20,12 +20,14 @@ class dba {
function __construct($server,$user,$pass,$db,$install = false) {
$this->db = @new mysqli($server,$user,$pass,$db);
- if((mysqli_connect_errno()) && (! $install)) {
+ if(! mysql_connect_errno()) {
+ $this->connected = true;
+ }
+ else {
$this->db = null;
- system_unavailable();
+ if(! $install)
+ system_unavailable();
}
- else
- $this->connected = true;
}
public function getdb() {
@@ -34,7 +36,7 @@ class dba {
public function q($sql) {
- if(! $this->db )
+ if((! $this->db) || (! $this->connected))
return false;
$result = @$this->db->query($sql);
@@ -92,7 +94,8 @@ class dba {
}
public function escape($str) {
- return @$this->db->real_escape_string($str);
+ if($this->db && $this->connected)
+ return @$this->db->real_escape_string($str);
}
function __destruct() {