#1 (permalink)  
Alt 12.06.2009, 11:02
Neuer Benutzer
 
Registriert seit: 29.08.2008
Beiträge: 8
Standard Paypal fehlermeldung line 118 paypal.php

Beim kauf in unserem Shop gibt es ein fehlermeldung:

Fatal error: Call to a member function complete_express_checkout() on a non-object in /var/www/g28291/speed-buster.nl/HTML/shop/includes/modules/payment/paypal.php on line 118

Ich hab im paypal.php line 118 nachgesehen aber hab keine ahnung was jetzt los ist. Kan jemand mich vielleicht damit helfen?

in line 118 von paypal.php steht:

PHP-Code:
$o_paypal->complete_express_checkout($insert_id$_GETtrue); 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 12.06.2009, 12:59
xt:Commerce Support Kunde
 
Registriert seit: 09.04.2008
Beiträge: 412
Standard

Zitat:
Zitat von Stenvers CC Beitrag anzeigen
keine ahnung was jetzt los ist
Mojn,
ging es bisher und jetzt nicht mehr?
Viele Grüße - Michael
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #3 (permalink)  
Alt 12.06.2009, 13:29
Neuer Benutzer
 
Registriert seit: 29.08.2008
Beiträge: 8
Standard

Seit gestern gab es diese Fehler. Wir haben nicht viel Kunden die mit Paypal zahlen darum haben wir es bis jetzt nicht gemerkt.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #4 (permalink)  
Alt 12.06.2009, 13:48
xt:Commerce Support Kunde
 
Registriert seit: 09.04.2008
Beiträge: 412
Standard

Mhh - damit weiss ich noch nicht ob es jemals funktioniert hat.
Schau mal in der /includes/application_top.php ob Du da die Zeilen

Code:
// paypal
require_once (DIR_WS_CLASSES.'paypal_checkout.php');
$o_paypal = new paypal_checkout();
findest.
2. Schritt: Ist in der /includes/classes/paypal_checkout.php die Funktion
complete_express_checkout vorhanden?

Viele Grüße - Michael
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #5 (permalink)  
Alt 12.06.2009, 14:38
Neuer Benutzer
 
Registriert seit: 29.08.2008
Beiträge: 8
Standard

Zitat:
Zitat von mikkel Beitrag anzeigen
Mhh - damit weiss ich noch nicht ob es jemals funktioniert hat.
Schau mal in der /includes/application_top.php ob Du da die Zeilen

Code:
// paypal
require_once (DIR_WS_CLASSES.'paypal_checkout.php');
$o_paypal = new paypal_checkout();
findest.
2. Schritt: Ist in der /includes/classes/paypal_checkout.php die Funktion
complete_express_checkout vorhanden?

Viele Grüße - Michael
Hallo Michael,

vielen dank für Ihren Hilfe!

Im [ /includes/application_top.php ] steht kein "// paypal"!

Im [ /includes/classes/paypal_checkout.php ] steht:

PHP-Code:
<?php
/**
 * Project:       xt:Commerce - eCommerce Engine
 * @version $Id   
 *
 * xt:Commerce - Shopsoftware
 * (c) 2003-2007 xt:Commerce (Winger/Zanier), http://www.xt-commerce.com
 *
 * xt:Commerce ist eine geschŸtzte Handelsmarke und wird vertreten durch die xt:Commerce GmbH (Austria)
 * xt:Commerce is a protected trademark and represented by the xt:Commerce GmbH (Austria)
 *
 * @copyright Copyright 2003-2007 xt:Commerce (Winger/Zanier), www.xt-commerce.com
 * @copyright based on Copyright 2002-2003 osCommerce; www.oscommerce.com
 * @copyright Porttions Copyright 2003-2007 Zen Cart Development Team
 * @copyright Porttions Copyright 2004 DevosC.com
 * @license http://www.xt-commerce.com.com/license/2_0.txt GNU Public License V2.0
 * 
 * For questions, help, comments, discussion, etc., please join the
 * xt:Commerce Support Forums at www.xt-commerce.com
 * 
 */
require_once(DIR_FS_INC 'xtc_write_user_info.inc.php');

define('PROXY_HOST''127.0.0.1');
define('PROXY_PORT''808');
define('VERSION''3.0');

class 
paypal_checkout {

    var 
$API_UserName,
        
$API_Password,
        
$API_Signature,
        
$API_Endpoint,
        
$version,
        
$location_error,
        
$NOTIFY_URL,
        
$EXPRESS_CANCEL_URL,
        
$EXPRESS_RETURN_URL,
        
$CANCEL_URL,
        
$RETURN_URL,
        
$EXPRESS_URL,
        
$IPN_URL,
        
$ppAPIec,
        
$ppAPIdp,
        
$payPalURL;

    function 
paypal_checkout() {

        if(
PAYPAL_MODE=='sandbox'){    
        
$this->API_UserName     PAYPAL_API_SANDBOX_USER;
        
$this->API_Password     PAYPAL_API_SANDBOX_PWD;
        
$this->API_Signature    PAYPAL_API_SANDBOX_SIGNATURE;            
        
$this->API_Endpoint     'https://api-3t.sandbox.paypal.com/nvp';
        
$this->EXPRESS_URL        'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=';
        
$this->IPN_URL            'https://www.sandbox.paypal.com/cgi-bin/webscr';
        }elseif(
PAYPAL_MODE=='live'){    
        
$this->API_UserName     PAYPAL_API_USER;
        
$this->API_Password     PAYPAL_API_PWD;
        
$this->API_Signature    PAYPAL_API_SIGNATURE;                    
        
$this->API_Endpoint     'https://api-3t.paypal.com/nvp';
        
$this->EXPRESS_URL        'https://www.paypal.com/webscr&cmd=_express-checkout&token=';
        
$this->IPN_URL            'https://www.paypal.com/cgi-bin/webscr';
        }

        if(
ENABLE_SSL == true){
        
$this->NOTIFY_URL HTTPS_SERVER.DIR_WS_CATALOG.'callback/paypal/ipn.php';
        
        
$this->EXPRESS_CANCEL_URL HTTPS_SERVER.DIR_WS_CATALOG.FILENAME_SHOPPING_CART.'?XTCsid='.xtc_session_id();
        
$this->EXPRESS_RETURN_URL HTTPS_SERVER.DIR_WS_CATALOG.FILENAME_PAYPAL_CHECKOUT.'?XTCsid='.xtc_session_id();
        
$this->CANCEL_URL HTTPS_SERVER.DIR_WS_CATALOG.FILENAME_CHECKOUT_PAYMENT.'?XTCsid='.xtc_session_id().'&error=true&error_message='.PAYPAL_ERROR;
        
$this->RETURN_URL HTTPS_SERVER.DIR_WS_CATALOG.FILENAME_CHECKOUT_PROCESS.'?XTCsid='.xtc_session_id();        
        }else{
        
$this->NOTIFY_URL HTTP_SERVER.DIR_WS_CATALOG.'callback/paypal/ipn.php';    
        
        
$this->EXPRESS_CANCEL_URL HTTP_SERVER.DIR_WS_CATALOG.FILENAME_SHOPPING_CART.'?XTCsid='.xtc_session_id();
        
$this->EXPRESS_RETURN_URL HTTP_SERVER.DIR_WS_CATALOG.FILENAME_PAYPAL_CHECKOUT.'?XTCsid='.xtc_session_id();
        
$this->CANCEL_URL HTTP_SERVER.DIR_WS_CATALOG.FILENAME_CHECKOUT_PAYMENT.'?XTCsid='.xtc_session_id().'&error=true&error_message='.PAYPAL_ERROR;
        
$this->RETURN_URL HTTP_SERVER.DIR_WS_CATALOG.FILENAME_CHECKOUT_PROCESS.'?XTCsid='.xtc_session_id();                
        }
        
        
$this->version            VERSION;
        
$this->USE_PROXY        FALSE;
        
$this->payPalURL '';
        
        
$this->ppAPIec $this->buildAPIKey(PAYPAL_API_KEY'ec');
        
$this->ppAPIdp $this->buildAPIKey(PAYPAL_API_KEY'dp');

    }


    function 
build_express_checkout_button($total$currency){
        global 
$PHP_SELF;

        if(
MODULE_PAYMENT_PAYPALEXPRESS_STATUS=='True'){
            if (
$_SESSION['languages_id']=='2') { // de
            
$source 'https://www.paypal.com/de_DE/i/btn/btn_xpressCheckout.gif';
            } else {
            
$source 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif';
            }        
            
$button .= '<a class="paypal_checkout" href="'.xtc_href_link(basename($PHP_SELF), xtc_get_all_get_params(array ('action')).'action=paypal_express_checkout').'"><img src="'.$source.'"></a>';

            
            return 
$button;
        }
    }

    function 
paypal_auth_call($force_redirect=''){
        global 
$order;
        
        
// Shipping:
        
        
if (!isset ($_SESSION['sendto'])) {
            
$_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
        } else {
            
// verify the selected shipping address
            
$check_address_query xtc_db_query("select count(*) as total from ".TABLE_ADDRESS_BOOK." where customers_id = '".(int) $_SESSION['customer_id']."' and address_book_id = '".(int) $_SESSION['sendto']."'");
            
$check_address xtc_db_fetch_array($check_address_query);
        
            if (
$check_address['total'] != '1') {
                
$_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
                if (isset (
$_SESSION['shipping']))
                    unset (
$_SESSION['shipping']);
            }
        }        

        
// Shipping END
        
                    
unset($_SESSION['reshash'])    ;
                    unset(
$_SESSION['nvpReqArray'])    ;

                    if(
$force_redirect!='' && $force_redirect=='checkout_process'){
                        
$paymentAmountround($order->info['total'],2);
                        
$currencyCodeType=$order->info['currency'];                    
                    }else{
                        
$paymentAmountround($_SESSION['cart']->show_total(),2);
                        
$currencyCodeType=$_SESSION['currency'];
                    }

                   if(
PAYPAL_COUNTRY_MODE == 'de'){
                   
$paymentType='Sale';
                   }else{
                   
$paymentType=PAYPAL_EXPRESS_PAYMENTACTION;
                   }

                     
/* The returnURL is the location where buyers return when a
                    payment has been succesfully authorized.
                    The cancelURL is the location buyers are sent to when they hit the
                    cancel button during authorization of payment during the PayPal flow
                    */

                     
if($force_redirect!='' && $force_redirect=='checkout_process'){
                         
$returnURL =urlencode($this->RETURN_URL);
                           
$cancelURL =urlencode($this->CANCEL_URL);    
                        
$add '&ADDROVERRIDE=1';    
                        
                     }else{ 
                           
$returnURL =urlencode($this->EXPRESS_RETURN_URL);
                           
$cancelURL =urlencode($this->EXPRESS_CANCEL_URL);
                     }
                     
/* Construct the parameter string that describes the PayPal payment
                    the varialbes were set in the web form, and the resulting string
                    is stored in $nvpstr
                    */
                     
                     
$sh_name urlencode(iconv($_SESSION['language_charset'], "UTF-8"$order->delivery['firstname'].' '.$order->delivery['lastname']));
                    
$sh_street urlencode(iconv($_SESSION['language_charset'], "UTF-8"$order->delivery['street_address']));
                    
$sh_street_2 '';
                    
$sh_city urlencode(iconv($_SESSION['language_charset'], "UTF-8"$order->delivery['city']));
                    
$sh_state urlencode($order->delivery['state']);
                    
$sh_country urlencode($order->delivery['country']['iso_code_2']);
                    
$sh_phonenum urlencode($order->customer['telephone']);
                    
$sh_zip urlencode($order->delivery['postcode']);
            
                    if(
$_SESSION['paypal_express_new_customer']!='true'){
                        
$address '&SHIPTONAME='.$sh_name.'&SHIPTOSTREET='.$sh_street.'&SHIPTOCITY='.$sh_city.'&SHIPTOCOUNTRY='.$sh_country.'&SHIPTOSTATE='.$sh_state.'&SHIPTOZIP='.$sh_zip.'&SHIPTOPHONENUM='.$sh_phonenum.''
                    }
                     
                    
                       
$nvpstr="&Amt=".$paymentAmount."&PAYMENTACTION=".$paymentType."&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL $address $add."&CURRENCYCODE=".$currencyCodeType;
                       
                     
/* Make the call to PayPal to set the Express Checkout token
                    If the API call succeded, then redirect the buyer to PayPal
                    to begin to authorize payment.  If an error occured, show the
                    resulting errors
                    */
                       
$resArray=$this->hash_call("SetExpressCheckout",$nvpstr);
                       
$_SESSION['reshash']= $resArray;

                       
$ack strtoupper($resArray["ACK"]);

                       if(
$ack=="SUCCESS"){
                        
// Redirect to paypal.com here
                        
$token urldecode($resArray["TOKEN"]);
                        
$this->payPalURL $this->EXPRESS_URL.''.$token;

                        return 
$this->payPalURL;
                      } else  {
                          
$this->build_error_message($_SESSION['reshash']);
                          
$this->payPalURL $this->EXPRESS_CANCEL_URL;
                          return 
$this->payPalURL;
                    }

    }

    function 
paypal_get_customer_data(){

           
$nvpstr="&TOKEN=".$_SESSION['reshash']['TOKEN'];

         
/* Make the API call and store the results in an array.  If the
            call was a success, show the authorization details, and provide
            an action to complete the payment.  If failed, show the error
            */

           
$resArray=$this->hash_call("GetExpressCheckoutDetails",$nvpstr);
           
$_SESSION['reshash'] = array_merge($_SESSION['reshash'], $resArray) ;
           
$ack strtoupper($resArray["ACK"]);

           if(
$ack=="SUCCESS"){

                   
$_SESSION['paypal_express_checkout'] = true;
                   
$_SESSION['paypal_express_payment_modules'] = 'paypalexpress.php';

                
$this->check_customer();

              } else  {
                    
$this->build_error_message($_SESSION['reshash']);
                      
$this->payPalURL $this->EXPRESS_CANCEL_URL;
                      return 
$this->payPalURL;
              }
    }

    function 
check_customer(){

        if (!isset (
$_SESSION['customer_id'])) {
            
$check_customer_query xtc_db_query("select * from ".TABLE_CUSTOMERS." where customers_email_address = '".xtc_db_input($_SESSION['reshash']['EMAIL'])."' and account_type = '0'");
            if (!
xtc_db_num_rows($check_customer_query)) {
                
$this->create_account();
            }else{
                
$check_customer_query xtc_db_query("select * from ".TABLE_CUSTOMERS." where customers_email_address = '".xtc_db_input($_SESSION['reshash']['EMAIL'])."' and account_type = '0'");
                
$check_customer xtc_db_fetch_array($check_customer_query);
                
$this->login_customer($check_customer);
                if(
PAYPAL_EXPRESS_ADDRESS_OVERRIDE == 'true' && $_SESSION['pp_allow_address_change']!='true'){
                    
$this->create_shipping_address($check_customer);
                }
            }
        }else{            
            if(
PAYPAL_EXPRESS_ADDRESS_OVERRIDE == 'true' && $_SESSION['pp_allow_address_change']!='true'){
                
$check_customer_query xtc_db_query("select * from ".TABLE_CUSTOMERS." where customers_id = '".xtc_db_input($_SESSION['customer_id'])."' and account_type = '0'");
                
$check_customer xtc_db_fetch_array($check_customer_query);
                
$this->create_shipping_address($check_customer);
            }
        }
    }

    function 
create_account(){

        
//$gender = xtc_db_prepare_input($_POST['gender']);
        
        
$firstname xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $_SESSION['reshash']['FIRSTNAME']));
        
