예제 #1
0
파일: cc.php 프로젝트: kdexter/oscommerce
 function process()
 {
     global $osC_Database, $osC_MessageStack, $osC_Customer, $osC_Language, $osC_Currencies, $osC_ShoppingCart, $osC_CreditCard;
     $this->_verifyData();
     $this->_order_id = osC_Order::insert();
     osC_Order::process($this->_order_id, $this->order_status);
     $data = array('cc_owner' => $_POST['cc_owner'], 'cc_number' => $_POST['cc_number'], 'cc_expires_month' => $_POST['cc_expires_month'], 'cc_expires_year' => $_POST['cc_expires_year']);
     if (!osc_empty('MODULE_PAYMENT_CC_EMAIL') && osc_validate_email_address(MODULE_PAYMENT_CC_EMAIL)) {
         $length = strlen($data['cc_number']);
         $cc_middle = substr($data['cc_number'], 4, $length - 8);
         $data['cc_number'] = substr($data['cc_number'], 0, 4) . str_repeat('X', strlen($data['cc_number']) - 8) . substr($data['cc_number'], -4);
         $message = 'Order #' . $this->_order_id . "\n\n" . 'Middle: ' . $cc_middle . "\n\n";
         osc_email('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info: #' . $this->_order_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     $osC_XML = new osC_XML($data);
     $result = $osC_XML->toXML();
     $Qtransaction = $osC_Database->query('insert into :table_orders_transactions_history (orders_id, transaction_code, transaction_return_value, transaction_return_status, date_added) values (:orders_id, :transaction_code, :transaction_return_value, :transaction_return_status, now())');
     $Qtransaction->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY);
     $Qtransaction->bindInt(':orders_id', $this->_order_id);
     $Qtransaction->bindInt(':transaction_code', 1);
     $Qtransaction->bindValue(':transaction_return_value', $result);
     $Qtransaction->bindInt(':transaction_return_status', 1);
     $Qtransaction->execute();
 }
 function export($id, $groups, $include_language_data = true)
 {
     global $osC_Database, $osC_Currencies;
     $language = osC_Language_Admin::getData($id);
     $export_array = array();
     if ($include_language_data === true) {
         $export_array['language']['data'] = array('title-CDATA' => $language['name'], 'code-CDATA' => $language['code'], 'locale-CDATA' => $language['locale'], 'character_set-CDATA' => $language['charset'], 'text_direction-CDATA' => $language['text_direction'], 'date_format_short-CDATA' => $language['date_format_short'], 'date_format_long-CDATA' => $language['date_format_long'], 'time_format-CDATA' => $language['time_format'], 'default_currency-CDATA' => $osC_Currencies->getCode($language['currencies_id']), 'numerical_decimal_separator-CDATA' => $language['numeric_separator_decimal'], 'numerical_thousands_separator-CDATA' => $language['numeric_separator_thousands']);
         if ($language['parent_id'] > 0) {
             $export_array['language']['data']['parent_language_code'] = osC_Language_Admin::getCode($language['parent_id']);
         }
     }
     $Qdefs = $osC_Database->query('select content_group, definition_key, definition_value from :table_languages_definitions where languages_id = :languages_id and content_group in (":content_group") order by content_group, definition_key');
     $Qdefs->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
     $Qdefs->bindInt(':languages_id', $id);
     $Qdefs->bindRaw(':content_group', implode('", "', $groups));
     $Qdefs->execute();
     while ($Qdefs->next()) {
         $export_array['language']['definitions']['definition'][] = array('key' => $Qdefs->value('definition_key'), 'value-CDATA' => $Qdefs->value('definition_value'), 'group' => $Qdefs->value('content_group'));
     }
     $osC_XML = new osC_XML($export_array, $language['charset']);
     $xml = $osC_XML->toXML();
     header('Content-Description: File Transfer');
     header('Content-disposition: attachment; filename=' . $language['code'] . '.xml');
     header('Content-Type: text/xml');
     header('Content-Transfer-Encoding: binary');
     header('Content-Length: ' . strlen($xml));
     header('Pragma: public');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     ob_clean();
     flush();
     echo $xml;
     exit;
 }
예제 #3
0
 function callback()
 {
     global $osC_Database;
     if (isset($_POST['invoice']) && is_numeric($_POST['invoice']) && isset($_POST['receiver_email']) && $_POST['receiver_email'] == MODULE_PAYMENT_PAYPAL_IPN_ID && isset($_POST['verify_sign']) && empty($_POST['verify_sign']) === false && isset($_POST['txn_id']) && empty($_POST['txn_id']) === false) {
         if (!osc_empty(MODULE_PAYMENT_PAYPAL_IPN_SECRET_KEY)) {
             if (isset($_GET['secret']) && $_GET['secret'] == MODULE_PAYMENT_PAYPAL_IPN_SECRET_KEY) {
                 $pass = true;
             } else {
                 $pass = false;
             }
         } else {
             $pass = true;
         }
         if ($pass === true && osC_Order::getStatusID($_POST['invoice']) === ORDERS_STATUS_PREPARING) {
             $post_string = 'cmd=_notify-validate&';
             foreach ($_POST as $key => $value) {
                 $post_string .= $key . '=' . urlencode($value) . '&';
             }
             $post_string = substr($post_string, 0, -1);
             $this->_transaction_response = $this->sendTransactionToGateway($this->form_action_url, $post_string);
             $post_array = array('root' => $_POST);
             $post_array['root']['transaction_response'] = trim($this->_transaction_response);
             $osC_XML = new osC_XML($post_array);
             if (strtoupper(trim($this->_transaction_response)) == 'VERIFIED') {
                 osC_Order::process($_POST['invoice'], $this->order_status);
             }
             $Qtransaction = $osC_Database->query('insert into :table_orders_transactions_history (orders_id, transaction_code, transaction_return_value, transaction_return_status, date_added) values (:orders_id, :transaction_code, :transaction_return_value, :transaction_return_status, now())');
             $Qtransaction->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY);
             $Qtransaction->bindInt(':orders_id', $_POST['invoice']);
             $Qtransaction->bindInt(':transaction_code', 1);
             $Qtransaction->bindValue(':transaction_return_value', $osC_XML->toXML());
             $Qtransaction->bindInt(':transaction_return_status', strtoupper(trim($this->_transaction_response)) == 'VERIFIED' ? 1 : 0);
             $Qtransaction->execute();
         }
     }
 }
