Commit a2ce9dc7 authored by Jesse Norell's avatar Jesse Norell

remove config variable name prefix

parent 94babc39
......@@ -43,8 +43,6 @@ class db
private $_iQueryId;
private $_iConnId;
private $_Prefix = ''; // config variable name prefix
private $dbHost = ''; // hostname of the MySQL server
private $dbPort = ''; // port of the MySQL server
private $dbName = ''; // logical database name on that server
......@@ -74,18 +72,17 @@ class db
*/
// constructor
public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL, $port = NULL, $flags = NULL, $confPrefix = '') {
public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL, $port = NULL, $flags = NULL) {
global $app, $conf;
if($confPrefix != '') $this->_Prefix = $confPrefix . '_';
$this->dbHost = $host ? $host : $conf[$this->_Prefix.'db_host'];
$this->dbPort = $port ? $port : $conf[$this->_Prefix.'db_port'];
$this->dbName = $database ? $database : $conf[$this->_Prefix.'db_database'];
$this->dbUser = $user ? $user : $conf[$this->_Prefix.'db_user'];
$this->dbPass = $pass ? $pass : $conf[$this->_Prefix.'db_password'];
$this->dbCharset = $conf[$this->_Prefix.'db_charset'];
$this->dbNewLink = $conf[$this->_Prefix.'db_new_link'];
$this->dbClientFlags = $flags ? $flags : $conf[$this->_Prefix.'db_client_flags'];
$this->dbHost = $host ? $host : $conf['db_host'];
$this->dbPort = $port ? $port : $conf['db_port'];
$this->dbName = $database ? $database : $conf['db_database'];
$this->dbUser = $user ? $user : $conf['db_user'];
$this->dbPass = $pass ? $pass : $conf['db_password'];
$this->dbCharset = $conf['db_charset'];
$this->dbNewLink = $conf['db_new_link'];
$this->dbClientFlags = $flags ? $flags : $conf['db_client_flags'];
$this->_iConnId = mysqli_init();
mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags);
......@@ -279,7 +276,7 @@ class db
}
if($try > 9) {
$this->_sqlerror('DB::_query -> reconnect', '', true);
$this->_sqlerror('db::_query -> reconnect', '', true);
return false;
} else {
sleep(($try > 7 ? 5 : 1));
......@@ -547,7 +544,7 @@ class db
//$sAddMsg .= getDebugBacktrace();
if($this->show_error_messages && $conf[$this->_Prefix.'demo_mode'] === false) {
if($this->show_error_messages && $conf['demo_mode'] === false) {
echo $sErrormsg . $sAddMsg;
} elseif(is_object($app) && method_exists($app, 'log') && $bNoLog == false) {
$app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN, false);
......
......@@ -43,8 +43,6 @@ class db
private $_iQueryId;
private $_iConnId;
private $_Prefix = ''; // config variable name prefix
private $dbHost = ''; // hostname of the MySQL server
private $dbPort = ''; // port of the MySQL server
private $dbName = ''; // logical database name on that server
......@@ -74,18 +72,17 @@ class db
*/
// constructor
public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL, $port = NULL, $flags = NULL, $confPrefix = '') {
public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL, $port = NULL, $flags = NULL) {
global $app, $conf;
if($confPrefix != '') $this->_Prefix = $confPrefix . '_';
$this->dbHost = $host ? $host : $conf[$this->_Prefix.'db_host'];
$this->dbPort = $port ? $port : $conf[$this->_Prefix.'db_port'];
$this->dbName = $database ? $database : $conf[$this->_Prefix.'db_database'];
$this->dbUser = $user ? $user : $conf[$this->_Prefix.'db_user'];
$this->dbPass = $pass ? $pass : $conf[$this->_Prefix.'db_password'];
$this->dbCharset = $conf[$this->_Prefix.'db_charset'];
$this->dbNewLink = $conf[$this->_Prefix.'db_new_link'];
$this->dbClientFlags = $flags ? $flags : $conf[$this->_Prefix.'db_client_flags'];
$this->dbHost = $host ? $host : $conf['db_host'];
$this->dbPort = $port ? $port : $conf['db_port'];
$this->dbName = $database ? $database : $conf['db_database'];
$this->dbUser = $user ? $user : $conf['db_user'];
$this->dbPass = $pass ? $pass : $conf['db_password'];
$this->dbCharset = $conf['db_charset'];
$this->dbNewLink = $conf['db_new_link'];
$this->dbClientFlags = $flags ? $flags : $conf['db_client_flags'];
$this->_iConnId = mysqli_init();
mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags);
......@@ -279,7 +276,7 @@ class db
}
if($try > 9) {
$this->_sqlerror('DB::_query -> reconnect', '', true);
$this->_sqlerror('db::_query -> reconnect', '', true);
return false;
} else {
sleep(($try > 7 ? 5 : 1));
......@@ -547,7 +544,7 @@ class db
//$sAddMsg .= getDebugBacktrace();
if($this->show_error_messages && $conf[$this->_Prefix.'demo_mode'] === false) {
if($this->show_error_messages && $conf['demo_mode'] === false) {
echo $sErrormsg . $sAddMsg;
} elseif(is_object($app) && method_exists($app, 'log') && $bNoLog == false) {
$app->log($sErrormsg . $sAddMsg . ' -> ' . $mysql_errno . ' (' . $mysql_error . ')', LOGLEVEL_WARN, false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment