function delete_categories($categories_ids) { global $db, $table_prefix; // additional connection $dbs = new VA_SQL(); $dbs->DBType = $db->DBType; $dbs->DBDatabase = $db->DBDatabase; $dbs->DBHost = $db->DBHost; $dbs->DBPort = $db->DBPort; $dbs->DBUser = $db->DBUser; $dbs->DBPassword = $db->DBPassword; $dbs->DBPersistent = $db->DBPersistent; $categories = array(); $sql = " SELECT category_id,category_path FROM " . $table_prefix . "categories "; $sql .= " WHERE category_id IN (" . $db->tosql($categories_ids, INTEGERS_LIST) . ") "; $dbs->query($sql); while ($dbs->next_record()) { $category_id = $dbs->f("category_id"); $category_path = $dbs->f("category_path"); if (!in_array($category_id, $categories)) { $categories[] = $category_id; $sql = " SELECT category_id FROM " . $table_prefix . "categories "; $sql .= " WHERE category_path LIKE '" . $db->tosql($category_path . $category_id . ",", TEXT, false) . "%'"; $db->query($sql); while ($db->next_record()) { $categories[] = $db->f("category_id"); } } } if (is_array($categories) && sizeof($categories) > 0) { $categories_ids = join(",", $categories); $db->query("DELETE FROM " . $table_prefix . "categories WHERE category_id IN (" . $db->tosql($categories_ids, INTEGERS_LIST) . ")"); $db->query("DELETE FROM " . $table_prefix . "items_categories WHERE category_id IN (" . $db->tosql($categories_ids, INTEGERS_LIST) . ")"); $db->query("DELETE FROM " . $table_prefix . "categories_user_types WHERE category_id IN (" . $db->tosql($categories_ids, INTEGERS_LIST) . ")"); $db->query("DELETE FROM " . $table_prefix . "categories_subscriptions WHERE category_id IN (" . $db->tosql($categories_ids, INTEGERS_LIST) . ")"); $db->query("DELETE FROM " . $table_prefix . "categories_sites WHERE category_id IN (" . $db->tosql($categories_ids, INTEGERS_LIST) . ")"); $db->query("DELETE FROM " . $table_prefix . "categories_columns WHERE category_id IN (" . $db->tosql($categories_ids, INTEGERS_LIST) . ")"); } // delete products that are not assigned to any category $sql = " SELECT i.item_id FROM (" . $table_prefix . "items i "; $sql .= " LEFT JOIN " . $table_prefix . "items_categories ic ON i.item_id=ic.item_id) "; $sql .= " WHERE ic.category_id IS NULL "; $dbs->query($sql); while ($dbs->next_record()) { $item_id = $dbs->f("item_id"); delete_products($item_id); } }
$google_base_product_condition = get_setting_value($settings, "google_base_product_condition", "new"); $gb_global_type_id = get_setting_value($settings, "google_base_product_type_id", 0); $gb_global_type = ""; if ($gb_global_type_id) { $sql = " SELECT type_name FROM " . $table_prefix . "google_base_types "; $sql .= " WHERE type_id=" . $db->tosql($gb_global_type_id, INTEGER); $gb_global_type = get_db_value($sql); } $site_url = get_setting_value($settings, "site_url"); $friendly_urls = get_setting_value($settings, "friendly_urls", 0); $friendly_extension = get_setting_value($settings, "friendly_extension", ""); $product_link = $site_url . get_custom_friendly_url("product_details.php") . "?item_id="; $current_date = getdate(); $expiration_date = mktime($current_date["hours"], $current_date["minutes"], $current_date["seconds"], $current_date["mon"], $current_date["mday"] + $google_base_days_expiry, $current_date["year"]); $expiration_date_formatted = date("Y-m-d", $expiration_date); $dbd = new VA_SQL(); $dbd->DBType = $db->DBType; $dbd->DBDatabase = $db->DBDatabase; $dbd->DBUser = $db->DBUser; $dbd->DBPassword = $db->DBPassword; $dbd->DBHost = $db->DBHost; $dbd->DBPort = $db->DBPort; $dbd->DBPersistent = $db->DBPersistent; // write in file or output to the browser $write_to_file = false; if ($google_base_export_type == 1 && $google_base_ftp_login && $google_base_ftp_password) { $fp = fopen($google_base_save_path . $google_base_filename, "w+"); if (!$fp) { echo MODULE_COULDNT_WRITE_TO_MSG . $google_base_save_path . $google_base_filename . CHECK_PERMISSIONS_MSG . "<br/>"; fclose($fp); exit;
// prepare categories for items table $categories = array(); if ($table == "items") { $sql = "SELECT category_id,category_name FROM " . $table_prefix . "categories "; $db->query($sql); while ($db->next_record()) { $category_id = $db->f("category_id"); $category_name = $db->f("category_name"); if ($apply_translation) { $category_name = get_translation($category_name); } $categories[$category_id] = $category_name; } } // connection for additional operations $dbh = new VA_SQL(); $dbh->DBType = $db->DBType; $dbh->DBDatabase = $db->DBDatabase; $dbh->DBUser = $db->DBUser; $dbh->DBPassword = $db->DBPassword; $dbh->DBHost = $db->DBHost; $dbh->DBPort = $db->DBPort; $dbh->DBPersistent = $db->DBPersistent; $columns = array(); $total_columns = get_param("total_columns"); $columns_selected = 0; $db_column = 0; $columns_list = ""; $csv_columns_list = ""; $exported_fields = ""; // generate db columns list
<?php include_once "../includes/var_definition.php"; include_once "../includes/constants.php"; include_once "../includes/db_{$db_lib}.php"; header('Content-Type: text/html; charset=iso-8859-1'); $db = new VA_SQL(); $db->DBType = $db_type; $db->DBDatabase = $db_name; $db->DBHost = $db_host; $db->DBPort = $db_port; $db->DBUser = $db_user; $db->DBPassword = $db_password; $db->DBPersistent = $db_persistent; $sql = " SELECT article_id, article_title, short_description FROM va_articles WHERE article_id IN (SELECT article_id FROM va_articles_assigned WHERE category_id = 43) AND status_id = 2 "; $db->query($sql); ?> <ul class="DetailTabs"><li class="tab tabActive"><a id="desc_a_tab" href="#" class="tab tabActive">Questions on Ordering, Shipping and Returns</a></li><li class="tab" id="reviews_td_tab"><a href="#" class="tab">Questions on Stenciling and Paint</a></li></ul> <div style="display: none;" id="faqData2"> <?php while ($db->next_record()) { echo '<div class="accordionButton" name="' . $db->f("article_id") . '">' . $db->f("article_title") . '</div> <div class="accordionContent" style="display: none;">' . $db->f("short_description") . '</div>'; } ?> </div> <?php $sql = " SELECT article_id, article_title, short_description FROM va_articles WHERE article_id IN (SELECT article_id FROM va_articles_assigned WHERE category_id = 42) AND status_id = 2 "; $db->query($sql); ?> <div style="display: none;" id="faqData">
<?php include_once "../includes/common_functions.php"; include_once "../includes/var_definition.php"; include_once "../includes/constants.php"; include_once "../includes/db_{$db_lib}.php"; session_start(); $db = new VA_SQL(); $db->DBType = $db_type; $db->DBDatabase = $db_name; $db->DBHost = $db_host; $db->DBPort = $db_port; $db->DBUser = $db_user; $db->DBPassword = $db_password; $db->DBPersistent = $db_persistent; if (isset($_REQUEST['action']) && $_REQUEST['action'] == "add" && isset($_REQUEST['item_id']) && is_numeric($_REQUEST['item_id']) && isset($_REQUEST['item_name']) && isset($_REQUEST['quantity']) && isset($_REQUEST['price'])) { $duplicates = false; if (isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id'])) { $user_id = get_session("session_user_id") ? get_session("session_user_id") : $_REQUEST['user_id']; $product_dup_query = "SELECT * FROM va_saved_items WHERE item_id = " . $_REQUEST['item_id'] . " AND user_id = " . $user_id; $db->query($product_dup_query); $duplicates = $db->next_record(); } else { $id_query = "SELECT MAX(user_id) AS last_user_id FROM va_saved_items"; $db->query($id_query); $db->next_record(); $user_id = $db->f("last_user_id") < 444444444 ? 444444444 : $db->f("last_user_id") + 1; } if (!$duplicates) { $sql = "INSERT INTO `va_saved_items` (`cart_item_id`, `site_id`, `item_id`, `cart_id`, `user_id`, `type_id`, `item_name`, `quantity`, `quantity_bought`, `price`,`date_added`) VALUES (NULL, 1, '" . $_REQUEST['item_id'] . "', 0, '" . $user_id . "', '1', '" . $_REQUEST['item_name'] . "', '" . $_REQUEST['quantity'] . "', 0, '" . $_REQUEST['price'] . "', NOW())"; $db->query($sql);
**************************************************************************** */ include_once "./admin_config.php"; include_once $root_folder_path . "includes/common.php"; include_once $root_folder_path . "includes/sorter.php"; include_once $root_folder_path . "includes/navigator.php"; include_once $root_folder_path . "includes/record.php"; include_once $root_folder_path . "includes/shopping_cart.php"; include_once $root_folder_path . "includes/order_items.php"; include_once $root_folder_path . "includes/order_links.php"; include_once $root_folder_path . "includes/parameters.php"; include_once $root_folder_path . "messages/" . $language_code . "/cart_messages.php"; include_once "./admin_common.php"; check_admin_security("sales_orders"); //Customization by Vital $dbp = new VA_SQL(); $dbp->DBType = $db_type; $dbp->DBDatabase = $db_name; $dbp->DBHost = $db_host; $dbp->DBPort = $db_port; $dbp->DBUser = $db_user; $dbp->DBPassword = $db_password; $dbp->DBPersistent = $db_persistent; //END customization $orders_currency = get_setting_value($settings, "orders_currency", 0); $permissions = get_permissions(); $operation = get_param("operation"); $orders_ids = get_param("orders_ids"); $status_id = get_param("status_id"); $orders_errors = ""; $recurring_errors = "";
set_session("session_cc_number_first", ""); set_session("session_cc_number_last", ""); set_session("session_cc_code", ""); // Begin google analytics ecommerce $google_analytics = get_setting_value($settings, "google_analytics", 0); $google_tracking_code = get_setting_value($settings, "google_tracking_code", ""); if ($paid_status && $google_analytics && $google_tracking_code) { $t->set_var("google_order_id", $order_id); $t->set_var("google_affiliation", str_replace("\"", "\\\"", htmlspecialchars($affiliate_code))); $t->set_var("google_total", $order_total); $t->set_var("google_tax", $tax_total); $t->set_var("google_shipping", $shipping_cost); $t->set_var("google_city", str_replace("\"", "\\\"", htmlspecialchars($delivery_city))); $t->set_var("google_state", str_replace("\"", "\\\"", htmlspecialchars($variables["delivery_state"]))); $t->set_var("google_country", str_replace("\"", "\\\"", htmlspecialchars($variables["delivery_country"]))); $dbh = new VA_SQL(); $dbh->DBType = $db_type; $dbh->DBDatabase = $db_name; $dbh->DBHost = $db_host; $dbh->DBPort = $db_port; $dbh->DBUser = $db_user; $dbh->DBPassword = $db_password; $dbh->DBPersistent = $db_persistent; $sql = " SELECT item_id,item_code,manufacturer_code,item_name,"; $sql .= " price,quantity"; $sql .= " FROM " . $table_prefix . "orders_items WHERE order_id=" . $db->tosql($order_id, INTEGER); $db->query($sql); while ($db->next_record()) { $google_item_id = $db->f("item_id"); $google_item_name = $db->f("item_name"); //$google_sku_code = $db->f("manufacturer_code");
<?php if (isset($_REQUEST['id']) && isset($_REQUEST['rating']) && is_numeric($_REQUEST['id']) && is_numeric($_REQUEST['rating'])) { include_once "../includes/var_definition.php"; include_once "../includes/constants.php"; include_once "../includes/db_{$db_lib}.php"; include_once "../includes/common_functions.php"; $db = new VA_SQL(); $db->DBType = $db_type; $db->DBDatabase = $db_name; $db->DBHost = $db_host; $db->DBPort = $db_port; $db->DBUser = $db_user; $db->DBPassword = $db_password; $db->DBPersistent = $db_persistent; $product_id = $db->tosql($_REQUEST['id'], INTEGER); $sql = "INSERT INTO `va_reviews` (`review_id`, `item_id`, `user_id`, `admin_id`, `recommended`, `approved`, `rating`, `summary`, `user_name`, `user_email`, `remote_address`, `comments`, `admin_id_approved_by`, `admin_id_modified_by`, `date_added`, `date_modified`, `date_approved`) VALUES (NULL, '" . $product_id . "', '0', '0', '1', '1', '" . $db->tosql($_REQUEST['rating'], INTEGER) . "', 'Web', 'Visitor', '*****@*****.**', '" . $_SERVER['REMOTE_ADDR'] . "', 'Fantastic product', NULL, NULL, NOW(), NOW(), NOW())"; $db->query($sql); $votes = get_db_value("SELECT COUNT(*) FROM " . $table_prefix . "reviews WHERE approved=1 AND rating <> 0 AND item_id=" . $product_id); $points = get_db_value("SELECT SUM(rating) FROM " . $table_prefix . "reviews WHERE approved=1 AND rating <> 0 AND item_id=" . $product_id); $sql = "UPDATE " . $table_prefix . "items SET votes=" . $votes . ", points=" . $points . " WHERE item_id=" . $product_id; $db->query($sql); } else { echo "Wrong or missing parameters"; header('HTTP', true, 500); }
$query_symbol = '?'; } foreach ($languages as $language_code) { $language_item_url = $item_url . $query_symbol . 'language_code=' . $language_code; xml_add_url($language_item_url, $date_modified); } } } } } } // Ads // Manual if ($va_version_code & 36) { if ($show_manual_categories || $show_manuals || $show_manual_articles) { $dbm = new VA_SQL(); $dbm->DBType = $db_type; $dbm->DBDatabase = $db_name; $dbm->DBUser = $db_user; $dbm->DBPassword = $db_password; $dbm->DBHost = $db_host; $dbm->DBPort = $db_port; $dbm->DBPersistent = $db_persistent; $sql = " SELECT c.category_id, c.friendly_url, c.date_added, c.date_modified "; $sql .= " FROM "; if ($multisites_version && isset($site_id)) { if (isset($site_id)) { $sql .= "("; } } $sql .= $table_prefix . "manuals_categories c ";
function sync_wishlist($user_id) { if (isset($_COOKIE['wishlist_user_id']) && is_numeric($_COOKIE['wishlist_user_id'])) { global $db, $table_prefix; $dba = new VA_SQL(); $dba->DBType = $db->DBType; $dba->DBDatabase = $db->DBDatabase; $dba->DBUser = $db->DBUser; $dba->DBPassword = $db->DBPassword; $dba->DBHost = $db->DBHost; $dba->DBPort = $db->DBPort; $dba->DBPersistent = $db->DBPersistent; // 1st sync step: add cookie wishlist items to user wishlist items by updating the user_id $sql = "UPDATE " . $table_prefix . "saved_items SET user_id=" . $db->tosql($user_id, INTEGER) . " WHERE user_id=" . $db->tosql($_COOKIE['wishlist_user_id'], INTEGER) . " AND item_id NOT IN (SELECT item_id FROM (SELECT DISTINCT item_id FROM va_saved_items WHERE user_id = " . $db->tosql($user_id, INTEGER) . ") AS tmptable)"; $dba->query($sql); // 2nd sync step: get and load items to the cookie wishlist $sql = "SELECT DISTINCT item_id, item_name, quantity, price, date_added FROM " . $table_prefix . "saved_items WHERE user_id=" . $db->tosql($user_id, INTEGER) . " AND item_id NOT IN (SELECT item_id FROM (SELECT DISTINCT item_id FROM va_saved_items WHERE user_id = " . $db->tosql($_COOKIE['wishlist_user_id'], INTEGER) . ") AS tmptable)"; $dba->query($sql); if ($dba->next_record()) { $wishlist_item_values = "(NULL, 1, '" . $dba->f("item_id") . "', 0, '" . $dba->tosql($_COOKIE['wishlist_user_id'], INTEGER) . "', '1', '" . $dba->f("item_name") . "', '" . $dba->f("quantity") . "', 0, '" . $dba->f("price") . "', TIMESTAMP('" . $dba->f("date_added") . "'))"; while ($dba->next_record()) { $wishlist_item_values .= ",(NULL, 1, '" . $dba->f("item_id") . "', 0, '" . $dba->tosql($_COOKIE['wishlist_user_id'], INTEGER) . "', '1', '" . $dba->f("item_name") . "', '" . $dba->f("quantity") . "', 0, '" . $dba->f("price") . "', TIMESTAMP('" . $dba->f("date_added") . "'))"; } $sql = "INSERT INTO `va_saved_items` (`cart_item_id`, `site_id`, `item_id`, `cart_id`, `user_id`, `type_id`, `item_name`, `quantity`, `quantity_bought`, `price`, `date_added`) VALUES " . $wishlist_item_values; $dba->query($sql); } } }