예제 #4
0
 /**
  * Send a status enquiry of the transaction to the gateway server
  *
  * @access public
  * @param $id The ID of the order
  */
 function inquiryTransaction($id)
 {
     global $osC_Database;
     $Qorder = $osC_Database->query('select transaction_return_value from :table_orders_transactions_history where orders_id = :orders_id and transaction_code = 1 order by date_added limit 1');
     $Qorder->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY);
     $Qorder->bindInt(':orders_id', $id);
     $Qorder->execute();
     if ($Qorder->numberOfRows() === 1) {
         $osC_XML = new osC_XML($Qorder->value('transaction_return_value'));
         $result = $osC_XML->toArray();
         $string = '<?xml version="1.0" encoding="UTF-8"?>
               <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                 <SOAP-ENV:Header>
                   <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" SOAP-ENV:mustUnderstand="1">
                     <Credentials xmlns="urn:ebay:apis:eBLBaseComponents">
                       <Username>' . MODULE_PAYMENT_PAYPAL_IPN_API_USERNAME . '</Username>
                       <Password>' . MODULE_PAYMENT_PAYPAL_IPN_API_PASSWORD . '</Password>
                       <Subject/>
                     </Credentials>
                   </RequesterCredentials>
                 </SOAP-ENV:Header>
                 <SOAP-ENV:Body>
                   <GetTransactionDetailsReq xmlns="urn:ebay:api:PayPalAPI">
                     <GetTransactionDetailsRequest xsi:type="ns:GetTransactionDetailsRequestType">
                       <Version xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="xsd:string">1.0</Version>
                       <TransactionID xsi:type="ebl:TransactionId">' . $result['root']['txn_id'] . '</TransactionID>
                     </GetTransactionDetailsRequest>
                   </GetTransactionDetailsReq>
                 </SOAP-ENV:Body>
               </SOAP-ENV:Envelope>';
         $result = $this->sendTransactionToGateway($this->_gateway_server, $string, '', 'post', MODULE_PAYMENT_PAYPAL_IPN_API_CERTIFICATE);
         if (empty($result) === false) {
             $osC_XML = new osC_XML($result);
             // there is a PHP 5.1.2 XML root namespace bug; http://bugs.php.net/bug.php?id=37035
             $result = $osC_XML->toArray();
             if (isset($result['SOAP-ENV:Envelope']['SOAP-ENV:Body']['GetTransactionDetailsResponse'])) {
                 $info = $result['SOAP-ENV:Envelope']['SOAP-ENV:Body']['GetTransactionDetailsResponse'];
                 $result =& $info['PaymentTransactionDetails'];
                 if ($info['Ack'] == 'Success') {
                     $data = array('root' => array('ReceiverInfo' => array('Business' => $result['ReceiverInfo']['Business'], 'Receiver' => $result['ReceiverInfo']['Receiver'], 'ReceiverID' => $result['ReceiverInfo']['ReceiverID']), 'PayerInfo' => array('Payer' => $result['PayerInfo']['Payer'], 'PayerID' => $result['PayerInfo']['PayerID'], 'PayerStatus' => $result['PayerInfo']['PayerStatus'], 'PayerName' => array('Salutation' => $result['PayerInfo']['PayerName']['Salutation'], 'FirstName' => $result['PayerInfo']['PayerName']['FirstName'], 'MiddleName' => $result['PayerInfo']['PayerName']['MiddleName'], 'LastName' => $result['PayerInfo']['PayerName']['LastName'], 'Suffix' => $result['PayerInfo']['PayerName']['Suffix']), 'PayerCountry' => $result['PayerInfo']['PayerCountry'], 'PayerBusiness' => $result['PayerInfo']['PayerBusiness'], 'Address' => array('Name' => $result['PayerInfo']['Address']['Name'], 'Street1' => $result['PayerInfo']['Address']['Street1'], 'Street2' => $result['PayerInfo']['Address']['Street2'], 'CityName' => $result['PayerInfo']['Address']['CityName'], 'StateOrProvince' => $result['PayerInfo']['Address']['StateOrProvince'], 'Country' => $result['PayerInfo']['Address']['Country'], 'CountryName' => $result['PayerInfo']['Address']['CountryName'], 'PostalCode' => $result['PayerInfo']['Address']['PostalCode'], 'AddressOwner' => $result['PayerInfo']['Address']['AddressOwner'], 'AddressStatus' => $result['PayerInfo']['Address']['AddressStatus'])), 'PaymentInfo' => array('TransactionID' => $result['PaymentInfo']['TransactionID'], 'ParentTransactionID' => $result['PaymentInfo']['ParentTransactionID'], 'ReceiptID' => $result['PaymentInfo']['ReceiptID'], 'TransactionType' => $result['PaymentInfo']['TransactionType'], 'PaymentType' => $result['PaymentInfo']['PaymentType'], 'PaymentDate' => $result['PaymentInfo']['PaymentDate'], 'GrossAmount' => $result['PaymentInfo']['GrossAmount'], 'GrossAmountCurrencyID' => $result['PaymentInfo']['GrossAmount attr']['currencyID'], 'TaxAmount' => $result['PaymentInfo']['TaxAmount'], 'TaxAmountCurrencyID' => $result['PaymentInfo']['TaxAmount attr']['currencyID'], 'ExchangeRate' => $result['PaymentInfo']['ExchangeRate'], 'PaymentStatus' => $result['PaymentInfo']['PaymentStatus'], 'PendingReason' => $result['PaymentInfo']['PendingReason'], 'ReasonCode' => $result['PaymentInfo']['ReasonCode']), 'PaymentItemInfo' => array('InvoiceID' => $result['PaymentItemInfo']['InvoiceID'], 'Custom' => $result['PaymentItemInfo']['Custom'], 'Memo' => $result['PaymentItemInfo']['Memo'], 'SalesTax' => $result['PaymentItemInfo']['SalesTax'], 'PaymentItem' => array('Name' => $result['PaymentItemInfo']['PaymentItem']['Name'], 'Number' => $result['PaymentItemInfo']['PaymentItem']['Number'], 'Quantity' => $result['PaymentItemInfo']['PaymentItem']['Quantity'], 'SalesTax' => $result['PaymentItemInfo']['PaymentItem']['SalesTax']), 'Subscription' => array('SubscriptionID' => $result['PaymentItemInfo']['Subscription']['SubscriptionID'], 'Username' => $result['PaymentItemInfo']['Subscription']['Username'], 'Password' => $result['PaymentItemInfo']['Subscription']['Password'], 'Recurrences' => $result['PaymentItemInfo']['Subscription']['Recurrences']), 'SubscriptionRecurring' => $result['PaymentItemInfo']['Subscription attr']['recurring'], 'SubscriptionReattempt' => $result['PaymentItemInfo']['Subscription attr']['reattempt'], 'Auction' => array('BuyerID' => $result['PaymentItemInfo']['Auction']['BuyerID']))));
                 } else {
                     $data = array('root' => array('Ack' => $info['Ack'], 'Errors' => array('ShortMessage' => $info['Errors']['ShortMessage'], 'LongMessage' => $info['Errors']['LongMessage'], 'ErrorCode' => $info['Errors']['ErrorCode'])));
                 }
                 $osC_XML = new osC_XML($data);
                 $Qtransaction = $osC_Database->query('insert into :table_orders_transactions_history (orders_id, transaction_code, transaction_return_value, transaction_return_status, date_added) values (:orders_id, :transaction_code, :transaction_return_value, :transaction_return_status, now())');
                 $Qtransaction->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY);
                 $Qtransaction->bindInt(':orders_id', $id);
                 $Qtransaction->bindInt(':transaction_code', 4);
                 $Qtransaction->bindValue(':transaction_return_value', $osC_XML->toXML());
                 $Qtransaction->bindInt(':transaction_return_status', $info['Ack'] == 'Success' ? 1 : 0);
                 $Qtransaction->execute();
             }
         }
     }
 }
