function getConfigValue($gID, $cID) { global $filter; $configuration_query = smn_db_query("select configuration_value, use_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . $cID . "' and configuration_group_id = '" . (int) $gID . "'" . $filter . " order by sort_order"); $configuration = smn_db_fetch_array($configuration_query); if (smn_not_null($configuration['use_function'])) { $use_function = $configuration['use_function']; if (ereg('->', $use_function)) { $class_method = explode('->', $use_function); if (!is_object(${$class_method[0]})) { include DIR_WS_CLASSES . $class_method[0] . '.php'; ${$class_method[0]} = new $class_method[0](); } $cfgValue = smn_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]}); } else { $cfgValue = smn_call_function($use_function, $configuration['configuration_value']); } } else { $cfgValue = $configuration['configuration_value']; } if (empty($cfgValue) && !is_numeric($cfgValue)) { $cfgValue = ' '; } return $cfgValue; }
function ups() { global $store_id, $order; $this->code = 'ups'; $this->title = MODULE_SHIPPING_UPS_TEXT_TITLE; $this->description = MODULE_SHIPPING_UPS_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_UPS_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_ups.gif'; $this->tax_class = MODULE_SHIPPING_UPS_TAX_CLASS; $this->enabled = MODULE_SHIPPING_UPS_STATUS == 'True' ? true : false; if ($this->enabled == true && (int) MODULE_SHIPPING_UPS_ZONE > 0) { $check_flag = false; $check_query = smn_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_UPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' and store_id = '" . $store_id . "' order by zone_id"); while ($check = smn_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } $this->types = array('1DM' => 'Next Day Air Early AM', '1DML' => 'Next Day Air Early AM Letter', '1DA' => 'Next Day Air', '1DAL' => 'Next Day Air Letter', '1DAPI' => 'Next Day Air Intra (Puerto Rico)', '1DP' => 'Next Day Air Saver', '1DPL' => 'Next Day Air Saver Letter', '2DM' => '2nd Day Air AM', '2DML' => '2nd Day Air AM Letter', '2DA' => '2nd Day Air', '2DAL' => '2nd Day Air Letter', '3DS' => '3 Day Select', 'GND' => 'Ground', 'GNDCOM' => 'Ground Commercial', 'GNDRES' => 'Ground Residential', 'STD' => 'Canada Standard', 'XPR' => 'Worldwide Express', 'XPRL' => 'worldwide Express Letter', 'XDM' => 'Worldwide Express Plus', 'XDML' => 'Worldwide Express Plus Letter', 'XPD' => 'Worldwide Expedited'); }
function smn_get_header_tag_products_desc($product_id) { global $languages_id, $_GET; $product_header_tags = smn_db_query("select products_head_desc_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . (int) $languages_id . "' and products_id = '" . (int) $_GET['products_id'] . "'"); $product_header_tags_values = smn_db_fetch_array($product_header_tags); return $product_header_tags_values['products_head_desc_tag']; }
function usps() { global $order, $store_id; $this->code = 'usps'; $this->title = MODULE_SHIPPING_USPS_TEXT_TITLE; $this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_USPS_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_usps.gif'; $this->tax_class = MODULE_SHIPPING_USPS_TAX_CLASS; $this->enabled = MODULE_SHIPPING_USPS_STATUS == 'True' ? true : false; if ($this->enabled == true && (int) MODULE_SHIPPING_USPS_ZONE > 0) { $check_flag = false; $check_query = smn_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_USPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' and store_id = '" . $store_id . "' order by zone_id"); while ($check = smn_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } $this->types = array('Express' => 'EXPRESS', 'First Class' => 'First-Class Mail', 'Priority' => 'Priority', 'Parcel' => 'Parcel', 'BPM' => 'Bound Printed Material', 'Library' => 'Library', 'Media' => 'Media Mail'); $this->intl_types = array('GXG Document' => 'Global Express Guaranteed Document Service', 'GXG Non-Document' => 'Global Express Guaranteed Non-Document Service', 'Express' => 'Global Express Mail (EMS)', 'Priority Lg' => 'Global Priority Mail - Flat-rate Envelope (Large)', 'Priority Sm' => 'Global Priority Mail - Flat-rate Envelope (Small)', 'Priority Var' => 'Global Priority Mail - Variable Weight (Single)', 'Airmail Letter' => 'Airmail Letter Post', 'Airmail Parcel' => 'Airmail Parcel Post', 'Surface Letter' => 'Economy (Surface) Letter Post', 'Surface Post' => 'Economy (Surface) Parcel Post'); $this->countries = $this->country_list(); }
function affiliate_insert($sql_data_array, $affiliate_parent = 0) { // LOCK TABLES smn_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE"); if ($affiliate_parent > 0) { $affiliate_root_query = smn_db_query("select affiliate_root, affiliate_rgt, affiliate_lft�from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' "); // Check if we have a parent affiliate if ($affiliate_root_array = smn_db_fetch_array($affiliate_root_query)) { smn_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . " AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " "); smn_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " "); $sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root']; $sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt']; $sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1; smn_db_perform(TABLE_AFFILIATE, $sql_data_array); $affiliate_id = smn_db_insert_id(); } // no parent -> new root } else { $sql_data_array['affiliate_lft'] = '1'; $sql_data_array['affiliate_rgt'] = '2'; smn_db_perform(TABLE_AFFILIATE, $sql_data_array); $affiliate_id = smn_db_insert_id(); smn_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' "); } // UNLOCK TABLES smn_db_query("UNLOCK TABLES"); return $affiliate_id; }
function freeshipper() { global $order, $cart, $store_id; $this->code = 'freeshipper'; $this->title = MODULE_SHIPPING_FREESHIPPER_TEXT_TITLE; $this->description = MODULE_SHIPPING_FREESHIPPER_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FREESHIPPER_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_free_shipper.jpg'; $this->tax_class = MODULE_SHIPPING_FREESHIPPER_TAX_CLASS; $this->enabled = MODULE_SHIPPING_FREESHIPPER_STATUS == 'True' ? true : false; // Only show if weight is 0 $this->enabled = MODULE_SHIPPING_FREESHIPPER_STATUS; if ($this->enabled == true && (int) MODULE_SHIPPING_FREESHIPPER_ZONE > 0) { $check_flag = false; $check_query = smn_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREESHIPPER_ZONE . "' and store_id = '" . $store_id . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = smn_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } }
function smn_update_whos_online() { global $customer_id; if (smn_session_is_registered('customer_id')) { $wo_customer_id = $customer_id; $customer_query = smn_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'"); $customer = smn_db_fetch_array($customer_query); $wo_full_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname']; } else { $wwo_full_name = 'Guest'; } $wo_session_id = smn_session_id(); $wo_ip_address = getenv('REMOTE_ADDR'); $wo_last_page_url = getenv('REQUEST_URI'); $current_time = time(); $xx_mins_ago = $current_time - 900; // remove entries that have expired smn_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'"); $stored_customer_query = smn_db_query("select count(*) as count from " . TABLE_WHOS_ONLINE . " where session_id = '" . smn_db_input($wo_session_id) . "'"); $stored_customer = smn_db_fetch_array($stored_customer_query); if ($stored_customer['count'] > 0) { smn_db_query("update " . TABLE_WHOS_ONLINE . " set customer_id = '" . (int) $wo_customer_id . "', full_name = '" . smn_db_input($wo_full_name) . "', ip_address = '" . smn_db_input($wo_ip_address) . "', time_last_click = '" . smn_db_input($current_time) . "', last_page_url = '" . smn_db_input($wo_last_page_url) . "' where session_id = '" . smn_db_input($wo_session_id) . "'"); } else { smn_db_query("insert into " . TABLE_WHOS_ONLINE . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values ('" . (int) $wo_customer_id . "', '" . smn_db_input($wo_full_name) . "', '" . smn_db_input($wo_session_id) . "', '" . smn_db_input($wo_ip_address) . "', '" . smn_db_input($current_time) . "', '" . smn_db_input($current_time) . "', '" . smn_db_input($wo_last_page_url) . "')"); } }
function freeshipper() { global $order, $cart; $this->code = 'freeshipper'; $this->title = MODULE_SHIPPING_FREESHIPPER_TEXT_TITLE; $this->description = MODULE_SHIPPING_FREESHIPPER_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FREESHIPPER_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_free_shipper.jpg'; $this->tax_class = MODULE_SHIPPING_FREESHIPPER_TAX_CLASS; $this->enabled = MODULE_SHIPPING_FREESHIPPER_STATUS == 'True' ? true : false; $this->single = MODULE_SHIPPING_FREESHIPPER_SINGLE_CHECKOUT == 'True' ? true : false; // Only show if weight is 0 // if ( (!strstr($PHP_SELF,'modules.php')) || $cart->show_weight()==0) { $this->enabled = MODULE_SHIPPING_FREESHIPPER_STATUS; if ($this->enabled == true && (int) MODULE_SHIPPING_FREESHIPPER_ZONE > 0) { $check_flag = false; $check_query = smn_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREESHIPPER_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' and store_id = '" . $store_id . "' order by zone_id"); while ($check = smn_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } // } // EOF: WebMakers.com Added: Free Payments and Shipping }
function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows) { if (empty($current_page_number)) { $current_page_number = 1; } if (!isset($query_num_rows)) { $pos_to = strlen($sql_query); $pos_from = strpos($sql_query, ' from', 0); $pos_group_by = strpos($sql_query, ' group by', $pos_from); if ($pos_group_by < $pos_to && $pos_group_by != false) { $pos_to = $pos_group_by; } $pos_having = strpos($sql_query, ' having', $pos_from); if ($pos_having < $pos_to && $pos_having != false) { $pos_to = $pos_having; } $pos_order_by = strpos($sql_query, ' order by', $pos_from); if ($pos_order_by < $pos_to && $pos_order_by != false) { $pos_to = $pos_order_by; } $reviews_count_query = smn_db_query("select count(*) as total " . substr($sql_query, $pos_from, $pos_to - $pos_from)); $reviews_count = smn_db_fetch_array($reviews_count_query); $query_num_rows = $reviews_count['total']; } $num_pages = ceil($query_num_rows / $max_rows_per_page); if ($current_page_number > $num_pages) { $current_page_number = $num_pages; } $offset = max($max_rows_per_page * ($current_page_number - 1), 0); // systemsmanager begin - Dec 1, 2005 security patch // $sql_query .= " limit " . $offset . ", " . $max_rows_per_page; $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page; // systemsmanager end }
function table() { global $store_id, $order; $this->code = 'table'; $this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE; $this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS; $this->enabled = MODULE_SHIPPING_TABLE_STATUS == 'True' ? true : false; if ($this->enabled == true && (int) MODULE_SHIPPING_TABLE_ZONE > 0) { $check_flag = false; $check_query = smn_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' and store_id = '" . $store_id . "' order by zone_id"); while ($check = smn_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } }
function query($order_id) { global $store_id; $order_query = smn_db_query("select customers_name, customers_company, customers_street_address, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where store_id = '" . $store_id . "' and orders_id = '" . (int) $order_id . "'"); $order = smn_db_fetch_array($order_query); $totals_query = smn_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order"); while ($totals = smn_db_fetch_array($totals_query)) { $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text']); } $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']); $this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']); $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id']); $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id']); $index = 0; $orders_products_query = smn_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "'"); while ($orders_products = smn_db_fetch_array($orders_products_query)) { $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); $subindex = 0; $attributes_query = smn_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'"); if (smn_db_num_rows($attributes_query)) { while ($attributes = smn_db_fetch_array($attributes_query)) { $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']); $subindex++; } } $index++; } }
function update_status() { global $order, $store_id; if ($this->enabled == true && (int) MODULE_PAYMENT_COD_ZONE > 0) { $check_flag = false; $check_query = smn_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COD_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' and store_id = '" . $store_id . "' order by zone_id"); while ($check = smn_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } // disable the module if the order only contains virtual products if ($this->enabled == true) { if ($order->content_type == 'virtual') { // $this->enabled = false; } } }
function smn_get_category_description($category_id, $language_id) { global $store_id; $category_query = smn_db_query("select categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $language_id . "' and store_id = '" . $store_id . "'"); $category = smn_db_fetch_array($category_query); return $category['categories_description']; }
function currencies() { $this->currencies = array(); $currencies_query = smn_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES); while ($currencies = smn_db_fetch_array($currencies_query)) { $this->currencies[$currencies['code']] = array('title' => $currencies['title'], 'symbol_left' => $currencies['symbol_left'], 'symbol_right' => $currencies['symbol_right'], 'decimal_point' => $currencies['decimal_point'], 'thousands_point' => $currencies['thousands_point'], 'decimal_places' => $currencies['decimal_places'], 'value' => $currencies['value']); } }
function smn_delete_store($prefix) { global $languages; if ($prefix != '') { $DB_tables = array(TABLE_ADMIN, TABLE_CATEGORIES, TABLE_CATEGORIES_DESCRIPTION, TABLE_CONFIGURATION, TABLE_LANGUAGES, TABLE_NEWSLETTERS, TABLE_ORDERS_TRACKING, TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD, TABLE_PRODUCTS_NOTIFICATIONS, TABLE_PRODUCTS_OPTIONS, TABLE_PRODUCTS_OPTIONS_VALUES, TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS, TABLE_REVIEWS, TABLE_REVIEWS_DESCRIPTION, TABLE_TAX_CLASS, TABLE_TAX_RATES, TABLE_GEO_ZONES, TABLE_ZONES_TO_GEO_ZONES, TABLE_ARTICLES, TABLE_WEB_SITE_CONTENT, TABLE_DYNAMIC_PAGE_INDEX, TABLE_SPECIALS, TABLE_STORE_MAIN, TABLE_STORE_COSTS, TABLE_STORE_TO_CATEGORIES, TABLE_STORE_DESCRIPTION, TABLE_STORE_REVIEWS, TABLE_MEMBER_ORDERS); //delete all DB table rows associated with the store.... foreach ($DB_tables as $table_name) { smn_db_query("delete from " . $table_name . " WHERE store_id = '" . $prefix . "'"); } //remove products from system $product_categories_query = smn_db_query("select products_id from " . TABLE_PRODUCTS . " where store_id = '" . (int) $prefix . "'"); while ($product_categories = smn_db_fetch_array($product_categories_query)) { $product_id = (int) $product_categories['products_id']; smn_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'"); smn_db_query("delete from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'"); smn_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'"); smn_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id . "'"); smn_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'"); smn_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'"); smn_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'"); $product_reviews_query = smn_db_query("select reviews_id from " . TABLE_REVIEWS . " where products_id = '" . $product_id . "'"); while ($product_reviews = smn_db_fetch_array($product_reviews_query)) { smn_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $product_reviews['reviews_id'] . "' and store_id = '" . (int) $prefix . "'"); } smn_db_query("delete from " . TABLE_REVIEWS . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'"); if (USE_CACHE == 'true') { smn_reset_cache_block('categories'); smn_reset_cache_block('also_purchased'); } } //remove orders from system $store_orders_query = smn_db_query("select orders_id from " . TABLE_ORDERS . " where store_id = '" . (int) $prefix . "'"); while ($store_orders = smn_db_fetch_array($store_orders_query)) { smn_db_query("delete from " . TABLE_ORDERS_TRACKING . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'"); smn_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'"); smn_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'"); smn_db_query("delete from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'"); smn_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'"); smn_db_query("delete from " . TABLE_ORDERS_TOTAL . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'"); } //delete the stores image directory and files from the system $dir = DIR_FS_CATALOG . 'images/' . $prefix . '_images'; smn_deldir($dir); /* //delete any saved orders in the DB tables associated with this store $saved_store_order_query = smn_db_query("select saved_order_id from " . TABLE_SAVED_ORDERS . " WHERE saved_store_id = '". $prefix_id ."'"); if (smn_db_num_rows($store_query)){ while ($saved_store_order = smn_db_fetch_array($saved_store_order_query)){ smn_db_query("delete from " . TABLE_SAVED_ORDERS_PRODUCTS . " where saved_order_id = '" . $saved_store_order['saved_order_id'] . "'"); smn_db_query("delete from " . TABLE_SAVED_ORDERS_PRODUCTS_ATTRIBUTES . " where saved_order_id = '" . $saved_store_order['saved_order_id'] . "'"); } smn_db_query("delete from " . TABLE_SAVED_ORDERS . " where saved_store_id = '". $prefix_id ."'"); }*/ } return $store_deleted = 'true'; }
function smn_expire_specials() { $specials_query = smn_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0"); if (smn_db_num_rows($specials_query)) { while ($specials = smn_db_fetch_array($specials_query)) { smn_set_specials_status($specials['specials_id'], '0'); } } }
function template_setup() { // set the template and theme parameters (can be modified through the administration interface) if (ALLOW_STORE_TEMPLATE == 'true') { $template_query = smn_db_query("select thema as themeKey, template_name as templateValue from " . TABLE_TEMPLATE . " where template_id = '" . TEMPLATE_ID . "'"); } else { $template_query = smn_db_query("select thema as themeKey, template_name as templateValue from " . TABLE_TEMPLATE . " where template_id = '" . DEFAULT_TEMPLATE_ID . "'"); } $this->template = smn_db_fetch_array($template_query); }
function get_store_module_language($modules_installed) { global $languages_id; $prepare_module_string = str_replace('.php', '', $modules_installed); $initial_module_string = str_replace(";", "' or page_name= '", $prepare_module_string); $text_contents_conditions = " and ( page_name= '" . $initial_module_string . "' )"; $content_query = smn_db_query("select text_key, text_content from " . TABLE_WEB_SITE_CONTENT . " where store_id = '" . $this->store_id . "' " . $text_contents_conditions . " and language_id ='" . (int) $languages_id . "'"); while ($text_contents = smn_db_fetch_array($content_query)) { define($text_contents['text_key'], $text_contents['text_content']); } }
function paymentModuleInfo($pmInfo_array) { $this->payment_code = $pmInfo_array['payment_code']; for ($i = 0, $n = sizeof($pmInfo_array) - 1; $i < $n; $i++) { $key_value_query = smn_db_query("select configuration_title, configuration_value, configuration_description from " . TABLE_CONFIGURATION . " where configuration_key = '" . $pmInfo_array[$i] . "'"); $key_value = smn_db_fetch_array($key_value_query); $this->keys[$pmInfo_array[$i]]['title'] = $key_value['configuration_title']; $this->keys[$pmInfo_array[$i]]['value'] = $key_value['configuration_value']; $this->keys[$pmInfo_array[$i]]['description'] = $key_value['configuration_description']; } }
function send($newsletter_id) { $mail_query = smn_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mimemessage = new email(array('X-Mailer: oscMall bulk mailer')); $mimemessage->add_html($this->content); $mimemessage->build_message(); while ($mail = smn_db_fetch_array($mail_query)) { $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title); } $newsletter_id = smn_db_prepare_input($newsletter_id); smn_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . smn_db_input($newsletter_id) . "'"); }
function smn_get_languages_directory($code) { global $languages_id; $language_query = smn_db_query("select languages_id, directory from " . TABLE_LANGUAGES . " where code = '" . smn_db_input($code) . "'"); if (smn_db_num_rows($language_query)) { $language = smn_db_fetch_array($language_query); $languages_id = $language['languages_id']; return $language['directory']; } else { return false; } }
function smn_get_affiliate_tax_rate($class_id, $country_id, $zone_id) { $tax_query = smn_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za ON tr.tax_zone_id = za.geo_zone_id left join " . TABLE_GEO_ZONES . " tz ON tz.geo_zone_id = tr.tax_zone_id WHERE (za.zone_country_id IS NULL OR za.zone_country_id = '0' OR za.zone_country_id = '" . $country_id . "') AND (za.zone_id IS NULL OR za.zone_id = '0' OR za.zone_id = '" . $zone_id . "') AND tr.tax_class_id = '" . $class_id . "' GROUP BY tr.tax_priority"); if (smn_db_num_rows($tax_query)) { $tax_multiplier = 0; while ($tax = smn_db_fetch_array($tax_query)) { $tax_multiplier += $tax['tax_rate']; } return $tax_multiplier; } else { return 0; } }
function _sess_write($key, $val) { global $SESS_LIFE; $expiry = time() + $SESS_LIFE; $value = $val; $check_query = smn_db_query("select count(*) as total from " . TABLE_SESSIONS . " where sesskey = '" . smn_db_input($key) . "'"); $check = smn_db_fetch_array($check_query); if ($check['total'] > 0) { return smn_db_query("update " . TABLE_SESSIONS . " set expiry = '" . smn_db_input($expiry) . "', value = '" . smn_db_input($value) . "' where sesskey = '" . smn_db_input($key) . "'"); } else { return smn_db_query("insert into " . TABLE_SESSIONS . " values ('" . smn_db_input($key) . "', '" . smn_db_input($expiry) . "', '" . smn_db_input($value) . "')"); } }
function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page') { global $_GET, $_POST; $this->sql_query = $query; $this->page_name = $page_holder; if (isset($_GET[$page_holder])) { $page = $_GET[$page_holder]; } elseif (isset($_POST[$page_holder])) { $page = $_POST[$page_holder]; } else { $page = ''; } if (empty($page) || !is_numeric($page)) { $page = 1; } $this->current_page_number = $page; $this->number_of_rows_per_page = $max_rows; $pos_to = strlen($this->sql_query); $pos_from = strpos($this->sql_query, ' from', 0); $pos_group_by = strpos($this->sql_query, ' group by', $pos_from); if ($pos_group_by < $pos_to && $pos_group_by != false) { $pos_to = $pos_group_by; } $pos_having = strpos($this->sql_query, ' having', $pos_from); if ($pos_having < $pos_to && $pos_having != false) { $pos_to = $pos_having; } $pos_order_by = strpos($this->sql_query, ' order by', $pos_from); if ($pos_order_by < $pos_to && $pos_order_by != false) { $pos_to = $pos_order_by; } if (strpos($this->sql_query, 'distinct') || strpos($this->sql_query, 'group by')) { $count_string = 'distinct ' . smn_db_input($count_key); } else { $count_string = smn_db_input($count_key); } $count_query = smn_db_query("select count(" . $count_string . ") as total " . substr($this->sql_query, $pos_from, $pos_to - $pos_from)); $count = smn_db_fetch_array($count_query); $this->number_of_rows = $count['total']; $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page); if ($this->current_page_number > $this->number_of_pages) { $this->current_page_number = $this->number_of_pages; } $offset = max($this->number_of_rows_per_page * ($this->current_page_number - 1), 0); // systemsmanager begin - Dec 1, 2005 security patch // $this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page; $this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page; // systemsmanager end }
function payment($module = '') { global $payment, $language, $PHP_SELF, $store_id, $cart; if (defined('MODULE_PAYMENT_INSTALLED') && smn_not_null(MODULE_PAYMENT_INSTALLED)) { $this->modules = explode(';', MODULE_PAYMENT_INSTALLED); $include_modules = array(); $prepare_module_string = str_replace('.php', '', MODULE_PAYMENT_INSTALLED); $initial_module_string = str_replace(";", "' or page_name= '", $prepare_module_string); $text_contents_conditions = " and page_name= '" . $initial_module_string . "'"; $content_query = smn_db_query("select text_key, text_content from " . TABLE_WEB_SITE_CONTENT . " where store_id = '" . $store_id . "' " . $text_contents_conditions); while ($text_contents = smn_db_fetch_array($content_query)) { define($text_contents['text_key'], $text_contents['text_content']); } if (smn_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); $text_contents_conditions = " and page_name= '" . $module . "'"; } else { reset($this->modules); if (smn_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and ($cart->show_total() == 0 and $cart->show_weight == 0)) { $this->selected_module = $module; $include_modules[] = array('class' => 'freecharger', 'file' => 'freecharger.php'); } else { // All Other Payment Modules while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); // Don't show Free Payment Module if ($class != 'freecharger') { $include_modules[] = array('class' => $class, 'file' => $value); } } } } for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) { include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file']; $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'](); } // if there is only one payment method, select it as default because in // checkout_confirmation.php the $payment variable is being assigned the // $_POST['payment'] value which will be empty (no radio button selection possible) if (smn_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) { $payment = $include_modules[0]['class']; } if (smn_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) { $this->form_action_url = $GLOBALS[$module]->form_action_url; } } }
function language($lng = '') { global $store_id; $this->languages = array('ar' => 'ar([-_][[:alpha:]]{2})?|arabic', 'bg' => 'bg|bulgarian', 'br' => 'pt[-_]br|brazilian portuguese', 'ca' => 'ca|catalan', 'cs' => 'cs|czech', 'da' => 'da|danish', 'de' => 'de([-_][[:alpha:]]{2})?|german', 'el' => 'el|greek', 'en' => 'en([-_][[:alpha:]]{2})?|english', 'es' => 'es([-_][[:alpha:]]{2})?|spanish', 'et' => 'et|estonian', 'fi' => 'fi|finnish', 'fr' => 'fr([-_][[:alpha:]]{2})?|french', 'gl' => 'gl|galician', 'he' => 'he|hebrew', 'hu' => 'hu|hungarian', 'id' => 'id|indonesian', 'it' => 'it|italian', 'ja' => 'ja|japanese', 'ko' => 'ko|korean', 'ka' => 'ka|georgian', 'lt' => 'lt|lithuanian', 'lv' => 'lv|latvian', 'nl' => 'nl([-_][[:alpha:]]{2})?|dutch', 'no' => 'no|norwegian', 'pl' => 'pl|polish', 'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese', 'ro' => 'ro|romanian', 'ru' => 'ru|russian', 'sk' => 'sk|slovak', 'sr' => 'sr|serbian', 'sv' => 'sv|swedish', 'th' => 'th|thai', 'tr' => 'tr|turkish', 'uk' => 'uk|ukrainian', 'tw' => 'zh[-_]tw|chinese traditional', 'zh' => 'zh|chinese simplified'); $this->catalog_languages = array(); if (ALLOW_STORE_SITE_TEXT == 'true') { $use_store_id = $store_id; } else { $use_store_id = 1; } $languages_query = smn_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " where store_id = '" . $use_store_id . "' order by sort_order"); while ($languages = smn_db_fetch_array($languages_query)) { $this->catalog_languages[$languages['code']] = array('id' => $languages['languages_id'], 'name' => $languages['name'], 'image' => $languages['image'], 'directory' => $languages['directory']); } $this->browser_languages = ''; $this->language = ''; $this->set_language($lng); }
function update_status() { global $order, $store_id; if ($this->enabled == true && (int) MODULE_PAYMENT_IPAYMENT_ZONE > 0) { $check_flag = false; $check_query = smn_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_IPAYMENT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' and store_id = '" . $store_id . "' order by zone_id"); while ($check = smn_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } }
function smn_language_list() { $left = false; $smn_language_list_array[] = array('id' => '', 'text' => TEXT_NONE); $language_query = smn_db_query("select name from " . TABLE_LANGUAGES . " order by sort_order"); while ($languages = smn_db_fetch_array($language_query)) { $language_array[] = $languages['name']; } if ($dir = dir(DIR_FS_CATALOG_LANGUAGES . 'install')) { while ($file = $dir->read()) { if ($file != '.' && $file != '..' && !is_dir($file)) { $list_file = explode('_', $file); if (!in_array($list_file[0], $language_array)) { $smn_language_list_array[] = array('id' => $list_file[0], 'text' => $list_file[0]); } } } } $dir->close(); return $smn_language_list_array; }
function shipping($module = '') { global $language, $PHP_SELF, $store_id, $cart; if (defined('MODULE_SHIPPING_INSTALLED') && smn_not_null(MODULE_SHIPPING_INSTALLED)) { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); $prepare_module_string = str_replace('.php', '', MODULE_SHIPPING_INSTALLED); $initial_module_string = str_replace(";", "' or page_name= '", $prepare_module_string); $text_contents_conditions = " and page_name= '" . $initial_module_string . "'"; $content_query = smn_db_query("select text_key, text_content from " . TABLE_WEB_SITE_CONTENT . " where store_id = '" . $store_id . "' " . $text_contents_conditions); while ($text_contents = smn_db_fetch_array($content_query)) { define($text_contents['text_key'], $text_contents['text_content']); } $include_modules = array(); if (smn_not_null($module) && in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) { $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1)); $text_contents_conditions = " and page_name= '" . $module . "'"; } else { reset($this->modules); if (smn_get_configuration_key_value('MODULE_SHIPPING_FREESHIPPER_STATUS') and $cart->show_weight() == 0) { $include_modules[] = array('class' => 'freeshipper', 'file' => 'freeshipper.php'); } else { // All Other Shipping Modules while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); // Don't show Free Shipping Module if ($class != 'freeshipper') { $include_modules[] = array('class' => $class, 'file' => $value); } } } } for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) { include DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']; $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'](); } } }
This source file is subject to version 2.0 of the GPL license, that is bundled with this package in the file LICENSE. If you did not receive a copy of the oscMall System license and are unable to obtain it through the world-wide-web, please send a note to license@systemsmanager.net so we can mail you a copy immediately. */ include DIR_WS_CLASSES . 'phplot.php'; $year = $_GET['year'] ? $_GET['year'] : date('Y'); $month = $_GET['month'] ? $_GET['month'] : date('n'); $days = date('t', mktime(0, 0, 0, $month)) + 1; $stats = array(); for ($i = 1; $i < $days; $i++) { $stats[] = array($i, '0', '0'); } $banner_stats_query = smn_db_query("select dayofmonth(banners_history_date) as banner_day, banners_shown as value, banners_clicked as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $banner_id . "' and month(banners_history_date) = '" . $month . "' and year(banners_history_date) = '" . $year . "'"); while ($banner_stats = smn_db_fetch_array($banner_stats_query)) { $stats[$banner_stats['banner_day'] - 1] = array($banner_stats['banner_day'], $banner_stats['value'] ? $banner_stats['value'] : '0', $banner_stats['dvalue'] ? $banner_stats['dvalue'] : '0'); } $graph = new PHPlot(600, 350, 'images/graphs/banner_daily-' . $banner_id . '.' . $banner_extension); $graph->SetFileFormat($banner_extension); $graph->SetIsInline(1); $graph->SetPrintImage(0); $graph->SetSkipBottomTick(1); $graph->SetDrawYGrid(1); $graph->SetPrecisionY(0); $graph->SetPlotType('lines'); $graph->SetPlotBorderType('left'); $graph->SetTitleFontSize('4'); $graph->SetTitle(sprintf(TEXT_BANNERS_DAILY_STATISTICS, $banner['banners_title'], strftime('%B', mktime(0, 0, 0, $month)), $year)); $graph->SetBackgroundColor('white'); $graph->SetVertTickPosition('plotleft');