$lastname xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $_SESSION['reshash']['LASTNAME']));
        
$email_address xtc_db_prepare_input($_SESSION['reshash']['EMAIL']);
        
$company xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $_SESSION['reshash']['BUSINESS']));
        
$street_address xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $_SESSION['reshash']['SHIPTOSTREET'] . $_SESSION['reshash']['SHIPTOSTREET_2']));
        
$postcode xtc_db_prepare_input($_SESSION['reshash']['SHIPTOZIP']);
        
$city xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $_SESSION['reshash']['SHIPTOCITY']));
        
$state xtc_db_prepare_input($_SESSION['reshash']['SHIPTOSTATE']);
        
$telephone xtc_db_prepare_input($_SESSION['reshash']['PHONENUM']);

        
$country_query xtc_db_query("select * from ".TABLE_COUNTRIES." where countries_iso_code_2 = '".xtc_db_input($_SESSION['reshash']['SHIPTOCOUNTRYCODE'])."' ");
        
$tmp_country xtc_db_fetch_array($country_query);

        
$country xtc_db_prepare_input($tmp_country['countries_id']);

        
$customers_status DEFAULT_CUSTOMERS_STATUS_ID;

        
$sql_data_array = array (
            
'customers_status' => $customers_status,
            
'customers_firstname' => $firstname,
            
'customers_lastname' => $lastname,
            
'customers_email_address' => $email_address,
            
'customers_telephone' => $telephone,
            
'customers_date_added' => 'now()',
            
'customers_last_modified' => 'now()');

        
xtc_db_perform(TABLE_CUSTOMERS$sql_data_array);

        
$_SESSION['paypal_express_new_customer'] = 'true';

        
$_SESSION['customer_id'] = xtc_db_insert_id();
        
$user_id xtc_db_insert_id();
        
xtc_write_user_info($user_id);
        
$sql_data_array = array (
            
'customers_id' => $_SESSION['customer_id'],
            
'entry_firstname' => $firstname,
            
'entry_lastname' => $lastname,
            
'entry_street_address' => $street_address,
            
'entry_postcode' => $postcode,
            
'entry_city' => $city,
            
'entry_country_id' => $country,
            
'address_date_added' => 'now()',
            
'address_last_modified' => 'now()'
        
);

        if (
ACCOUNT_COMPANY == 'true')
            
$sql_data_array['entry_company'] = $company;
        if (
ACCOUNT_SUBURB == 'true')
            
$sql_data_array['entry_suburb'] = $suburb;
        if (
ACCOUNT_STATE == 'true') {
                
$sql_data_array['entry_zone_id'] = '0';
                
$sql_data_array['entry_state'] = $state;
        }

        
xtc_db_perform(TABLE_ADDRESS_BOOK$sql_data_array);

        
$address_id xtc_db_insert_id();

        
xtc_db_query("update " TABLE_CUSTOMERS " set customers_default_address_id = '" $address_id "' where customers_id = '" . (int) $_SESSION['customer_id'] . "'");

        
xtc_db_query("insert into " TABLE_CUSTOMERS_INFO " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $_SESSION['customer_id'] . "', '0', now())");

        if (isset (
$_SESSION['tracking']['refID'])) {
            
$campaign_check_query_raw "SELECT *
                                                    FROM " 
TABLE_CAMPAIGNS "
                                                    WHERE campaigns_refID = '" 
$_SESSION[tracking][refID] . "'";
            
$campaign_check_query xtc_db_query($campaign_check_query_raw);
            if (
xtc_db_num_rows($campaign_check_query) > 0) {
                
$campaign xtc_db_fetch_array($campaign_check_query);
                
$refID $campaign['campaigns_id'];
            } else {
                
$refID 0;
            }

            
xtc_db_query("update " TABLE_CUSTOMERS " set
                                             refferers_id = '" 
$refID "'
                                             where customers_id = '" 
. (int) $_SESSION['customer_id'] . "'");

            
$leads $campaign['campaigns_leads'] + 1;
            
xtc_db_query("update " TABLE_CAMPAIGNS " set
                                             campaigns_leads = '" 
$leads "'
                                             where campaigns_id = '" 
$refID "'");
        }

        if (
ACTIVATE_GIFT_SYSTEM == 'true') {
            
// GV Code Start
            // ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* BEGIN
            
if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT 0) {
                
$coupon_code create_coupon_code();
                
$insert_query xtc_db_query("insert into " TABLE_COUPONS " (coupon_code, coupon_type, coupon_amount, date_created) values ('" $coupon_code "', 'G', '" NEW_SIGNUP_GIFT_VOUCHER_AMOUNT "', now())");
                
$insert_id xtc_db_insert_id($insert_query);
                
$insert_query xtc_db_query("insert into " TABLE_COUPON_EMAIL_TRACK " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" $insert_id "', '0', 'Admin', '" $email_address "', now() )");

                
$_SESSION['reshash']['SEND_GIFT'] = 'true';
                
$_SESSION['reshash']['GIFT_AMMOUNT'] = $xtPrice->xtcFormat(NEW_SIGNUP_GIFT_VOUCHER_AMOUNTtrue);
                
$_SESSION['reshash']['GIFT_CODE'] = $coupon_code;
                
$_SESSION['reshash']['GIFT_LINK'] = xtc_href_link(FILENAME_GV_REDEEM'gv_no=' $coupon_code'NONSSL'false);

            }
            if (
NEW_SIGNUP_DISCOUNT_COUPON != '') {
                
$coupon_code NEW_SIGNUP_DISCOUNT_COUPON;
                
$coupon_query xtc_db_query("select * from " TABLE_COUPONS " where coupon_code = '" $coupon_code "'");
                
$coupon xtc_db_fetch_array($coupon_query);
                
$coupon_id $coupon['coupon_id'];
                
$coupon_desc_query xtc_db_query("select * from " TABLE_COUPONS_DESCRIPTION " where coupon_id = '" $coupon_id "' and language_id = '" . (int) $_SESSION['languages_id'] . "'");
                
$coupon_desc xtc_db_fetch_array($coupon_desc_query);
                
$insert_query xtc_db_query("insert into " TABLE_COUPON_EMAIL_TRACK " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" $coupon_id "', '0', 'Admin', '" $email_address "', now() )");

                
$_SESSION['reshash']['SEND_COUPON'] = 'true';
                
$_SESSION['reshash']['COUPON_DESC'] = $coupon_desc['coupon_description'];
                
$_SESSION['reshash']['COUPON_CODE'] = $coupon['coupon_code'];

            }
            
// ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* END
            // GV Code End       // create templates
        
}

        
$_SESSION['ACCOUNT_PASSWORD'] = 'true';

        
// Login Customer
        