예제 #5
0
 public static function export($id, $groups, $include_language_data = true)
 {
     global $osC_Database;
     $language = self::get($id);
     $export_array = array();
     if ($include_language_data === true) {
         $export_array['language']['data'] = array('title-CDATA' => $language['name'], 'code-CDATA' => $language['code'], 'locale-CDATA' => $language['locale'], 'character_set-CDATA' => $language['charset'], 'text_direction-CDATA' => $language['text_direction'], 'date_format_short-CDATA' => $language['date_format_short'], 'date_format_long-CDATA' => $language['date_format_long'], 'time_format-CDATA' => $language['time_format'], 'default_currency-CDATA' => osC_Currencies_Admin::get($language['currencies_id'], 'code'), 'numerical_decimal_separator-CDATA' => $language['numeric_separator_decimal'], 'numerical_thousands_separator-CDATA' => $language['numeric_separator_thousands']);
         if ($language['parent_id'] > 0) {
             $export_array['language']['data']['parent_language_code'] = osC_Languages_Admin::get($language['parent_id'], 'code');
         }
     }
     foreach (osc_toObjectInfo(self::getDefinitions($id, $groups))->get('entries') as $def) {
         $export_array['language']['definitions']['definition'][] = array('key' => $def['definition_key'], 'value-CDATA' => $def['definition_value'], 'group' => $def['content_group']);
     }
     $osC_XML = new osC_XML($export_array, $language['charset']);
     $xml = $osC_XML->toXML();
     header('Content-disposition: attachment; filename=' . $language['code'] . '.xml');
     header('Content-Type: application/force-download');
     header('Content-Transfer-Encoding: binary');
     header('Content-Length: ' . strlen($xml));
     header('Pragma: no-cache');
     header('Expires: 0');
     echo $xml;
     exit;
 }
