Example #1
0
  *  So, this prefix problem will be taken care of here.
  *
  *  This whole situation is still quite fragile because and change in the step order
  *  could prevent this issue to be fixed. To fully fix this problem - this fix has to be
  *  moved from here to the top (where queries are executed) so every time a step after
  *  this one is processed, the fix-check will modify the prefix value if needed.
  *
  *  In this version, however, the original implementation releys on the fact that the 
  *  step STEP_DBPREFIX is previous step from STEP_RUNSQL!  */
 if (in_array($dbase->GetDatabaseName(), $successInstall)) {
     // Get the status from sessions and check with the current set prefix
     $currentPrefix = $keywords['connection']['dbprefix'];
     $dbStatus = GetDatabaseInstallStatus($dbase->GetDatabaseName());
     if ($currentPrefix != $dbStatus['prefix']) {
         // Change the prefix value to the one used during installation of SQL queries
         SetSessionPrefix($dbStatus['prefix']);
         $keywords['connection']['dbprefix'] = $dbStatus['prefix'];
         $text = $dbStatus['prefix'] == '' ? '<i>empty</i>' : '<b>' . $dbStatus['prefix'] . '</b>';
         // And then notify the user that the prefix has been changed!
         $page->WarningBox('During the setup of database <b>' . $dbase->GetDatabaseName() . '</b>, the prefix ' . 'was set to <tt><i>' . $dbStatus['prefix'] . '</i></tt> but has been changed ' . 'since then to <tt><i>' . $currentPrefix . '</i></tt><br />&nbsp;<br />' . 'The prefix has been reverted back to ' . $text . ' to prevent incorrect ' . 'installation.');
     }
 }
 // Get the number of tables (and list of table names) from database to
 // know what to warn the user about and perhaps show a list of tables if needed
 $tableList = $dbase->GetTableListFromDatabase();
 if (count($tableList) > 0) {
     $prefix = $keywords['connection']['dbprefix'];
     if (strlen($prefix) == 0 && $steps[STEP_DBPREFIX]['enabled']) {
         // Only show a "no prefix set" warning if there has NOT been a successful
         // database installation on the selected database!!
         if (!in_array($dbase->GetDatabaseName(), $successInstall)) {
// keywords session and override any values that match. The changes will be
// updated to $keywords below
if (isset($_POST) && count($_POST) > 0) {
    foreach ($_POST as $key => $value) {
        $value = trim($value);
        // Special keywords are just stored
        if (array_key_exists($key, $_SESSION[$ID][$special])) {
            $_SESSION[$ID][$special][$key] = $value;
        } else {
            if (array_key_exists($key, $_SESSION[$ID][$connect])) {
                // If encryption is enabled, encrypt the login to session
                if ($steps[STEP_DBCONNECT]['encryptlogin'] && in_array($key, array('password', 'username', 'hostname', 'database'))) {
                    $_SESSION[$ID][$connect][$key] = Encrypt($value);
                } else {
                    if ($key == 'dbprefix') {
                        SetSessionPrefix($value);
                    } else {
                        $_SESSION[$ID][$connect][$key] = $value;
                    }
                }
            } else {
                if (array_key_exists($key, $_SESSION[$ID][$admin])) {
                    if ($steps[STEP_ROOTUSER]['encryptdata']) {
                        $_SESSION[$ID][$admin][$key] = Encrypt($value);
                    } else {
                        $_SESSION[$ID][$admin][$key] = $value;
                    }
                }
            }
        }
    }