$check_customer_query xtc_db_query("select * from ".TABLE_CUSTOMERS." where customers_email_address = '".xtc_db_input($email_address)."' and account_type = '0'");
        
$check_customer xtc_db_fetch_array($check_customer_query);
        
$this->login_customer($check_customer);
        if(
PAYPAL_EXPRESS_ADDRESS_OVERRIDE == 'true'){
            
$this->create_shipping_address($check_customer);
        }

    }
    
    function 
login_customer($check_customer){
        global 
$econda;

            if (
SESSION_RECREATE == 'True') {
                
xtc_session_recreate();
            }

            
$check_country_query xtc_db_query("select entry_country_id, entry_zone_id from ".TABLE_ADDRESS_BOOK." where customers_id = '".(int) $check_customer['customers_id']."' and address_book_id = '".$check_customer['customers_default_address_id']."'");
            
$check_country xtc_db_fetch_array($check_country_query);

            
$_SESSION['customer_gender'] = $check_customer['customers_gender'];
            
$_SESSION['customer_first_name'] = $check_customer['customers_firstname'];
            
$_SESSION['customer_last_name'] = $check_customer['customers_lastname'];
            
$_SESSION['customer_id'] = $check_customer['customers_id'];
            
$_SESSION['customer_vat_id'] = $check_customer['customers_vat_id'];
            
$_SESSION['customer_default_address_id'] = $check_customer['customers_default_address_id'];
            
$_SESSION['customer_country_id'] = $check_country['entry_country_id'];
            
$_SESSION['customer_zone_id'] = $check_country['entry_zone_id'];
            
$_SESSION['customer_email_address'] = $check_customer['customers_email_address'];

            
$date_now date('Ymd');

            
xtc_db_query("update ".TABLE_CUSTOMERS_INFO." SET customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 WHERE customers_info_id = '".(int) $_SESSION['customer_id']."'");
            
xtc_write_user_info((int) $_SESSION['customer_id']);
            
// restore cart contents
            
$_SESSION['cart']->restore_contents($check_customer['customers_status']);
            
//$_SESSION['cart']->check_cart($check_customer['customers_status']);

            
if (is_object($econda)) $econda->_loginUser();

    }

    function 
create_shipping_address($check_customer){
                
        
//$gender = xtc_db_prepare_input($_POST['gender']);
        
        
$pos strrpos($_SESSION['reshash']['SHIPTONAME'], ' ');
        
$lenght strlen($_SESSION['reshash']['SHIPTONAME']);
        
        
$firstname iconv("UTF-8"$_SESSION['language_charset'], substr($_SESSION['reshash']['SHIPTONAME'], 0$pos));
        
$lastname iconv("UTF-8"$_SESSION['language_charset'], substr($_SESSION['reshash']['SHIPTONAME'], ($pos+1), $lenght));
        
        
$email_address xtc_db_prepare_input($_SESSION['reshash']['EMAIL']);
        
$company xtc_db_prepare_input($_SESSION['reshash']['BUSINESS']);
        
$street_address xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $_SESSION['reshash']['SHIPTOSTREET'] . $_SESSION['reshash']['SHIPTOSTREET_2']));
        
$postcode xtc_db_prepare_input($_SESSION['reshash']['SHIPTOZIP']);
        
$city xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $_SESSION['reshash']['SHIPTOCITY']));
        
$state xtc_db_prepare_input($_SESSION['reshash']['SHIPTOSTATE']);
        
$telephone xtc_db_prepare_input($_SESSION['reshash']['PHONENUM']);

        
$country_query xtc_db_query("select * from ".TABLE_COUNTRIES." where countries_iso_code_2 = '".xtc_db_input($_SESSION['reshash']['SHIPTOCOUNTRYCODE'])."' ");
        
$tmp_country xtc_db_fetch_array($country_query);

        
$country xtc_db_prepare_input($tmp_country['countries_id']);
    
        
$sql_data_array = array (
            
'customers_id' => $_SESSION['customer_id'],
            
'entry_firstname' => $firstname,
            
'entry_lastname' => $lastname,
            
'entry_street_address' => $street_address,
            
'entry_postcode' => $postcode,
            
'entry_city' => $city,
            
'entry_country_id' => $country,
            
'address_date_added' => 'now()',
            
'address_last_modified' => 'now()',
            
'address_class' => 'paypal'
        
);

        if (
ACCOUNT_COMPANY == 'true')
            
$sql_data_array['entry_company'] = $company;
        if (
ACCOUNT_STATE == 'true') {
                
$sql_data_array['entry_zone_id'] = '0';
                
$sql_data_array['entry_state'] = $state;
        }

        
$check_address_query xtc_db_query("select address_book_id from ".TABLE_ADDRESS_BOOK." where customers_id = '".(int) $_SESSION['customer_id']."' and address_class = 'paypal'");
        
$check_address xtc_db_fetch_array($check_address_query);
        
        if (
$check_address['address_book_id']!='') {
            
xtc_db_perform(TABLE_ADDRESS_BOOK$sql_data_array'update'"address_book_id = '".(int) $check_address['address_book_id']."' and customers_id ='".(int) $_SESSION['customer_id']."'");
            
$send_to $check_address['address_book_id'];            

        }else{            
            
xtc_db_perform(TABLE_ADDRESS_BOOK$sql_data_array);    
            
$send_to xtc_db_insert_id();
        }
        
        
$_SESSION['sendto'] = $send_to;
    }
    
    
    function 
complete_express_ceckout($tmp_id$data=''$check=false){
        global 
$xtPrice,  $order;
        
        
        if(
$check==true){
                
$order = new order($tmp_id);    
        }
        
        if (
$_SERVER["HTTP_X_FORWARDED_FOR"]) {
            
$customers_ip $_SERVER["HTTP_X_FORWARDED_FOR"];
        } else {
            
$customers_ip $_SERVER["REMOTE_ADDR"];
        }

        if (
$_SESSION['customers_status']['customers_status_show_price_tax'] == && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
            
$total $order->info['total'] + $order->info['tax'];
        } else {
            
$total $order->info['total'];
        }
        
        if(
$check==true){
            
$total round($order->info['pp_total'], $xtPrice->get_decimal_places($_SESSION['currency']));    
        }
        
        
        
$products_count 0;
        for (
$i 0$n sizeof($order->products); $i $n$i ++) {
        
        
$products_tax 0;    
        
$products_tax $xtPrice->xtcGetTax($order->products[$i]['price'], $order->products[$i]['tax']);        
            
        if (
$_SESSION['customers_status']['customers_status_show_price_tax'] == && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
            
$products_price $order->products[$i]['price'];
        } else {
            
$products_price $order->products[$i]['price'] - products_tax;
        }
        
            
$tmp_products .= '&L_NAME'.$i.'='.$order->products[$i]['name'].'&L_NUMBER'.$i.'='.$order->products[$i]['model'].'&L_QTY'.$i.'='.$order->products[$i]['qty'].'&L_TAXAMT'.$i.'='.$products_tax.'&L_AMT'.$i.'='$products_price;
             
$products_count ++;
        }
        
        
$amount round($total$xtPrice->get_decimal_places($_SESSION['currency']));
        if(
$check==true){
            
$shipping $order->info['pp_shipping'];    
        }else{
            
$shipping $xtPrice->xtcFormat($order->info['shipping_cost'], false0true);
        }
        
$item_amt $amount-$shipping;


        if(
$data['token']!=''){
            
$tkn $data['token'];
        }else{
            
$tkn =  $_SESSION['nvpReqArray']['TOKEN'];
        }
        
        if(
$data['PayerID']!=''){
            
$payer $data['PayerID'];
        }else{
            
$payer =  $_SESSION['reshash']['PAYERID'];
        }        
        
        
$token =urlencode($tkn);
        
$paymentAmount =urlencode ($total);
        
        if(
PAYPAL_COUNTRY_MODE == 'de'){
            
$paymentType='Sale';
        }else{
            
$paymentType=PAYPAL_EXPRESS_PAYMENTACTION;
        }        
        
        
$currCodeType urlencode($_SESSION['currency']);
        
$payerID urlencode($payer);
        
$serverName urlencode($_SERVER['SERVER_NAME']);
        
$notify_url  urlencode($this->NOTIFY_URL);
        
$inv_num urlencode($tmp_id);
        
$item_amt urlencode($item_amt);
        
$tax_amt urlencode($order->info['tax']);
        
$shipping_amt urlencode($shipping);
        
$button_source urlencode($this->ppAPIec);
        
        
$sh_name urlencode(iconv($_SESSION['language_charset'], "UTF-8"$order->delivery['firstname'].' '.$order->delivery['lastname']));
        
$sh_street urlencode(iconv($_SESSION['language_charset'], "UTF-8"$order->delivery['street_address']));
        
$sh_street_2 '';
        
$sh_city urlencode(iconv($_SESSION['language_charset'], "UTF-8"$order->delivery['city']));
        
$sh_state urlencode($order->delivery['state']);
        if(
$check==true){
            
$sh_country urlencode($order->delivery['country_iso_2']);    
        }else{
            
$sh_country urlencode($order->delivery['country']['iso_code_2']);
        }
        
        
$sh_phonenum urlencode($order->customer['telephone']);
        
$sh_zip urlencode($order->delivery['postcode']);
            
        if(
$_SESSION['paypal_express_new_customer']!='true'){
            
$adress '&SHIPTONAME='.$sh_name.'&SHIPTOSTREET='.$sh_street.'&SHIPTOCITY='.$sh_city.'&SHIPTOCOUNTRY='.$sh_country.'&SHIPTOSTATE='.$sh_state.'&SHIPTOZIP='.$sh_zip.'&SHIPTOPHONENUM='.$sh_phonenum.''
        }
        
        
$nvpstr='&TOKEN='.$token.'&PAYERID='.$payerID.'&PAYMENTACTION='.$paymentType.'&AMT='.$paymentAmount.'&CURRENCYCODE='.$currCodeType.'&IPADDRESS='.$customers_ip.'&NOTIFYURL='.$notify_url.'&INVNUM='.$inv_num.$adress.'&BUTTONSOURCE='.$button_source;

         
/* Make the call to PayPal to finalize payment
            If an error occured, show the resulting errors
        */
            
$resArray=$this->hash_call("DoExpressCheckoutPayment",$nvpstr);
              
$_SESSION['reshash'] = array_merge($_SESSION['reshash'], $resArray) ;
           
$ack strtoupper($resArray["ACK"]);

           if(
$ack!="SUCCESS"){
                    
$this->build_error_message($_SESSION['reshash']);
                      
$this->payPalURL $this->EXPRESS_CANCEL_URL;
                      return 
$this->payPalURL;
              }
    }

