Esempio n. 1
0
    require_once MYBB_ROOT . "inc/config.php";
    $mybb->config =& $config;
    if (!isset($config['database'])) {
        $not_installed = true;
    }
}
if ($not_installed !== false) {
    if (file_exists(MYBB_ROOT . "install/index.php")) {
        if (defined("IN_ARCHIVE") || defined("IN_ADMINCP")) {
            header("Location: ../install/index.php");
            exit;
        }
        header("Location: ./install/index.php");
        exit;
    }
    $mybb->trigger_generic_error("board_not_installed");
}
if (!is_array($config['database'])) {
    $mybb->trigger_generic_error("board_not_upgraded");
}
if (empty($config['admin_dir'])) {
    $config['admin_dir'] = "admin";
}
// Trigger an error if the installation directory exists
if (is_dir(MYBB_ROOT . "install") && !file_exists(MYBB_ROOT . "install/lock")) {
    $mybb->trigger_generic_error("install_directory");
}
// Load DB interface
require_once MYBB_ROOT . "inc/db_base.php";
require_once MYBB_ROOT . "inc/db_" . $config['database']['type'] . ".php";
switch ($config['database']['type']) {
Esempio n. 2
0
    case "sqlite":
        $db = new DB_SQLite();
        break;
    case "pgsql":
        $db = new DB_PgSQL();
        break;
    case "mysqli":
        $db = new DB_MySQLi();
        break;
    default:
        $db = new DB_MySQL();
}
// Check if our DB engine is loaded
if (!extension_loaded($db->engine)) {
    // Throw our super awesome db loading error
    $mybb->trigger_generic_error("sql_load_error");
}
if (function_exists('mb_internal_encoding')) {
    @mb_internal_encoding("UTF-8");
}
// Connect to the installed MyBB database
define("TABLE_PREFIX", $config['database']['table_prefix']);
$db->connect($config['database']);
$db->set_table_prefix(TABLE_PREFIX);
$db->type = $config['database']['type'];
// Start up our main timer so we can aggregate performance data
$start_timer = microtime(true);
// Get the import session cache if exists
$import_session = $cache->read("import_cache", 1);
// Setup our arrays if they don't exist yet
if (!$import_session['resume_module']) {