Esempio n. 1
0
/**
 * Processes upgrade.
 *
 * @since 1.0
 * @package facileManager
 * @subpackage Upgrader
 */
function fmUpgrade($database)
{
    global $fmdb, $branding_logo;
    include ABSPATH . 'fm-includes/version.php';
    include ABSPATH . 'fm-modules/facileManager/variables.inc.php';
    $errors = false;
    $GLOBALS['running_db_version'] = getOption('fm_db_version');
    printf('<div id="fm-branding">
		<img src="%s" /><span>%s</span>
	</div>
	<div id="window"><table class="form-table">' . "\n", $branding_logo, _('Upgrade'));
    /** Checks to support older versions (ie n-3 upgrade scenarios */
    $success = $GLOBALS['running_db_version'] < 42 ? fmUpgrade_200($database) : true;
    if ($success) {
        $success = upgradeConfig('fm_db_version', $fm_db_version);
        setOption('version_check', array('timestamp' => date("Y-m-d H:i:s", strtotime("2 months ago")), 'data' => null), 'update', true, 0, $fm_name);
    } else {
        $errors = true;
    }
    displayProgress(_('Upgrading Core Schema'), $success);
    /** Upgrade any necessary modules */
    include ABSPATH . 'fm-modules/' . $fm_name . '/classes/class_tools.php';
    $fmdb->get_results("SELECT module_name FROM fm_options WHERE option_name='version'");
    $num_rows = $fmdb->num_rows;
    $module_list = $fmdb->last_result;
    for ($x = 0; $x < $num_rows; $x++) {
        $module_name = $module_list[$x]->module_name;
        $success = $fm_tools->upgradeModule($module_name, 'quiet');
        if (!$success || $fmdb->last_error) {
            $errors = true;
            $success = false;
        } else {
            $success = true;
        }
        displayProgress(sprintf(_('Upgrading %s Schema'), $module_name), $success);
    }
    echo "</table>";
    if (!$errors) {
        displaySetupMessage(1, $GLOBALS['RELPATH']);
    } else {
        displaySetupMessage(2);
    }
    echo "</div>";
}
Esempio n. 2
0
            $err = 'Could not delete ' . __FILE__ . '. Please delete the file manually.';
            $err .= '<strong>Important:</strong> ' . _NAME . ' will not run until this file is deleted for security reasons!';
            displaySetupMessage($err, false);
        } else {
            $msg = 'Deleted ' . __FILE__ . ' successfully.';
            displaySetupMessage($msg, true);
            send("<br/>");
            send("<h2>Next: Login</h2>");
            send("<p>To continue on to the " . _NAME . " login screen, click the button below:</p>");
            send('<form name="setup" action="login.php" method="post">');
            send('<input type="submit" value="Continue">');
            send('</form>');
        }
    } else {
        $msg = '<font color="blue">This is an ' . substr(_VERSION, 0, 3) . '-version. ' . __FILE__ . ' is untouched. Please remove the file manually to login to your ' . _NAME . ' installation.</font>';
        displaySetupMessage($msg, true);
    }
    send("<p><strong>Important:</strong><br/>When logging in for the first time <strong>the login username and password you supply there will create the default superadmin user for your " . _NAME . " installation.</strong>  For this reason it is important you do this immediately and remember the username and password!!!</p>");
} else {
    // default
    sendHead();
    if (is_file(_FILE_DBCONF)) {
        send('<p><br><font color="red"><h1>db-config already exists (' . _FILE_DBCONF . ')</h1></font>Delete setup.php if you came here after finishing setup to proceed to login.</p><hr>');
    }
    send("<h1>" . _TITLE . "</h1>");
    send("<p>Welcome to the installation script for " . _NAME . ". In the following pages you will be guided through the steps necessary to get your installation of " . _NAME . " up and running, including database configuration and initial " . _NAME . " system configuration file creation.</p>");
    send("<br/>");
    send("<h2>Next: Database</h2>");
    sendButton(1);
}
// foot