function 
doDirectPayment($data$tmp_id){
global 
$xtPrice$order;

    if (
$_SERVER["HTTP_X_FORWARDED_FOR"]) {
        
$customers_ip $_SERVER["HTTP_X_FORWARDED_FOR"];
    } else {
        
$customers_ip $_SERVER["REMOTE_ADDR"];
    }

        if (
$_SESSION['customers_status']['customers_status_show_price_tax'] == && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
            
$total $order->info['total'] + $order->info['tax'];
        } else {
            
$total $order->info['total'];
        }
        
        
$products_count 0;
        for (
$i 0$n sizeof($order->products); $i $n$i ++) {

        
$products_tax 0;    
        
$products_tax $xtPrice->xtcGetTax($order->products[$i]['price'], $order->products[$i]['tax']);                    
            
        if (
$_SESSION['customers_status']['customers_status_show_price_tax'] == && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
            
$products_price $order->products[$i]['price'];
        } else {
            
$products_price $order->products[$i]['price'] - products_tax;
        }
        
            
$tmp_products .= '&L_NAME'.$i.'='.$order->products[$i]['name'].'&L_NUMBER'.$i.'='.$order->products[$i]['model'].'&L_QTY'.$i.'='.$order->products[$i]['qty'].'&L_TAXAMT'.$i.'='.$products_tax.'&L_AMT'.$i.'='$products_price;
             
$products_count ++;
        }

        
$amount round($total$xtPrice->get_decimal_places($_SESSION['currency']));
        
$shipping $xtPrice->xtcFormat($order->info['shipping_cost'], false0true);
        
$item_amt $amount-$shipping;
                 

$paymentType =urlencode('Sale');
$firstName =urlencode$data['firstName']);
$lastName =urlencode$data['lastName']);
$creditCardType =urlencode$data['creditCardType']);
$creditCardNumber urlencode($data['creditCardNumber']);
$expDateMonth =urlencode($data['expDateMonth']);
$ip_address urlencode($customers_ip);
$notify_url  urlencode($this->NOTIFY_URL);
$inv_num urlencode($tmp_id);
$item_amt urlencode($item_amt);
$shipping_amt urlencode($shipping);
$tax_amt urlencode($order->info['tax']);

// Month must be padded with leading zero
$padDateMonth str_pad($expDateMonth2'0'STR_PAD_LEFT);

$expDateYear =urlencode$data['expDateYear']);
$cvv2Number urlencode($data['cvv2Number']);
$address1 urlencode($data['address1']);
$address2 urlencode($data['address2']);
$city urlencode($data['city']);
$state =urlencode$data['state']);
$zip urlencode($data['zip']);
$amount urlencode($total);
$currencyCode=urlencode($_SESSION['currency']);
$paymentType=urlencode($paymentType);
$country_code urlencode($data['country']);
$button_source urlencode($this->ppAPIdp);
//////////

/* Construct the request string that will be sent to PayPal.
   The variable $nvpstr contains all the variables and is a
   name value pair string with & as a delimiter */
   
  
$nvpstr="&PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber&EXPDATE=".$padDateMonth.$expDateYear."&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName&STREET=$address1&CITY=$city&STATE=$state"."&ZIP=$zip&COUNTRYCODE=US&CURRENCYCODE=$currencyCode&BUTTONSOURCE=$button_source";


/* Make the API call to PayPal, using API signature.
   The API response is stored in an associative array called $resArray */
   
$resArray=$this->hash_call("doDirectPayment",$nvpstr);
   
//$_SESSION['reshash']=$resArray;

   
$nvpstr_1='&TRANSACTIONID='.urlencode($resArray['TRANSACTIONID']);
   
$resArray_1=$this->hash_call("gettransactionDetails",$nvpstr_1);
   
   
$_SESSION['reshash'] = array_merge($resArray$resArray_1) ;   
   
/* Display the API response back to the browser.
   If the response from PayPal was a success, display the response parameters'
   If the response was an error, display the errors received using APIError.php.
   */
$ack strtoupper($resArray["ACK"]);

           if(
$ack!="SUCCESS"){
                    
$this->build_error_message($_SESSION['reshash']=$resArray);
                      
$this->payPalURL $this->EXPRESS_CANCEL_URL;
                      return 
$this->payPalURL;
              }

}


    
/**
      * hash_call: Function to perform the API call to PayPal using API signature
      * @methodName is name of API  method.
      * @nvpStr is nvp string.
      * returns an associtive array containing the response from the server.
    */

    
function hash_call($methodName,$nvpStr,$pp_token='')
    {
        
//declaring of global variables
        //global $API_Endpoint,$version,$API_UserName,$API_Password,$API_Signature,$nvp_Header;

        //setting the curl parameters.
        
$ch curl_init();
        
curl_setopt($chCURLOPT_URL,$this->API_Endpoint.$pp_token);
        
curl_setopt($chCURLOPT_VERBOSE1);

        
//turning off the server and peer verification(TrustManager Concept).
        
curl_setopt($chCURLOPT_SSL_VERIFYPEERFALSE);
        
curl_setopt($chCURLOPT_SSL_VERIFYHOSTFALSE);

        
curl_setopt($chCURLOPT_RETURNTRANSFER,1);
        
curl_setopt($chCURLOPT_POST1);
        
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
       //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
        
if($this->USE_PROXY)
        
curl_setopt ($chCURLOPT_PROXYPROXY_HOST.":".PROXY_PORT);


        
//NVPRequest for submitting to server
        
$nvpreq="METHOD=".urlencode($methodName)."&VERSION=".urlencode($this->version)."&PWD=".urlencode($this->API_Password)."&USER=".urlencode($this->API_UserName)."&SIGNATURE=".urlencode($this->API_Signature).$nvpStr;
//echo $nvpreq;
        //setting the nvpreq as POST FIELD to curl
        
curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);

        
//getting response from server
        
$response curl_exec($ch);

        
//convrting NVPResponse to an Associative Array
        
$nvpResArray=$this->deformatNVP($response);
        
$nvpReqArray=$this->deformatNVP($nvpreq);
        
        
        
$_SESSION['nvpReqArray']= $nvpReqArray;

        if (
curl_errno($ch)) {
            
// moving to display page to display curl errors
              
$_SESSION['curl_error_no']=curl_errno($ch) ;
              
$_SESSION['curl_error_msg']=curl_error($ch);
              
$this->build_error_message($_SESSION['reshash']);
             
// $this->payPalURL = $this->EXPRESS_CANCEL_URL;
             // return $this->payPalURL;
         
} else {
             
//closing the curl
                
curl_close($ch);
          }

    return 
$nvpResArray;
    }

    
/** This function will take NVPString and convert it to an Associative Array and it will decode the response.
      * It is usefull to search for a particular key and displaying arrays.
      * @nvpstr is NVPString.
      * @nvpArray is Associative Array.
      */

    
function deformatNVP($nvpstr)
    {

        
$intial=0;
         
$nvpArray = array();


        while(
strlen($nvpstr)){
                    
            
//postion of Key
            
$keyposstrpos($nvpstr,'=');
            
//position of value
            
$valuepos strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr);

            
/*getting the Key and Value values and storing in a Associative Array*/
            
$keyval=substr($nvpstr,$intial,$keypos);
            
$valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1);
            
//decoding the respose
            
$nvpArray[urldecode($keyval)] =urldecode$valval);
            
$nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr));
         }
        return 
$nvpArray;
    }

        
    function 
build_error_message($resArray=''){
        global 
$messageStack;

            if(isset(
$_SESSION['curl_error_no'])) {
                
$errorCode$_SESSION['curl_error_no'] ;
                
$errorMessage=$_SESSION['curl_error_msg'] ;

                
$error .=  'Error Number: '.  $errorCode '<br />';
                
$error .=  'Error Message: '.  $errorMessage '<br />';

            } else {

                
$error .=  'Ack: '.  $resArray['ACK'] . '<br />';
                
$error .=  'Correlation ID: '.  $resArray['CORRELATIONID']  . '<br />';
                
$error .=  'Version:'.  $resArray['VERSION'] . '<br />';

                
$count=0;
                while (isset(
$resArray["L_SHORTMESSAGE".$count])) {
                      
$errorCode    $resArray["L_ERRORCODE".$count];
                      
$shortMessage $resArray["L_SHORTMESSAGE".$count];
                      
$longMessage  $resArray["L_LONGMESSAGE".$count];
                      
$count=$count+1;

                     
$error .=  'Error Number:'.  $errorCode '<br />';
                      
$error .=  'Error Short Message: '.   $shortMessage '<br />';
                      
$error .=  'Error Long Message: '.  $longMessage '<br />';
                 }
//end while
            
}// end else

        
$_SESSION['reshash']['FORMATED_ERRORS'] = $error;

    }

    function 
write_status_history($o_id) {
        
        if (empty(
$o_id) ) return false;

        
$ack strtoupper($_SESSION['reshash']["ACK"]);
        if(
$ack!="SUCCESS"){
            
$o_status PAYPAL_ORDER_STATUS_REJECTED_ID;
        } else {
            
$o_status PAYPAL_ORDER_STATUS_SUCCESS_ID;
        }
        
/*
        while (list ($key, $value) = each($_SESSION['reshash'])) {
            
            $comment .= $key.'='.$value;

        }
        */
        
$order_history_data = array('orders_id' => $o_id,
                                     
'orders_status_id' => $o_status,
                                     
'date_added' => 'now()',
                                     
'customer_notified' => '0',
                                     
'comments' => $comment);
        
xtc_db_perform(TABLE_ORDERS_STATUS_HISTORY,$order_history_data);
        
xtc_db_query("UPDATE " TABLE_ORDERS " SET orders_status = '" $o_status "', last_modified = now() WHERE orders_id = '" xtc_db_prepare_input($o_id) . "'");        

        return 
true;
        
    }
    
    function 
callback_process($data) {
        global 
$_GET;
        
$this->data $data;

        
//$this->_logTrans($data);
        
        
require_once (DIR_WS_CLASSES 'class.phpmailer.php');
            if (
EMAIL_TRANSPORT == 'smtp')
                require_once (
DIR_WS_CLASSES 'class.smtp.php');
            require_once (
DIR_FS_INC 'xtc_Security.inc.php');

        if (isset (
$this->data['invoice']) && is_numeric($this->data['invoice']) && ($this->data['invoice'] > 0)) {
            
$order_query xtc_db_query("SELECT    currency, currency_value
                                                           FROM " 
TABLE_ORDERS "
                                                           WHERE orders_id = '" 
xtc_db_prepare_input($this->data['invoice']) . "'");

            if (
xtc_db_num_rows($order_query) > 0) {
                
$order xtc_db_fetch_array($order_query);
                
$total_query xtc_db_query("SELECT value
                                                                     FROM " 
TABLE_ORDERS_TOTAL 
                                                                     WHERE orders_id = '" 
xtc_db_prepare_input($this->data['invoice']) . "' 
                                                                     AND class = 'ot_total' limit 1"
);

                
                                
$ipn_data = array();
                
                
$ipn_data['reason_code'] = xtc_db_prepare_input($this->data['reason_code']);
                
$ipn_data['xtc_order_id'] = xtc_db_prepare_input($this->data['invoice']);
                
$ipn_data['payment_type'] = xtc_db_prepare_input($this->data['payment_type']);
                
$ipn_data['payment_status'] = xtc_db_prepare_input($this->data['payment_status']);
                
$ipn_data['pending_reason'] = xtc_db_prepare_input($this->data['pending_reason']);
                
$ipn_data['invoice'] = xtc_db_prepare_input($this->data['invoice']);
                
$ipn_data['mc_currency'] = xtc_db_prepare_input($this->data['mc_currency']);
                
$ipn_data['first_name'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['first_name']));
                
$ipn_data['last_name'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['last_name']));
                
                
$ipn_data['address_name'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['address_name']));
                
