예제 #1
0
 function getTomatCartFeeds()
 {
     global $toC_Json;
     $url = 'http://www.tomatocart.com/live_feeds.php';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_REFERER, HTTP_SERVER);
     curl_setopt($ch, CURLOPT_HTTPGET, true);
     curl_setopt($ch, CURLOPT_HEADER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     $response = curl_exec($ch);
     if (!curl_errno($ch)) {
         $data = trim(substr($response, strpos($response, "\r\n\r\n", strpos(strtolower($response), 'content-length:'))));
         $osC_XML = new osC_XML($data);
         $definitions = $osC_XML->toArray();
         $items = $definitions['rss']['channel']['item'];
         $feeds = '';
         if (is_array($items) && sizeof($items) > 0) {
             $feeds = '<a href="' . $items['link'] . '" target="_blank"><h1>' . $items['title'] . '</h1></a>' . '<p>' . $items['description'] . '</p><p align="right"><a href="' . $items['link'] . '" target="_blank">Read More...</a></p>';
         }
         $response = array('success' => true, 'feeds' => $feeds);
     } else {
         $response = array('success' => false);
     }
     curl_close($ch);
     echo $toC_Json->encode($response);
 }
예제 #2
0
 public function &extractDefinitions($xml)
 {
     $definitions = array();
     if (file_exists(dirname(__FILE__) . '/../../../includes/languages/' . $xml)) {
         $osC_XML = new osC_XML(file_get_contents(dirname(__FILE__) . '/../../../includes/languages/' . $xml));
         $definitions = $osC_XML->toArray();
         if (isset($definitions['language']['definitions']['definition'][0]) === false) {
             $definitions['language']['definitions']['definition'] = array($definitions['language']['definitions']['definition']);
         }
         $definitions = $definitions['language']['definitions']['definition'];
     }
     return $definitions;
 }
예제 #3
0
 function osC_LanguageInstall()
 {
     $osC_DirectoryListing = new osC_DirectoryListing('../includes/languages');
     $osC_DirectoryListing->setIncludeDirectories(false);
     $osC_DirectoryListing->setCheckExtension('xml');
     foreach ($osC_DirectoryListing->getFiles() as $file) {
         $osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file['name']));
         $lang = $osC_XML->toArray();
         $this->_languages[$lang['language']['data']['code']] = array('name' => $lang['language']['data']['title'], 'code' => $lang['language']['data']['code'], 'charset' => $lang['language']['data']['character_set']);
     }
     unset($lang);
     $language = isset($_GET['language']) && !empty($_GET['language']) ? $_GET['language'] : '';
     $this->set($language);
     $this->loadIniFile();
     $this->loadIniFile(basename($_SERVER['SCRIPT_FILENAME']));
 }
