connect() private static method

private static connect ( $settings )
Exemplo n.º 1
0
if (installer::already_installed()) {
    $content = render("success.html.php");
} else {
    switch (@$_GET["step"]) {
        default:
        case "welcome":
            $errors = check_environment();
            if ($errors) {
                $content = render("environment_errors.html.php", array("errors" => $errors));
            } else {
                $content = render("get_db_info.html.php");
            }
            break;
        case "save_db_info":
            $config = array("host" => $_POST["dbhost"], "user" => $_POST["dbuser"], "password" => $_POST["dbpass"], "dbname" => $_POST["dbname"], "prefix" => $_POST["prefix"], "type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql");
            if (!installer::connect($config)) {
                $content = render("invalid_db_info.html.php");
            } else {
                if (!installer::select_db($config)) {
                    $content = render("missing_db.html.php");
                } else {
                    if (!installer::db_empty($config)) {
                        $content = render("db_not_empty.html.php");
                    } else {
                        if (!installer::unpack_var()) {
                            $content = oops("Unable to create files inside the <code>var</code> directory");
                        } else {
                            if (!installer::unpack_sql($config)) {
                                $content = oops("Failed to create tables in your database:" . mysql_error());
                            } else {
                                if (!installer::create_database_config($config)) {