Example #1
0
        $db->query("UPDATE " . $db->config['prefix'] . "email_templates\n                    SET day='" . $config['mail_not_completed_days'] . "'\n                    WHERE name='mail_not_completed' and day IS NULL");
        print "OK<br />";
        ob_end_flush();
    }
}
/* ******************************************************************************* *
 *                  M A I N
 */
$old_db_version = $db->query_one("\n    SELECT value\n    FROM {$db->config[prefix]}config\n    WHERE name='db_version'\n    ");
print "Current database version: [{$old_db_version}] <small>(may be different from aMember version number)</small>.\n<br />";
$f = join('', file('../amember.sql'));
if (preg_match("/REPLACE INTO @DB_MYSQL_PREFIX@config \\(name,type,value\\) VALUES \\('db_version', 0, '(\\d+)'\\)/", $f, $rr)) {
    print "Version of <strong>amember.sql</strong> file is [{$rr['1']}].\n<br />";
}
$create_email_templates = !email_templates_created();
create_mysql_tables();
if (!$admin_accounts_created) {
    create_admin_accounts();
}
check_aff_commission_id();
$d =& amDb();
if ($d->selectCell("SELECT COUNT(*) FROM ?_countries") <= 0) {
    load_countries_from_file();
}
if ($d->selectCell("SELECT COUNT(*) FROM ?_states") <= 0) {
    load_states_from_file();
}
if ($create_email_templates) {
    print "<br /><br /><strong>Default e-mail templates were imported (from amember.sql file).<br />\n    If you wish to load your templates to database from text files, click the following link:\n    <a target='_blank' href='email_templates.php?a=convert'>Import templates from text files</a><br />";
}
if ($old_db_version < '301') {
Example #2
0
function commit_changes()
{
    global $root_dir;
    $vars = $_POST;
    create_mysql_tables();
    list($f1, $f2) = get_config_files();
    ///
    $fp = @fopen($fn = "{$root_dir}/config.inc.php", 'wb');
    if (!$fp) {
        display_send_files_form($fn);
        return;
    }
    fwrite($fp, $f1);
    fclose($fp);
    $HTTP_HOST = $_SERVER['HTTP_HOST'];
    $REQUEST_URI = $_SERVER['REQUEST_URI'];
    header(sprintf("Location: http://%s%s?step=5", $HTTP_HOST, $REQUEST_URI));
    exit;
}