$ipn_data['address_street'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['address_street']));
                
$ipn_data['address_city'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['address_city']));
                
$ipn_data['address_state'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['address_state']));
                
$ipn_data['address_zip'] = xtc_db_prepare_input($this->data['address_zip']);
                
$ipn_data['address_country'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['address_country']));
                
$ipn_data['address_status'] = xtc_db_prepare_input($this->data['address_status']);
                
                
$ipn_data['payer_email'] = xtc_db_prepare_input($this->data['payer_email']);
                
$ipn_data['payer_id'] = xtc_db_prepare_input($this->data['payer_id']);
                
$ipn_data['payer_status'] = xtc_db_prepare_input($this->data['payer_status']);
                
                
$ipn_data['payment_date'] = xtc_db_prepare_input($this->datetime_to_sql_format($this->data['payment_date']));
                
$ipn_data['business'] = xtc_db_prepare_input(iconv("UTF-8"$_SESSION['language_charset'], $this->data['business']));
                
$ipn_data['receiver_email'] = xtc_db_prepare_input($this->data['receiver_email']);
                
$ipn_data['receiver_id'] = xtc_db_prepare_input($this->data['receiver_id']);
                
                
$ipn_data['txn_id'] = xtc_db_prepare_input($this->data['txn_id']);
                
$ipn_data['parent_txn_id'] = xtc_db_prepare_input($this->data['parent_txn_id']);
                
                
$ipn_data['mc_gross'] = xtc_db_prepare_input($this->data['mc_gross']);
                
$ipn_data['mc_fee'] = xtc_db_prepare_input($this->data['mc_fee']);
                
                
$ipn_data['payment_gross'] = xtc_db_prepare_input($this->data['payment_gross']);
                
$ipn_data['payment_fee'] = xtc_db_prepare_input($this->data['payment_fee']);


                
$ipn_data['notify_version'] = xtc_db_prepare_input($this->data['notify_version']);
                
$ipn_data['verify_sign'] = xtc_db_prepare_input($this->data['verify_sign']);
                
$ipn_data['txn_type']= $this->ipn_determine_txn_type($this->data['txn_type']);

                
$_transQuery "SELECT paypal_ipn_id FROM paypal WHERE txn_id = '".$ipn_data['txn_id']."'";
                
$_transQuery xtc_db_query($_transQuery);
                
$_transQuery xtc_db_fetch_array($_transQuery);
                if (
$_transQuery['paypal_ipn_id']!='') {
                    
$insert_id $_transQuery['paypal_ipn_id'];
                    
// do not insert data in main table
//                    xtc_db_perform('paypal',$ipn_data,'update','paypal_ipn_id='.$insert_id);    
                    // only update status of main transaction
                    
                    
xtc_db_query("update paypal set payment_status = '".$ipn_data['payment_status']."',pending_reason='"$ipn_data['pending_reason']."', last_modified = now() where paypal_ipn_id = '".$insert_id."'");
                } else {
                    
                    
$ipn_data['date_added']='now()';
                    
$ipn_data['last_modified']='now()';
                    
xtc_db_perform('paypal',$ipn_data);    
                    
$insert_id xtc_db_insert_id();
                }

                
$paypal_order_history = array ('paypal_ipn_id' => $insert_id,
                                   
'txn_id' => $ipn_data['txn_id'],
                                   
'parent_txn_id' => $ipn_data['parent_txn_id'],
                                   
'payment_status' => $ipn_data['payment_status'],
                                   
'pending_reason' => $ipn_data['pending_reason'],
                                   
'mc_amount' => $ipn_data['mc_gross'],
                                   
'date_added' => 'now()'
                                  
);
                
xtc_db_perform('paypal_status_history',$paypal_order_history);    
                
                
                
$total xtc_db_fetch_array($total_query);
                
$crlf "\n";
                
$comment_status xtc_db_prepare_input($this->data['payment_status']) . ' ' xtc_db_prepare_input($this->data['mc_gross']) . xtc_db_prepare_input($this->data['mc_currency']) . $crlf;
                
$comment_status .= ' ' xtc_db_prepare_input($this->data['first_name']) . ' ' xtc_db_prepare_input($this->data['last_name']) . ' ' xtc_db_prepare_input($this->data['payer_email']);

                if (isset (
$this->data['payer_status'])) {
                    
$comment_status .= ' is ' xtc_db_prepare_input($this->data['payer_status']);
                }
                
                
$comment_status .= '.' $crlf $crlf ' [';

                if (isset (
$this->data['test_ipn']) && is_numeric($this->data['test_ipn']) && ($_POST['test_ipn'] > 0)) {
                    
$debug '(Sandbox-Test Mode) ';
                }

                
$comment_status .= $crlf 'Fee=' xtc_db_prepare_input($this->data['mc_fee']) . xtc_db_prepare_input($this->data['mc_currency']);

                if (isset (
$this->data['pending_reason'])) {
                    
$comment_status .= $crlf ' Pending Reason=' xtc_db_prepare_input($this->data['pending_reason']);
                }

                if (isset (
$this->data['reason_code'])) {
                    
$comment_status .= $crlf ' Reason Code=' xtc_db_prepare_input($this->data['reason_code']);
                }

                
$comment_status .= $crlf ' Payment=' xtc_db_prepare_input($this->data['payment_type']);
                
$comment_status .= $crlf ' Date=' xtc_db_prepare_input($this->data['payment_date']);

                if (isset (
$this->data['parent_txn_id'])) {
                    
$comment_status .= $crlf ' ParentID=' xtc_db_prepare_input($this->data['parent_txn_id']);
                }

                
$comment_status .= $crlf ' ID=' xtc_db_prepare_input($_POST['txn_id']);

                
//Set status for default (Pending)
                
$order_status_id PAYPAL_ORDER_STATUS_PENDING_ID;

                
$parameters 'cmd=_notify-validate';

                foreach (
$this->data as $key => $value) {
                    
$parameters .= '&' $key '=' urlencode(stripslashes($value));
                }

                
//$this->_logTransactions($parameters);

                
$ch curl_init();

                
curl_setopt($chCURLOPT_URL$this->IPN_URL);
                
                
curl_setopt($chCURLOPT_POST1);
                
curl_setopt($chCURLOPT_POSTFIELDS$parameters);
                
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                
curl_setopt($chCURLOPT_HEADER0);
                
curl_setopt($chCURLOPT_TIMEOUT30);
                
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                
                
$result curl_exec($ch);
                
curl_close($ch);

                if (
$result == 'VERIFIED' or $result == '1') {
                    if (
$this->data['payment_status'] == 'Completed') {

                        if (
PAYPAL_ORDER_STATUS_SUCCESS_ID 0) {
                            
$order_status_id PAYPAL_ORDER_STATUS_SUCCESS_ID;
                                                    
                            
                        }
                    }
                    
//Set status for Denied, Failed, Refunded or Reversed
                    
elseif (($this->data['payment_status'] == 'Denied') OR ($this->data['payment_status'] == 'Failed') OR ($this->data['payment_status'] == 'Refunded') OR ($this->data['payment_status'] == 'Reversed')) {
                        
$order_status_id PAYPAL_ORDER_STATUS_REJECTED_ID;
                    }
                } else {
                    
$debug .= '[INVALID VERIFIED FAILED] - ' $result "\n";
                    
$order_status_id PAYPAL_ORDER_STATUS_REJECTED_ID;
                    
$error_reason 'Received INVALID responce but invoice and Customer matched.';
                }

                
$comment_status .= ']';

                
xtc_db_query("UPDATE " TABLE_ORDERS 
                                                      SET orders_status = '" 
$order_status_id "', last_modified = now() 
                                                      WHERE orders_id = '" 
xtc_db_prepare_input($this->data['invoice']) . "'");

                
$sql_data_array = array (
                    
'orders_id' => xtc_db_prepare_input($this->data['invoice']
                ), 
'orders_status_id' => $order_status_id'date_added' => 'now()''customer_notified' => '0''comments' => 'PayPal IPN ' $comment_status '');

                
xtc_db_perform(TABLE_ORDERS_STATUS_HISTORY$sql_data_array);
                                
            } else {
                
$error_reason 'No order found for invoice=' xtc_db_prepare_input($this->data['invoice']) . ' with customer=' . (int) $this->data['custom'] . '.';
            }
        } else {
            
$error_reason 'No invoice id found on received data.';
        }

        if (
xtc_not_null(EMAIL_SUPPORT_ADDRESS) && strlen($error_reason)) {
            
$email_body $error_reason "\n\n";
            
$email_body .= $_SERVER["REQUEST_METHOD"] . " - " $_SERVER["REMOTE_ADDR"] . " - " $_SERVER["HTTP_REFERER"] . " - " $_SERVER["HTTP_ACCEPT"] . "\n\n";
            
$email_body .= '$_POST:' "\n\n";

            foreach (
$this->data as $key => $value) {
                
$email_body .= $key '=' $value "\n";
            }

            
$email_body .= "\n" '$_GET:' "\n\n";

            foreach (
$_GET as $key => $value) {
                
$email_body .= $key '=' $value "\n";
            }

            

            
xtc_php_mail(EMAIL_BILLING_ADDRESSEMAIL_BILLING_NAMEEMAIL_SUPPORT_ADDRESSEMAIL_SUPPORT_ADDRESS''EMAIL_BILLING_ADDRESSEMAIL_BILLING_NAMEfalsefalse'PayPal IPN Invalid Process'$email_body$email_body);
        }

    }    

    function 
datetime_to_sql_format($paypalDateTime) {
        
//Copyright (c) 2004 DevosC.com
        
$months = array (
            
'Jan' => '01',
            
'Feb' => '02',
            
'Mar' => '03',
            
'Apr' => '04',
            
'May' => '05',
            
'Jun' => '06',
            
'Jul' => '07',
            
'Aug' => '08',
            
'Sep' => '09',
            
'Oct' => '10',
            
'Nov' => '11',
            
'Dec' => '12'
        
);
        
$hour substr($paypalDateTime02);
        
$minute substr($paypalDateTime32);
        
$second substr($paypalDateTime62);
        
$month $months[substr($paypalDateTime93)];
        
$day = (strlen($day preg_replace("/,/"''substr($paypalDateTime132))) < 2) ? '0' $day $day;
        
$year substr($paypalDateTime, -84);
        if (
strlen($day) < 2)
            
$day '0' $day;
        return (
$year "-" $month "-" $day " " $hour ":" $minute ":" $second);
    }


    function 