예제 #4
0
 function getTomatCartFeeds()
 {
     global $toC_Json;
     $url = 'http://www.tomatoshop.ir/live_feeds.php';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_REFERER, HTTP_SERVER);
     curl_setopt($ch, CURLOPT_HTTPGET, true);
     curl_setopt($ch, CURLOPT_HEADER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     $response = curl_exec($ch);
     if (!curl_errno($ch)) {
         $data = trim(substr($response, strpos($response, "\r\n\r\n", strpos(strtolower($response), 'content-length:'))));
         $osC_XML = new osC_XML($data);
         $definitions = $osC_XML->toArray();
         $items = $definitions['rss']['channel']['item'];
         $feeds = '';
         if (is_array($items) && sizeof($items) > 0) {
             $feeds = '<a href="' . $items['link'] . '" target="_blank"><h1 dir="rtl" align="right">' . $items['title'] . '</h1></a>' . '<p dir="rtl" align="right">' . $items['description'] . '</p><p dir="rtl" align="left"><a href="' . $items['link'] . '" target="_blank">بیشتر...</a></p>';
             require_once 'includes/classes/desktop_settings.php';
             $toC_Desktop_Settings = new toC_Desktop_Settings();
             $last_feed = (int) $toC_Desktop_Settings->getLastLiveFeed();
             $current_feed = (int) $items['pubDate'];
             if ($current_feed > $last_feed) {
                 $response = array('success' => true, 'feeds' => $feeds);
                 $toC_Desktop_Settings->setLastLiveFeed($current_feed);
             } else {
                 $response = array('success' => false);
             }
         }
     } else {
         $response = array('success' => false);
     }
     curl_close($ch);
     echo $toC_Json->encode($response);
 }
 /**
  * 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();
         if (isset($result['IDP attr']['ID'])) {
             $params = array('spPassword' => MODULE_PAYMENT_SAFERPAY_VT_PASSWORD, 'ACCOUNTID' => MODULE_PAYMENT_SAFERPAY_VT_ACCOUNT_ID, 'ID' => $result['IDP attr']['ID'], 'ORDERID' => $id);
             $post_string = '';
             foreach ($params as $key => $value) {
                 $post_string .= $key . '=' . urlencode(trim($value)) . '&';
             }
             $post_string = substr($post_string, 0, -1);
             $this->_transaction_response = $result_string = $this->sendTransactionToGateway('https://support.saferpay.de/scripts/Inquiry.asp', $post_string);
             $pass = false;
             if (substr($this->_transaction_response, 0, 3) == 'OK:') {
                 $pass = true;
                 $this->_transaction_response = substr($this->_transaction_response, 3);
             }
             $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', $this->_transaction_response);
             $Qtransaction->bindInt(':transaction_return_status', $pass === true ? 1 : 0);
             $Qtransaction->execute();
         }
     }
 }
예제 #6
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();
 }
예제 #7
0
 function process()
 {
     global $osC_Database, $osC_Customer, $osC_Currencies, $osC_ShoppingCart, $osC_Language, $osC_MessageStack, $osC_CreditCard;
     $this->_verifyData();
     $this->_order_id = osC_Order::insert();
     $params = array('spPassword' => MODULE_PAYMENT_SAFERPAY_CC_PASSWORD, 'ACCOUNTID' => MODULE_PAYMENT_SAFERPAY_CC_ACCOUNT_ID, 'ORDERID' => $this->_order_id, 'NAME' => $osC_CreditCard->getOwner(), 'PAN' => $osC_CreditCard->getNumber(), 'EXP' => $osC_CreditCard->getExpiryMonth() . substr($osC_CreditCard->getExpiryYear(), -2), 'AMOUNT' => $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal(), $osC_Currencies->getCode()) * 100, 'CURRENCY' => $osC_Currencies->getCode());
     if (MODULE_PAYMENT_SAFERPAY_CC_VERIFY_WITH_CVC == '1') {
         $params['CVC'] = $osC_CreditCard->getCVC();
     }
     $post_string = '';
     foreach ($params as $key => $value) {
         $post_string .= $key . '=' . urlencode(trim($value)) . '&';
     }
     $post_string = substr($post_string, 0, -1);
     $this->_transaction_response = $this->sendTransactionToGateway('https://support.saferpay.de/scripts/Execute.asp', $post_string);
     $error = false;
     if (substr($this->_transaction_response, 0, 3) == 'OK:') {
         $this->_transaction_response = trim(substr($this->_transaction_response, 3));
         $osC_XML = new osC_XML($this->_transaction_response);
         $result = $osC_XML->toArray();
         switch ($result['IDP attr']['RESULT']) {
             case '0':
                 //success
                 break;
             case '62':
             case '63':
             case '64':
                 $error = $osC_Language->get('payment_saferpay_cc_error_' . (int) $result['IDP attr']['RESULT']);
                 break;
             default:
                 $error = $osC_Language->get('payment_saferpay_cc_error_general');
                 break;
         }
     } else {
         $error = $osC_Language->get('payment_saferpay_cc_error_general');
     }
     if ($error === false) {
         osC_Order::process($this->_order_id, $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', $this->_order_id);
         $Qtransaction->bindInt(':transaction_code', 1);
         $Qtransaction->bindValue(':transaction_return_value', $this->_transaction_response);
         $Qtransaction->bindInt(':transaction_return_status', 1);
         $Qtransaction->execute();
     } else {
         osC_Order::remove($this->_order_id);
         $osC_MessageStack->add('checkout_payment', $error, 'error');
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment&saferpay_cc_owner=' . $osC_CreditCard->getOwner() . '&saferpay_cc_expires_month=' . $osC_CreditCard->getExpiryMonth() . '&saferpay_cc_expires_year=' . $osC_CreditCard->getExpiryYear() . (MODULE_PAYMENT_SAFERPAY_CC_VERIFY_WITH_CVC == '1' ? '&saferpay_cc_cvc=' . $osC_CreditCard->getCVC() : ''), 'SSL'));
     }
 }
예제 #8
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();
         }
     }
 }
예제 #9
0
 function process()
 {
     global $osC_Database, $osC_Customer, $osC_Currencies, $osC_ShoppingCart, $osC_Language, $messageStack, $osC_CreditCard;
     $this->_verifyData();
     $this->_order_id = osC_Order::insert();
     $post_string = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">' . "\n" . '  <W_REQUEST>' . "\n" . '    <W_JOB>' . "\n" . '      <JobID>Job 1</JobID>' . "\n" . '      <BusinessCaseSignature>' . MODULE_PAYMENT_WIRECARD_CC_BUSINESS_SIGNATURE . '</BusinessCaseSignature>' . "\n" . '      <FNC_CC_PREAUTHORIZATION>' . "\n" . '        <FunctionID>Preauthorization 1</FunctionID>' . "\n" . '        <CC_TRANSACTION mode="' . MODULE_PAYMENT_WIRECARD_CC_TRANSACTION_MODE . '">' . "\n" . '          <TransactionID>' . $this->_order_id . '</TransactionID>' . "\n" . '          <CommerceType>eCommerce</CommerceType>' . "\n" . '          <Amount>' . $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal(), $osC_Currencies->getCode()) * 100 . '</Amount>' . "\n" . '          <Currency>' . $osC_Currencies->getCode() . '</Currency>' . "\n" . '          <CountryCode>' . osC_Address::getCountryIsoCode2(STORE_COUNTRY) . '</CountryCode>' . "\n" . '          <Usage>' . STORE_NAME . '</Usage>' . "\n" . '          <RECURRING_TRANSACTION>' . "\n" . '            <Type>Single</Type>' . "\n" . '          </RECURRING_TRANSACTION>' . "\n" . '          <CREDIT_CARD_DATA>' . "\n" . '            <CreditCardNumber>' . $osC_CreditCard->getNumber() . '</CreditCardNumber>' . "\n";
     if (MODULE_PAYMENT_WIRECARD_CC_VERIFY_WITH_CVC == '1') {
         $post_string .= '            <CVC2>' . $osC_CreditCard->getCVC() . '</CVC2>' . "\n";
     }
     $post_string .= '            <ExpirationYear>' . $osC_CreditCard->getExpiryYear() . '</ExpirationYear>' . "\n" . '            <ExpirationMonth>' . $osC_CreditCard->getExpiryMonth() . '</ExpirationMonth>' . "\n" . '            <CardHolderName>' . $osC_CreditCard->getOwner() . '</CardHolderName>' . "\n" . '          </CREDIT_CARD_DATA>' . "\n" . '          <CONTACT_DATA>' . "\n" . '            <IPAddress>' . osc_get_ip_address() . '</IPAddress>' . "\n" . '          </CONTACT_DATA>' . "\n" . '          <CORPTRUSTCENTER_DATA>' . "\n" . '            <ADDRESS>' . "\n" . '              <FirstName>' . $osC_ShoppingCart->getBillingAddress('firstname') . '</FirstName>' . "\n" . '              <LastName>' . $osC_ShoppingCart->getBillingAddress('lastname') . '</LastName>' . "\n" . '              <Address1>' . $osC_ShoppingCart->getBillingAddress('street_address') . '</Address1>' . "\n" . '              <City>' . $osC_ShoppingCart->getBillingAddress('city') . '</City>' . "\n" . '              <ZipCode>' . $osC_ShoppingCart->getBillingAddress('postcode') . '</ZipCode>' . "\n";
     if (osc_empty($osC_ShoppingCart->getBillingAddress('zone_code')) === false) {
         $post_string .= '              <State>' . $osC_ShoppingCart->getBillingAddress('zone_code') . '</State>' . "\n";
     }
     $post_string .= '              <Country>' . $osC_ShoppingCart->getBillingAddress('country_iso_code_2') . '</Country>' . "\n" . '              <Phone>' . $osC_ShoppingCart->getBillingAddress('telephone_number') . '</Phone>' . "\n" . '              <Email>' . $osC_Customer->getEmailAddress() . '</Email>' . "\n" . '            </ADDRESS>' . "\n" . '          </CORPTRUSTCENTER_DATA>' . "\n" . '        </CC_TRANSACTION>' . "\n" . '      </FNC_CC_PREAUTHORIZATION>' . "\n" . '    </W_JOB>' . "\n" . '  </W_REQUEST>' . "\n" . '</WIRECARD_BXML>';
     $this->_transaction_response = $this->sendTransactionToGateway($this->_gateway_url, $post_string, array('Content-type: text/xml'));
     if (empty($this->_transaction_response) === false) {
         $osC_XML = new osC_XML($this->_transaction_response);
         $result = $osC_XML->toArray();
     } else {
         $result = array();
     }
     $error = false;
     if (isset($result['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_PREAUTHORIZATION']['CC_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'])) {
         if ($result['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_PREAUTHORIZATION']['CC_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'] != 'ACK') {
             $errno = $result['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_PREAUTHORIZATION']['CC_TRANSACTION']['PROCESSING_STATUS']['ERROR']['Number'];
             switch ($errno) {
                 case '14':
                 case '20109':
                     $error = $osC_Language->get('payment_wirecard_cc_error_unkown_card');
                     break;
                 case '33':
                 case '20071':
                     $error = $osC_Language->get('payment_wirecard_cc_error_' . (int) $errno);
                     break;
                 default:
                     $error = $osC_Language->get('payment_wirecard_cc_error_general');
                     break;
             }
         }
     } else {
         $error = $osC_Language->get('payment_wirecard_cc_error_general');
     }
     if ($error === false) {
         osC_Order::process($this->_order_id, $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', $this->_order_id);
         $Qtransaction->bindInt(':transaction_code', 1);
         $Qtransaction->bindValue(':transaction_return_value', $this->_transaction_response);
         $Qtransaction->bindInt(':transaction_return_status', 1);
         $Qtransaction->execute();
     } else {
         osC_Order::remove($this->_order_id);
         $messageStack->add_session('checkout_payment', $error, 'error');
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment&wirecard_cc_owner=' . $osC_CreditCard->getOwner() . '&wirecard_cc_expires_month=' . $osC_CreditCard->getExpiryMonth() . '&wirecard_cc_expires_year=' . $osC_CreditCard->getExpiryYear() . (MODULE_PAYMENT_WIRECARD_CC_VERIFY_WITH_CVC == '1' ? '&wirecard_cc_cvc=' . $osC_CreditCard->getCVC() : ''), 'SSL'));
     }
 }
 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();
             }
         }
     }
 }
 function import($file, $type)
 {
     global $osC_Database, $osC_Currencies;
     if (file_exists('../includes/languages/' . $file . '.xml')) {
         $osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
         $source = $osC_XML->toArray();
         $language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => $source['language']['data']['parent_language_code'], 'parent_id' => 0);
         if (!$osC_Currencies->exists($language['currency'])) {
             $language['currency'] = DEFAULT_CURRENCY;
         }
         if (!empty($language['parent_language_code'])) {
             $Qlanguage = $osC_Database->query('select languages_id from :table_languages where code = :code');
             $Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
             $Qlanguage->bindValue(':code', $language['parent_language_code']);
             $Qlanguage->execute();
             if ($Qlanguage->numberOfRows() === 1) {
                 $language['parent_id'] = $Qlanguage->valueInt('languages_id');
             }
         }
         $definitions = array();
         if (isset($source['language']['definitions']['definition'])) {
             $definitions = $source['language']['definitions']['definition'];
             if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
                 $definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
             }
         }
         $tables = array();
         if (isset($source['language']['tables']['table'])) {
             $tables = $source['language']['tables']['table'];
         }
         unset($source);
         $error = false;
         $add_category_and_product_placeholders = true;
         $osC_Database->startTransaction();
         $Qcheck = $osC_Database->query('select languages_id from :table_languages where code = :code');
         $Qcheck->bindTable(':table_languages', TABLE_LANGUAGES);
         $Qcheck->bindValue(':code', $language['code']);
         $Qcheck->execute();
         if ($Qcheck->numberOfRows() === 1) {
             $add_category_and_product_placeholders = false;
             $language_id = $Qcheck->valueInt('languages_id');
             $Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
             $Qlanguage->bindInt(':languages_id', $language_id);
         } else {
             $Qlanguage = $osC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
         }
         $Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
         $Qlanguage->bindValue(':name', $language['name']);
         $Qlanguage->bindValue(':code', $language['code']);
         $Qlanguage->bindValue(':locale', $language['locale']);
         $Qlanguage->bindValue(':charset', $language['charset']);
         $Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
         $Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
         $Qlanguage->bindValue(':time_format', $language['time_format']);
         $Qlanguage->bindValue(':text_direction', $language['text_direction']);
         $Qlanguage->bindInt(':currencies_id', $osC_Currencies->getID($language['currency']));
         $Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
         $Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
         $Qlanguage->bindInt(':parent_id', $language['parent_id']);
         $Qlanguage->setLogging($_SESSION['module'], $Qcheck->numberOfRows() === 1 ? $language_id : null);
         $Qlanguage->execute();
         if ($osC_Database->isError()) {
             $error = true;
         } else {
             if ($Qcheck->numberOfRows() !== 1) {
                 $language_id = $osC_Database->nextID();
             }
             $default_language_id = osC_Language_Admin::getData(osC_Language_Admin::getID(DEFAULT_LANGUAGE), 'languages_id');
             if ($type == 'replace') {
                 $Qdel = $osC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
                 $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                 $Qdel->bindInt(':languages_id', $language_id);
                 $Qdel->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                 }
             }
         }
         if ($error === false) {
             $osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/' . $file);
             $osC_DirectoryListing->setRecursive(true);
             $osC_DirectoryListing->setIncludeDirectories(false);
             $osC_DirectoryListing->setAddDirectoryToFilename(true);
             $osC_DirectoryListing->setCheckExtension('xml');
             foreach ($osC_DirectoryListing->getFiles() as $files) {
                 $definitions = array_merge($definitions, osC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
             }
             foreach ($definitions as $def) {
                 $insert = false;
                 $update = false;
                 if ($type == 'replace') {
                     $insert = true;
                 } else {
                     $Qcheck = $osC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                     $Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qcheck->bindValue(':definition_key', $def['key']);
                     $Qcheck->bindInt(':languages_id', $language_id);
                     $Qcheck->bindValue(':content_group', $def['group']);
                     $Qcheck->execute();
                     if ($Qcheck->numberOfRows() > 0) {
                         if ($type == 'update') {
                             $update = true;
                         }
                     } elseif ($type == 'add') {
                         $insert = true;
                     }
                 }
                 if ($insert === true || $update === true) {
                     if ($insert === true) {
                         $Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
                     } else {
                         $Qdef = $osC_Database->query('update :table_languages_definitions set content_group = :content_group, definition_key = :definition_key, definition_value = :definition_value where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                         $Qdef->bindValue(':definition_key', $def['key']);
                         $Qdef->bindValue(':content_group', $def['group']);
                     }
                     $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qdef->bindInt(':languages_id', $language_id);
                     $Qdef->bindValue(':content_group', $def['group']);
                     $Qdef->bindValue(':definition_key', $def['key']);
                     $Qdef->bindValue(':definition_value', $def['value']);
                     $Qdef->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
         if ($add_category_and_product_placeholders === true) {
             if (!empty($tables)) {
                 foreach ($tables as $table) {
                     $table_name = str_replace('toc_', DB_TABLE_PREFIX, $table['meta']['name']);
                     $key_field = $table['meta']['key_field'];
                     $language_field = $table['meta']['language_field'];
                     $Qcheck = $osC_Database->query('select * from :table_name where ' . $language_field . ' = :language_id');
                     $Qcheck->bindTable(':table_name', $table_name);
                     $Qcheck->bindInt(':language_id', $default_language_id);
                     $Qcheck->execute();
                     while ($Qcheck->next()) {
                         $data = $Qcheck->toArray();
                         $data[$language_field] = $language_id;
                         $insert = false;
                         foreach ($table['definition'] as $definition) {
                             if ($data[$key_field] == $definition['key']) {
                                 $insert = true;
                                 foreach ($definition as $key => $value) {
                                     if ($key != 'key' && array_key_exists($key, $data)) {
                                         $data[$key] = $osC_Database->escapeString($value);
                                     }
                                 }
                             }
                         }
                         if ($insert === true) {
                             $fields = array_keys($data);
                             $values = array();
                             foreach ($fields as $field) {
                                 $values[] = "'" . $data[$field] . "'";
                             }
                             $Qinsert = $osC_Database->query('insert into :table_name (' . implode(', ', $fields) . ') values (' . implode(', ', $values) . ')');
                             $Qinsert->bindTable(':table_name', $table_name);
                             $Qinsert->execute();
                         }
                     }
                 }
             }
             if ($error === false) {
                 $Qcategories = $osC_Database->query('select categories_id, categories_name, categories_url, categories_page_title, categories_meta_keywords, categories_meta_description from :table_categories_description where language_id = :language_id');
                 $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                 $Qcategories->bindInt(':language_id', $default_language_id);
                 $Qcategories->execute();
                 while ($Qcategories->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_categories_description (categories_id, language_id, categories_name, categories_url, categories_page_title, categories_meta_keywords, categories_meta_description) values (:categories_id, :language_id, :categories_name, :categories_url, :categories_page_title, :categories_meta_keywords, :categories_meta_description)');
                     $Qinsert->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                     $Qinsert->bindInt(':categories_id', $Qcategories->valueInt('categories_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':categories_name', $Qcategories->value('categories_name'));
                     $Qinsert->bindValue(':categories_url', $Qcategories->value('categories_url'));
                     $Qinsert->bindValue(':categories_page_title', $Qcategories->value('categories_page_title'));
                     $Qinsert->bindValue(':categories_meta_keywords', $Qcategories->value('categories_meta_keywords'));
                     $Qinsert->bindValue(':categories_meta_description', $Qcategories->value('categories_meta_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qproducts = $osC_Database->query('select products_id, products_name, products_description, products_keyword, products_tags, products_url, products_friendly_url, products_page_title, products_meta_keywords, products_meta_description, products_viewed from :table_products_description where language_id = :language_id');
                 $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                 $Qproducts->bindInt(':language_id', $default_language_id);
                 $Qproducts->execute();
                 while ($Qproducts->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_description (products_id, language_id, products_name, products_description, products_keyword, products_tags, products_url, products_friendly_url, products_page_title, products_meta_keywords, products_meta_description, products_viewed) values (:products_id, :language_id, :products_name, :products_description, :products_keyword, :products_tags, :products_url, :products_friendly_url, :products_page_title, :products_meta_keywords, :products_meta_description, :products_viewed)');
                     $Qinsert->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                     $Qinsert->bindInt(':products_id', $Qproducts->valueInt('products_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_name', $Qproducts->value('products_name'));
                     $Qinsert->bindValue(':products_description', $Qproducts->value('products_description'));
                     $Qinsert->bindValue(':products_keyword', $Qproducts->value('products_keyword'));
                     $Qinsert->bindValue(':products_tags', $Qproducts->value('products_tags'));
                     $Qinsert->bindValue(':products_url', $Qproducts->value('products_url'));
                     $Qinsert->bindValue(':products_friendly_url', $Qproducts->value('products_friendly_url'));
                     $Qinsert->bindValue(':products_page_title', $Qproducts->value('products_page_title'));
                     $Qinsert->bindValue(':products_meta_keywords', $Qproducts->value('products_meta_keywords'));
                     $Qinsert->bindValue(':products_meta_description', $Qproducts->value('products_meta_description'));
                     $Qinsert->bindInt(':products_viewed', $Qproducts->valueInt('products_viewed'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $QcustomizationFields = $osC_Database->query('select customization_fields_id, languages_id, name from :table_customization_fields_description where languages_id = :languages_id');
                 $QcustomizationFields->bindTable(':table_customization_fields_description', TABLE_CUSTOMIZATION_FIELDS_DESCRIPTION);
                 $QcustomizationFields->bindInt(':languages_id', $default_language_id);
                 $QcustomizationFields->execute();
                 while ($QcustomizationFields->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_customization_fields_description (customization_fields_id, languages_id, name) values (:customization_fields_id, :languages_id, :name)');
                     $Qinsert->bindTable(':table_customization_fields_description', TABLE_CUSTOMIZATION_FIELDS_DESCRIPTION);
                     $Qinsert->bindInt(':customization_fields_id', $QcustomizationFields->valueInt('customization_fields_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':name', $QcustomizationFields->value('name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qvariants = $osC_Database->query('select products_variants_groups_id, products_variants_groups_name from :table_products_variants_groups where language_id = :language_id');
                 $Qvariants->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                 $Qvariants->bindInt(':language_id', $default_language_id);
                 $Qvariants->execute();
                 while ($Qvariants->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_variants_groups (products_variants_groups_id, language_id, products_variants_groups_name) values (:products_variants_groups_id, :language_id, :products_variants_groups_name)');
                     $Qinsert->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                     $Qinsert->bindInt(':products_variants_groups_id', $Qvariants->valueInt('products_variants_groups_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_variants_groups_name', $Qvariants->value('products_variants_groups_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qvalues = $osC_Database->query('select products_variants_values_id, products_variants_values_name from :table_products_variants_values where language_id = :language_id');
                 $Qvalues->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                 $Qvalues->bindInt(':language_id', $default_language_id);
                 $Qvalues->execute();
                 while ($Qvalues->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_variants_values (products_variants_values_id, language_id, products_variants_values_name) values (:products_variants_values_id, :language_id, :products_variants_values_name)');
                     $Qinsert->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                     $Qinsert->bindInt(':products_variants_values_id', $Qvalues->valueInt('products_variants_values_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_variants_values_name', $Qvalues->value('products_variants_values_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qmanufacturers = $osC_Database->query('select manufacturers_id, manufacturers_url, manufacturers_friendly_url from :table_manufacturers_info where languages_id = :languages_id');
                 $Qmanufacturers->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                 $Qmanufacturers->bindInt(':languages_id', $default_language_id);
                 $Qmanufacturers->execute();
                 while ($Qmanufacturers->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_manufacturers_info (manufacturers_id, languages_id, manufacturers_url, manufacturers_friendly_url) values (:manufacturers_id, :languages_id, :manufacturers_url, :manufacturers_friendly_url)');
                     $Qinsert->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                     $Qinsert->bindInt(':manufacturers_id', $Qmanufacturers->valueInt('manufacturers_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':manufacturers_url', $Qmanufacturers->value('manufacturers_url'));
                     $Qinsert->bindValue(':manufacturers_friendly_url', $Qmanufacturers->value('manufacturers_friendly_url'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qimages = $osC_Database->query('select image_id, description, image, image_url, sort_order, status from :table_slide_images where language_id = :language_id');
                 $Qimages->bindTable(':table_slide_images', TABLE_SLIDE_IMAGES);
                 $Qimages->bindInt(':language_id', $default_language_id);
                 $Qimages->execute();
                 while ($Qimages->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_slide_images (image_id, language_id, description, image, image_url, sort_order, status) values (:image_id, :language_id, :description, :image, :image_url, :sort_order, :status)');
                     $Qinsert->bindTable(':table_slide_images', TABLE_SLIDE_IMAGES);
                     $Qinsert->bindInt(':image_id', $Qimages->valueInt('image_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':description', $Qimages->value('description'));
                     $Qinsert->bindValue(':image', $Qimages->value('image'));
                     $Qinsert->bindValue(':image_url', $Qimages->value('image_url'));
                     $Qinsert->bindInt(':sort_order', $Qimages->valueInt('sort_order'));
                     $Qinsert->bindInt(':status', $Qimages->valueInt('status'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattributes = $osC_Database->query('select products_attributes_values_id, products_attributes_groups_id, name, module, value, status, sort_order from :table_products_attributes_values where language_id = :language_id');
                 $Qattributes->bindTable(':table_products_attributes_values', TABLE_PRODUCTS_ATTRIBUTES_VALUES);
                 $Qattributes->bindInt(':language_id', $default_language_id);
                 $Qattributes->execute();
                 while ($Qattributes->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_attributes_values (products_attributes_values_id, products_attributes_groups_id, language_id, name, module, value, status, sort_order) values (:products_attributes_values_id, :products_attributes_groups_id, :language_id, :name, :module, :value, :status, :sort_order)');
                     $Qinsert->bindTable(':table_products_attributes_values', TABLE_PRODUCTS_ATTRIBUTES_VALUES);
                     $Qinsert->bindInt(':products_attributes_values_id', $Qattributes->valueInt('products_attributes_values_id'));
                     $Qinsert->bindInt(':products_attributes_groups_id', $Qattributes->valueInt('products_attributes_groups_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':name', $Qattributes->value('name'));
                     $Qinsert->bindValue(':module', $Qattributes->value('module'));
                     $Qinsert->bindValue(':value', $Qattributes->value('value'));
                     $Qinsert->bindInt(':status', $Qattributes->valueInt('status'));
                     $Qinsert->bindInt(':sort_order', $Qattributes->valueInt('sort_order'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattributes = $osC_Database->query('select products_id, products_attributes_values_id, value from :table_products_attributes where language_id = :language_id');
                 $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                 $Qattributes->bindInt(':language_id', $default_language_id);
                 $Qattributes->execute();
                 while ($Qattributes->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_attributes (products_id, products_attributes_values_id, value, language_id) values (:products_id, :products_attributes_values_id, :value, :language_id)');
                     $Qinsert->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                     $Qinsert->bindInt(':products_id', $Qattributes->valueInt('products_id'));
                     $Qinsert->bindInt(':products_attributes_values_id', $Qattributes->valueInt('products_attributes_values_id'));
                     $Qinsert->bindValue(':value', $Qattributes->value('value'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qfaqs = $osC_Database->query('select faqs_id, faqs_question, faqs_url, faqs_answer from :table_faqs_description where language_id = :language_id');
                 $Qfaqs->bindTable(':table_faqs_description', TABLE_FAQS_DESCRIPTION);
                 $Qfaqs->bindInt(':language_id', $default_language_id);
                 $Qfaqs->execute();
                 while ($Qfaqs->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_faqs_description (faqs_id, language_id, faqs_question, faqs_answer, faqs_url) values (:faqs_id, :language_id, :faqs_question, :faqs_answer, :faqs_url)');
                     $Qinsert->bindTable(':table_faqs_description', TABLE_FAQS_DESCRIPTION);
                     $Qinsert->bindInt(':faqs_id', $Qfaqs->valueInt('faqs_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':faqs_question', $Qfaqs->value('faqs_question'));
                     $Qinsert->bindValue(':faqs_answer', $Qfaqs->value('faqs_answer'));
                     $Qinsert->bindValue(':faqs_url', $Qfaqs->value('faqs_url'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qcoupons = $osC_Database->query('select coupons_id, coupons_name, coupons_description from :table_coupons_description where language_id = :language_id');
                 $Qcoupons->bindTable(':table_coupons_description', TABLE_COUPONS_DESCRIPTION);
                 $Qcoupons->bindInt(':language_id', $default_language_id);
                 $Qcoupons->execute();
                 while ($Qcoupons->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_coupons_description (coupons_id, language_id, coupons_name, coupons_description) values (:coupons_id, :language_id, :coupons_name, :coupons_description)');
                     $Qinsert->bindTable(':table_coupons_description', TABLE_COUPONS_DESCRIPTION);
                     $Qinsert->bindInt(':coupons_id', $Qcoupons->valueInt('coupons_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':coupons_name', $Qcoupons->value('coupons_name'));
                     $Qinsert->bindValue(':coupons_description', $Qcoupons->value('coupons_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qarticles = $osC_Database->query('select articles_id, articles_name, articles_description, articles_url, articles_page_title, articles_meta_keywords, articles_meta_description from :table_articles_description where language_id = :language_id');
                 $Qarticles->bindTable(':table_articles_description', TABLE_ARTICLES_DESCRIPTION);
                 $Qarticles->bindInt(':language_id', $default_language_id);
                 $Qarticles->execute();
                 while ($Qarticles->next()) {
                     $Qcheck = $osC_Database->query('select * from :table_articles_description where articles_id = :articles_id and language_id = :language_id');
                     $Qcheck->bindTable(':table_articles_description', TABLE_ARTICLES_DESCRIPTION);
                     $Qcheck->bindInt(':articles_id', $Qarticles->valueInt('articles_id'));
                     $Qcheck->bindInt(':language_id', $language_id);
                     $Qcheck->execute();
                     if ($Qcheck->numberOfRows() === 0) {
                         $Qinsert = $osC_Database->query('insert into :table_articles_description (articles_id, language_id, articles_name, articles_description, articles_url, articles_page_title, articles_meta_keywords, articles_meta_description) values (:articles_id, :language_id, :articles_name, :articles_description, :articles_url, :articles_page_title, :articles_meta_keywords, :articles_meta_description)');
                         $Qinsert->bindTable(':table_articles_description', TABLE_ARTICLES_DESCRIPTION);
                         $Qinsert->bindInt(':articles_id', $Qarticles->valueInt('articles_id'));
                         $Qinsert->bindInt(':language_id', $language_id);
                         $Qinsert->bindValue(':articles_name', $Qarticles->value('articles_name'));
                         $Qinsert->bindValue(':articles_description', $Qarticles->value('articles_description'));
                         $Qinsert->bindValue(':articles_url', $Qarticles->value('articles_url'));
                         $Qinsert->bindValue(':articles_page_title', $Qarticles->value('articles_page_title'));
                         $Qinsert->bindValue(':articles_meta_keywords', $Qarticles->value('articles_meta_keywords'));
                         $Qinsert->bindValue(':articles_meta_description', $Qarticles->value('articles_meta_description'));
                         $Qinsert->execute();
                         if ($osC_Database->isError()) {
                             $error = true;
                             break;
                         }
                     }
                 }
             }
             if ($error === false) {
                 $Qcategories = $osC_Database->query('select articles_categories_id, articles_categories_name, articles_categories_url, articles_categories_page_title, articles_categories_meta_keywords, articles_categories_meta_description from :table_articles_categories_description where language_id = :language_id');
                 $Qcategories->bindTable(':table_articles_categories_description', TABLE_ARTICLES_CATEGORIES_DESCRIPTION);
                 $Qcategories->bindInt(':language_id', $default_language_id);
                 $Qcategories->execute();
                 while ($Qcategories->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_articles_categories_description (articles_categories_id, language_id, articles_categories_name, articles_categories_url, articles_categories_page_title, articles_categories_meta_keywords, articles_categories_meta_description) values (:articles_categories_id, :language_id, :articles_categories_name, :articles_categories_url, :articles_categories_page_title, :articles_categories_meta_keywords, :articles_categories_meta_description )');
                     $Qinsert->bindTable(':table_articles_categories_description', TABLE_ARTICLES_CATEGORIES_DESCRIPTION);
                     $Qinsert->bindInt(':articles_categories_id', $Qcategories->valueInt('articles_categories_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':articles_categories_name', $Qcategories->value('articles_categories_name'));
                     $Qinsert->bindValue(':articles_categories_url', $Qcategories->value('articles_categories_url'));
                     $Qinsert->bindValue(':articles_categories_page_title', $Qcategories->value('articles_categories_page_title'));
                     $Qinsert->bindValue(':articles_categories_meta_keywords', $Qcategories->value('articles_categories_meta_keywords'));
                     $Qinsert->bindValue(':articles_categories_meta_description', $Qcategories->value('articles_categories_meta_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qgroups = $osC_Database->query('select customers_groups_id, customers_groups_name from :table_customers_groups_description where language_id = :language_id');
                 $Qgroups->bindTable(':table_customers_groups_description', TABLE_CUSTOMERS_GROUPS_DESCRIPTION);
                 $Qgroups->bindInt(':language_id', $default_language_id);
                 $Qgroups->execute();
                 while ($Qgroups->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_customers_groups_description (customers_groups_id, language_id, customers_groups_name) values (:customers_groups_id, :language_id, :customers_groups_name)');
                     $Qinsert->bindTable(':table_customers_groups_description', TABLE_CUSTOMERS_GROUPS_DESCRIPTION);
                     $Qinsert->bindInt(':customers_groups_id', $Qgroups->valueInt('customers_groups_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':customers_groups_name', $Qgroups->value('customers_groups_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qratings = $osC_Database->query('select ratings_id, ratings_text from :table_ratings_description where languages_id = :languages_id');
                 $Qratings->bindTable(':table_ratings_description', TABLE_RATINGS_DESCRIPTION);
                 $Qratings->bindInt(':languages_id', $default_language_id);
                 $Qratings->execute();
                 while ($Qratings->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_ratings_description (ratings_id, languages_id, ratings_text) values (:ratings_id, :languages_id, :ratings_text)');
                     $Qinsert->bindTable(':table_ratings_description', TABLE_RATINGS_DESCRIPTION);
                     $Qinsert->bindInt(':ratings_id', $Qratings->valueInt('ratings_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':ratings_text', $Qratings->value('ratings_text'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qpolls = $osC_Database->query('select polls_id, polls_title from :table_polls_description where languages_id = :languages_id');
                 $Qpolls->bindTable(':table_polls_description', TABLE_POLLS_DESCRIPTION);
                 $Qpolls->bindInt(':languages_id', $default_language_id);
                 $Qpolls->execute();
                 while ($Qpolls->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_polls_description (polls_id, languages_id, polls_title) values (:polls_id, :languages_id, :polls_title)');
                     $Qinsert->bindTable(':table_polls_description', TABLE_POLLS_DESCRIPTION);
                     $Qinsert->bindInt(':polls_id', $Qpolls->valueInt('polls_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':polls_title', $Qpolls->value('polls_title'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qanswers = $osC_Database->query('select polls_answers_id, answers_title from :table_polls_answers_description where languages_id = :languages_id');
                 $Qanswers->bindTable(':table_polls_answers_description', TABLE_POLLS_ANSWERS_DESCRIPTION);
                 $Qanswers->bindInt(':languages_id', $default_language_id);
                 $Qanswers->execute();
                 while ($Qanswers->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_polls_answers_description (polls_answers_id, languages_id, answers_title) values (:polls_answers_id, :languages_id, :answers_title)');
                     $Qinsert->bindTable(':table_polls_answers_description', TABLE_POLLS_ANSWERS_DESCRIPTION);
                     $Qinsert->bindInt(':polls_answers_id', $Qanswers->valueInt('polls_answers_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':answers_title', $Qanswers->value('answers_title'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattachments = $osC_Database->query('select attachments_id, attachments_name, attachments_description from :table_products_attachments_description where languages_id = :language_id');
                 $Qattachments->bindTable(':table_products_attachments_description', TABLE_PRODUCTS_ATTACHMENTS_DESCRIPTION);
                 $Qattachments->bindInt(':language_id', $default_language_id);
                 $Qattachments->execute();
                 while ($Qattachments->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_attachments_description (attachments_id, languages_id, attachments_name, attachments_description) values (:attachments_id, :languages_id, :attachments_name, :attachments_description)');
                     $Qinsert->bindTable(':table_products_attachments_description', TABLE_PRODUCTS_ATTACHMENTS_DESCRIPTION);
                     $Qinsert->bindInt(':attachments_id', $Qattachments->valueInt('attachments_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':attachments_name', $Qattachments->value('attachments_name'));
                     $Qinsert->bindValue(':attachments_description', $Qattachments->value('attachments_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qdepart = $osC_Database->query('select departments_id, departments_title, departments_description from :table_departments_description where languages_id = :language_id');
                 $Qdepart->bindTable(':table_departments_description', TABLE_DEPARTMENTS_DESCRIPTION);
                 $Qdepart->bindInt(':language_id', $default_language_id);
                 $Qdepart->execute();
                 while ($Qdepart->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_departments_description (departments_id, languages_id, departments_title, departments_description) values (:departments_id, :languages_id, :departments_title, :departments_description)');
                     $Qinsert->bindTable(':table_departments_description', TABLE_DEPARTMENTS_DESCRIPTION);
                     $Qinsert->bindInt(':departments_id', $Qdepart->valueInt('departments_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':departments_title', $Qdepart->value('departments_title'));
                     $Qinsert->bindValue(':departments_description', $Qdepart->value('departments_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('languages');
         return true;
     } else {
         $osC_Database->rollbackTransaction();
     }
     return false;
 }
예제 #12
0
 function process()
 {
     global $osC_Database, $osC_Customer, $osC_Currencies, $osC_ShoppingCart, $osC_Language, $messageStack, $osC_CreditCard;
     $this->_verifyData();
     $this->_order_id = osC_Order::insert();
     $post_string = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">' . "\n" . '  <W_REQUEST>' . "\n" . '    <W_JOB>' . "\n" . '      <JobID>Job 1</JobID>' . "\n" . '      <BusinessCaseSignature>' . MODULE_PAYMENT_WIRECARD_EFT_BUSINESS_SIGNATURE . '</BusinessCaseSignature>' . "\n" . '      <FNC_FT_DEBIT>' . "\n" . '        <FunctionID>Debit 1</FunctionID>' . "\n" . '        <FT_TRANSACTION mode="' . MODULE_PAYMENT_WIRECARD_EFT_TRANSACTION_MODE . '">' . "\n" . '          <TransactionID>' . $this->_order_id . '</TransactionID>' . "\n" . '          <EXTERNAL_ACCOUNT>' . "\n" . '            <FirstName>' . $_POST['wirecard_eft_owner_first'] . '</FirstName>' . "\n" . '            <LastName>' . $_POST['wirecard_eft_owner_last'] . '</LastName>' . "\n" . '            <AccountNumber>' . $_POST['wirecard_eft_account'] . '</AccountNumber>' . "\n" . '            <AccountType>' . $_POST['wirecard_eft_account_type'] . '</AccountType>' . "\n" . '            <BankCode>' . $_POST['wirecard_eft_bank_code'] . '</BankCode>' . "\n" . '            <Country>' . $osC_ShoppingCart->getBillingAddress('country_iso_code_2') . '</Country>' . "\n" . '            <CheckNumber>' . $_POST['wirecard_eft_check_number'] . '</CheckNumber>' . "\n";
     if ($osC_ShoppingCart->getBillingAddress('country_iso_code_2') == 'IT') {
         $post_string .= '            <COUNTRY_SPECIFIC>' . "\n" . '              <IdentificationNumber>' . $_POST['wirecard_eft_id_number'] . '</IdentificationNumber>' . "\n" . '            </COUNTRY_SPECIFIC>' . "\n";
     }
     $post_string .= '          </EXTERNAL_ACCOUNT>' . "\n" . '          <Amount>' . $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal(), $osC_Currencies->getCode()) * 100 . '</Amount>' . "\n" . '          <Currency>' . $osC_Currencies->getCode() . '</Currency>' . "\n" . '          <CORPTRUSTCENTER_DATA>' . "\n" . '            <ADDRESS>' . "\n" . '              <Address1>' . $osC_ShoppingCart->getBillingAddress('street_address') . '</Address1>' . "\n" . '              <City>' . $osC_ShoppingCart->getBillingAddress('city') . '</City>' . "\n" . '              <ZipCode>' . $osC_ShoppingCart->getBillingAddress('postcode') . '</ZipCode>' . "\n";
     if (osc_empty($osC_ShoppingCart->getBillingAddress('zone_code')) === false) {
         $post_string .= '              <State>' . $osC_ShoppingCart->getBillingAddress('zone_code') . '</State>' . "\n";
     }
     $post_string .= '              <Country>' . $osC_ShoppingCart->getBillingAddress('country_iso_code_2') . '</Country>' . "\n" . '              <Phone>' . $osC_ShoppingCart->getBillingAddress('telephone_number') . '</Phone>' . "\n" . '              <Email>' . $osC_Customer->getEmailAddress() . '</Email>' . "\n" . '            </ADDRESS>' . "\n" . '          </CORPTRUSTCENTER_DATA>' . "\n" . '        </FT_TRANSACTION>' . "\n" . '      </FNC_FT_DEBIT>' . "\n" . '    </W_JOB>' . "\n" . '  </W_REQUEST>' . "\n" . '</WIRECARD_BXML>';
     $this->_transaction_response = $this->sendTransactionToGateway($this->_gateway_url, $post_string, array('Content-type: text/xml'));
     if (empty($this->_transaction_response) === false) {
         $osC_XML = new osC_XML($this->_transaction_response);
         $result = $osC_XML->toArray();
     } else {
         $result = array();
     }
     $error = false;
     if (isset($result['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_FT_DEBIT']['FT_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'])) {
         if ($result['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_FT_DEBIT']['FT_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'] != 'ACK') {
             //          $errno = $result['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_FT_DEBIT']['FT_TRANSACTION']['PROCESSING_STATUS']['DETAIL']['ReturnCode'];
             //          switch ($errno) {
             //            default:
             $error = $osC_Language->get('payment_wirecard_eft_error_general');
             //              break;
             //          }
         }
     } else {
         $error = $osC_Language->get('payment_wirecard_eft_error_general');
     }
     if ($error === false) {
         osC_Order::process($this->_order_id, $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', $this->_order_id);
         $Qtransaction->bindInt(':transaction_code', 1);
         $Qtransaction->bindValue(':transaction_return_value', $this->_transaction_response);
         $Qtransaction->bindInt(':transaction_return_status', 1);
         $Qtransaction->execute();
     } else {
         osC_Order::remove($this->_order_id);
         $messageStack->add_session('checkout_payment', $error, 'error');
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment&wirecard_eft_owner_first=' . $_POST['wirecard_eft_owner_first'] . '&wirecard_eft_owner_last=' . $_POST['wirecard_eft_owner_last'] . '&wirecard_eft_account_type=' . $_POST['wirecard_eft_account_type'] . '&wirecard_eft_bank=' . $_POST['wirecard_eft_bank'] . '&wirecard_eft_check_number=' . $_POST['wirecard_eft_check_number'] . ($osC_ShoppingCart->getBillingAddress('country_iso_code_2') == 'IT' ? '&wirecard_eft_id_number=' . $_POST['wirecard_eft_id_number'] : ''), 'SSL'));
     }
 }
 function process()
 {
     global $osC_Database, $osC_Customer, $osC_Currencies, $osC_ShoppingCart, $osC_Language, $messageStack, $osC_CreditCard;
     $this->_verifyData();
     $this->_order_id = osC_Order::insert();
     $params = array('orderID' => $this->_order_id, 'PSPID' => MODULE_PAYMENT_OGONE_DIRECTLINK_CC_MERCHANT_ID, 'PSWD' => MODULE_PAYMENT_OGONE_DIRECTLINK_CC_PASSWORD, 'amount' => $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal(), $osC_Currencies->getCode()) * 100, 'currency' => $osC_Currencies->getCode(), 'CARDNO' => $osC_CreditCard->getNumber(), 'ED' => $osC_CreditCard->getExpiryMonth() . '/' . substr($osC_CreditCard->getExpiryYear(), -2), 'CVC' => $osC_CreditCard->getCVC(), 'CN' => $osC_CreditCard->getOwner(), 'EMAIL' => $osC_Customer->getEmailAddress(), 'Owneraddress' => $osC_ShoppingCart->getBillingAddress('street_address'), 'OwnerZip' => $osC_ShoppingCart->getBillingAddress('postcode'), 'Ecom_Payment_Card_Verification' => $osC_CreditCard->getCVC(), 'Operation' => 'RES', 'REMOTE_ADDR' => osc_get_ip_address(), 'COM' => 'Customer ID: ' . $osC_Customer->getID());
     if (osc_empty(MODULE_PAYMENT_OGONE_DIRECTLINK_CC_USER_ID) === false) {
         $params['USERID'] = MODULE_PAYMENT_OGONE_DIRECTLINK_CC_USER_ID;
     }
     if (osc_empty(MODULE_PAYMENT_OGONE_DIRECTLINK_CC_SHA1_SIGNATURE) === false) {
         $params['SHASign'] = sha1($this->_order_id . $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal(), $osC_Currencies->getCode()) * 100 . $osC_Currencies->getCode() . $osC_CreditCard->getNumber() . MODULE_PAYMENT_OGONE_DIRECTLINK_CC_MERCHANT_ID . 'RES' . MODULE_PAYMENT_OGONE_DIRECTLINK_CC_SHA1_SIGNATURE);
     }
     $post_string = '';
     foreach ($params as $key => $value) {
         $post_string .= $key . '=' . urlencode(trim($value)) . '&';
     }
     $post_string = substr($post_string, 0, -1);
     $this->_transaction_response = $this->sendTransactionToGateway($this->_gateway_url, $post_string);
     if (empty($this->_transaction_response) === false) {
         $osC_XML = new osC_XML($this->_transaction_response);
         $result = $osC_XML->toArray();
     } else {
         $result = array('ncresponse attr' => array('STATUS' => ''));
     }
     switch ($result['ncresponse attr']['STATUS']) {
         case '':
         case '0':
         case '2':
             osC_Order::remove($this->_order_id);
             $messageStack->add_session('checkout_payment', $osC_Language->get('payment_ogone_directlink_cc_error_general'), 'error');
             osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment&ogone_directlink_cc_owner=' . $osC_CreditCard->getOwner() . '&ogone_directlink_cc_expires_month=' . $osC_CreditCard->getExpiryMonth() . '&ogone_directlink_cc_expires_year=' . $osC_CreditCard->getExpiryYear() . (MODULE_PAYMENT_OGONE_DIRECTLINK_CC_VERIFY_WITH_CVC == '1' ? '&ogone_directlink_cc_cvc=' . $osC_CreditCard->getCVC() : ''), 'SSL'));
             break;
     }
     osC_Order::process($this->_order_id, $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', $this->_order_id);
     $Qtransaction->bindInt(':transaction_code', 1);
     $Qtransaction->bindValue(':transaction_return_value', $this->_transaction_response);
     $Qtransaction->bindInt(':transaction_return_status', 1);
     $Qtransaction->execute();
 }
예제 #14
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();
             }
         }
     }
 }
예제 #15
0
 public static function import($file, $type)
 {
     global $osC_Database;
     if (file_exists('../includes/languages/' . $file . '.xml')) {
         $osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
         $source = $osC_XML->toArray();
         $language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => isset($source['language']['data']['parent_language_code']) ? $source['language']['data']['parent_language_code'] : '', 'parent_id' => 0);
         if (osC_Currencies_Admin::exists($language['currency']) === false) {
             $language['currency'] = DEFAULT_CURRENCY;
         }
         if (!empty($language['parent_language_code']) && self::exists($language['parent_language_code'])) {
             $language['parent_id'] = self::get($language['parent_language_code'], 'languages_id');
         }
         $definitions = array();
         if (isset($source['language']['definitions']['definition'])) {
             $definitions = $source['language']['definitions']['definition'];
             if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
                 $definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
             }
         }
         unset($source);
         $error = false;
         $add_category_and_product_placeholders = true;
         $osC_Database->startTransaction();
         $language_id = self::get($language['code'], 'languages_id');
         if ($language_id !== false) {
             $add_category_and_product_placeholders = false;
             $Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
             $Qlanguage->bindInt(':languages_id', $language_id);
         } else {
             $Qlanguage = $osC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
         }
         $Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
         $Qlanguage->bindValue(':name', $language['name']);
         $Qlanguage->bindValue(':code', $language['code']);
         $Qlanguage->bindValue(':locale', $language['locale']);
         $Qlanguage->bindValue(':charset', $language['charset']);
         $Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
         $Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
         $Qlanguage->bindValue(':time_format', $language['time_format']);
         $Qlanguage->bindValue(':text_direction', $language['text_direction']);
         $Qlanguage->bindInt(':currencies_id', osC_Currencies_Admin::get($language['currency'], 'currencies_id'));
         $Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
         $Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
         $Qlanguage->bindInt(':parent_id', $language['parent_id']);
         $Qlanguage->setLogging($_SESSION['module'], $language_id !== false ? $language_id : null);
         $Qlanguage->execute();
         if ($osC_Database->isError()) {
             $error = true;
         } else {
             if ($language_id === false) {
                 $language_id = $osC_Database->nextID();
             }
             $default_language_id = osC_Languages_Admin::get(DEFAULT_LANGUAGE, 'languages_id');
             if ($type == 'replace') {
                 $Qdel = $osC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
                 $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                 $Qdel->bindInt(':languages_id', $language_id);
                 $Qdel->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                 }
             }
         }
         if ($error === false) {
             $osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/' . $file);
             $osC_DirectoryListing->setRecursive(true);
             $osC_DirectoryListing->setIncludeDirectories(false);
             $osC_DirectoryListing->setAddDirectoryToFilename(true);
             $osC_DirectoryListing->setCheckExtension('xml');
             foreach ($osC_DirectoryListing->getFiles() as $files) {
                 $definitions = array_merge($definitions, osC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
             }
             foreach ($definitions as $def) {
                 $insert = false;
                 $update = false;
                 if ($type == 'replace') {
                     $insert = true;
                 } else {
                     $Qcheck = $osC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                     $Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qcheck->bindValue(':definition_key', $def['key']);
                     $Qcheck->bindInt(':languages_id', $language_id);
                     $Qcheck->bindValue(':content_group', $def['group']);
                     $Qcheck->execute();
                     if ($Qcheck->numberOfRows() > 0) {
                         if ($type == 'update') {
                             $update = true;
                         }
                     } elseif ($type == 'add') {
                         $insert = true;
                     }
                 }
                 if ($insert === true || $update === true) {
                     if ($insert === true) {
                         $Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
                     } else {
                         $Qdef = $osC_Database->query('update :table_languages_definitions set content_group = :content_group, definition_key = :definition_key, definition_value = :definition_value where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                         $Qdef->bindValue(':definition_key', $def['key']);
                         $Qdef->bindValue(':content_group', $def['group']);
                     }
                     $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qdef->bindInt(':languages_id', $language_id);
                     $Qdef->bindValue(':content_group', $def['group']);
                     $Qdef->bindValue(':definition_key', $def['key']);
                     $Qdef->bindValue(':definition_value', $def['value']);
                     $Qdef->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
         if ($add_category_and_product_placeholders === true) {
             if ($error === false) {
                 $Qcategories = $osC_Database->query('select categories_id, categories_name from :table_categories_description where language_id = :language_id');
                 $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                 $Qcategories->bindInt(':language_id', $default_language_id);
                 $Qcategories->execute();
                 while ($Qcategories->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_categories_description (categories_id, language_id, categories_name) values (:categories_id, :language_id, :categories_name)');
                     $Qinsert->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                     $Qinsert->bindInt(':categories_id', $Qcategories->valueInt('categories_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':categories_name', $Qcategories->value('categories_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qproducts = $osC_Database->query('select products_id, products_name, products_description, products_keyword, products_tags, products_url from :table_products_description where language_id = :language_id');
                 $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                 $Qproducts->bindInt(':language_id', $default_language_id);
                 $Qproducts->execute();
                 while ($Qproducts->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_description (products_id, language_id, products_name, products_description, products_keyword, products_tags, products_url) values (:products_id, :language_id, :products_name, :products_description, :products_keyword, :products_tags, :products_url)');
                     $Qinsert->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                     $Qinsert->bindInt(':products_id', $Qproducts->valueInt('products_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_name', $Qproducts->value('products_name'));
                     $Qinsert->bindValue(':products_description', $Qproducts->value('products_description'));
                     $Qinsert->bindValue(':products_keyword', $Qproducts->value('products_keyword'));
                     $Qinsert->bindValue(':products_tags', $Qproducts->value('products_tags'));
                     $Qinsert->bindValue(':products_url', $Qproducts->value('products_url'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattributes = $osC_Database->query('select products_id, value from :table_product_attributes where languages_id = :languages_id');
                 $Qattributes->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
                 $Qattributes->bindInt(':languages_id', $default_language_id);
                 $Qattributes->execute();
                 while ($Qattributes->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_product_attributes (products_id, languages_id, value) values (:products_id, :languages_id, :value)');
                     $Qinsert->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
                     $Qinsert->bindInt(':products_id', $Qattributes->valueInt('products_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':value', $Qattributes->value('value'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qgroups = $osC_Database->query('select id, title, sort_order, module from :table_products_variants_groups where languages_id = :languages_id');
                 $Qgroups->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                 $Qgroups->bindInt(':languages_id', $default_language_id);
                 $Qgroups->execute();
                 while ($Qgroups->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_variants_groups (id, languages_id, title, sort_order, module) values (:id, :languages_id, :title, :sort_order, :module)');
                     $Qinsert->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                     $Qinsert->bindInt(':id', $Qgroups->valueInt('id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':title', $Qgroups->value('title'));
                     $Qinsert->bindInt(':sort_order', $Qgroups->valueInt('sort_order'));
                     $Qinsert->bindValue(':module', $Qgroups->value('module'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qvalues = $osC_Database->query('select id, products_variants_groups_id, title, sort_order from :table_products_variants_values where languages_id = :languages_id');
                 $Qvalues->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                 $Qvalues->bindInt(':languages_id', $default_language_id);
                 $Qvalues->execute();
                 while ($Qvalues->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_variants_values (id, languages_id, products_variants_groups_id, title, sort_order) values (:id, :languages_id, :products_variants_groups_id, :title, :sort_order)');
                     $Qinsert->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                     $Qinsert->bindInt(':id', $Qvalues->valueInt('id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindInt(':products_variants_groups_id', $Qvalues->valueInt('products_variants_groups_id'));
                     $Qinsert->bindValue(':title', $Qvalues->value('title'));
                     $Qinsert->bindInt(':sort_order', $Qvalues->valueInt('sort_order'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qmanufacturers = $osC_Database->query('select manufacturers_id, manufacturers_url from :table_manufacturers_info where languages_id = :languages_id');
                 $Qmanufacturers->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                 $Qmanufacturers->bindInt(':languages_id', $default_language_id);
                 $Qmanufacturers->execute();
                 while ($Qmanufacturers->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_manufacturers_info (manufacturers_id, languages_id, manufacturers_url) values (:manufacturers_id, :languages_id, :manufacturers_url)');
                     $Qinsert->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                     $Qinsert->bindInt(':manufacturers_id', $Qmanufacturers->valueInt('manufacturers_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':manufacturers_url', $Qmanufacturers->value('manufacturers_url'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $osC_Database->query('select orders_status_id, orders_status_name from :table_orders_status where language_id = :language_id');
                 $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
                 $Qstatus->bindInt(':language_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_orders_status (orders_status_id, language_id, orders_status_name) values (:orders_status_id, :language_id, :orders_status_name)');
                     $Qinsert->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
                     $Qinsert->bindInt(':orders_status_id', $Qstatus->valueInt('orders_status_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':orders_status_name', $Qstatus->value('orders_status_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $osC_Database->query('select id, status_name from :table_orders_transactions_status where language_id = :language_id');
                 $Qstatus->bindTable(':table_orders_transactions_status', TABLE_ORDERS_TRANSACTIONS_STATUS);
                 $Qstatus->bindInt(':language_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_orders_transactions_status (id, language_id, status_name) values (:id, :language_id, :status_name)');
                     $Qinsert->bindTable(':table_orders_transactions_status', TABLE_ORDERS_TRANSACTIONS_STATUS);
                     $Qinsert->bindInt(':id', $Qstatus->valueInt('id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':status_name', $Qstatus->value('status_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $osC_Database->query('select id, title, css_key from :table_shipping_availability where languages_id = :languages_id');
                 $Qstatus->bindTable(':table_shipping_availability', TABLE_SHIPPING_AVAILABILITY);
                 $Qstatus->bindInt(':languages_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_shipping_availability (id, languages_id, title, css_key) values (:id, :languages_id, :title, :css_key)');
                     $Qinsert->bindTable(':table_shipping_availability', TABLE_SHIPPING_AVAILABILITY);
                     $Qinsert->bindInt(':id', $Qstatus->valueInt('id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':title', $Qstatus->value('title'));
                     $Qinsert->bindValue(':css_key', $Qstatus->value('css_key'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qstatus = $osC_Database->query('select weight_class_id, weight_class_key, weight_class_title from :table_weight_classes where language_id = :language_id');
                 $Qstatus->bindTable(':table_weight_classes', TABLE_WEIGHT_CLASS);
                 $Qstatus->bindInt(':language_id', $default_language_id);
                 $Qstatus->execute();
                 while ($Qstatus->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_weight_classes (weight_class_id, weight_class_key, language_id, weight_class_title) values (:weight_class_id, :weight_class_key, :language_id, :weight_class_title)');
                     $Qinsert->bindTable(':table_weight_classes', TABLE_WEIGHT_CLASS);
                     $Qinsert->bindInt(':weight_class_id', $Qstatus->valueInt('weight_class_id'));
                     $Qinsert->bindValue(':weight_class_key', $Qstatus->value('weight_class_key'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':weight_class_title', $Qstatus->value('weight_class_title'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qgroup = $osC_Database->query('select id, title, code, size_width, size_height, force_size from :table_products_images_groups where language_id = :language_id');
                 $Qgroup->bindTable(':table_products_images_groups', TABLE_PRODUCTS_IMAGES_GROUPS);
                 $Qgroup->bindInt(':language_id', $default_language_id);
                 $Qgroup->execute();
                 while ($Qgroup->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_images_groups (id, language_id, title, code, size_width, size_height, force_size) values (:id, :language_id, :title, :code, :size_width, :size_height, :force_size)');
                     $Qinsert->bindTable(':table_products_images_groups', TABLE_PRODUCTS_IMAGES_GROUPS);
                     $Qinsert->bindInt(':id', $Qgroup->valueInt('id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':title', $Qgroup->value('title'));
                     $Qinsert->bindValue(':code', $Qgroup->value('code'));
                     $Qinsert->bindInt(':size_width', $Qgroup->value('size_width'));
                     $Qinsert->bindInt(':size_height', $Qgroup->value('size_height'));
                     $Qinsert->bindInt(':force_size', $Qgroup->value('force_size'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('languages');
         return true;
     } else {
         $osC_Database->rollbackTransaction();
     }
     return false;
 }
예제 #16
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();
 /**
  * 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_array = $osC_XML->toArray();
         $params = array('PSPID' => MODULE_PAYMENT_OGONE_DIRECTLINK_CC_MERCHANT_ID, 'PSWD' => MODULE_PAYMENT_OGONE_DIRECTLINK_CC_PASSWORD, 'PAYID' => $result_array['ncresponse attr']['PAYID']);
         if (osc_empty(MODULE_PAYMENT_OGONE_DIRECTLINK_CC_USER_ID) === false) {
             $params['USERID'] = MODULE_PAYMENT_OGONE_DIRECTLINK_CC_USER_ID;
         }
         $post_string = '';
         foreach ($params as $key => $value) {
             $post_string .= $key . '=' . urlencode($value) . '&';
         }
         $post_string = substr($post_string, 0, -1);
         $result = osC_Payment::sendTransactionToGateway($this->_inquiry_gateway_url, $post_string);
         if (empty($result) === false) {
             $osC_XML = new osC_XML($result);
             $result_array = $osC_XML->toArray();
             switch ($result_array['ncresponse attr']['STATUS']) {
                 case '':
                 case '0':
                     $transaction_return_status = '0';
                     break;
                 default:
                     $transaction_return_status = '1';
                     break;
             }
             $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', $result);
             $Qtransaction->bindInt(':transaction_return_status', $transaction_return_status);
             $Qtransaction->execute();
         }
     }
 }
예제 #18
0
 function process()
 {
     global $osC_Database, $osC_Customer, $osC_Currencies, $osC_ShoppingCart, $osC_Language, $messageStack;
     $this->_verifyData();
     $this->_order_id = osC_Order::insert();
     $params = array('spPassword' => MODULE_PAYMENT_SAFERPAY_CC_PASSWORD, 'ACCOUNTID' => MODULE_PAYMENT_SAFERPAY_CC_ACCOUNT_ID, 'ORDERID' => $this->_order_id, 'NAME' => $_POST['saferpay_elv_owner'], 'TRACK2' => ';59' . $_POST['saferpay_elv_bank'] . '=' . str_pad($_POST['saferpay_elv_account'], 10, '0', STR_PAD_LEFT), 'AMOUNT' => $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal(), $osC_Currencies->getCode()) * 100, 'CURRENCY' => $osC_Currencies->getCode());
     $post_string = '';
     foreach ($params as $key => $value) {
         $post_string .= $key . '=' . urlencode(trim($value)) . '&';
     }
     $post_string = substr($post_string, 0, -1);
     $this->_transaction_response = $this->sendTransactionToGateway('https://support.saferpay.de/scripts/Execute.asp', $post_string);
     $error = false;
     if (substr($this->_transaction_response, 0, 3) == 'OK:') {
         $this->_transaction_response = trim(substr($this->_transaction_response, 3));
         $osC_XML = new osC_XML($this->_transaction_response);
         $result = $osC_XML->toArray();
         switch ($result_array['IDP attr']['RESULT']) {
             case '0':
                 //success
                 break;
             default:
                 $error = $osC_Language->get('payment_saferpay_elv_error_general');
                 break;
         }
     } else {
         $error = $osC_Language->get('payment_saferpay_elv_error_general');
     }
     if ($error === false) {
         osC_Order::process($this->_order_id, $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', $this->_order_id);
         $Qtransaction->bindInt(':transaction_code', 1);
         $Qtransaction->bindValue(':transaction_return_value', $this->_transaction_response);
         $Qtransaction->bindInt(':transaction_return_status', 1);
         $Qtransaction->execute();
     } else {
         osC_Order::remove($this->_order_id);
         $messageStack->add_session('checkout_payment', $error, 'error');
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment&saferpay_elv_owner=' . $_POST['saferpay_elv_owner'] . '&saferpay_elv_bank=' . $_POST['saferpay_elv_bank'], 'SSL'));
     }
 }
예제 #19
0
 function process()
 {
     global $osC_Database, $osC_Language, $osC_MessageStack;
     $this->_verifyData();
     $params = array('DATA' => $_GET['DATA'], 'SIGNATURE' => $_GET['SIGNATURE']);
     $post_string = '';
     foreach ($params as $key => $value) {
         $post_string .= $key . '=' . urlencode(trim($value)) . '&';
     }
     $post_string = substr($post_string, 0, -1);
     $this->_transaction_response = $this->sendTransactionToGateway('http://support.saferpay.de/scripts/VerifyPayConfirm.asp', $post_string);
     $error = false;
     if (substr($this->_transaction_response, 0, 3) != 'OK:') {
         $error = true;
     }
     /* HPDL; performs capture
           if (substr($this->_transaction_response, 0, 3) == 'OK:') {
             $result = array();
             parse_str(substr($this->_transaction_response, 3), $result);
     
             $params = array('ACCOUNTID' => MODULE_PAYMENT_SAFERPAY_CC_ACCOUNT_ID,
                             'ID' => $result['ID'],
                             'TOKEN' => $result['TOKEN']);
     
             $post_string = '';
     
             foreach ($params as $key => $value) {
               $post_string .= $key . '=' . urlencode(trim($value)) . '&';
             }
     
             $post_string = substr($post_string, 0, -1);
     
             $this->_transaction_response = $this->sendTransactionToGateway('http://support.saferpay.de/scripts/PayComplete.asp', $post_string);
     
             if ($this->_transaction_response != 'OK') {
               $error = true;
             }
           } else {
             $error = true;
           }
     */
     if ($error === false) {
         $osC_XML = new osC_XML($_GET['DATA']);
         $result = $osC_XML->toArray();
         $this->_order_id = $result['IDP attr']['ORDERID'];
         osC_Order::process($this->_order_id, $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', $this->_order_id);
         $Qtransaction->bindInt(':transaction_code', 1);
         $Qtransaction->bindValue(':transaction_return_value', $_GET['DATA']);
         $Qtransaction->bindInt(':transaction_return_status', 1);
         $Qtransaction->execute();
     } else {
         osC_Order::remove($this->_order_id);
         $osC_MessageStack->add('checkout_payment', $osC_Language->get('payment_saferpay_vt_error_general'), 'error');
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
     }
 }
