<?
/* ------------------------------------------------------------------------ *\
    Copyright 2007-2009 Your Company ltd. All rights reserved
\* ------------------------------------------------------------------------ */
?>
<?php
/*
This file is the property of Teapplix. Use of this file is
restricted to Teapplix 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 Teapplix
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 Teapplix subscription.
Copyright 2008-2012 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.
You can customize this function to return 1 for the correct
"username password" combination, 0 otherwise, and setup
Teapplix to use the special username and password to
download your orders.
*/
if (!isset($_GET['debug'])) { error_reporting(0);
} else { 
error_reporting(E_ALL);
ini_set('display_errors'1);
} function 
Ffb659fb6($V14c4b06b$V5f4dcc3b) { //__EXCLUDE__
if ($V14c4b06b == "teapplix" && $V5f4dcc3b="changeme123") { //__EXCLUDE__
return 1//__EXCLUDE__
//__EXCLUDE__
return 0//__EXCLUDE__
//__EXCLUDE__
define('IS_ADMIN_FLAG'true);
define('TE_VAR_ACTION''action');
define('TE_VAR_ID''id');
define('TE_VAR_START''start');
define('TE_VAR_END''end');
define('TE_VAR_MAXCOUNT''maxcount');
define('TE_VAR_STATUS_CODE''status_code');
define('TE_VAR_COMMENTS''comments');
define('TE_VAR_VERBOSE''verbose');
define('TE_VAR_DEBUG''debug');
define('TE_VAR_USERNAME''username');
define('TE_VAR_PASSWORD''password');
define('TE_VAR_PAGE''page');
define('TE_VAR_LISTING_ID''listing_id');
define('TE_VAR_LISTING_QTY''listing_qty');
define('TE_VAR_LISTING_PRICE''listing_price');
function 
F07962d8c($V14c4b06b$V5f4dcc3b)
{ global 
$_REQUEST;
global 
$db;
if (!
function_exists('zen_encrypt_password'))
{ require_once(
DIR_FS_CATALOG DIR_WS_FUNCTIONS 'password_funcs.php');
} if ((
'' !== $V14c4b06b) && ('' !== $V5f4dcc3b))
$V21232f29 zen_db_prepare_input($V14c4b06b);
$V5f4dcc3b zen_db_prepare_input($V5f4dcc3b);
$Vbedd5858 $db->Execute("select admin_id as login_id, admin_pass as login_pass " .
" from " TABLE_ADMIN .
" where admin_name = '"zen_db_input($V21232f29) . "'");
if (
zen_validate_password($V5f4dcc3b$Vbedd5858->Vd05b6ed7['login_pass']))
{ return 
1;
} } return 
0;
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
/* HTTP/1.1 */
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0"false);
/* HTTP/1.0 */
header("Pragma: no-cache");
F2be1259a();
function 
Fc866a26d($gmt) { return date("Y-m-d H:i:s"$gmt);
} function 
F31c02eee($Vb098c59a)
$V240bf022 "/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/i";
if (
preg_match($V240bf022$Vb098c59a$dt))
$V19769ecc mktime($dt[4], $dt[5], $dt[6], $dt[2], $dt[3], $dt[1]);
return 
gmdate(DATE_ATOM$V19769ecc);
} return 
$Vb098c59a;
} function 
Ffdb73c67() { global $_REQUEST;
global 
$V418c5509$Vea2b2676$end$Vad42f669$V2c7aea42$V7d47c917$Vbd7ead44;
$V418c5509 = (isset($_REQUEST[TE_VAR_ACTION]) ? $_REQUEST[TE_VAR_ACTION] : '');
$Vea2b2676 = (isset($_REQUEST[TE_VAR_START]) ? $_REQUEST[TE_VAR_START] : '');
$Vea2b2676 = ($Vea2b2676 0) ? $Vea2b2676 0;
$Vea2b2676 Fc866a26d($Vea2b2676);
$end = (isset($_REQUEST[TE_VAR_END]) ? $_REQUEST[TE_VAR_END] : '');
$end = ($end 0) ? $end 0;
$end Fc866a26d($end);
$V7d47c917 = isset($_REQUEST[TE_VAR_MAXCOUNT]) ? $_REQUEST[TE_VAR_MAXCOUNT] : 0;
$V7d47c917 = ($V7d47c917 0) ? $V7d47c917 200;
$Vbd7ead44 $_REQUEST[TE_VAR_STATUS_CODE];
$Vbd7ead44 = ($Vbd7ead44 0) ? $Vbd7ead44 0;
$Vad42f669 = (isset($_REQUEST[TE_VAR_DEBUG]) ? $_REQUEST[TE_VAR_DEBUG] : '');
$V2c7aea42 = (isset($_REQUEST[TE_VAR_VERBOSE]) ? $_REQUEST[TE_VAR_VERBOSE] : '');
foreach(array(
TE_VAR_ACTIONTE_VAR_STARTTE_VAR_ENDTE_VAR_MAXCOUNT,
TE_VAR_STATUS_CODETE_VAR_DEBUGTE_VAR_VERBOSE) as $key) { unset($_POST[$key], $_REQUEST[$key], $_GET[$key]);
} } function 
F5dbc98dc($tag) { echo '<' $tag '>';
} function 
F3a3ea00c($tag) { echo '</' $tag '>';
} function 
Fb9ece18c($tag$V2063c160) { F5dbc98dc($tag);
echo 
htmlspecialchars($V2063c160);
F3a3ea00c($tag);
} function 
F3501bb09() { echo "<?xml version=\"1.0\"?>";
} function 
Fc2282187()
$V76034a9f zen_get_orders_status();
reset($V76034a9f);
while (list(
$key$val) = each($V76034a9f))
F5dbc98dc("OrderStatus");
Fb9ece18c("Code"$val['id']);
Fb9ece18c("Name"$val['text']);
F3a3ea00c("OrderStatus");
} } function 
F8cd2119e($Vcb5e100e=""$V67daf92c="")
F5dbc98dc("Header");
Fb9ece18c("DocumentVersion""1.01");
global 
$V418c5509$Vea2b2676$end$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"zen_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"$end);
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 $db$V418c5509;
session_start();
global 
$_SESSION;
$_SESSION['admin_id'] = 0;
$_SERVER['PHP_SELF'] = str_replace('teapplix.php''index'$_SERVER['PHP_SELF']);
$V14c4b06b $V5f4dcc3b '';
if (!empty(
$_REQUEST[TE_VAR_USERNAME])) { $V14c4b06b $_REQUEST[TE_VAR_USERNAME];
unset(
$_POST[TE_VAR_USERNAME]);
unset(
$_REQUEST[TE_VAR_USERNAME]);
} if (!empty(
$_REQUEST[TE_VAR_PASSWORD])) { $V5f4dcc3b $_REQUEST[TE_VAR_PASSWORD];
unset(
$_POST[TE_VAR_PASSWORD]);
unset(
$_REQUEST[TE_VAR_PASSWORD]);
Ffdb73c67();
ob_start();
$_SESSION['admin_id'] = 1;
require(
'includes/application_top.php');
header('Content-Type: text/xml');
ob_end_clean();
F3501bb09();
F5dbc98dc("TeapplixEnvelop");
if ((!
$_SERVER{'HTTPS'}) && ENABLE_SSL_ADMIN != 'false')
F8cd2119e(401'https url required. http url not allowed.');
F3a3ea00c("TeapplixEnvelop");
return;
} if (!
F07962d8c($V14c4b06b$V5f4dcc3b)) { if (!Ffb659fb6($V14c4b06b$V5f4dcc3b)) { F8cd2119e(401'username and password not correct');
F3a3ea00c("TeapplixEnvelop");
return;
} } if (
zen_not_null($V418c5509))
{ switch (
strtolower($V418c5509))
{ case 
'download-listings'F7f9b84cb(); break;
case 
'update-listings'Fc21708a8(); break;
case 
'download'F00d1ec58(); break;
case 
'update'F588d2181();
} } 
F3a3ea00c("TeapplixEnvelop");
} function 
F00d1ec58()
{ global 
$_REQUEST$db;
global 
$V418c5509$Vea2b2676$end$Vad42f669$V2c7aea42$V7d47c917$Vbd7ead44;
F8cd2119e();
$row $db->Execute(
"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 <= '$end' " .
" order by Modified asc " .
" limit 0, " $V7d47c917);
$Ve2942a04 1;
Fb9ece18c("MessageType""OrderReport");
while (!
$row->EOF)
{ if( 
function_exists"sw_GetOrders_row_hook" ) )
sw_GetOrders_row_hook$row );
$V153efb17 = (int) $row->Vd05b6ed7['currency_value'];
$Vcc51e870 $db->Execute("select title from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$row->Vd05b6ed7['orders_id'] . "' and class = 'ot_shipping'");
if( 
function_exists'sw_ShippingMethod_hook' ) )
sw_ShippingMethod_hook$Vcc51e870 );
$Vcc51e870 $Vcc51e870->Vd05b6ed7['title'];
$Vcc51e870 = ((substr($Vcc51e870, -1) == ':') ? substr(strip_tags($Vcc51e870), 0, -1) : strip_tags($Vcc51e870));
$Vfe0276f8 $db->Execute(
"select comments from " TABLE_ORDERS_STATUS_HISTORY .
" where orders_id = " $row->Vd05b6ed7['orders_id'] . " " .
" order by date_added asc " .
" limit 0, 1" );
F5dbc98dc("Message");
Fb9ece18c("MessageID"$Ve2942a04);
F5dbc98dc("OrderReport");
Fb9ece18c("OrderID"$row->Vd05b6ed7['orders_id']);
Fb9ece18c("OrderDate"F31c02eee($row->Vd05b6ed7['date_purchased']));
Fb9ece18c("OrderPostedDate"F31c02eee($row->Vd05b6ed7['Modified']));
F5dbc98dc("CustomerOrderInfo");
Fb9ece18c("Type""CustomerComment");
Fb9ece18c("Value"$Vfe0276f8->Vd05b6ed7['comments']);
F3a3ea00c("CustomerOrderInfo");
F5dbc98dc("CustomerOrderInfo");
Fb9ece18c("Type""StatusCode");
Fb9ece18c("Value"$row->Vd05b6ed7['orders_status']);
F3a3ea00c("CustomerOrderInfo");
F5dbc98dc("BillingData");
Fb9ece18c("BuyerEmailAddress"$row->Vd05b6ed7['customers_email_address']);
Fb9ece18c("BuyerName"$row->Vd05b6ed7['billing_name']);
Fb9ece18c("BuyerPhoneNumber"$row->Vd05b6ed7['customers_telephone']);
F3a3ea00c("BillingData");
F5dbc98dc("FulfillmentData");
Fb9ece18c("FulfillmentMethod""Ship");
Fb9ece18c("FulfillmentServiceLevel"$Vcc51e870);
F5dbc98dc("Address");
Fb9ece18c("Name"$row->Vd05b6ed7['delivery_name']);
Fb9ece18c("Company"$row->Vd05b6ed7['delivery_company']);
Fb9ece18c("AddressFieldOne"$row->Vd05b6ed7['delivery_street_address']);
Fb9ece18c("AddressFieldTwo"$row->Vd05b6ed7['delivery_suburb']);
Fb9ece18c("City"$row->Vd05b6ed7['delivery_city']);
Fb9ece18c("StateOrRegion"$row->Vd05b6ed7['delivery_state']);
Fb9ece18c("PostalCode"$row->Vd05b6ed7['delivery_postcode']);
Fb9ece18c("CountryCode"$row->Vd05b6ed7['delivery_country']);
Fb9ece18c("PhoneNumber"$row->Vd05b6ed7['customers_telephone']);
F3a3ea00c("Address");
F3a3ea00c("FulfillmentData");
Fb7990dae($row->Vd05b6ed7['orders_id'], $V153efb17);
Fc6c824d9($row->Vd05b6ed7['orders_id'], $V153efb17);
F3a3ea00c("OrderReport");
F3a3ea00c("Message");
$Ve2942a04++;
$row->MoveNext();
} } function 
Fb7990dae($Vde4690b3$V153efb17)
{ global 
$db$V3555b98c;
$V2455ea35 HTTP_CATALOG_SERVER DIR_WS_CATALOG DIR_WS_IMAGES;
$V447b7147 $db->Execute(
"select * from " TABLE_PRODUCTS .
" INNER JOIN ".TABLE_ORDERS_PRODUCTS." USING(products_id)".
" where orders_id = " $Vde4690b3);
while(!
$V447b7147->EOF)
{ if( 
function_exists"sw_OrderItems_row_hook" ) )
sw_OrderItems_row_hook$V447b7147 );
$V28b569d3 $Vf5bf48aa->Vd05b6ed7['products_image'];
if (isset(
$V28b569d3) and strlen($V28b569d3) > 0)
$V28b569d3 $V2455ea35 $V28b569d3;
F5dbc98dc("Item");
Fb9ece18c("OrderItemCode"$V447b7147->Vd05b6ed7['orders_products_id']);
Fb9ece18c("ProductID"$V447b7147->Vd05b6ed7['products_id']);
Fb9ece18c("SKU"$V447b7147->Vd05b6ed7['products_model']);
Fb9ece18c("Title"$V447b7147->Vd05b6ed7['products_name']);
F2c6422ba($V447b7147->Vd05b6ed7['orders_products_id'], $V153efb17);
Fb9ece18c("Quantity"$V447b7147->Vd05b6ed7['products_quantity']);
F5dbc98dc("ItemPrice");
F5dbc98dc("Component");
Fb9ece18c("Type""Principal");
Fb9ece18c("Amount"$V447b7147->Vd05b6ed7['final_price'] * $V153efb17);
F3a3ea00c("Component");
F3a3ea00c("ItemPrice");
Fb9ece18c("Image"$V28b569d3);
Fb9ece18c("ItemWeight"$V447b7147->Vd05b6ed7['products_weight'] + $V3555b98c);
F3a3ea00c("Item");
$V447b7147->MoveNext();
} } function 
F2c6422ba($Vdd663f36$V153efb17)
{ global 
$db$V3555b98c;
$att $db->Execute(
"select * from " TABLE_ORDERS_PRODUCTS_ATTRIBUTES .
" where orders_products_id = " $Vdd663f36);
while(!
$att->EOF)
{ if( 
function_exists"sw_ItemAtributtes_row_hook" ) )
sw_ItemAttributes_row_hook$att );
$Vf1aca6b7 $att->Vd05b6ed7['options_values_price'];
$V3555b98c $att->Vd05b6ed7['products_attributes_weight'];
if (
$att->Vd05b6ed7['price_prefix'] == '-')
$Vf1aca6b7 = -$Vf1aca6b7;
F5dbc98dc("CustomizationInfo");
Fb9ece18c("Type"$att->Vd05b6ed7['products_options']);
Fb9ece18c("Data"$att->Vd05b6ed7['products_options_values']);
F3a3ea00c("CustomizationInfo");
$att->MoveNext();
} } function 
Fc6c824d9($Vde4690b3$V153efb17)
{ global 
$db;
$Vfbb44b44 $db->Execute(
"select * from " TABLE_ORDERS_TOTAL .
" where orders_id = " $Vde4690b3);
F5dbc98dc("Totals");
while(!
$Vfbb44b44->EOF)
{ if( 
function_exists"sw_OrderTotals_row_hook" ) )
sw_OrderTotals_row_hook$Vfbb44b44 );
$V2063c160 $Vfbb44b44->Vd05b6ed7['value'];
$Va2f2ed4f $Vfbb44b44->Vd05b6ed7['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);
$Vfbb44b44->MoveNext();
F3a3ea00c("Totals");
} function 
F588d2181()
{ global 
$_REQUEST$_POST;
global 
$db$Vbd7ead44;
if ((!isset(
$_POST[TE_VAR_ID])) || ($Vbd7ead44 == "") || (!isset($_REQUEST[TE_VAR_COMMENTS])))
F8cd2119e(10"Not all parameters supplied.");
return;
} else { 
F8cd2119e();
} if (
function_exists('mysql_escape_string')) { $Va5d49106 mysql_escape_string($_REQUEST[TE_VAR_COMMENTS]);
} else { 
$Va5d49106 mysqli_escape_string($db->link$_REQUEST[TE_VAR_COMMENTS]);
$Ve2942a04 0;
foreach (
$_POST[TE_VAR_ID] as $id) { $db->Execute(
"insert into " TABLE_ORDERS_STATUS_HISTORY .
" (orders_id, orders_status_id, date_added, customer_notified, comments) " .
" values (" $id ", " $Vbd7ead44 ", now(), 0, '" $Va5d49106 "')");
$db->Execute(
"update " TABLE_ORDERS .
" set orders_status = " $Vbd7ead44 " " .
" where orders_id = " $id);
if( 
function_exists"sw_UpdateStatus_hook" ) )
sw_UpdateStatus_hook$id$Vbd7ead44$Va5d49106 );
$Ve2942a04++;
Fb9ece18c("MessageType""UpdateStatusCount");
F5dbc98dc("Message");
Fb9ece18c("UpdateCount"$Ve2942a04);
F3a3ea00c("Message");
} function 
F49c0bbe2($V93bfec8a)
{ global 
$db;
$Ve909c2d7 $db->Execute("select countries_iso_code_2 from " TABLE_COUNTRIES " where countries_id = '" . (int)$V93bfec8a "'");
if (!
$Ve909c2d7->RecordCount() > 1) { return $V93bfec8a;
} else { return 
$Ve909c2d7->Vd05b6ed7['countries_iso_code_2'];
} } function 
F7f9b84cb()
{ global 
$_REQUEST$db;
global 
$V7d47c917;
$V71860c77 $_REQUEST[TE_VAR_PAGE];
$V71860c77 = (!empty($V71860c77) && intval($V71860c77) >= 0) ? intval($V71860c77) : 1;
$Ve84053d0 $V7d47c917 * ($V71860c77 1);
$sql "SELECT * FROM " TABLE_PRODUCTS " p "
"INNER JOIN " TABLE_PRODUCTS_DESCRIPTION " pd ON p.products_id = pd.products_id "
"LIMIT " $Ve84053d0 "," $V7d47c917;
$row $db->Execute($sql);
F8cd2119e();
F5dbc98dc("ListingsReport");
while (!
$row->EOF)
$Vf5bf48aa $row->Vd05b6ed7;
F5dbc98dc("listing");
foreach (
$Vf5bf48aa as $key => $V2063c160) { Fb9ece18c($key$V2063c160);
F3a3ea00c("listing");
$row->MoveNext();
F3a3ea00c("ListingsReport");
} function 
Fc21708a8()
{ global 
$_REQUEST$db;
$Va5acdb6c $_REQUEST[TE_VAR_LISTING_ID];
$Vd05b6ed7 '';
if (isset(
$_REQUEST[TE_VAR_LISTING_QTY]))
$Vd05b6ed7 .= 'products_quantity = ' intval($_REQUEST[TE_VAR_LISTING_QTY]);
if (isset(
$_REQUEST[TE_VAR_LISTING_PRICE]))
$Vd05b6ed7 .= 'products_price = ' intval($_REQUEST[TE_VAR_LISTING_PRICE]);
if (!isset(
$Va5acdb6c) || $Va5acdb6c <= 0)
F8cd2119e('Bad request''Incorrect listing id.');
return 
false;
} if (!
$Vd05b6ed7)
F8cd2119e('Bad request''Fields for update are absent.');
return 
false;
$sql "UPDATE " TABLE_PRODUCTS " "
"SET " $Vd05b6ed7 " "
"WHERE products_id = " intval($Va5acdb6c);
$Vb4a88417 $db->Execute($sql);
if (!
$Vb4a88417)
F8cd2119e('Database request error.');
return 
false;
F8cd2119e();
return 
true;
?>