function _sess_write($key, $val) { global $db; if (!is_object($db)) { //PHP 5.2.0 bug workaround ... if (!class_exists('queryFactory')) { require 'includes/classes/db/' . DB_TYPE . '/query_factory.php'; } $db = new queryFactory(); $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false); } $val = base64_encode($val); global $SESS_LIFE; $expiry = time() + $SESS_LIFE; $qid = "select count(*) as total\r\n from " . TABLE_SESSIONS . "\r\n where sesskey = '" . zen_db_input($key) . "'"; $total = $db->Execute($qid); if ($total->fields['total'] > 0) { $sql = "update " . TABLE_SESSIONS . "\r\n set expiry = '" . zen_db_input($expiry) . "', value = '" . zen_db_input($val) . "'\r\n where sesskey = '" . zen_db_input($key) . "'"; $result = $db->Execute($sql); } else { $sql = "insert into " . TABLE_SESSIONS . "\r\n values ('" . zen_db_input($key) . "', '" . zen_db_input($expiry) . "', '" . zen_db_input($val) . "')"; $result = $db->Execute($sql); } return !empty($result) && !empty($result->resource); }
function _sess_write($key, $val) { global $SESS_LIFE, $db; if (!is_object($db)) { //PHP 5.2.0 bug workaround ... $db = new queryFactory(); $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false); } $expiry = time() + $SESS_LIFE; $value = $val; $total = $db->Execute("select count(*) as total\r\n from " . TABLE_SESSIONS . "\r\n where sesskey = '" . zen_db_input($key) . "'"); if ($total->fields['total'] > 0) { return $db->Execute("update " . TABLE_SESSIONS . "\r\n set expiry = '" . zen_db_input($expiry) . "',\r\n value = '" . zen_db_input($value) . "'\r\n where sesskey = '" . zen_db_input($key) . "'"); } else { return $db->Execute("insert into " . TABLE_SESSIONS . "\r\n values ('" . zen_db_input($key) . "', '" . zen_db_input($expiry) . "',\r\n '" . zen_db_input($value) . "')"); } }
public function ShowProductDetail($productID) { $db = new queryFactory(); $this->Products = array(); $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE); $products_all_query_raw = "SELECT\n p.products_type,\n p.products_id,\n pd.products_name,\n p.products_image,\n p.products_price,\n p.products_tax_class_id,\n p.products_date_added,\n m.manufacturers_name,\n p.products_model,\n p.products_quantity,\n p.products_weight,\n p.product_is_call,\n p.product_is_always_free_shipping,\n p.products_qty_box_status,\n p.master_categories_id,\n pd.products_description\n FROM " . TABLE_PRODUCTS . " p\n LEFT JOIN " . TABLE_MANUFACTURERS . " m\n ON (p.manufacturers_id = m.manufacturers_id),\n " . TABLE_PRODUCTS_DESCRIPTION . " pd\n WHERE p.products_status = 1\n AND p.products_id = pd.products_id\n AND pd.language_id = 1\n AND p.products_id = " . $productID . "\n Order By p.products_date_added desc\n LIMIT 10"; $products_all_results = $db->Execute($products_all_query_raw, '', false, 0); $track = 0; while (!$products_all_results->EOF) { $this->Products[$track] = array('id' => $products_all_results->fields['products_id'], 'name' => $products_all_results->fields['products_name'], 'price' => $products_all_results->fields['products_price'], 'image' => $products_all_results->fields['products_image'], 'dateadded' => $products_all_results->fields['products_date_added'], 'desctiption' => $products_all_results->fields['products_description'], 'model' => $products_all_results->fields['products_model']); $track++; $products_all_results->MoveNext(); } }
function UI_Router($id) { //go to db and get UI name //return ui name global $db5; //, $cPath, $cPath_array; $this->returnContent = ""; //will either be a path or definition; $db5 = new queryFactory(); $db5->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE); $interface_qry = "select * from EZ_UserInterface where\n Interfaceid = {$id}"; $ui = $db5->Execute($interface_qry, '', false, 0); while (!$ui->EOF) { if ($ui->fields["InterfaceUseDef"] == 1) { $this->returnContent .= $ui->fields["InterfaceDefinition"]; } else { $this->returnContent .= $ui->fields["InterfacePath"]; } $ui->MoveNext(); } }
$db = new queryFactory(); $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_SERVER_NAME); // set application wide parameters for phreebooks module $configuration = $db->Execute_return_error("select configuration_key as cfgKey, configuration_value as cfgValue\r\n\t\t\t\t\t\t\t\t from " . TABLE_CONFIGURATION); if ($db->error_number) { // there was a problem, report and halt die('There was an error returned while retrieving the configuration data.<br />PhreeBooks was able to connect to the database but could not find the configuration table. Looks like the table is missing! Options include deleting /includes/configure.php and re-installing (for new installations) or restoring the database tables (database crash).'); } while (!$configuration->EOF) { define($configuration->fields['cfgKey'], $configuration->fields['cfgValue']); $configuration->MoveNext(); } // Define the project version (must come after db class is loaded) require DIR_FS_INCLUDES . 'version.php'; // Determine the DATABASE patch level $project_db_info = $db->Execute("select * from " . TABLE_PROJECT_VERSION . " WHERE project_version_key = 'PhreeBooks Database' "); define('PROJECT_DB_VERSION_MAJOR', $project_db_info->fields['project_version_major']); define('PROJECT_DB_VERSION_MINOR', $project_db_info->fields['project_version_minor']); if (PROJECT_VERSION_MAJOR . PROJECT_VERSION_MINOR != PROJECT_DB_VERSION_MAJOR . PROJECT_DB_VERSION_MINOR) { // run the upgrade script if necessary $filepath = DIR_FS_MODULES . 'install/updater.php'; if (file_exists($filepath)) { // execute the sql require_once DIR_FS_MODULES . 'general/language/' . $_SESSION['language'] . '/language.php'; require $filepath; execute_upgrade(); } else { die('Trying to upgrade to Release ' . PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR . ' but the upgrade file could not be found!'); } } // load currency classes
$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); if ($result->RecordCount() > 0) { $got_v1_0 = true; $zdb_ver = '1.0'; } // first test to see if they have run the x.x upgrade script (v1.0 to v1.x.x) // select a test condition like: $tables = $db_test->Execute("SHOW TABLES like '" . DB_PREFIX . "files_uploaded'");
if (!install_build_co_config_file($db_name, 'DB_SERVER_PASSWORD', $db_password)) { $error = true; } if (!install_build_co_config_file($db_name, 'DB_SERVER_HOST', $db_host)) { $error = true; } } if (!$error) { // try to connect to db require '../includes/db/' . DB_TYPE . '/query_factory.php'; $db = new queryFactory(); if (!$db->connect($db_host, $db_username, $db_password, $db_name)) { $error = $messageStack->add(MSG_ERROR_CANNOT_CONNECT_DB . $db->show_error(), 'error'); } else { // test for InnoDB support $result = $db->Execute("show engines"); $innoDB_enabled = false; while (!$result->EOF) { if ($result->fields['Engine'] == 'InnoDB') { $innoDB_enabled = true; } $result->MoveNext(); } if (!$innoDB_enabled) { $error = $messageStack->add(MSG_ERROR_INNODB_NOT_ENABLED, 'error'); } } } if ($error) { $include_template = 'template_install.php'; define('PAGE_TITLE', TITLE_INSTALL);
<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 } executeSql($_POST['db_type'] . '_zencart.sql', $_POST['db_name'], $_POST['db_prefix']); //update the cache folder setting: $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); $db->Close(); // done - now onto next page for Store Setup (entries into database) if ($zc_show_progress == 'yes') { $linkto = 'index.php?main_page=store_setup&language=' . $language; $link = '<a href="' . $linkto . '">' . '<br /><br />Done!<br />Click Here To Continue<br /><br />' . '</a>'; echo "\n<script type=\"text/javascript\">\nwindow.location=\"{$linkto}\";\n</script>\n"; echo '<noscript>' . $link . '</noscript><br /><br />'; echo '<div id="footer"><p>Copyright © 2003, 2004, 2005 <a href="http://www.zen-cart.com" target="_blank">Zen Cart</a></p></div></div></body></html>'; } header('location: index.php?main_page=store_setup&language=' . $language); exit; }
// include the list of compatibility issues require DIR_WS_FUNCTIONS . 'compatibility.php'; // include the list of extra database tables and filenames // include(DIR_WS_MODULES . 'extra_datafiles.php'); if ($za_dir = @dir(DIR_WS_INCLUDES . 'extra_datafiles')) { while ($zv_file = $za_dir->read()) { if (preg_match('/\\.php$/', $zv_file) > 0) { require DIR_WS_INCLUDES . 'extra_datafiles/' . $zv_file; } } $za_dir->close(); } // include the cache class require DIR_WS_CLASSES . 'cache.php'; $zc_cache = new cache(); $configuration = $db->Execute('select configuration_key as cfgkey, configuration_value as cfgvalue from ' . TABLE_CONFIGURATION, '', true, 150); while (!$configuration->EOF) { // define($configuration->fields['cfgkey'], $configuration->fields['cfgvalue']); define($configuration->fields['cfgkey'], $configuration->fields['cfgvalue']); // echo $configuration->fields['cfgkey'] . '#'; $configuration->MoveNext(); } // Load the database dependant query defines if (file_exists(DIR_WS_CLASSES . 'db/' . DB_TYPE . '/define_queries.php')) { include DIR_WS_CLASSES . 'db/' . DB_TYPE . '/define_queries.php'; } if (MODULE_PAYMENT_IPS_IPN_DEBUG == 'Yes') { mail(MODULE_PAYMENT_IPS_DEBUG_EMAIL_ADDRESS, 'IPN DEBUG MESSAGE', '0.1. Got past Configuration Load ' . $PHP_SELF); } // define general functions used application-wide require DIR_WS_FUNCTIONS . 'functions_general.php';
require 'config.php'; require 'language/' . DEFAULT_LANGUAGE . '/language.php'; require 'includes/functions.php'; require 'includes/db/' . DB_TYPE . '/query_factory.php'; $context_ref = isset($_GET['idx']) ? $_GET['idx'] : ''; // Load db class $db = new queryFactory(); if (!$db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE)) { echo $db->show_error() . '<br />'; die(NO_CONNECT_DB); } $current = check_version(); // make sure db is current with latest information files $result = false; if ($context_ref) { $result = $db->Execute("select doc_url from " . DB_PREFIX . "zh_search where doc_pos = '" . $context_ref . "'"); } $start_page = !$result ? DOC_ROOT_URL . '/' . DOC_HOME_PAGE : $result->fields['doc_url']; //$start_page = DOC_ROOT_URL . '/' . DOC_HOME_PAGE; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title><?php echo HEADING_TITLE; ?> </title> <link rel="stylesheet" href="css/phreehelp.css"> </head>
} elseif (strpos($line, 'DB_SERVER_PASSWORD')) { $db_pw = substr($line, strpos($line, ",") + 1, strpos($line, ")") - strpos($line, ",") - 1); } elseif (strpos($line, 'DB_SERVER_HOST')) { $db_server = substr($line, strpos($line, ",") + 1, strpos($line, ")") - strpos($line, ",") - 1); } } $db_user = str_replace("'", "", $db_user); $db_pw = str_replace("'", "", $db_pw); $db_server = str_replace("'", "", $db_server); $del_db = new queryFactory(); if (!$del_db->connect($db_server, $db_user, $db_pw, $db_name)) { $error = $messageStack->add(SETUP_CO_MGR_CANNOT_CONNECT, 'error'); } if (!$error) { $tables = array(); $table_list = $del_db->Execute("show tables"); while (!$table_list->EOF) { $tables[] = array_shift($table_list->fields); $table_list->MoveNext(); } if (is_array($tables)) { foreach ($tables as $table) { $del_db->Execute("drop table " . $table); } } $backup->delete_dir(DIR_FS_MY_FILES . $db_name); unset($_SESSION['companies'][$_POST['del_company']]); gen_add_audit_log(SETUP_CO_MGR_LOG . TEXT_DELETE, $db_name); $messageStack->add(SETUP_CO_MGR_DELETE_SUCCESS, 'success'); } }
require DIR_WS_INCLUDES . 'database_tables.php'; // include the list of compatibility issues require DIR_WS_FUNCTIONS . 'compatibility.php'; // include the list of extra database tables and filenames // include(DIR_WS_MODULES . 'extra_datafiles.php'); if ($za_dir = @dir(DIR_WS_INCLUDES . 'extra_datafiles')) { while ($zv_file = $za_dir->read()) { if (strstr($zv_file, '.php')) { require DIR_WS_INCLUDES . 'extra_datafiles/' . $zv_file; } } } // include the cache class require DIR_WS_CLASSES . 'cache.php'; $zc_cache = new cache(); $configuration = $db->Execute('select configuration_key as cfgkey, configuration_value as cfgvalue from ' . TABLE_CONFIGURATION, '', true, 150); while (!$configuration->EOF) { // define($configuration->fields['cfgkey'], $configuration->fields['cfgvalue']); define($configuration->fields['cfgkey'], $configuration->fields['cfgvalue']); // echo $configuration->fields['cfgkey'] . '#'; $configuration->MoveNext(); } $configuration = $db->Execute('select configuration_key as cfgkey, configuration_value as cfgvalue from ' . TABLE_PRODUCT_TYPE_LAYOUT); while (!$configuration->EOF) { define($configuration->fields['cfgkey'], $configuration->fields['cfgvalue']); $configuration->movenext(); } // Load the database dependant query defines if (file_exists(DIR_WS_CLASSES . 'db/' . DB_TYPE . '/define_queries.php')) { include DIR_WS_CLASSES . 'db/' . DB_TYPE . '/define_queries.php';
<?php if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } if ($this_is_home_page && FORUM_SIDEBOX_ENABLED) { $forum_db = new queryFactory(); if ($forum_db->connect(FORUM_DB_SERVER, FORUM_DB_SERVER_USERNAME, FORUM_DB_SERVER_PASSWORD, FORUM_DB_DATABASE, FORUM_USE_PCONNECT, false)) { $forum_article_sql = 'select topic_id,forum_id,topic_title from topics where topic_approved=1 order by topic_views desc,topic_time desc limit 3'; $forum_article_db = $forum_db->Execute($forum_article_sql); if ($forum_article_db->RecordCount() > 0) { $forum_articles = array(); while (!$forum_article_db->EOF) { $tmp_topic_link = sprintf(FORUM_ARTICLE_LINK, $forum_article_db->fields['forum_id'], $forum_article_db->fields['topic_id']); $forum_articles[] = array('topic_title' => $forum_article_db->fields['topic_title'], 'topic_link' => $tmp_topic_link); $forum_article_db->MoveNext(); } require $template->get_template_dir('tpl_forum_articles.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_forum_articles.php'; } } unset($forum_db); unset($forum_article_db); }
define('LANGUAGE', 'en_us'); } // load general language translation require DIR_FS_MODULES . 'general/language/' . LANGUAGE . '/language.php'; // include the list of project database tables require DIR_FS_INCLUDES . 'database_tables.php'; // include the list of project security tokens require DIR_FS_INCLUDES . 'security_tokens.php'; // include the database functions require DIR_FS_FUNCTIONS . 'database.php'; // Load queryFactory db classes require DIR_FS_CLASSES . 'db/' . DB_TYPE . '/query_factory.php'; $db = new queryFactory(); $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE); // set application wide parameters for phreebooks module $configuration = $db->Execute("select configuration_key as cfgKey, configuration_value as cfgValue\r\n\t\t\t\t\t\t\t from " . TABLE_CONFIGURATION); while (!$configuration->EOF) { define($configuration->fields['cfgKey'], $configuration->fields['cfgValue']); $configuration->MoveNext(); } // load currency classes require DIR_FS_CLASSES . 'currencies.php'; $currencies = new currencies(); // Include validation functions (right now only email address) require DIR_FS_FUNCTIONS . 'validations.php'; // setup our boxes require DIR_FS_CLASSES . 'table_block.php'; require DIR_FS_CLASSES . 'box.php'; // initialize the message stack for output messages require DIR_FS_CLASSES . 'message_stack.php'; $messageStack = new messageStack();
<?php if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } if ($this_is_home_page && BLOG_SIDEBOX_ENABLED) { $blog_db = new queryFactory(); if ($blog_db->connect(BLOG_DB_SERVER, BLOG_DB_SERVER_USERNAME, BLOG_DB_SERVER_PASSWORD, BLOG_DB_DATABASE, BLOG_USE_PCONNECT, false)) { $blog_article_sql = 'select post_title,id,post_content,post_author,post_date from wp_posts where post_type="post" and post_parent=0 order by comment_count desc limit 2'; $blog_article_db = $blog_db->Execute($blog_article_sql); if ($blog_article_db->RecordCount() > 0) { $blog_articles = array(); while (!$blog_article_db->EOF) { $blog_postdate = $blog_article_db->fields['post_date']; $blog_postdate = explode(' ', $blog_postdate); $blog_postdate = $blog_postdate[0]; $blog_link = sprintf(BLOG_ARTICLE_LINK, $blog_article_db->fields['id']); $blog_articles[] = array('title' => $blog_article_db->fields['post_title'], 'blog_link' => $blog_link, 'content' => $blog_article_db->fields['post_content'], 'author' => $blog_article_db->fields['post_author'], 'date' => $blog_postdate); $blog_article_db->MoveNext(); } /*$blog_articles=array('title'=>$blog_article_db->fields['post_title'], 'id'=>$blog_article_db->fields['id'], 'content'=>$blog_article_db->fields['post_content'], //'author'=>$blog_article_db->fields['post_author'], 'date'=>$blog_article_db->fields['post_date'] );*/ require $template->get_template_dir('tpl_blog_articles.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_blog_articles.php';
$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 // Check to see if this is v1.0.3/v1.0.4 ... ie, is it really Zen Cart? $sql = "select * from " . DB_PREFIX . "configuration where configuration_key = 'STORE_COUNTRY' and use_function='zen_get_country_name'"; $result = $db_test->Execute($sql); if (ZC_UPG_DEBUG == true) { echo 'v103-recordcount should be 1: ' . $result->RecordCount() . '<br>'; } if ($result->RecordCount() > 0) {
function table_exists_phpbb($table_name) { global $db; // Check to see if the requested PHPBB table exists, regardless of which database it's set to use $sql = "SHOW TABLES like '" . $table_name . "'"; $db_phpbb = new queryFactory(); $db_phpbb->connect($this->phpBB['dbhost'], $this->phpBB['dbuser'], $this->phpBB['dbpasswd'], $this->phpBB['dbname'], USE_PCONNECT, false); $tables = $db_phpbb->Execute($sql); //echo 'tables_found = '. $tables->RecordCount() .'<br>'; if ($tables->RecordCount() > 0) { $found_table = true; } $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false); return $found_table; }
$error = true; $messageStack->add('account_password', ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING); } if ($error == false) { $check_customer_query = "select customers_password, customers_nick\r\n from " . TABLE_CUSTOMERS . "\r\n where customers_id = '" . (int) $_SESSION['customer_id'] . "'"; $check_customer = $db->Execute($check_customer_query); if (zen_validate_password($password_current, $check_customer->fields['customers_password'])) { $nickname = $check_customer->fields['customers_nick']; $db->Execute("update " . TABLE_CUSTOMERS . " set customers_password = '******' where customers_id = '" . (int) $_SESSION['customer_id'] . "'"); $sql = "update " . TABLE_CUSTOMERS_INFO . "\r\n set customers_info_date_account_last_modified = now()\r\n where customers_info_id = '" . (int) $_SESSION['customer_id'] . "'"; $db->Execute($sql); if ($sniffer->phpBB['installed'] == true) { if (zen_not_null($nickname) && $nickname != '') { // require($sniffer->phpBB['phpbb_path'] . 'config.php'); $db_phpbb = new queryFactory(); $db_phpbb->connect($sniffer->phpBB['dbhost'], $sniffer->phpBB['dbuser'], $sniffer->phpBB['dbpasswd'], $sniffer->phpBB['dbname'], USE_PCONNECT, false); $sql = "update " . $sniffer->phpBB['users_table'] . " set user_password='******'\r\n where username = '******'"; $phpbb_users = $db_phpbb->Execute($sql); $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false); } } $messageStack->add_session('account', SUCCESS_PASSWORD_UPDATED, 'success'); zen_redirect(zen_href_link(FILENAME_ACCOUNT, '', 'SSL')); } else { $error = true; $messageStack->add('account_password', ERROR_CURRENT_PASSWORD_NOT_MATCHING); } } } $breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2);
$db->Close(); if (!($admin_name == $result->fields['admin_name']) || $admin_name == 'demo') { $zc_install->setError(ERROR_TEXT_ADMIN_PWD_REQUIRED, ERROR_CODE_ADMIN_PWD_REQUIRED, true); } if (!zen_validate_password($admin_pass, $result->fields['admin_pass'])) { $zc_install->setError(ERROR_TEXT_ADMIN_PWD_REQUIRED, ERROR_CODE_ADMIN_PWD_REQUIRED, true); } } // end admin verification if (ZC_UPG_DEBUG2 == true) { echo 'Processing prefix updates...<br />'; } if ($zc_install->error == false && $nothing_to_process == false) { $db = new queryFactory(); $db->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE) or die("Unable to connect to database"); $tables = $db->Execute("SHOW TABLES"); // get a list of tables to compare against $tables_list = array(); while (!$tables->EOF) { $tables_list[] = $tables->fields['Tables_in_' . DB_DATABASE]; $tables->MoveNext(); } //end while //read the "database_tables.php" files, and loop through the table names foreach ($database_tablenames_array as $filename) { if (!file_exists($filename)) { continue; } $lines = file($filename); foreach ($lines as $line) { $line = trim($line);
} } } // include the cache class require DIR_FS_CATALOG . DIR_WS_CLASSES . 'cache.php'; $zc_cache = new cache(); // Load db classes // Load queryFactory db classes require DIR_FS_CATALOG . DIR_WS_CLASSES . 'db/' . DB_TYPE . '/query_factory.php'; $db = new queryFactory(); $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE); $zc_cache->sql_cache_flush_cache(); // Define the project version (must come after db class is loaded) require DIR_FS_CATALOG . DIR_WS_INCLUDES . 'version.php'; // Determine the DATABASE patch level $project_db_info = $db->Execute('select * from ' . TABLE_PROJECT_VERSION . ' WHERE project_version_key = "Zen-Cart Database" '); define('PROJECT_DB_VERSION_MAJOR', $project_db_info->fields['project_version_major']); define('PROJECT_DB_VERSION_MINOR', $project_db_info->fields['project_version_minor']); define('PROJECT_DB_VERSION_PATCH1', $project_db_info->fields['project_version_patch1']); define('PROJECT_DB_VERSION_PATCH2', $project_db_info->fields['project_version_patch2']); define('PROJECT_DB_VERSION_PATCH1_SOURCE', $project_db_info->fields['project_version_patch1_source']); define('PROJECT_DB_VERSION_PATCH2_SOURCE', $project_db_info->fields['project_version_patch2_source']); // set application wide parameters $configuration = $db->Execute('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION); while (!$configuration->EOF) { define($configuration->fields['cfgKey'], $configuration->fields['cfgValue']); $configuration->MoveNext(); } // set product type layout paramaters $configuration = $db->Execute('select configuration_key as cfgKey, configuration_value as cfgValue
die("No database name passed! Cannot determine which company to connect to!"); } // set the language $_SESSION['language'] = $_GET['lang'] ? $_GET['lang'] : 'en_us'; define('LANGUAGE', $_SESSION['language']); gen_pull_language('phreedom'); require_once DIR_FS_ADMIN . 'soap/language/' . LANGUAGE . '/language.php'; // include the database functions // Load queryFactory db classes require_once DIR_FS_ADMIN . 'includes/db/' . DB_TYPE . '/query_factory.php'; $db = new queryFactory(); if (!$db->connect(DB_SERVER_HOST, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE)) { die('cannot connec to db!'); } // set application wide parameters for phreebooks module $configuration = $db->Execute("select configuration_key, configuration_value from " . DB_PREFIX . "configuration"); while (!$configuration->EOF) { define($configuration->fields['configuration_key'], $configuration->fields['configuration_value']); $configuration->MoveNext(); } // load general language translation gen_pull_language('phreedom', 'menu'); require_once DIR_FS_MODULES . 'phreedom/config.php'; $dirs = scandir(DIR_FS_MODULES); foreach ($dirs as $dir) { // first pull all module language files, loaded or not if ($dir == '.' || $dir == '..') { continue; } if (is_dir(DIR_FS_MODULES . $dir)) { gen_pull_language($dir, 'menu');
session_write_close(); if (file_exists('zc_install/index.php')) { header('location: zc_install/index.php'); exit; } elseif (file_exists($down_for_maint_source)) { if (defined('HTTP_SERVER') && defined('DIR_WS_CATALOG')) { header('location: ' . HTTP_SERVER . DIR_WS_CATALOG . $down_for_maint_source); } else { header('location: ' . $down_for_maint_source); // header('location: mystoreisdown.html'); } exit; } else { exit; } } // Do a quick sanity check that system tables exist if (defined('SQL_CACHE_METHOD') && SQL_CACHE_METHOD == 'database') { $sql = "SHOW TABLES LIKE '" . TABLE_DB_CACHE . "'"; } else { $sql = "SHOW TABLES LIKE '" . TABLE_PROJECT_VERSION . "'"; } $db->dieOnErrors = FALSE; $result = $db->Execute($sql, FALSE, FALSE); if ($result->RecordCount() == 0) { if (defined('ERROR_DATABASE_MAINTENANCE_NEEDED')) { die(ERROR_DATABASE_MAINTENANCE_NEEDED); } die('<a href="http://www.zen-cart.com/content.php?334-ERROR-0071-There-appears-to-be-a-problem-with-the-database-Maintenance-is-required" target="_blank">ERROR 0071: There appears to be a problem with the database. Maintenance is required.</a>'); } $db->dieOnErrors = TRUE;
if (isset($_POST['check_for_updates']) && $_POST['check_for_updates'] == '1') { $check_for_updates = 1; } else { $check_for_updates = 0; } $zc_install->isEmpty($admin_username, ERROR_TEXT_ADMIN_USERNAME_ISEMPTY, ERROR_CODE_ADMIN_USERNAME_ISEMPTY); $zc_install->isEmpty($admin_email, ERROR_TEXT_ADMIN_EMAIL_ISEMPTY, ERROR_CODE_ADMIN_EMAIL_ISEMPTY); $zc_install->isEmail($admin_email, ERROR_TEXT_ADMIN_EMAIL_NOTEMAIL, ERROR_CODE_ADMIN_EMAIL_NOTEMAIL); $zc_install->isEmpty($admin_pass, ERROR_TEXT_ADMIN_PASS_ISEMPTY, ERROR_CODE_ADMIN_PASS_ISEMPTY); $zc_install->isEqual($admin_pass, $admin_pass_confirm, ERROR_TEXT_ADMIN_PASS_NOTEQUAL, ERROR_CODE_ADMIN_PASS_NOTEQUAL); if (!$zc_install->error) { 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"); $sql = "update " . DB_PREFIX . "admin set admin_name = '" . $admin_username . "', admin_email = '" . $admin_email . "', admin_pass = '******' where admin_id = 1"; $db->Execute($sql) or die("Error in query: {$sql}" . $db->ErrorMsg()); // enable/disable automatic version-checking $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . ($check_for_updates ? 'true' : 'false') . "' where configuration_key = 'SHOW_VERSION_UPDATE_IN_HEADER'"; $db->Execute($sql) or die("Error in query: {$sql}" . $db->ErrorMsg()); $db->Close(); header('location: index.php?main_page=finished&language=' . $language); exit; } } if (!isset($_POST['admin_username'])) { $_POST['admin_username'] = ''; } if (!isset($_POST['admin_email'])) { $_POST['admin_email'] = ''; } setInputValue($_POST['admin_username'], 'ADMIN_USERNAME_VALUE', '');
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) { $zone_string .= '<option value="' . $zone->fields['zone_id'] . '"' . setSelected($zone->fields['zone_id'], $_POST['store_zone']) . '>' . $zone->fields['zone_name'] . '</option>'; $zone->MoveNext(); }
$messageStack->add(SETUP_CO_MGR_ERROR_2, 'error'); break; } } // create the new directory and sub-directories if (!install_build_dirs($company, $cb_demo)) { $messageStack->add(SETUP_CO_MGR_ERROR_3, 'error'); break; } // create the config.php file and update COMPANY_NAME configuration parameter in table install_build_co_config_file(DB_DATABASE, DB_DATABASE . '_TITLE', $company_name); install_build_co_config_file(DB_DATABASE, 'DB_SERVER_USERNAME', $db_user); install_build_co_config_file(DB_DATABASE, 'DB_SERVER_PASSWORD', $db_pw); install_build_co_config_file(DB_DATABASE, 'DB_SERVER', $db_server); $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $company_name . "' where configuration_key = 'COMPANY_NAME'"; $db->Execute($sql); $temp_file = DIR_FS_ADMIN . 'my_files/' . $company . '/temp/temp.sql'; if ($action == 'copy') { if ($cb_all || $cb_inventory) { // duplicate the inventory table since new fields may have been entered if (!copy_db_table($db_old, array('inventory'), $temp_file, 'structure')) { $error = true; } } if ($cb_all && !$error) { $result = $db->Execute("show tables"); // pull table list from new install to avoid PhreeHelp tables $table_list = array(); while (!$result->EOF) { $table_list[] = array_shift($result->fields); $result->MoveNext();