Ejemplo n.º 1
0
 // Get the new database name if posted - or false if not. Then
 // validate the name and try to insert this new database. Messages
 // are not added to queue right away
 $newdb = false;
 $msg = false;
 if (isset($_REQUEST['createdb']) && $steps[STEP_DBSELECT]['allowcreate']) {
     $newdb = trim($_REQUEST['createdb']);
     if (strlen($newdb) == 0) {
         $page->InfoBox('Please specify a name for the database');
         $msg[] = $page->PopQueue();
     } else {
         if ($dbase->DoesDatabaseExist($newdb)) {
             $page->WarningBox('There exists a database with the name <b>' . $newdb . '</b> already, please choose another one.');
             $msg[] = $page->PopQueue();
         } else {
             if (!$dbase->IsDatabaseFriendly($newdb)) {
                 $page->WarningBox('The database name <b>' . $newdb . '</b> is not valid, please choose another one.');
                 $msg[] = $page->PopQueue();
             } else {
                 if ($dbase->CreateNewDatabase($newdb)) {
                     $page->SuccessBox('The database <b>' . $newdb . '</b> has been created successfully!');
                     $msg[] = $page->PopQueue();
                 } else {
                     $page->ErrorBox('Installer was unable to create the database <b>' . $newdb . '</b>, either select database from a list or contact support.');
                     $msg[] = $page->PopQueue();
                     if ($config['show_database_error_messages']) {
                         $page->ErrorDatabaseBox($dbase->GetDatabaseError());
                         $msg[] = $page->PopQueue();
                     }
                 }
             }