$zc_install->fileExists('demo/' . DB_TYPE . '_demo.sql', ERROR_TEXT_DEMO_SQL_NOTEXIST, ERROR_CODE_DEMO_SQL_NOTEXIST); } if ($zc_install->error == false) { if ($_POST['demo_install'] == 'true') { $zc_install->dbDemoDataInstall(); } $zc_install->dbStoreSetup(); // Close the database connection $zc_install->db->Close(); header('location: index.php?main_page=admin_setup' . zcInstallAddSID()); exit; } } require '../includes/classes/db/' . DB_TYPE . '/query_factory.php'; $db = new queryFactory(); $db->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE) or die("Unable to connect to database"); //if not submit, set some defaults $sql = "select countries_id, countries_name from " . DB_PREFIX . "countries order by countries_name"; $country = $db->Execute($sql); $country_string = ''; while (!$country->EOF) { $country_string .= '<option value="' . $country->fields['countries_id'] . '"' . setSelected($country->fields['countries_id'], $_POST['store_country']) . '>' . $country->fields['countries_name'] . '</option>'; $country->MoveNext(); } $sql = "select zone_id, zone_name from " . DB_PREFIX . "zones"; // order by zone_country_id, zone_name $zone = $db->Execute($sql); $zone_string = ''; $zone_string .= '<option value="-1"' . setSelected('-1', $_POST['store_zone']) . '>' . '-- Please Select --' . '</option>'; $zone_string .= '<option value="0"' . setSelected('0', $_POST['store_zone']) . '>' . '-None-' . '</option>'; while (!$zone->EOF) {
$zen_cart_database_connect_OK = true; } if ($zc_install->error == true) { $zen_cart_previous_version_installed = false; } //reset error-check class after connection attempt $zc_install->error = false; $zc_install->fatal_error = false; $zc_install->error_list = array(); } //endif check for db_type and db_name defined if ($zen_cart_database_connect_OK) { #1 //open database connection to run queries against it $db_test = new queryFactory(); $db_test->Connect($zdb_server, $zdb_user, $zdb_pwd, $zdb_name) or $zen_cart_database_connect_OK = false; if ($zen_cart_database_connect_OK) { //#2 This check is done again just in case connect fails on previous line //set database table prefix define('DB_PREFIX', $zdb_prefix); // Check to see if any Zen Cart tables exist $sql = "SHOW TABLES like '" . DB_PREFIX . "configuration'"; $tables = $db_test->Execute($sql); if (ZC_UPG_DEBUG == true) { echo 'ZEN-Configuration (should be 1) = ' . $tables->RecordCount() . '<br>'; } if ($tables->RecordCount() > 0) { $zdb_configuration_table_found = true; } if ($zdb_configuration_table_found) { // now check for database version levels
//if upgrading, move onto the upgrade page //update the cache folder setting: $db = new queryFactory(); $db->Connect($_POST['db_host'], $_POST['db_username'], $_POST['db_pass'], $_POST['db_name'], true); $sql = "update " . $_POST['db_prefix'] . "configuration set configuration_value='" . $_POST['sql_cache_dir'] . "' where configuration_key='SESSION_WRITE_DIRECTORY'"; $db->Execute($sql); //update the phpbb setting: $sql = "update " . $_POST['db_prefix'] . "configuration set configuration_value='" . $_GET['use_phpbb'] . "' where configuration_key='PHPBB_LINKS_ENABLED'"; $db->Execute($sql); header('location: index.php?main_page=database_upgrade&language=' . $language); exit; } elseif (!$zc_install->fatal_error) { // not upgrading - load the fresh database //OK, files written -- now let's connect to the database and load the tables: $db = new queryFactory(); $db->Connect($_POST['db_host'], $_POST['db_username'], $_POST['db_pass'], $_POST['db_name'], true); if ($zc_show_progress == 'yes') { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Zen Cart™ Installer</title> <link rel="stylesheet" type="text/css" href="includes/templates/template_default/css/stylesheet.css"> </head> <div id="wrap"> <div id="header"> <img src="includes/templates/template_default/images/zen_header_bg.jpg"> </div> <div class="progress" align="center">Installation In Progress...<br /><br /> <?php
$phreebooks_database_connect_OK = true; } if ($zc_install->error == true) { $phreebooks_previous_version_installed = false; } //reset error-check class after connection attempt $zc_install->error = false; $zc_install->fatal_error = false; $zc_install->error_list = array(); } //endif check for db_type and db_name defined if ($phreebooks_database_connect_OK) { #1 //open database connection to run queries against it $db_test = new queryFactory(); $db_test->Connect($zdb_server, $zdb_user, $zdb_pwd, $zdb_name) or $phreebooks_database_connect_OK = false; if ($phreebooks_database_connect_OK) { //#2 This check is done again just in case connect fails on previous line //set database table prefix define('DB_PREFIX', $zdb_prefix); // Check to see if any PhreeBooks tables exist $sql = "SHOW TABLES like '" . DB_PREFIX . "configuration'"; $tables = $db_test->Execute($sql); if ($tables->RecordCount() > 0) { $zdb_configuration_table_found = true; } if ($zdb_configuration_table_found) { // now check for database version levels // Check to see if this is v1.0 ... ie, is it really PhreeBooks? $sql = "select * from " . DB_PREFIX . "configuration where configuration_key = 'COMPANY_COUNTRY'"; $result = $db_test->Execute($sql);