if (tep_session_is_registered('postpone_cart') && is_object($postpone_cart)) { if (PHP_VERSION < 4) { $broken_cart = $postpone_cart; $postpone_cart = new shoppingCart('postpone'); $postpone_cart->unserialize($broken_cart); } } else { tep_session_register('postpone_cart'); $postpone_cart = new shoppingCart('postpone'); } // create the foreign shopping cart & fix the cart if necesary if (tep_session_is_registered('foreign_cart') && is_object($foreign_cart)) { if (PHP_VERSION < 4) { $broken_cart = $foreign_cart; $foreign_cart = new shoppingCart('foreign'); $foreign_cart->unserialize($broken_cart); } } else { tep_session_register('foreign_cart'); $foreign_cart = new shoppingCart('foreign'); } // include currencies class and create an instance require DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); // include the mail classes require DIR_WS_CLASSES . 'mime.php'; require DIR_WS_CLASSES . 'email.php'; require DIR_WS_CLASSES . 'class.phpmailer.php'; $lang_query = tep_db_query("select languages_id, code from " . TABLE_LANGUAGES . " where default_status = '1'"); $lang = tep_db_fetch_array($lang_query); define('DEFAULT_LANGUAGE', $lang['code']);
} $session_data_id = substr($session_data, $start_id, strpos($session_data, ';', $start_id) - $start_id + 1); // fix nnobo bug $session_data_cart = substr($session_data, $start_cart, $i - $start_cart); $session_data_currency = substr($session_data, $start_currency, strpos($session_data, ';', $start_currency) - $start_currency + 1); $session_data_country = substr($session_data, $start_country, strpos($session_data, ';', $start_country) - $start_country + 1); $session_data_zone = substr($session_data, $start_zone, strpos($session_data, ';', $start_zone) - $start_zone + 1); session_decode($session_data_id); session_decode($session_data_currency); session_decode($session_data_country); session_decode($session_data_zone); session_decode($session_data_cart); if (PHP_VERSION < 4) { $broken_cart = $cart; $cart = new shoppingCart(); $cart->unserialize($broken_cart); } if (is_object($_SESSION['cart'])) { $contents[] = array('text' => $full_name . ' - ' . $ip_address . '<br />' . $info); $products = $_SESSION['cart']->get_products(); for ($i = 0, $n = sizeof($products); $i < $n; $i++) { $contents[] = array('text' => $products[$i]['quantity'] . ' x ' . '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . zen_get_product_path($products[$i]['id']) . '&pID=' . $products[$i]['id']) . '">' . $products[$i]['name'] . '</a>'); // cPath=23&pID=74 } if (sizeof($products) > 0) { $contents[] = array('text' => zen_draw_separator('pixel_black.gif', '100%', '1')); $contents[] = array('align' => 'right', 'text' => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($_SESSION['cart']->show_total(), true, $_SESSION['currency'])); } else { $contents[] = array('text' => TEXT_EMPTY_CART); } }
function tep_check_cart($which, $customer_id, $session_id) { global $cart, $status_active_cart, $status_inactive_cart, $status_active_nocart, $status_inactive_nocart, $status_inactive_bot, $status_active_bot, $active_time; // Pull Session data from the correct source. if (STORE_SESSIONS == 'mysql') { $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'"); $session_data = tep_db_fetch_array($session_data); $session_data = trim($session_data['value']); } else { if (file_exists(tep_session_save_path() . '/sess_' . $session_id) && filesize(tep_session_save_path() . '/sess_' . $session_id) > 0) { $session_data = file(tep_session_save_path() . '/sess_' . $session_id); $session_data = trim(implode('', $session_data)); } } if ($length = strlen($session_data)) { if (PHP_VERSION < 4) { $start_id = strpos($session_data, 'customer_id[==]s'); $start_cart = strpos($session_data, 'cart[==]o'); $start_currency = strpos($session_data, 'currency[==]s'); $start_country = strpos($session_data, 'customer_country_id[==]s'); $start_zone = strpos($session_data, 'customer_zone_id[==]s'); } else { $start_id = strpos($session_data, 'customer_id|s'); $start_cart = strpos($session_data, 'cart|O'); $start_currency = strpos($session_data, 'currency|s'); $start_country = strpos($session_data, 'customer_country_id|s'); $start_zone = strpos($session_data, 'customer_zone_id|s'); } for ($i = $start_cart; $i < $length; $i++) { if ($session_data[$i] == '{') { if (isset($tag)) { $tag++; } else { $tag = 1; } } elseif ($session_data[$i] == '}') { $tag--; } elseif (isset($tag) && $tag < 1) { break; } } $session_data_id = substr($session_data, $start_id, strpos($session_data, ';', $start_id) - $start_id + 1); $session_data_cart = substr($session_data, $start_cart, $i); $session_data_currency = substr($session_data, $start_currency, strpos($session_data, ';', $start_currency) - $start_currency + 1); $session_data_country = substr($session_data, $start_country, strpos($session_data, ';', $start_country) - $start_country + 1); $session_data_zone = substr($session_data, $start_zone, strpos($session_data, ';', $start_zone) - $start_zone + 1); session_decode($session_data_id); session_decode($session_data_currency); session_decode($session_data_country); session_decode($session_data_zone); session_decode($session_data_cart); if (PHP_VERSION < 4) { $broken_cart = $cart; $cart = new shoppingCart(); $cart->unserialize($broken_cart); } if (is_object($cart)) { $products = $cart->get_products(); } } $which_query = $session_data; $who_data = tep_db_query("select time_entry, time_last_click\r\n from " . TABLE_WHOS_ONLINE . "\r\n where session_id='" . $session_id . "'"); $who_query = tep_db_fetch_array($who_data); // Determine if visitor active/inactive $xx_mins_ago_long = time() - $active_time; // Determine Bot active/inactive if ($customer_id < 0) { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_bot, TEXT_STATUS_INACTIVE_BOT); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_bot, TEXT_STATUS_ACTIVE_BOT); } } // Determine active/inactive and cart/no cart status if (sizeof($products) == 0) { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_nocart, TEXT_STATUS_INACTIVE_NOCART); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_nocart, TEXT_STATUS_ACTIVE_NOCART); } // cart } else { // inactive if ($who_query['time_last_click'] < $xx_mins_ago_long) { return tep_image(DIR_WS_IMAGES . $status_inactive_cart, TEXT_STATUS_INACTIVE_CART); // active } else { return tep_image(DIR_WS_IMAGES . $status_active_cart, TEXT_STATUS_ACTIVE_CART); } } }