예제 #20
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_array = $osC_XML->toArray();
         $post_string = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">' . "\n" . '  <W_REQUEST>' . "\n" . '    <W_JOB>' . "\n" . '      <JobID>Job 1</JobID>' . "\n" . '      <BusinessCaseSignature>' . MODULE_PAYMENT_WIRECARD_CC_BUSINESS_SIGNATURE . '</BusinessCaseSignature>' . "\n" . '      <FNC_CC_QUERY>' . "\n" . '        <FunctionID>Query 1</FunctionID>' . "\n" . '        <CC_TRANSACTION mode="' . MODULE_PAYMENT_WIRECARD_CC_TRANSACTION_MODE . '">' . "\n" . '          <TransactionID>' . $result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_PREAUTHORIZATION']['CC_TRANSACTION']['TransactionID'] . '</TransactionID>' . "\n" . '          <GuWID>' . $result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_PREAUTHORIZATION']['CC_TRANSACTION']['PROCESSING_STATUS']['GuWID'] . '</GuWID>' . "\n" . '        </CC_TRANSACTION>' . "\n" . '      </FNC_CC_QUERY>' . "\n" . '    </W_JOB>' . "\n" . '  </W_REQUEST>' . "\n" . '</WIRECARD_BXML>';
         $result = osC_Payment::sendTransactionToGateway($this->_gateway_url, $post_string, array('Content-type: text/xml'));
         if (empty($result) === false) {
             $osC_XML = new osC_XML($result);
             $result_array = $osC_XML->toArray();
             $transaction_return_status = '0';
             if (isset($result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_QUERY']['CC_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'])) {
                 if ($result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_QUERY']['CC_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'] == 'ACK') {
                     $transaction_return_status = '1';
                 }
             }
             $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', $result);
             $Qtransaction->bindInt(':transaction_return_status', $transaction_return_status);
             $Qtransaction->execute();
         }
     }
 }