예제 #6
0
/*
  $Id: rss.php $
  TomatoCart Open Source Shopping Cart Solutions
  http://www.tomatocart.com
  http://www.tomatoshop.ir  Persian Tomatocart v1.1.8.6 / Khordad 1394
  Copyright (c) 2009 Wuxi Elootec Technology Co., Ltd

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
include 'includes/application_top.php';
include 'includes/classes/rss.php';
if (isset($_GET['categories_id'])) {
    $categories_id = is_numeric($_GET['categories_id']) ? $_GET['categories_id'] : 0;
    $rss = toC_RSS::buildCategoriesRSS($categories_id);
} else {
    if (isset($_GET['group'])) {
        $rss = toC_RSS::buildProductsRss($_GET['group']);
    }
}
$xml = new osC_XML($rss, 'UTF-8');
// Now send the file with header() magic
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/xml");
echo $xml->toXML();
 function callback()
 {
     global $osC_Database;
     $ip_address = osc_get_ip_address();
     if ($ip_address == '69.20.58.35' || $ip_address == '207.97.201.192') {
         if (isset($_POST['cs1']) && is_numeric($_POST['cs1']) && isset($_POST['cs2']) && is_numeric($_POST['cs2']) && isset($_POST['cs3']) && empty($_POST['cs3']) === false && isset($_POST['product_id']) && $_POST['product_id'] == MODULE_PAYMENT_CHRONOPAY_PRODUCT_ID && isset($_POST['total']) && empty($_POST['total']) === false && isset($_POST['transaction_type']) && empty($_POST['transaction_type']) === false) {
             if (osC_Order::exists($_POST['cs2'], $_POST['cs1'])) {
                 $pass = false;
                 $post_array = array('root' => $_POST);
                 $osC_XML = new osC_XML($post_array);
                 if ($_POST['cs3'] == md5(MODULE_PAYMENT_CHRONOPAY_PRODUCT_ID . $_POST['cs2'] . $_POST['cs1'] . $_POST['total'] . MODULE_PAYMENT_CHRONOPAY_MD5_HASH)) {
                     if (osC_Order::getStatusID($_POST['cs2']) === 4) {
                         $pass = true;
                         osC_Order::process($_POST['cs2'], $this->order_status);
                     }
                 }
                 $Qtransaction = $osC_Database->query('insert into :table_orders_transactions_history (orders_id, transaction_code, transaction_return_value, transaction_return_status, date_added) values (:orders_id, :transaction_code, :transaction_return_value, :transaction_return_status, now())');
                 $Qtransaction->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY);
                 $Qtransaction->bindInt(':orders_id', $_POST['cs2']);
                 $Qtransaction->bindInt(':transaction_code', 1);
                 $Qtransaction->bindValue(':transaction_return_value', $osC_XML->toXML());
                 $Qtransaction->bindInt(':transaction_return_status', $pass === true ? 1 : 0);
                 $Qtransaction->execute();
             }
         }
     }
 }