<?php
 
/*
   This file is the property of Teapplix. Use of this file is 
   restricted to Teapplix IntelliShip customers and governed by
   Teapplix's Terms and Conditions from the following url:

   http://www.teapplix.com/terms.html

   You can only use this file in conjunction with your IntelliShip
   account. You agree not to redistribute this file or reverse 
   engineer its contents. You agree to destroy all copies of this 
   file when you terminate your IntelliShip subscription.

   Copyright 2008 Teapplix. All rights reserved.

   http://www.teapplix.com
*/
/* 
   the following funciton can be customized if you do not want to 
   grant admin account access to Teapplix IntelliShip.

   You can customize this function to return 1 for the correct 
   "username password" combination, 0 otherwise, and setup 
   IntelliShip to use the special username and password to 
   download your orders.
*/
function DoAuthCustom($username$password
{
/*
    if ($username == "foo" && $password="bar") {
        return 1;
    }
*/
    
return 0;
}
define('C6f3fd73d''action'); define('Cb607377c''id'); define('C5c230cee''start'); define('C5c6ebc9f''end');
define('C3265be4c''maxcount'); define('C1c5c6c0f''status_code'); define('Cb06f7f88''comments');
define('C38313e08''verbose'); define('C373bc43f''debug'); define('Cf422dd8b''username'); define('Ccd3e077a''password');
define('Cb5f830f9''false'); require('includes/configure.php'); require(DIR_WS_INCLUDES 'database_tables.php');
require(
DIR_WS_CLASSES 'order.php'); require(DIR_WS_FUNCTIONS 'database.php'); require(DIR_WS_FUNCTIONS 'general.php');
function 
F07962d8c() { global $_REQUEST; require_once(DIR_WS_FUNCTIONS 'password_funcs.php'); if (isset($_REQUEST[Cf422dd8b]) && isset($_REQUEST[Ccd3e077a]))
 { 
$V21232f29 tep_db_prepare_input($_REQUEST[Cf422dd8b]); $V5f4dcc3b tep_db_prepare_input($_REQUEST[Ccd3e077a]);
 
$Vb2e430d9 tep_db_query"select id as login_id, user_password as login_password " " from " TABLE_ADMINISTRATORS 
 
" where user_name = '" tep_db_input($V21232f29) . "'"); if (tep_db_num_rows($Vb2e430d9)) { $Vbedd5858 tep_db_fetch_array($Vb2e430d9);
 if (
tep_validate_password($V5f4dcc3b$Vbedd5858['login_password'])) { return 1; } } } return 0;
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0"false); header("Pragma: no-cache"); F2be1259a();
function 
Fc866a26d($V3cb8eb17) { return date("Y-m-d H:i:s"$V3cb8eb17); } function F31c02eee($Vb098c59a)
$V240bf022 "/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/i"; if (preg_match($V240bf022$Vb098c59a$V3017d911)) 
 { 
$V19769ecc mktime($V3017d911[4], $V3017d911[5], $V3017d911[6], $V3017d911[2], $V3017d911[3], $V3017d911[1]);
return 
gmdate(DATE_ATOM$V19769ecc); } return $Vb098c59a; } function Ffdb73c67() { global $_REQUEST;
global 
$V418c5509$Vea2b2676$V7f021a14$Vad42f669$V2c7aea42$V7d47c917$Vbd7ead44$V418c5509 = (isset($_REQUEST[C6f3fd73d]) ? $_REQUEST[C6f3fd73d] : '');
$Vea2b2676 = (isset($_REQUEST[C5c230cee]) ? $_REQUEST[C5c230cee] : ''); $Vea2b2676 = ($Vea2b2676 0) ? $Vea2b2676 0;
$Vea2b2676 Fc866a26d($Vea2b2676); $V7f021a14 = (isset($_REQUEST[C5c6ebc9f]) ? $_REQUEST[C5c6ebc9f] : '');
$V7f021a14 = ($V7f021a14 0) ? $V7f021a14 0$V7f021a14 Fc866a26d($V7f021a14); $V7d47c917 $_REQUEST[C3265be4c];
$V7d47c917 = ($V7d47c917 0) ? $V7d47c917 200$Vbd7ead44 $_REQUEST[C1c5c6c0f]; $Vbd7ead44 = ($Vbd7ead44 0) ? $Vbd7ead44 0;
$Vad42f669 = (isset($_REQUEST[C373bc43f]) ? $_REQUEST[C373bc43f] : ''); $V2c7aea42 = (isset($_REQUEST[C38313e08]) ? $_REQUEST[C38313e08] : '');
} function 
F5dbc98dc($Ve4d23e84) { echo '<' $Ve4d23e84 '>'; } function F3a3ea00c($Ve4d23e84) {
 echo 
'</' $Ve4d23e84 '>'; } function Fb9ece18c($Ve4d23e84$V2063c160) { F5dbc98dc($Ve4d23e84);
echo 
htmlspecialchars($V2063c160); F3a3ea00c($Ve4d23e84); } function F3501bb09() { echo "<?xml version=\"1.0\"?>";
} function 
Fc2282187() { global $Vd21dc9dc; include(DIR_WS_CLASSES 'language.php'); $V8b8a2268 = new language();
$V8b8a2268->get_browser_language(); $V8512ae7d $V8b8a2268->V8512ae7d['directory']; $Vd21dc9dc $V8b8a2268->V8512ae7d['id'];
 
$V76034a9f tep_get_orders_status(); reset($V76034a9f); while (list($V3c6e0b8a$V3a6d0284) = each($V76034a9f))
 { 
F5dbc98dc("OrderStatus"); Fb9ece18c("Code"$V3a6d0284['id']); Fb9ece18c("Name"$V3a6d0284['text']);
F3a3ea00c("OrderStatus"); } } function F8cd2119e($Vcb5e100e=""$V67daf92c="") { F5dbc98dc("Header");
Fb9ece18c("DocumentVersion""1.01"); global $V418c5509$Vea2b2676$V7f021a14$Vad42f669$V2c7aea42$V7d47c917$Vbd7ead44;
if (
$Vcb5e100e) { $V2c7aea42 0$Vad42f669 1; } if ($V2c7aea42) { F5dbc98dc("ZenCart"); Fb9ece18c("Name"STORE_NAME);
Fb9ece18c("Owner"STORE_OWNER); Fb9ece18c("Email"STORE_OWNER_EMAIL_ADDRESS); Fb9ece18c("State"tep_get_zone_code(STORE_COUNTRYSTORE_ZONE"CA"));
Fb9ece18c("Country"F49c0bbe2(STORE_COUNTRY)); Fb9ece18c("Website"HTTP_CATALOG_SERVER); Fb9ece18c("Now"gmdate(DATE_ATOM));
Fc2282187(); F3a3ea00c("ZenCart"); } if ($Vad42f669) { F5dbc98dc("Debug"); Fb9ece18c("Action"$V418c5509);
Fb9ece18c("Start"$Vea2b2676); Fb9ece18c("End"$V7f021a14); Fb9ece18c("MaxCount"$V7d47c917); Fb9ece18c("StatusCode"$Vbd7ead44);
F3a3ea00c("Debug"); } if ($Vcb5e100e) { F5dbc98dc("Fault"); Fb9ece18c("Code"$Vcb5e100e); Fb9ece18c("Description"$V67daf92c);
F3a3ea00c("Fault"); } F3a3ea00c("Header"); } function F2be1259a() { global $V418c5509header('Content-Type: text/xml');
Ffdb73c67(); F3501bb09(); F5dbc98dc("TeapplixEnvelop"); if ((!$_SERVER{'HTTPS'}) && Cb5f830f9 != 'false')
 { 
F8cd2119e(401'https url required. http url not allowed.'); F3a3ea00c("TeapplixEnvelop"); return;
} if (!
tep_db_connect()) { F8cd2119e(501'tep_db_connect failed.'); F3a3ea00c("TeapplixEnvelop");
return; } if (!
function_exists("tep_get_orders_status")) { F8cd2119e(501'Could not find tep_get_orders_status.');
F3a3ea00c("TeapplixEnvelop"); return; } if (!F07962d8c()) { if (!DoAuthCustom($_REQUEST[Cf422dd8b], $_REQUEST[Ccd3e077a])) {
 
F8cd2119e(401'username and password not correct'); F3a3ea00c("TeapplixEnvelop"); return; } } $V3527aca3 tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' TABLE_CONFIGURATION);
while (
$Vccd10663 tep_db_fetch_array($V3527aca3)) { define($Vccd10663['cfgKey'], $Vccd10663['cfgValue']);
} if (
tep_not_null($V418c5509)) { switch (strtolower($V418c5509)) { case 'download'F00d1ec58(); break;
case 
'update'F588d2181(); break; default: F8cd2119e(); } } F3a3ea00c("TeapplixEnvelop"); } function F00d1ec58()
{ global 
$_REQUEST$db; global $V418c5509$Vea2b2676$V7f021a14$Vad42f669$V2c7aea42$V7d47c917$Vbd7ead44;
F8cd2119e(); $V09eff75b tep_db_query"select * ,ifnull(o.last_modified, o.date_purchased) as Modified" .
 
" from " TABLE_ORDERS " o, " TABLE_ORDERS_TOTAL " ot " " where ot.orders_id = o.orders_id " .
 
" and ot.class = 'ot_total' " " and o.orders_status = '$Vbd7ead44' " " having Modified > '$Vea2b2676' " .
 
" and Modified <= '$V7f021a14' " " order by Modified asc " " limit 0, " $V7d47c917); $Ve2942a04 1;
Fb9ece18c("MessageType""OrderReport"); while ($Vf1965a85 tep_db_fetch_array($V09eff75b)) { $V153efb17 = (int) $Vf1965a85['currency_value'];
 
$V09f3846b tep_db_query("select title from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$Vf1965a85['orders_id'] . "' and class = 'ot_shipping'");
$Vcc51e870 tep_db_fetch_array($V09f3846b); $Vcc51e870 = ((substr($Vcc51e870['title'], -1) == ':') ? substr(strip_tags($Vcc51e870['title']), 0, -1) : strip_tags($Vcc51e870['title'])); 
 
$Vd764d0c8 tep_db_query"select comments from " TABLE_ORDERS_STATUS_HISTORY " where orders_id = " $Vf1965a85['orders_id'] . " " .
 
" order by date_added asc " " limit 0, 1" ); $Vfe0276f8 tep_db_fetch_array($Vd764d0c8); F5dbc98dc("Message");
Fb9ece18c("MessageID"$Ve2942a04); F5dbc98dc("OrderReport"); Fb9ece18c("OrderID"$Vf1965a85['orders_id']);
Fb9ece18c("OrderDate"F31c02eee($Vf1965a85['date_purchased'])); Fb9ece18c("OrderPostedDate"F31c02eee($Vf1965a85['Modified']));
F5dbc98dc("CustomerOrderInfo"); Fb9ece18c("Type""CustomerComment"); Fb9ece18c("Value"$Vfe0276f8['comments']);
F3a3ea00c("CustomerOrderInfo"); F5dbc98dc("CustomerOrderInfo"); Fb9ece18c("Type""StatusCode"); Fb9ece18c("Value"$Vf1965a85['orders_status']);
F3a3ea00c("CustomerOrderInfo"); F5dbc98dc("BillingData"); Fb9ece18c("BuyerEmailAddress"$Vf1965a85['customers_email_address']);
Fb9ece18c("BuyerName"$Vf1965a85['billing_name']); Fb9ece18c("BuyerPhoneNumber"$Vf1965a85['customers_telephone']);
F3a3ea00c("BillingData"); F5dbc98dc("FulfillmentData"); Fb9ece18c("FulfillmentMethod""Ship"); Fb9ece18c("FulfillmentServiceLevel"$Vcc51e870);
F5dbc98dc("Address"); Fb9ece18c("Name"$Vf1965a85['delivery_name']); Fb9ece18c("Company"$Vf1965a85['delivery_company']);
Fb9ece18c("AddressFieldOne"$Vf1965a85['delivery_street_address']); Fb9ece18c("AddressFieldTwo"$Vf1965a85['delivery_suburb']);
Fb9ece18c("City"$Vf1965a85['delivery_city']); Fb9ece18c("StateOrRegion"$Vf1965a85['delivery_state']);
Fb9ece18c("PostalCode"$Vf1965a85['delivery_postcode']); Fb9ece18c("CountryCode"$Vf1965a85['delivery_country']);
Fb9ece18c("PhoneNumber"$Vf1965a85['customers_telephone']); F3a3ea00c("Address"); F3a3ea00c("FulfillmentData");
Fb7990dae($Vf1965a85['orders_id'], $V153efb17); Fc6c824d9($Vf1965a85['orders_id'], $V153efb17); F3a3ea00c("OrderReport");
F3a3ea00c("Message"); $Ve2942a04++; } } function Fb7990dae($Vde4690b3$V153efb17) { global $V3555b98c$Vf1aca6b7;
$V2455ea35 HTTP_CATALOG_SERVER DIR_WS_CATALOG DIR_WS_IMAGES$Vd0a6dab9 tep_db_query"select * from " TABLE_PRODUCTS .
 
" INNER JOIN ".TABLE_ORDERS_PRODUCTS." USING(products_id)"" where orders_id = " $Vde4690b3); while($V447b7147 tep_db_fetch_array($Vd0a6dab9))
 { 
$V28b569d3 $V447b7147['products_image']; if (isset($V28b569d3) and strlen($V28b569d3) > 0) {
 
$V28b569d3 $V2455ea35 $V28b569d3; } F5dbc98dc("Item"); Fb9ece18c("OrderItemCode"$V447b7147['orders_products_id']);
Fb9ece18c("ProductID"$V447b7147['products_id']); Fb9ece18c("SKU"$V447b7147['products_model']); Fb9ece18c("Title"$V447b7147['products_name']);
F2c6422ba($V447b7147['orders_products_id'], $V153efb17); Fb9ece18c("Quantity"$V447b7147['products_quantity']);
F5dbc98dc("ItemPrice"); F5dbc98dc("Component"); Fb9ece18c("Type""Principal"); Fb9ece18c("Amount", ($V447b7147['products_price'] + $Vf1aca6b7) * $V153efb17);
F3a3ea00c("Component"); F3a3ea00c("ItemPrice"); Fb9ece18c("Image"$V28b569d3); Fb9ece18c("ItemWeight"$Vf5bf48aa['products_weight'] + $V3555b98c);
 
F3a3ea00c("Item"); } } function F2c6422ba($Vdd663f36$V153efb17) { $V30d7a2d4 tep_db_query"select * from " TABLE_ORDERS_PRODUCTS_ATTRIBUTES 
 
" where orders_products_id = " $Vdd663f36); $Vf1aca6b7 0$V3555b98c 0; while($V65db43f2 tep_db_fetch_array($V30d7a2d4))
 { 
$V3555b98c += $V65db43f2['products_attributes_weight']; if ($V65db43f2['price_prefix'] == '-') {
 
$Vf1aca6b7 -= $V65db43f2['options_values_price']; } else { $Vf1aca6b7 += $V65db43f2['options_values_price'];
F5dbc98dc("CustomizationInfo"); Fb9ece18c("Type"$V65db43f2['products_options'] ); Fb9ece18c("Data"$V65db43f2['products_options_values']);
F3a3ea00c("CustomizationInfo"); } } function Fc6c824d9($Vde4690b3$V153efb17) { $V9d5c0533 tep_db_query(
 
"select * from " TABLE_ORDERS_TOTAL " where orders_id = " $Vde4690b3); F5dbc98dc("Totals");
while(
$Vfbb44b44 tep_db_fetch_array($V9d5c0533)) { $V2063c160 $Vfbb44b44['value']; $Va2f2ed4f $Vfbb44b44['class'];
 if (
$Va2f2ed4f == "ot_shipping") { Fb9ece18c("Shipping"$V2063c160 $V153efb17); } if ($Va2f2ed4f == "ot_tax") {
 
Fb9ece18c("Tax"$V2063c160 $V153efb17); } if ($Va2f2ed4f == "ot_total") { Fb9ece18c("Total"$V2063c160 $V153efb17);
} } 
F3a3ea00c("Totals"); } function F588d2181() { global $_REQUEST$_POST; global $db$Vbd7ead44;
if ((!isset(
$_POST[Cb607377c])) || ($Vbd7ead44 == "") || (!isset($_REQUEST[Cb06f7f88]))) { F8cd2119e(10"Not all parameters supplied.");
return; } else { 
F8cd2119e(); } $Va5d49106 mysql_escape_string($_REQUEST[Cb06f7f88]); $Ve2942a04 0;
foreach (
$_POST[Cb607377c] as $Vb80bb774) { tep_db_query"insert into " TABLE_ORDERS_STATUS_HISTORY 
 
" (orders_id, orders_status_id, date_added, customer_notified, comments) " " values (" $Vb80bb774 ", " $Vbd7ead44 ", now(), 0, '" $Va5d49106 "')");
 
tep_db_query"update " TABLE_ORDERS " set orders_status = " $Vbd7ead44 " " " where orders_id = " $Vb80bb774);
$Ve2942a04++; } Fb9ece18c("MessageType""UpdateStatusCount"); F5dbc98dc("Message"); Fb9ece18c("UpdateCount"$Ve2942a04);
F3a3ea00c("Message"); } function F49c0bbe2($V93bfec8a) { $V1ed6d4fd tep_db_query("select countries_iso_code_2 from " TABLE_COUNTRIES " where countries_id = '" . (int)$V93bfec8a "'");
if (!
tep_db_num_rows($V1ed6d4fd)) { return $V93bfec8a; } else { $Ve909c2d7 tep_db_fetch_array($V1ed6d4fd);
return 
$Ve909c2d7['countries_iso_code_2']; } } ?>