Ejemplo n.º 1
0
 // Try to connect to database
 $login = $keywords['connection'];
 $dbase->Connect($login);
 // Clear the plain-text password if encryption is enabled
 if ($steps[STEP_DBCONNECT]['encryptlogin']) {
     $login['password'] = '';
 }
 // If connection cannot be made, force show "connection" step!
 if (!$dbase->IsConnected() || $step == STEP_DBCONNECT) {
     $page->MainTitle($steps[STEP_DBCONNECT]['title'], 'connection');
     // If the step is not STEP_DBCONNECT, then the installer was going
     // somewhere else - so error message should be displayed
     if ($step != STEP_DBCONNECT) {
         $page->WarningBox('Unable to establish a connection to <b>' . $login['hostname'] . '</b>. ' . 'Please fill in <i>hostname</i>, <i>username</i> and <i>password</i>.');
         if ($config['show_database_error_messages']) {
             $page->ErrorDatabaseBox($dbase->GetDatabaseError());
         }
     } else {
         if ($step == STEP_DBCONNECT && $dbase->IsConnected()) {
             $page->SuccessBox('Connection to database server is successful with login ' . 'provided. Proceed to the next step');
         }
     }
     // If the port is optional and the port value contains
     // non-digits then display warning message
     if ($steps[STEP_DBCONNECT]['portoptional'] && !$dbase->IsConnected() && strlen($login['dbport']) > 0 && !IsNumericOnly($login['dbport'])) {
         $page->WarningBox('The port value <b>' . $login['dbport'] . '</b> is not a valid numeric value');
     }
     // If the password is encrypted and connection has been made successfully - then pressing NEXT
     // in the 'else' clause below would send an empty string and reset the password to nothing. So,
     // either force the user to type in the password every time he visists this step (which sucks)
     // or just show success message and offer a "disconnect" button instead. Then the only info posted