logging_status($o_id) {
        
$data array_merge($_SESSION['reshash'],$_SESSION['nvpReqArray']);

         
$data_array = array (
                            
'xtc_order_id' => $o_id,
                            
'txn_type' => $data['TRANSACTIONTYPE'],
                            
'reason_code' => $data['REASONCODE'],
                            
'payment_type' => $data['PAYMENTTYPE'],
                            
'payment_status' => $data['PAYMENTSTATUS'],
                            
'pending_reason' => $data['PENDINGREASON'],
                            
'invoice' => $data['INVNUM'],
                            
'mc_currency' => $data['CURRENCYCODE'],
                            
'first_name' => iconv("UTF-8"$_SESSION['language_charset'], $data['FIRSTNAME']),
                            
'last_name' => iconv("UTF-8"$_SESSION['language_charset'], $data['LASTNAME']),
                            
'payer_business_name' => iconv("UTF-8"$_SESSION['language_charset'], $data['BUSINESS']),
                            
'address_name' => iconv("UTF-8"$_SESSION['language_charset'], $data['SHIPTONAME']),
                            
'address_street' => iconv("UTF-8"$_SESSION['language_charset'], $data['SHIPTOSTREET']),
                            
'address_city' => iconv("UTF-8"$_SESSION['language_charset'], $data['SHIPTOCITY']),
                            
'address_state' => iconv("UTF-8"$_SESSION['language_charset'], $data['SHIPTOSTATE']),
                            
'address_zip' => $data['SHIPTOZIP'],
                            
'address_country' => iconv("UTF-8"$_SESSION['language_charset'], $data['SHIPTOCOUNTRYNAME']),
                            
'address_status' => $data['ADDRESSSTATUS'],
                            
'payer_email' => $data['EMAIL'],
                            
'payer_id' => $data['PAYERID'],
                            
'payer_status' => $data['PAYERSTATUS'],
                            
'payment_date' => $data['TIMESTAMP'],
                            
'business' => '',
                            
'receiver_email' => '',
                            
'receiver_id' => '',
                            
'txn_id' => $data['TRANSACTIONID'],
                            
'parent_txn_id' => '',
                            
'num_cart_items' => '',
                            
'mc_gross' => $data['AMT'],
                            
'mc_fee' => $data['FEEAMT'],
                            
'mc_authorization' => $data['AMT'],
                            
'payment_gross' => '',
                            
'payment_fee' => '',
                            
'settle_amount' => $data['SETTLEAMT'],
                            
'settle_currency' => '',
                            
'exchange_rate' => $data['EXCHANGERATE'],
                            
'notify_version' => $data['VERSION'],
                            
'verify_sign' => '',
                            
'last_modified' => '',
                            
'date_added' => 'now()',
                            
'memo' => $data['DESC']);
        
xtc_db_perform(TABLE_PAYPAL,$data_array);
        return 
true;
    }

    function 
buildAPIKey($key$pay){
        
$key_arr=explode(',',$key);
        
$k='';
        for (
$i=0$i<count($key_arr);$i++) $k.=chr($key_arr[$i]);
            if(
$pay=='ec'){
            return 
$k.'EC_AT_31';        
            }elseif(
$pay=='dp'){
            return 
$k.'DP_AT_31';    
            }
    }    
    
      function 
