コード例 #1
0
ファイル: web.php プロジェクト: xafr/gallery3
 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)) {
                                 $content = oops("Couldn't create var/database.php");
                             } else {
                                 try {