diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2015-03-13 00:16:19 +0100 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2015-03-13 00:36:32 +0100 |
commit | 124b17dcf44d6a9aac34b28ee455bd46738cb4ee (patch) | |
tree | 75decd2a417f2bc88abe9ef1a75f40cb2ab5ecb9 /include/dba/dba_driver.php | |
parent | c6162c4c88da2a903f07dd114d23d75cc94e9478 (diff) | |
download | volse-hubzilla-124b17dcf44d6a9aac34b28ee455bd46738cb4ee.tar.gz volse-hubzilla-124b17dcf44d6a9aac34b28ee455bd46738cb4ee.tar.bz2 volse-hubzilla-124b17dcf44d6a9aac34b28ee455bd46738cb4ee.zip |
Some cleanups.
Fixed dbesc_identifier(), but it is not used yet.
Corrected some other variable names and variable initialization before
using them.
Diffstat (limited to 'include/dba/dba_driver.php')
-rwxr-xr-x | include/dba/dba_driver.php | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 4a0f5e37b..708d8e709 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -24,7 +24,6 @@ function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) { $dba = null; - $dbtype = intval($dbtype); if($dbtype == DBTYPE_POSTGRES) { @@ -59,7 +58,7 @@ abstract class dba_driver { const INSTALL_SCRIPT='install/schema_mysql.sql'; const NULL_DATE = '0000-00-00 00:00:00'; const UTC_NOW = 'UTC_TIMESTAMP()'; - + protected $debug = 0; protected $db; public $connected = false; @@ -121,11 +120,11 @@ abstract class dba_driver { function get_null_date() { return static::NULL_DATE; } - + function get_install_script() { return static::INSTALL_SCRIPT; } - + function utcnow() { return static::UTC_NOW; } @@ -145,6 +144,7 @@ abstract class dba_driver { return false; } } + return true; } @@ -166,19 +166,19 @@ abstract class dba_driver { function quote_interval($txt) { return $txt; } - + function optimize_table($table) { q('OPTIMIZE TABLE '.$table); } - + function concat($fld, $sep) { return 'GROUP_CONCAT(DISTINCT '.$fld.' SEPARATOR \''.$sep.'\')'; } - + function escapebin($str) { return $this->escape($str); } - + function unescapebin($str) { return $str; } @@ -193,6 +193,7 @@ function printable($s) { $s = str_replace("\x00",'.',$s); if(x($_SERVER,'SERVER_NAME')) $s = escape_tags($s); + return $s; } @@ -252,7 +253,7 @@ function db_quoteinterval($txt) { function dbesc_identifier($str) { global $db; - return $db->escape_identifier($txt); + return $db->escape_identifier($str); } function db_utcnow() { @@ -349,6 +350,7 @@ function dbesc_array_cb(&$item, $key) { $item = '0001-01-01 00:00:00'; else if($item == '0001-01-01 00:00:00' && ACTIVE_DBTYPE == DBTYPE_MYSQL) $item = '0000-00-00 00:00:00'; + $item = dbesc($item); } } @@ -382,8 +384,7 @@ function db_getfunc($f) { $f = strtolower($f); if(isset($lookup[$f]) && isset($lookup[$f][ACTIVE_DBTYPE])) return $lookup[$f][ACTIVE_DBTYPE]; - + logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG); return $f; } - |