5 require_once getShopBasePath() . 
'core/adodblite/adodb.inc.php';
 
  200         self::$_dbType = $oConfig->getVar(
'dbType');
 
  201         self::$_dbUser = $oConfig->getVar(
'dbUser');
 
  202         self::$_dbPwd = $oConfig->getVar(
'dbPwd');
 
  203         self::$_dbName = $oConfig->getVar(
'dbName');
 
  204         self::$_dbHost = $oConfig->getVar(
'dbHost');
 
  205         self::$_iDebug = $oConfig->getVar(
'iDebug');
 
  206         self::$_blLogChangesInAdmin = $oConfig->getVar(
'blLogChangesInAdmin');
 
  207         self::$_iUtfMode = $oConfig->getVar(
'iUtfMode');
 
  208         self::$_sDefaultDatabaseConnection = $oConfig->getVar(
'sDefaultDatabaseConnection');
 
  209         self::$_aSlaveHosts = $oConfig->getVar(
'aSlaveHosts');
 
  211         self::$_iMasterSlaveBalance = $oConfig->getVar(
'iMasterSlaveBalance');
 
  213         self::$_sAdminEmail = $oConfig->getVar(
'sAdminEmail');
 
  214         self::$_sLocalTimeFormat = $oConfig->getVar(
'sLocalTimeFormat');
 
  215         self::$_sLocalDateFormat = $oConfig->getVar(
'sLocalDateFormat');
 
  229         if (isset(
self::$$sConfigName)) {
 
  230             return self::$$sConfigName;
 
  244         if (defined(
'OXID_PHP_UNIT')) {
 
  245             self::$_instance = modInstances::getMod(__CLASS__);
 
  248         if (!self::$_instance instanceof 
oxDb) {
 
  251             self::$_instance = 
new oxDb();
 
  253             if (defined(
'OXID_PHP_UNIT')) {
 
  254                 modInstances::addMod(__CLASS__, self::$_instance);
 
  286             $sModules = 
'perfmon';
 
  290         if ($this->
isAdmin() && self::_getConfigParam(
'_blLogChangesInAdmin')) {
 
  291             $sModules .= ($sModules ? 
':' : 
'') . 
'oxadminlog';
 
  304         global $ADODB_EXCEPTION;
 
  305         $ADODB_EXCEPTION = 
'oxAdoDbException';
 
  307         include_once getShopBasePath() . 
'core/adodblite/adodb-exceptions.inc.php';
 
  324                 $oDb->execute(
'truncate table adodb_logsql');
 
  325             } 
catch (ADODB_Exception $e) {
 
  328             if (method_exists($oDb, 
"logSQL")) {
 
  334         $oDb->cacheSecs = 60 * 10; 
 
  335         $oDb->execute(
'SET @@session.sql_mode = ""');
 
  337         if (self::_getConfigParam(
'_iUtfMode')) {
 
  338             $oDb->execute(
'SET NAMES "utf8"');
 
  339             $oDb->execute(
'SET CHARACTER SET utf8');
 
  340             $oDb->execute(
'SET CHARACTER_SET_CONNECTION = utf8');
 
  341             $oDb->execute(
'SET CHARACTER_SET_DATABASE = utf8');
 
  342             $oDb->execute(
'SET character_set_results = utf8');
 
  343             $oDb->execute(
'SET character_set_server = utf8');
 
  344         } elseif (($sConn = self::_getConfigParam(
'_sDefaultDatabaseConnection')) != 
'') {
 
  345             $oDb->execute(
'SET NAMES "' . $sConn . 
'"');
 
  360     protected function _sendMail($sEmail, $sSubject, $sBody)
 
  362         include_once getShopBasePath() . 
'core/phpmailer/class.phpmailer.php';
 
  363         include_once getShopBasePath() . 
'core/phpmailer/class.smtp.php';
 
  364         $oMailer = 
new phpmailer();
 
  367         $oMailer->From = $sEmail;
 
  368         $oMailer->AddAddress($sEmail);
 
  369         $oMailer->Subject = $sSubject;
 
  370         $oMailer->Body = $sBody;
 
  372         return $oMailer->send();
 
  385         if (($sAdminEmail = self::_getConfigParam(
'_sAdminEmail'))) {
 
  386             $sFailedShop = isset($_REQUEST[
'shp']) ? addslashes($_REQUEST[
'shp']) : 
'Base shop';
 
  388             $sDate = date(
'l dS of F Y h:i:s A');
 
  389             $sScript = $_SERVER[
'SCRIPT_NAME'] . 
'?' . $_SERVER[
'QUERY_STRING'];
 
  390             $sReferer = $_SERVER[
'HTTP_REFERER'];
 
  393             $sWarningSubject = 
'Offline warning!';
 
  395                 Database error in OXID eShop: 
  399                 mysql error: " . $oDb->errorMsg() . 
" 
  400                 mysql error no: " . $oDb->errorNo() . 
" 
  403                 Referer: {$sReferer}";
 
  405             $this->
_sendMail($sAdminEmail, $sWarningSubject, $sWarningBody);
 
  410         $oEx->setMessage(
'EXCEPTION_CONNECTION_NODB');
 
  411         $oEx->setConnectionError(self::_getConfigParam(
'_dbUser') . 
's' . getShopBasePath() . $oDb->errorMsg());
 
  429         $sConfig = join(
'', file(getShopBasePath() . 
'config.inc.php'));
 
  431         if (strpos($sConfig, 
'<dbHost' . $sVerPrefix . 
'>') !== 
false &&
 
  432             strpos($sConfig, 
'<dbName' . $sVerPrefix . 
'>') !== 
false 
  436             $sHeaderCode = 
"HTTP/1.1 302 Found";
 
  437             header($sHeaderCode);
 
  438             header(
"Location: setup/index.php");
 
  439             header(
"Connection: close");
 
  466         $oDb = ADONewConnection($sType, $this->
_getModules());
 
  470             $oDb->connect($sHost, $sUser, $sPwd, $sName);
 
  491         if (defined(
'OXID_PHP_UNIT')) {
 
  492             if (isset(modDB::$unitMOD) && is_object(modDB::$unitMOD)) {
 
  493                 return modDB::$unitMOD;
 
  497         if (self::$_oDB === null) {
 
  506             global $ADODB_SESSION_TBL,
 
  507                    $ADODB_SESSION_CONNECT,
 
  508                    $ADODB_SESSION_DRIVER,
 
  521             $ADODB_SESS_LIFE = 3000 * 60;
 
  522             $ADODB_SESSION_TBL = 
"oxsessions";
 
  528             $ADODB_SESS_DEBUG = 
false;
 
  533             $oDbInst = $oInst->_getDbInstance();
 
  534             $oDb->setConnection($oDbInst);
 
  539         self::$_oDB->setFetchMode($iFetchMode);
 
  565         self::$_aTblDescCache = array();
 
  578         if (isset(self::$_aTblDescCache[$sTableName])) {
 
  579             return self::$_aTblDescCache[$sTableName];
 
  582         $aFields = 
self::getDb()->MetaColumns($sTableName);
 
  584         self::$_aTblDescCache[$sTableName] = $aFields;
 
  601         return ( 
boolean ) 
getStr()->preg_match(
"#^[\w\d\._]*$#", $sField);
 
  628         if (
'mysql' == self::_getConfigParam(
"_dbType")) {
 
  630         } elseif (
'mysqli' == self::_getConfigParam(
"_dbType")) {