private function load_database(&$config) { // load database class switch (strtolower($config['Database']['dbtype'])) { // load standard MySQL class case 'mysql': $db = new vB_Database_MySQL(); break; // load MySQLi class // load MySQLi class case 'mysqli': $db = new vB_Database_MySQLi(); break; // load extended, non MySQL class // load extended, non MySQL class default: // this is not implemented fully yet // $db = 'vB_Database_' . $vbulletin->config['Database']['dbtype']; // $db = new $db($vbulletin); die('Fatal error: Database class not found'); } // get core functions if (!empty($db->explain)) { $db->timer_start('Including Functions.php'); require_once DIR . '/includes/functions.php'; $db->timer_stop(false); } else { require_once DIR . '/includes/functions.php'; } // make the usepconnect config option optional (VBV-12036) if (empty($config['MasterServer']['usepconnect'])) { $config['MasterServer']['usepconnect'] = 0; } if (empty($config['SlaveServer']['usepconnect'])) { $config['SlaveServer']['usepconnect'] = 0; } // make database connection $db->connect($config['Database']['dbname'], $config['MasterServer']['servername'], $config['MasterServer']['port'], $config['MasterServer']['username'], $config['MasterServer']['password'], $config['MasterServer']['usepconnect'], $config['SlaveServer']['servername'], $config['SlaveServer']['port'], $config['SlaveServer']['username'], $config['SlaveServer']['password'], $config['SlaveServer']['usepconnect'], $config['Mysqli']['ini_file'], isset($config['Mysqli']['charset']) ? $config['Mysqli']['charset'] : ''); //if (!empty($vb5_config['Database']['force_sql_mode'])) //{ $db->force_sql_mode(''); //} //30443 Right now the product doesn't work in strict mode at all. Its silly to make people have to edit their //config to handle what appears to be a very common case (though the mysql docs say that no mode is the default) //we no longer use the force_sql_mode parameter, though if the app is fixed to handle strict mode then we //may wish to change the default again, in which case we should honor the force_sql_mode option. //added the force parameter //if (!empty($vbulletin->config['Database']['force_sql_mode'])) //if (empty($vbulletin->config['Database']['no_force_sql_mode'])) //{ // $db->force_sql_mode(''); //} if (defined('DEMO_MODE') and DEMO_MODE and function_exists('vbulletin_demo_init_db')) { vbulletin_demo_init_db(); } self::$db = $db; return $db; }
// Load extended, non MySQL class (Not Implemented) // Load extended, non MySQL class (Not Implemented) default: // $dbclass = "vB_Database_$dbtype"; // $db = new $dbclass($vbulletin); die('Fatal error: Database class not found'); } $db->appshortname = 'vBulletin (' . VB_AREA . ')'; // make $db a member of $vbulletin $vbulletin->db =& $db; if (!defined('SKIPDB')) { // we do not want to use the slave server at all during this process // as latency problems may occur $vbulletin->config['SlaveServer']['servername'] = ''; // make database connection $db->connect($vbulletin->config['Database']['dbname'], $vbulletin->config['MasterServer']['servername'], $vbulletin->config['MasterServer']['port'], $vbulletin->config['MasterServer']['username'], $vbulletin->config['MasterServer']['password'], $vbulletin->config['MasterServer']['usepconnect'], $vbulletin->config['SlaveServer']['servername'], $vbulletin->config['SlaveServer']['port'], $vbulletin->config['SlaveServer']['username'], $vbulletin->config['SlaveServer']['password'], $vbulletin->config['SlaveServer']['usepconnect'], $vbulletin->config['Mysqli']['ini_file'], $vbulletin->config['Mysqli']['charset']); //30443 Right now the product doesn't work in strict mode at all. Its silly to make people have to edit their //config to handle what appears to be a very common case (though the mysql docs say that no mode is the default) //we no longer use the force_sql_mode parameter, though if the app is fixed to handle strict mode then we //may wish to change the default again, in which case we should honor the force_sql_mode option. //added the force parameter //The same logic is in includes/init.php and should stay in sync. //if (!empty($vbulletin->config['Database']['force_sql_mode'])) if (empty($vbulletin->config['Database']['no_force_sql_mode'])) { $db->force_sql_mode(''); } // ############################################################################# // fetch options and other data from the datastore // grab the MySQL Version once and let every script use it. $mysqlversion = $db->query_first("SELECT version() AS version"); define('MYSQL_VERSION', $mysqlversion['version']);