ipn_determine_txn_type($txn_type 'unknown') {

    if (
substr($txn_type,0,8) == 'cleared-') return $txn_type;
    if (
$this->data['txn_type'] == 'send_money') return $this->data['txn_type'];
    if (
$this->data['txn_type'] == 'express_checkout' || $this->data['txn_type'] == 'cart'$txn_type $this->data['txn_type'];
// if it's not unique or linked to a parent, then:
// 1. could be an e-check denied / cleared
// 2. could be an express-checkout "pending" transaction which has been Accepted in the merchant's PayPal console and needs activation in Zen Cart
    
if ($this->data['payment_status']=='Completed' && $txn_type=='express_checkout' && $this->data['payment_type']=='echeck') {
      
$txn_type 'express-checkout-cleared';
      return 
$txn_type;
    }
    if (
$this->data['payment_status']=='Completed' && $this->data['payment_type']=='echeck') {
      
$txn_type 'echeck-cleared';
      return 
$txn_type;
    }
    if ((
$this->data['payment_status']=='Denied' || $this->data['payment_status']=='Failed') && $this->data['payment_type']=='echeck') {
      
$txn_type 'echeck-denied';
      return 
$txn_type;
    }
    if (
$this->data['payment_status']=='Denied') {
      
$txn_type 'denied';
      return 
$txn_type;
    }
    if ((
$this->data['payment_status']=='Pending') && $this->data['pending_reason']=='echeck') {
      
$txn_type 'pending-echeck';
      return 
$txn_type;
    }
    if ((
$this->data['payment_status']=='Pending') && $this->data['pending_reason']=='address') {
      
$txn_type 'pending-address';
      return 
$txn_type;
    }
    if ((
$this->data['payment_status']=='Pending') && $this->data['pending_reason']=='intl') {
      
$txn_type 'pending-intl';
      return 
$txn_type;
    }
    if ((
$this->data['payment_status']=='Pending') && $this->data['pending_reason']=='multi-currency') {
      
$txn_type 'pending-multicurrency';
      return 
$txn_type;
    }
    if ((
$this->data['payment_status']=='Pending') && $this->data['pending_reason']=='multi-verify') {
      
$txn_type 'pending-verify';
      return 
$txn_type;
    }
    return 
$txn_type;
  }

        function 
_logTransactions($parameters) {

        
$logFilePP DIR_FS_CATALOG 'includes/logs/payment.paypal_ipn.log';

        
$line 'PP TRANS|' date("d.m.Y H:i"time()) . '|' xtc_get_ip_address() . '|';

        foreach (
$_POST as $key => $val)
            
$line .= $key ':' $val '|';

        
error_log($line "\n"3$logFilePP);

        }
        
        
        function 
_logTrans($data) {

            while (list (
$key$value) = each($data)) {
            
$line .= $key ':' $val '|';
            }
                
            
xtc_php_mail(EMAIL_BILLING_ADDRESSEMAIL_BILLING_NAMEEMAIL_SUPPORT_ADDRESSEMAIL_SUPPORT_ADDRESS''EMAIL_BILLING_ADDRESSEMAIL_BILLING_NAMEfalsefalse'PayPal IPN Invalid Process'$line$line);

        }        
    
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #6 (permalink)  
Alt 12.06.2009, 14:49
xt:Commerce Support Kunde
 
Registriert seit: 09.04.2008
Beiträge: 412
Standard

ok, die Funktion ist in der paypal_checkout.php.

das //paypal ist nur eine Bemerkung ohne Funktion (das mach das // davor).
Sind die anderen beiden Zeilen in der application_top.php ?

Hat es jemals funktioniert oder tritt der Fehler erst seit einiger Zeit auf?
Kannst du mal ausprobieren was beim PayPal Express Warenkorb passiert?

Viele Grüße - Michael
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #7 (permalink)  
Alt 12.06.2009, 14:55
Neuer Benutzer
 
Registriert seit: 29.08.2008
Beiträge: 8
Standard

Zitat:
Zitat von mikkel Beitrag anzeigen
ok, die Funktion ist in der paypal_checkout.php.

das //paypal ist nur eine Bemerkung ohne Funktion (das mach das // davor).
Sind die anderen beiden Zeilen in der application_top.php ?

Hat es jemals funktioniert oder tritt der Fehler erst seit einiger Zeit auf?
Kannst du mal ausprobieren was beim PayPal Express Warenkorb passiert?

Viele Grüße - Michael
application_top.php:

PHP-Code:
<?php

/* -----------------------------------------------------------------------------------------
   $Id: application_top.php 1323 2005-10-27 17:58:08Z mz $

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   -----------------------------------------------------------------------------------------
   based on:
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(application_top.php,v 1.273 2003/05/19); www.oscommerce.com
   (c) 2003     nextcommerce (application_top.php,v 1.54 2003/08/25); www.nextcommerce.org

   Released under the GNU General Public License
   -----------------------------------------------------------------------------------------
   Third Party contribution:
   Add A Quickie v1.0 Autor  Harald Ponce de Leon

   Credit Class/Gift Vouchers/Discount Coupons (Version 5.10)
   http://www.oscommerce.com/community/contributions,282
   Copyright (c) Strider | Strider@oscworks.com
   Copyright (c  Nick Stanko of UkiDev.com, nick@ukidev.com
   Copyright (c) Andre ambidex@gmx.net
   Copyright (c) 2001,2002 Ian C Wilson http://www.phesis.org


   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/
// start the timer for the page parse time log
define('PAGE_PARSE_START_TIME'microtime());

// set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE);
//  error_reporting(E_ALL);

// Set the local configuration parameters - mainly for developers - if exists else the mainconfigure
if (file_exists('includes/local/configure.php')) {
    include (
'includes/local/configure.php');
} else {
    include (
'includes/configure.php');
}

$php4_3_10 = (== version_compare(phpversion(), "4.3.10"));
define('PHP4_3_10'$php4_3_10);
// define the project version
define('PROJECT_VERSION''xt:Commerce v3.0.4 SP2.1');

// set the type of request (secure or not)
$request_type = (getenv('HTTPS') == '1' || getenv('HTTPS') == 'on') ? 'SSL' 'NONSSL';

// set php_self in the local scope
$PHP_SELF $_SERVER['PHP_SELF'];

// include the list of project filenames
require (DIR_WS_INCLUDES.'filenames.php');

// include the list of project database tables
require (DIR_WS_INCLUDES.'database_tables.php');

// SQL caching dir
define('SQL_CACHEDIR'DIR_FS_CATALOG.'cache/');

// Below are some defines which affect the way the discount coupon/gift voucher system work
// Be careful when editing them.
//
// Set the length of the redeem code, the longer the more secure
define('SECURITY_CODE_LENGTH''10');
//
// The settings below determine whether a new customer receives an incentive when they first signup
//
// Set the amount of a Gift Voucher that the new signup will receive, set to 0 for none
//  define('NEW_SIGNUP_GIFT_VOUCHER_AMOUNT', '10');  // placed in the admin configuration mystore
//
// Set the coupon ID that will be sent by email to a new signup, if no id is set then no email :)
//  define('NEW_SIGNUP_DISCOUNT_COUPON', '3'); // placed in the admin configuration mystore

// Store DB-Querys in a Log File
define('STORE_DB_TRANSACTIONS''false');

// graduated prices model or products assigned ?
define('GRADUATED_ASSIGN''true');

// include used functions

// Database
require_once (DIR_FS_INC.'xtc_db_connect.inc.php');
require_once (
DIR_FS_INC.'xtc_db_close.inc.php');
require_once (
DIR_FS_INC.'xtc_db_error.inc.php');
require_once (
DIR_FS_INC.'xtc_db_perform.inc.php');
require_once (
DIR_FS_INC.'xtc_db_query.inc.php');
require_once (
DIR_FS_INC.'xtc_db_queryCached.inc.php');
require_once (
DIR_FS_INC.'xtc_db_fetch_array.inc.php');
require_once (
DIR_FS_INC.'xtc_db_num_rows.inc.php');
require_once (
DIR_FS_INC.'xtc_db_data_seek.inc.php');
require_once (
DIR_FS_INC.'xtc_db_insert_id.inc.php');
require_once (
DIR_FS_INC.'xtc_db_free_result.inc.php');
require_once (
DIR_FS_INC.'xtc_db_fetch_fields.inc.php');
require_once (
DIR_FS_INC.'xtc_db_output.inc.php');
require_once (
DIR_FS_INC.'xtc_db_input.inc.php');
require_once (
DIR_FS_INC.'xtc_db_prepare_input.inc.php');
require_once (
DIR_FS_INC.'xtc_get_top_level_domain.inc.php');

// html basics
require_once (DIR_FS_INC.'xtc_href_link.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_separator.inc.php');
require_once (
DIR_FS_INC.'xtc_php_mail.inc.php');

require_once (
DIR_FS_INC.'xtc_product_link.inc.php');
require_once (
DIR_FS_INC.'xtc_category_link.inc.php');
require_once (
DIR_FS_INC.'xtc_manufacturer_link.inc.php');

// html functions
require_once (DIR_FS_INC.'xtc_draw_checkbox_field.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_form.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_hidden_field.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_input_field.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_password_field.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_pull_down_menu.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_radio_field.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_selection_field.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_separator.inc.php');
require_once (
DIR_FS_INC.'xtc_draw_textarea_field.inc.php');
require_once (
DIR_FS_INC.'xtc_image_button.inc.php');

require_once (
DIR_FS_INC.'xtc_not_null.inc.php');
require_once (
DIR_FS_INC.'xtc_update_whos_online.inc.php');
require_once (
DIR_FS_INC.'xtc_activate_banners.inc.php');
require_once (
DIR_FS_INC.'xtc_expire_banners.inc.php');
require_once (
DIR_FS_INC.'xtc_expire_specials.inc.php');
require_once (
DIR_FS_INC.'xtc_parse_category_path.inc.php');
require_once (
DIR_FS_INC.'xtc_get_product_path.inc.php');

require_once (
DIR_FS_INC.'xtc_get_category_path.inc.php');

require_once (
DIR_FS_INC.'xtc_get_parent_categories.inc.php');
require_once (
DIR_FS_INC.'xtc_redirect.inc.php');
require_once (
DIR_FS_INC.'xtc_get_uprid.inc.php');
require_once (
DIR_FS_INC.'xtc_get_all_get_params.inc.php');
require_once (
DIR_FS_INC.'xtc_has_product_attributes.inc.php');
require_once (
DIR_FS_INC.'xtc_image.inc.php');
require_once (
DIR_FS_INC.'xtc_check_stock_attributes.inc.php');
require_once (
DIR_FS_INC.'xtc_currency_exists.inc.php');
require_once (
DIR_FS_INC.'xtc_remove_non_numeric.inc.php');
require_once (
DIR_FS_INC.'xtc_get_ip_address.inc.php');
require_once (
DIR_FS_INC.'xtc_setcookie.inc.php');
require_once (
DIR_FS_INC.'xtc_check_agent.inc.php');
require_once (
DIR_FS_INC.'xtc_count_cart.inc.php');
require_once (
DIR_FS_INC.'xtc_get_qty.inc.php');
require_once (
DIR_FS_INC.'create_coupon_code.inc.php');
require_once (
DIR_FS_INC.'xtc_gv_account_update.inc.php');
require_once (
DIR_FS_INC.'xtc_get_tax_rate_from_desc.inc.php');
require_once (
DIR_FS_INC.'xtc_get_tax_rate.inc.php');
require_once (
DIR_FS_INC.'xtc_add_tax.inc.php');
require_once (
DIR_FS_INC.'xtc_cleanName.inc.php');
require_once (
DIR_FS_INC.'xtc_calculate_tax.inc.php');
require_once (
DIR_FS_INC.'xtc_input_validation.inc.php');
require_once (
DIR_FS_INC.'xtc_js_lang.php');

// make a connection to the database... now
xtc_db_connect() or die('Unable to connect to database server!');

$configuration_query xtc_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from '.TABLE_CONFIGURATION);
while (
$configuration xtc_db_fetch_array($configuration_query)) {
    
define($configuration['cfgKey'], $configuration['cfgValue']);
}

require_once (
DIR_WS_CLASSES.'class.phpmailer.php');
if (
EMAIL_TRANSPORT == 'smtp')
    require_once (
DIR_WS_CLASSES.'class.smtp.php');
require_once (
DIR_FS_INC.'xtc_Security.inc.php');

// set the application parameters

function xtDBquery($query) {
    if (
DB_CACHE == 'true') {
//            echo  'cached query: '.$query.'<br>';
        
$result xtc_db_queryCached($query);
    } else {
//                echo '::'.$query .'<br>';
        
$result xtc_db_query($query);

    }
    return 
$result;
}

function 
CacheCheck() {
    if (
USE_CACHE == 'false') return false;
    if (!isset(
$_COOKIE['XTCsid'])) return false;
    return 
true;
}

// if gzip_compression is enabled, start to buffer the output
if ((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded extension_loaded('zlib')) && (PHP_VERSION >= '4')) {
    if ((
$ini_zlib_output_compression = (int) ini_get('zlib.output_compression')) < 1) {
        
ob_start('ob_gzhandler');
    } else {
        
ini_set('zlib.output_compression_level'GZIP_LEVEL);
    }
}

// set the HTTP GET parameters manually if search_engine_friendly_urls is enabled
if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
    if (
strlen(getenv('PATH_INFO')) > 1) {
        
$GET_array = array ();
        
$PHP_SELF str_replace(getenv('PATH_INFO'), ''$PHP_SELF);
        
$vars explode('/'substr(getenv('PATH_INFO'), 1));
        for (
$i 0$n sizeof($vars); $i $n$i ++) {
            if (
strpos($vars[$i], '[]')) {
                
$GET_array[substr($vars[$i], 0, -2)][] = $vars[$i +1];
            } else {
                
$_GET[$vars[$i]] = htmlspecialchars($vars[$i +1]);
                if(
get_magic_quotes_gpc()) $_GET[$vars[$i]] = addslashes($_GET[$vars[$i]]);
            }
            
$i ++;
        }

        if (
sizeof($GET_array) > 0) {
            while (list (
$key$value) = each($GET_array)) {
                
$_GET[$key] = htmlspecialchars($value);
                if(
get_magic_quotes_gpc()) $_GET[$key] = addslashes($_GET[$key]);
            }
        }
    }
}
// check GET/POST/COOKIE VARS
require (DIR_WS_CLASSES.'class.inputfilter.php');
$InputFilter = new InputFilter();
$_GET $InputFilter->process($_GET);
$_POST $InputFilter->process($_POST);

// set the top level domains
$http_domain xtc_get_top_level_domain(HTTP_SERVER);
$https_domain xtc_get_top_level_domain(HTTPS_SERVER);
$current_domain = (($request_type == 'NONSSL') ? $http_domain $https_domain);

// include shopping cart class
require (DIR_WS_CLASSES.'shopping_cart.php');

// include navigation history class
require (DIR_WS_CLASSES.'navigation_history.php');

// some code to solve compatibility issues
require (DIR_WS_FUNCTIONS.'compatibility.php');

// define how the session functions will be used
require (DIR_WS_FUNCTIONS.'sessions.php');

// set the session name and save path
session_name('XTCsid');
if (
STORE_SESSIONS != 'mysql'session_save_path(SESSION_WRITE_DIRECTORY);

// set the session cookie parameters
if (function_exists('session_set_cookie_params')) {
    
session_set_cookie_params(0'/', (xtc_not_null($current_domain) ? '.'.$current_domain ''));
}
elseif (
function_exists('ini_set')) {
    
ini_set('session.cookie_lifetime''0');
    
ini_set('session.cookie_path''/');
    
ini_set('session.cookie_domain', (xtc_not_null($current_domain) ? '.'.$current_domain ''));
}

// set the session ID if it exists
if (isset ($_POST[session_name()])) {
    
session_id($_POST[session_name()]);
}
elseif ((
$request_type == 'SSL') && isset ($_GET[session_name()])) {
    
session_id($_GET[session_name()]);
}

// start the session
$session_started false;
if (
SESSION_FORCE_COOKIE_USE == 'True') {
    
xtc_setcookie('cookie_test''please_accept_for_session'time() + 60 60 24 30'/'$current_domain);

    if (isset (
$_COOKIE['cookie_test'])) {
        
session_start();
        include (
DIR_WS_INCLUDES.'tracking.php');
        
$session_started true;
    }
} else {
    
session_start();
    include (
DIR_WS_INCLUDES.'tracking.php');
    
$session_started true;
}

// check the Agent
$truncate_session_id false;
if (
CHECK_CLIENT_AGENT) {
    if (
xtc_check_agent() == 1) {
        
$truncate_session_id true;
    }
}

// verify the ssl_session_id if the feature is enabled
if (($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true)) {
    
$ssl_session_id getenv('SSL_SESSION_ID');
    if (!
session_is_registered('SSL_SESSION_ID')) {
        
$_SESSION['SESSION_SSL_ID'] = $ssl_session_id;
    }

    if (
$_SESSION['SESSION_SSL_ID'] != $ssl_session_id) {
        
session_destroy();
        
xtc_redirect(xtc_href_link(FILENAME_SSL_CHECK));
    }
}

// verify the browser user agent if the feature is enabled
if (SESSION_CHECK_USER_AGENT == 'True') {
    
$http_user_agent strtolower($_SERVER['HTTP_USER_AGENT']);
    
$http_user_agent2 strtolower(getenv("HTTP_USER_AGENT"));
    
$http_user_agent = ($http_user_agent == $http_user_agent2) ? $http_user_agent $http_user_agent.';'.$http_user_agent2;
    if (!isset (
$_SESSION['SESSION_USER_AGENT'])) {
        
$_SESSION['SESSION_USER_AGENT'] = $http_user_agent;
    }

    if (
$_SESSION['SESSION_USER_AGENT'] != $http_user_agent) {
        
session_destroy();
        
xtc_redirect(xtc_href_link(FILENAME_LOGIN));
    }
}

// verify the IP address if the feature is enabled
if (SESSION_CHECK_IP_ADDRESS == 'True') {
    
$ip_address xtc_get_ip_address();
    if (!isset (
$_SESSION['SESSION_IP_ADDRESS'])) {
        
$_SESSION['SESSION_IP_ADDRESS'] = $ip_address;
    }

    if (
$_SESSION['SESSION_IP_ADDRESS'] != $ip_address) {
        
session_destroy();
        
xtc_redirect(xtc_href_link(FILENAME_LOGIN));
    }
}

// set the language
if (!isset ($_SESSION['language']) || isset ($_GET['language'])) {

    include (
DIR_WS_CLASSES.'language.php');
    
$lng = new language(xtc_input_validation($_GET['language'], 'char'''));

    if (!isset (
$_GET['language']))
        
$lng->get_browser_language();

    
$_SESSION['language'] = $lng->language['directory'];
    
$_SESSION['languages_id'] = $lng->language['id'];
    
$_SESSION['language_charset'] = $lng->language['language_charset'];
    
$_SESSION['language_code'] = $lng->language['code'];
}

if (isset(
$_SESSION['language']) && !isset($_SESSION['language_charset'])) {
    
    include (
DIR_WS_CLASSES.'language.php');
    
$lng = new language(xtc_input_validation($_SESSION['language'], 'char'''));


    
$_SESSION['language'] = $lng->language['directory'];
    
$_SESSION['languages_id'] = $lng->language['id'];
    
$_SESSION['language_charset'] = $lng->language['language_charset'];
    
$_SESSION['language_code'] = $lng->language['code'];
    
}

// include the language translations
require (DIR_WS_LANGUAGES.$_SESSION['language'].'/'.$_SESSION['language'].'.php');

// currency
if (!isset ($_SESSION['currency']) || isset ($_GET['currency']) || ((USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $_SESSION['currency']))) {

    if (isset (
$_GET['currency'])) {
        if (!
$_SESSION['currency'] = xtc_currency_exists($_GET['currency']))
            
$_SESSION['currency'] = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY DEFAULT_CURRENCY;
    } else {
        
$_SESSION['currency'] = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY DEFAULT_CURRENCY;
    }
}
if (isset (
$_SESSION['currency']) && $_SESSION['currency'] == '') {
    
$_SESSION['currency'] = DEFAULT_CURRENCY;
}

// write customers status in session
require (DIR_WS_INCLUDES.'write_customers_status.php');

// testing new price class

require (DIR_WS_CLASSES.'main.php');
$main = new main();

require (
DIR_WS_CLASSES.'xtcPrice.php');
$xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']);

// econda tracking
if (TRACKING_ECONDA_ACTIVE=='true') {        
    require(
DIR_WS_INCLUDES 'econda/class.econda304SP2.php');
    
$econda = new econda();
}

require (
DIR_WS_INCLUDES.FILENAME_CART_ACTIONS);
// create the shopping cart & fix the cart if necesary
if (!is_object($_SESSION['cart'])) {
    
$_SESSION['cart'] = new shoppingCart();
}

// include the who's online functions
xtc_update_whos_online();

// split-page-results
require (DIR_WS_CLASSES.'split_page_results.php');

// infobox
require (DIR_WS_CLASSES.'boxes.php');

// auto activate and expire banners
xtc_activate_banners();
xtc_expire_banners();

// auto expire special products
xtc_expire_specials();
require (
DIR_WS_CLASSES.'product.php');
// new p URLS
if (isset ($_GET['info'])) {
    
$site explode('_'$_GET['info']);
    
$pID $site[0];
    
$actual_products_id = (int) str_replace('p'''$pID);
    
$product = new product($actual_products_id);
// also check for old 3.0.3 URLS
elseif (isset($_GET['products_id'])) {
    
$actual_products_id = (int) $_GET['products_id'];
    
$product = new product($actual_products_id);
    
}
if (!
is_object($product)) {
    
$product = new product();    
}

// new c URLS
if (isset ($_GET['cat'])) {
    
$site explode('_'$_GET['cat']);
    
$cID $site[0];
    
$cID str_replace('c'''$cID);
    
$_GET['cPath'] = xtc_get_category_path($cID);
}
// new m URLS
if (isset ($_GET['manu'])) {
    
$site explode('_'$_GET['manu']);
    
$mID $site[0];
    
$mID = (int)str_replace('m'''$mID);
    
$_GET['manufacturers_id'] = $mID;
}

// calculate category path
if (isset ($_GET['cPath'])) {
    
$cPath xtc_input_validation($_GET['cPath'], 'cPath''');
}
elseif (
is_object($product) && !isset ($_GET['manufacturers_id'])) {
    if (
$product->isProduct()) {
        
$cPath xtc_get_product_path($actual_products_id);
    } else {
        
$cPath '';
    }
} else {
    
$cPath '';
}

if (
xtc_not_null($cPath)) {
    
$cPath_array xtc_parse_category_path($cPath);
    
$cPath implode('_'$cPath_array);
    
$current_category_id $cPath_array[(sizeof($cPath_array) - 1)];
} else {
    
$current_category_id 0;
}

// include the breadcrumb class and start the breadcrumb trail
require (DIR_WS_CLASSES.'breadcrumb.php');
$breadcrumb = new breadcrumb;

$breadcrumb->add(HEADER_TITLE_TOPHTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOGxtc_href_link(FILENAME_DEFAULT));

// add category names or the manufacturer name to the breadcrumb trail
if (isset ($cPath_array)) {
    for (
$i 0$n sizeof($cPath_array); $i $n$i ++) {
        if (
GROUP_CHECK == 'true') {
            
$group_check "and c.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";
        }
        
$categories_query xtDBquery("select
                                                        cd.categories_name
                                                        from "
.TABLE_CATEGORIES_DESCRIPTION." cd,
                                                        "
.TABLE_CATEGORIES." c
                                                        where cd.categories_id = '"
.$cPath_array[$i]."'
                                                        and c.categories_id=cd.categories_id
                                                        "
.$group_check."
                                                        and cd.language_id='"
.(int) $_SESSION['languages_id']."'");
        if (
xtc_db_num_rows($categories_query,true) > 0) {
            
$categories xtc_db_fetch_array($categories_query,true);

            
$breadcrumb->add($categories['categories_name'], xtc_href_link(FILENAME_DEFAULTxtc_category_link($cPath_array[$i], $categories['categories_name'])));
        } else {
            break;
        }
    }
}
elseif (
xtc_not_null($_GET['manufacturers_id'])) {
    
$manufacturers_query xtDBquery("select manufacturers_name from ".TABLE_MANUFACTURERS." where manufacturers_id = '".(int) $_GET['manufacturers_id']."'");
    
$manufacturers xtc_db_fetch_array($manufacturers_querytrue);

    
$breadcrumb->add($manufacturers['manufacturers_name'], xtc_href_link(FILENAME_DEFAULTxtc_manufacturer_link((int) $_GET['manufacturers_id'], $manufacturers['manufacturers_name'])));

}

// add the products model/name to the breadcrumb trail
if ($product->isProduct()) {
        
$breadcrumb->add($product->getBreadcrumbModel(), xtc_href_link(FILENAME_PRODUCT_INFOxtc_product_link($product->data['products_id'], $product->data['products_name'])));
}


// initialize the message stack for output messages
require (DIR_WS_CLASSES.'message_stack.php');
$messageStack = new messageStack;

// set which precautions should be checked
define('WARN_INSTALL_EXISTENCE''true');
define('WARN_CONFIG_WRITEABLE''true');
define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE''true');
define('WARN_SESSION_AUTO_START''true');
define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE''true');

// Include Template Engine
require (DIR_WS_CLASSES.'Smarty_2.6.14/Smarty.class.php');

if (isset (
$_SESSION['customer_id'])) {
    
$account_type_query xtc_db_query("SELECT
                                            account_type,
                                            customers_default_address_id
                                            FROM
                                            "
.TABLE_CUSTOMERS."
                                            WHERE customers_id = '"
.(int) $_SESSION['customer_id']."'");
    
$account_type xtc_db_fetch_array($account_type_query);

    
// check if zone id is unset bug #0000169
    
if (!isset ($_SESSION['customer_country_id'])) {
        
$zone_query xtc_db_query("SELECT  entry_country_id
                                                     FROM "
.TABLE_ADDRESS_BOOK."
                                                     WHERE customers_id='"
.(int) $_SESSION['customer_id']."'
                                                     and address_book_id='"
.$account_type['customers_default_address_id']."'");

        
$zone xtc_db_fetch_array($zone_query);
        
$_SESSION['customer_country_id'] = $zone['entry_country_id'];
    }
    
$_SESSION['account_type'] = $account_type['account_type'];
} else {
    
$_SESSION['account_type'] = '0';
}

// modification for nre graduated system
unset ($_SESSION['actual_content']);

// econda tracking
if (TRACKING_ECONDA_ACTIVE=='true') {    
    
    require(
DIR_WS_INCLUDES 'econda/emos.php');
}

xtc_count_cart();
?>
Wir haben Paypal in 2008 installiert und gepruft und hat funktioniert. Aber wir haben viel sachen geandert im layout. Gestern war unsere erste Kunde mit Paypal zahlung und das war den erste fehler.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #8 (permalink)  
Alt 12.06.2009, 14:56
Neuer Benutzer
 
Registriert seit: 29.08.2008
Beiträge: 8
Standard

Zitat:
Zitat von mikkel Beitrag anzeigen
ok, die Funktion ist in der paypal_checkout.php.

das //paypal ist nur eine Bemerkung ohne Funktion (das mach das // davor).
Sind die anderen beiden Zeilen in der application_top.php ?

Hat es jemals funktioniert oder tritt der Fehler erst seit einiger Zeit auf?
Kannst du mal ausprobieren was beim PayPal Express Warenkorb passiert?

Viele Grüße - Michael
PayPal Express Warenkorb brauchen wir nicht glaube ich...?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #9 (permalink)  
Alt 12.06.2009, 15:08
xt:Commerce Support Kunde
 
Registriert seit: 09.04.2008
Beiträge: 412
Standard

Das PP Express Warenkorb sollte nur mal zu Test dienen - aber egal:
In der /includes/application_top.php fehlen die beiden PayPal Zeilen !

Nach:
Code:
if (TRACKING_ECONDA_ACTIVE=='true') {
	require(DIR_WS_INCLUDES . 'econda/class.econda304SP2.php');
	$econda = new econda();
}
muss hinein:
Code:
// paypal
require_once (DIR_WS_CLASSES.'paypal_checkout.php');
$o_paypal = new paypal_checkout();
vor:
Code:
require (DIR_WS_INCLUDES.FILENAME_CART_ACTIONS);
// create the shopping cart & fix the cart if necesary
if (!is_object($_SESSION['cart'])) {
	$_SESSION['cart'] = new shoppingCart();
}
so dass es dann so aussieht:
Code:
if (TRACKING_ECONDA_ACTIVE=='true') {
	require(DIR_WS_INCLUDES . 'econda/class.econda304SP2.php');
	$econda = new econda();
}

// paypal
require_once (DIR_WS_CLASSES.'paypal_checkout.php');
$o_paypal = new paypal_checkout();

require (DIR_WS_INCLUDES.FILENAME_CART_ACTIONS);
// create the shopping cart & fix the cart if necesary
if (!is_object($_SESSION['cart'])) {
	$_SESSION['cart'] = new shoppingCart();
}
Dann wirds auch hinhauen.

Viele Grüße - Michael
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #10 (permalink)  
Alt 12.06.2009, 15:17
Neuer Benutzer
 
Registriert seit: 29.08.2008
Beiträge: 8
Standard

Hab es geändert aber funktioniert leider nicht. Selbe Fehler:

Fatal error: Call to undefined method paypal_checkout::complete_express_checkout() in /var/www/g28291/speed-buster.nl/HTML/shop/includes/modules/payment/paypal.php on line 118
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
118, fehlermeldung, line, paypal, paypalphp

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
image_processing.php - Ein paar Zeilen, die das Leben besser machen ;) toniguenther87 Admininterface 38 12.12.2010 11:25
Fehler "allow_call_time_pass_reference" cakl Installation und Konfiguration 1 04.02.2007 18:43


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:46 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand