Go Back   vb.org Archive > Community Central > Community Lounge
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 10-08-2013, 05:33 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works fine for me on vb3.8 including paypal payments but i think Adam only updated it to work as far as vb4.1

--------------- Added [DATE]1381258719[/DATE] at [TIME]1381258719[/TIME] ---------------

Also a word of note:
This by BOP5 http://www.vbulletin.com/forum/forum...-may-be-needed will need taking care of both in the vbulletin file and in the /awcoding/methods/paypal.php (4 instances of each rather that 2)
Reply With Quote
  #12  
Old 10-09-2013, 09:30 AM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Simon, is this the file that needs to change ? Not sure what changes does it need?

forum/awcoding/clientscript/methods/paypal.js

PHP Code:
/* AWCoding Back-End created by AWNetwork, Inc., Version 4.0.2, PayPal Script, Copyright 2010 all rights reserved */
function paypal_databacitem_new ){
    
    if ( 
document.awc.sid.value == "ss" ){
        var 
document.awc.itemterms.options[document.awc.itemterms.selectedIndex].innerHTML+" "+document.awc.item.options[document.awc.item.selectedIndex].innerHTML+" "+name;
    } else {
        var 
document.awc.item.options[document.awc.item.selectedIndex].innerHTML+" "+name;
    }
    
    if ( 
document.awc.sid.value == "ps" ){
        
document.awc.item.value item_new[0]; 
    }
    
a[0] = new Array(2);
    
a[0][0] = "business";
    
a[0][1] = pp_email;
    
a[1] = new Array(2);
    
a[1][0] = "amount";
    
a[1][1] = document.awc.amt.value;
    
a[2] = new Array(2);
    
a[2][0] = "item_name";
    
a[2][1] = z;
    
a[3] = new Array(2);
    
a[3][0] = "tax";
    
a[3][1] = 0;
    
a[4] = new Array(2);
    
a[4][0] = "currency_code";
    
a[4][1] = document.awc.currency.value;
    
a[5] = new Array(2);
    
a[5][0] = "shipping";
    
a[5][1] = 0;
    
a[6] = new Array(2);
    
a[6][0] = "no_shipping";
    
a[6][1] = 1;
    
a[7] = new Array(2);
    
a[7][0] = "item_number";
    
a[7][1] = document.awc.item.value;
    
a[8] = new Array(2);
    
a[8][0] = "custom";
    
a[8][1] = c;
    
a[9] = new Array(2);
    
a[9][0] = "a3";
    
a[9][1] = document.awc.amt.value;
    
a[10] = new Array(2);
    
a[10][0] = "p3";
    
a[10][1] = document.awc.length.value;
    
a[11] = new Array(2);
    
a[11][0] = "t3";
    
a[11][1] = document.awc.units.value;
    
a[12] = new Array(2);
    
a[12][0] = "src";
    
a[12][1] = 1;
    
a[13] = new Array(2);
    
a[13][0] = "sra";
    
a[13][1] = 1;
    
a[14] = new Array(2);
    
a[14][0] = "rm";
    
a[14][1] = 2;
    
a[15] = new Array(2);
    
a[15][0] = "cpp_header_image";
    
a[15][1] = pp_image;
    
    if ( 
pp_ipn ){
        
a[16] = new Array(2);
        
a[16][0] = "return";
        
a[16][1] = return_url;
        
a[17] = new Array(2);
        
a[17][0] = "notify_url";
        
        if ( 
pp_ipn_home != "http://www.remotedomain.com/" && pp_ipn_home != "" ){
            
a[17][1] = pp_ipn_home+"awc_payment.php?do=process&method="+document.awc.method.value;
        } else {
            
a[17][1] = home+"awc_payment.php?do=process&method="+document.awc.method.value;
        }

        
a[17][1] = home+"awc_payment.php?do=process&method="+document.awc.method.value;
        
        
a[18] = new Array(2);
        
a[18][0] = "lc";
        
a[18][1] = "US";
    } else {
        
a[16] = new Array(2);
        
a[16][0] = "return";
        
a[16][1] = home+"awc_payment.php?do=verify&pid="+pid+"&method="+document.awc.method.value;
        
a[17] = new Array(2);
        
a[17][0] = "cancel_return";
        
a[17][1] = home+"awc_payment.php?do=cancel&pid="+pid+"&method="+document.awc.method.value+"&custom="+c;
        
a[18] = new Array(2);
        
a[18][0] = "pid";
        
a[18][1] = pid;
        
a[19] = new Array(2);
        
a[19][0] = "usr_manage";
        
a[19][1] = 0;
        
a[20] = new Array(2);
        
a[20][0] = "lc";
        
a[20][1] = "US";
    }
    
add);
    
    if ( 
pp_ipn != ){
        
YAHOO.util.Connect.asyncRequest'POST''awc_payment.php'''"do=add&method="+document.awc.method.value+"&pid="+pid+"&custom="+c+"&item_number="+document.awc.item.value+"&amt="+document.awc.amt.value+"&mc_currency="+document.awc.currency.value+"&business="+pp_email+"&item_name="+z+"&pending_reason="+pending_reason );
    }
    
    if ( 
pp_test ){
        
        if ( 
document.awc.recurring.value == ){
            
"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions";
        } else {
            
            if ( 
document.awc.sid.value == "ds" && pp_donation ){
                
"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_donations";
            } else {
                
"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick";
            }
        }
    } else {
        
        if ( 
document.awc.recurring.value == ){
            
"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions";
        } else {
            
            if ( 
document.awc.sid.value == "ds" && pp_donation ){
                
"https://www.paypal.com/cgi-bin/webscr?cmd=_donations";
            } else {
                
"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick";
            }
        }
    }
    return 
b;
}; 
Reply With Quote
  #13  
Old 10-09-2013, 03:16 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's not the path I pointed to
Reply With Quote
  #14  
Old 10-09-2013, 10:15 PM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Simon, oh i see it now! how to apply the changes? Can you help me with this? Which one to change exactly in this file?

P.s. still waiting for your pm reply btw :/ the files

This is the entire file and it is a bit different:

PHP Code:
<?php /* AWCoding Back-End created by AWNetwork, Inc., Version 4.0.0, PayPal Method File, Copyright 2010 all rights reserved  */

class paypal {

    function 
test$sid ){
        global 
$vbulletin;
        
$communication false
        
$query 'cmd=_notify-validate';
        
        if ( !
$communication ){
            
            if ( 
$vbulletin->options[$sid.'_paypal_test'] == ){
                
$domain "www.sandbox.paypal.com";
            } else {
                
$domain "www.paypal.com";
            }
            
$header "POST /cgi-bin/webscr HTTP/1.0\r\n"
            
$header .= "Host: $domain\r\n"
            
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"
            
$header .= "Content-Length: ".strlen$query )."\r\n\r\n";
            
            if ( 
$fp fsockopen$domain80$errno$errstr15 ) ){
                
socket_set_timeout$fp10 ); 
                
fwrite$fp$header.$query ); 
                while ( !
feof$fp ) ){
                    
$result fgets$fp1024 ); 
                    if ( 
strcmp$result'INVALID' ) == ){
                        
$communication true
                        break;
                    }
                } 
                
fclose$fp );
            }
            
            if ( !
$communication ){
                
                if ( 
$vbulletin->options[$sid.'_paypal_test'] == ){
                    
$domain "ssl://www.sandbox.paypal.com"
                    
$host 'www.sandbox.paypal.com';
                } else {
                    
$domain "ssl://www.paypal.com"
                    
$host 'www.paypal.com';
                }
                
$header "POST /cgi-bin/webscr HTTP/1.0\r\n"
                
$header .= "Host: $domain\r\n"
                
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"
                
$header .= "Content-Length: ".strlen$query )."\r\n\r\n";
                
                if ( 
$fp fsockopen$domain443$errno$errstr15 ) ){
                    
socket_set_timeout$fp10 ); 
                    
fwrite$fp$header.$query ); 
                    while ( !
feof$fp ) ){
                        
$result fgets$fp1024 ); 
                        
                        if ( 
strcmp$result'INVALID' ) == ){
                            
$communication true
                            break;
                        }
                    } 
                    
fclose$fp );
                }
            }
            
            if ( !
$communication ){
                
                if ( 
$vbulletin->options[$sid.'_paypal_test'] == ){
                    
$domain "https://www.sandbox.paypal.com/cgi-bin/webscr";
                } else {
                    
$domain "https://www.paypal.com/cgi-bin/webscr";
                }
                
$ch curl_init(); 
                
curl_setopt $chCURLOPT_URL$domain ); 
                
curl_setopt $chCURLOPT_TIMEOUT15 ); 
                
curl_setopt $chCURLOPT_POSTtrue );
                
curl_setopt $chCURLOPT_POSTFIELDSIZE); 
                
curl_setopt $chCURLOPT_POSTFIELDS$req ); 
                
curl_setopt $chCURLOPT_RETURNTRANSFERtrue );
                
curl_setopt $chCURLOPT_HTTPHEADER, Array( "Content-Type: application/x-www-form-urlencoded""Content-Length: ".strlen$req ) ) );
                
curl_setopt $chCURLOPT_HEADER); 
                
curl_setopt $chCURLOPT_VERBOSE); 
                
curl_setopt $chCURLOPT_SSL_VERIFYPEERFALSE );
                
$result curl_exec$ch ); 
                
curl_close$ch ); 
                
                if ( 
$result !== false ){
                    
$communication true;
                }
            }
            
            if ( !
$communication ){
                
                if ( 
$vbulletin->options[$sid.'_paypal_test'] == ){
                    
$domain "https://www.sandbox.paypal.com/cgi-bin/webscr";
                } else {
                    
$domain "https://www.paypal.com/cgi-bin/webscr";
                }
                
$ch curl_init(); 
                
curl_setopt $chCURLOPT_URL$domain ); 
                
curl_setopt $chCURLOPT_TIMEOUT15 ); 
                
curl_setopt $chCURLOPT_POSTtrue );
                
curl_setopt $chCURLOPT_POSTFIELDSIZE); 
                
curl_setopt $chCURLOPT_POSTFIELDS$req ); 
                
curl_setopt $chCURLOPT_RETURNTRANSFERtrue );
                
curl_setopt $chCURLOPT_HTTPHEADER, Array( "Content-Type: application/x-www-form-urlencoded""Content-Length: ".strlen$req ) ) );
                
curl_setopt $chCURLOPT_HEADER); 
                
curl_setopt $chCURLOPT_VERBOSE); 
                
curl_setopt $chCURLOPT_HTTPPROXYTUNNELTRUE );
                
curl_setopt $chCURLOPT_PROXYTYPECURLPROXY_HTTP ); 
                
curl_setopt $chCURLOPT_PROXY"http://proxy.shr.secureserver.net:3128" ); 
                
curl_setopt $chCURLOPT_SSL_VERIFYPEERFALSE );
                
$result curl_exec$ch ); 
                
curl_close$ch ); 
                
                if ( 
$result !== false ){
                    
$communication true;
                }
            }
        }
        return ( !empty( 
$vbulletin->options[$sid.'_paypal_email'] ) AND $communication );
    }

    function 
add$pid ){
        global 
$vbulletin$vbphrase$AWC$BASE$TRANS;
        
$AWC['IN']['mc_gross'] = $AWC['IN']['amt']; 
        
$AWC['IN']['mc_fee'] = '0'
        
$AWC['IN']['payment_status'] = 'Unconfirmed'
        
$AWC['IN']['txn_id'] = $pid
        unset( 
$AWC['IN']['amt'], $AWC['IN']['do'] );
        
$db_string null
        
$db_string $BASE->compile_db_insert_string$AWC['IN'] ); 
        
        
$vbulletin->db->query_write("
            INSERT INTO `"
.TABLE_PREFIX."awc_payments` 
                ("
.$db_string['FIELD_NAMES'].") 
            VALUES 
                ("
.$db_string['FIELD_VALUES'].")
        "
);
        
        if ( 
$vbulletin->options['awc_ns_en'] ){
            
            if ( 
$vbulletin->options['awc_ns_tn_en'] ){
                
$msg_rec_ids explode","$vbulletin->options['awc_ns_tn_rec'] ); 
                foreach ( 
$msg_rec_ids AS $msg_rec_id ){
                    
$TRANS->notify_send'new'$msg_rec_id );
                }
            } 
            
            if ( 
$AWC['IN']['userid'] > && $vbulletin->options['awc_ns_ts_en'] ){
                
$TRANS->notify_send'status'$AWC['IN']['userid'] );
            }
        }        
    }

    function 
verify$pid ){
        global 
$vbulletin$vbphrase$AWC$BASE$TRANS;
        
//if ($AWC['IN']['receiver_email']===$vbulletin->options[$AWC['IN']['sid'].'_paypal_email'] || $vbulletin->options[$AWC['IN']['sid'].'_paypal_bypass']){
            
            
if ( $AWC['IN']['txn_type'] = 'subscr_signup' ){
                
$AWC['IN']['payment_status'] = 'Completed'
                
$AWC['IN']['mc_gross'] = $AWC['IN']['mc_amount3'];
            } 
            unset( 
$AWC['IN']['do'] ); 
            
$items = array();

            ( 
$hook vBulletinHook::fetch_hook'awc_payment_methods' ) ) ? eval( $hook ) : false;
                                    
            if ( 
in_array$AWC['IN']['item_number'], $items ) ){
                
//if ($TRANS->var_check('payment_status','Pending') || $TRANS->var_check('payment_status','Processed') || $TRANS->var_check('payment_status','Completed')){
                
                
if ( $AWC['IN']['payment_status'] == 'Completed' ){    
                    
                    
$payment_sql $vbulletin->db->query_read("
                        SELECT txn_id 
                        FROM `"
.TABLE_PREFIX."awc_payments` 
                        WHERE txn_id = '"
.$pid."'
                    "
);
                    
                    if ( 
$vbulletin->db->num_rows$payment_sql ) == ){
                        
$db_string null
                        
$db_string $BASE->compile_db_insert_string$AWC['IN'] ); 
                        
                        
$vbulletin->db->query_write("
                            INSERT INTO `"
.TABLE_PREFIX."awc_payments` 
                                ("
.$db_string['FIELD_NAMES'].") 
                            VALUES 
                                ("
.$db_string['FIELD_VALUES'].")
                        "
); 
                        
$AWC['IN']['id'] = $vbulletin->db->insert_id();
                    } else {
                        
$db_string null
                        
$db_string $BASE->compile_db_update_string$AWC['IN'] ); 
                        
                        
$vbulletin->db->query_write("
                            UPDATE `"
.TABLE_PREFIX."awc_payments` 
                            SET "
.$db_string.
                            WHERE txn_id = '"
.$pid."'
                        "
);
                    }
                    
                    if ( 
$AWC['IN']['payment_status'] == 'Completed' && $AWC['IN']['userid'] > ){
                        
$TRANS->updates();
                    }
                    
                    if ( 
$vbulletin->options['awc_ns_en'] ){
                        
                        if ( 
$vbulletin->options['awc_ns_tn_en'] ){
                            
$msg_rec_ids explode","$vbulletin->options['awc_ns_tn_rec'] ); 
                            foreach ( 
$msg_rec_ids AS $msg_rec_id ){
                                
$TRANS->notify_send'new'$msg_rec_id );
                            }
                        }
                        
                        if ( 
$AWC['IN']['userid'] > ){
                            
                            if ( 
$AWC['IN']['payment_status'] == 'Completed' ){
                                
                                if ( 
$vbulletin->options['awc_ns_tt_en'] ){
                                    
$TRANS->notify_send'thanks'$AWC['IN']['userid'] );
                                }
                            } else {
                                
                                if ( 
$vbulletin->options['awc_ns_ts_en'] ){
                                    
$TRANS->notify_send'status'$AWC['IN']['userid'] );
                                }
                            }
                        }
                    }
                }
            }
        
//}
    
}

    function 
process($postipn){
        global 
$vbulletin$vbphrase$AWC$BASE$TRANS;
        
header"Status: 200 OK" );

        if ( !isset( 
$AWC['IN']['ipnkey'] ) || $AWC['IN']['ipnkey'] != $vbulletin->options[$AWC['IN']['sid'].'_paypal_ipnkey'] ){
        
            if ( 
$vbulletin->options[$AWC['IN']['sid'].'_paypal_test'] == ){
                
$domain "ssl://www.sandbox.paypal.com"
                
$host 'www.sandbox.paypal.com';
            } else {
                
$domain "ssl://www.paypal.com"
                
$host 'www.paypal.com';
            }
            
set_time_limit60 ); 
            
$socket fsockopen$domain"443"$errno$errstr30 );
            
$header "POST /cgi-bin/webscr HTTP/1.0\r\n"
            
$header .= "User-Agent: PHP/".phpversion()."\r\n"
            
$header .= "Referer: ".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING']."\r\n"
            
$header .= "Server: ".$_SERVER['SERVER_SOFTWARE']."\r\n"
            
$header .= "Host: ".$host."\r\n";
            
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"
            
$header .= "Content-Length: ".strlen$postipn )."\r\n"
            
$header .= "Accept: */*\r\n\r\n";
            
            if ( !
$socket ){
                
                if ( 
phpversion() >= '4.3.0' && function_exists'file_get_contents' ) ){
                    
                } else {
                    function 
file_get_contents$ipnget ){
                        
$ipnget file$ipnget ); 
                        return 
$ipnget[0];
                    }
                }
                
$response file_get_contents$domain.':443/cgi-bin/webscr?'.$postipn );
            } else {
                
fputs $socket$header.$postipn."\r\n\r\n" ); 
                while ( !
feof$socket ) ){
                    
$response fgets$socket1024 );
                }
            }
            
$response trim$response );
            
            if ( 
strcmp$response"VERIFIED" ) && strcmp$response"INVALID" ) ){
                
                if ( 
$vbulletin->options[$AWC['IN']['sid'].'_paypal_test'] == ){
                    
$domain "www.sandbox.paypal.com";
                } else {
                    
$domain "www.paypal.com";
                }
                
set_time_limit60 ); 
                
$socket fsockopen$domain"80"$errno$errstr30 );
                
$header "POST /cgi-bin/webscr HTTP/1.0\r\n"
                
$header .= "User-Agent: PHP/".phpversion()."\r\n"
                
$header .= "Referer: ".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING']."\r\n"
                
$header .= "Server: ".$_SERVER['SERVER_SOFTWARE']."\r\n"
                
$header .= "Host: ".$domain."\r\n";
                
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"
                
$header .= "Content-Length: ".strlen$postipn )."\r\n"
                
$header .= "Accept: */*\r\n\r\n";
                
                if ( !
$socket ){
                    
                    if ( 
phpversion() >= '4.3.0' && function_exists'file_get_contents' ) ){
                        
                    } else {
                        function 
file_get_contents$ipnget ){
                            
$ipnget file$ipnget ); 
                            return 
$ipnget[0];
                        }
                    }
                    
$response file_get_contents'http://'.$domain.':80/cgi-bin/webscr?'.$postipn );
                } else {
                    
fputs $socket$header.$postipn."\r\n\r\n" ); 
                    while ( !
feof$socket ) ){
                        
$response fgets$socket1024 );
                    }
                }
                
$response trim$response );
            }
            
            if ( 
strcmp$response"VERIFIED" ) && strcmp$response"INVALID" ) ){
                
                if ( 
$vbulletin->options[$AWC['IN']['sid'].'_paypal_test'] == ){
                    
$domain "https://www.sandbox.paypal.com/cgi-bin/webscr";
                } else {
                    
$domain "https://www.paypal.com/cgi-bin/webscr";
                }
                
$response $curl_err ''
                
$ch curl_init();
                
curl_setopt $chCURLOPT_URL$domain ); 
                
curl_setopt $chCURLOPT_RETURNTRANSFER); 
                
curl_setopt $chCURLOPT_POST); 
                
curl_setopt $chCURLOPT_POSTFIELDS$req );
                
curl_setopt $chCURLOPT_HTTPHEADER, Array( "Content-Type: application/x-www-form-urlencoded""Content-Length: ".strlen$req ) ) );
                
curl_setopt $chCURLOPT_HEADER); 
                
curl_setopt $chCURLOPT_VERBOSE); 
                
curl_setopt $chCURLOPT_SSL_VERIFYPEERFALSE ); 
                
curl_setopt $chCURLOPT_URL$domain ); 
                
curl_setopt $chCURLOPT_TIMEOUT15 );
                
$response = @curl_exec$ch ); 
                
$curl_err curl_error$ch ); 
                
curl_close$ch );
            }
            
            if ( 
strcmp$response"VERIFIED" ) && strcmp$response"INVALID" ) ){
                
                if ( 
$vbulletin->options[$AWC['IN']['sid'].'_paypal_test'] == ){
                    
$domain "https://www.sandbox.paypal.com/cgi-bin/webscr";
                } else {
                    
$domain "https://www.paypal.com/cgi-bin/webscr";
                }
                
$response $curl_err ''
                
$ch curl_init();
                
curl_setopt $chCURLOPT_URL$domain ); 
                
curl_setopt $chCURLOPT_RETURNTRANSFER); 
                
curl_setopt $chCURLOPT_POST); 
                
curl_setopt $chCURLOPT_POSTFIELDS$req );
                
curl_setopt $chCURLOPT_HTTPHEADER, Array( "Content-Type: application/x-www-form-urlencoded""Content-Length: ".strlen$req ) ) );
                
curl_setopt $chCURLOPT_HEADER); 
                
curl_setopt $chCURLOPT_VERBOSE); 
                
curl_setopt $chCURLOPT_HTTPPROXYTUNNELTRUE ); 
                
curl_setopt $chCURLOPT_PROXYTYPECURLPROXY_HTTP );
                
curl_setopt $chCURLOPT_PROXY"http://proxy.shr.secureserver.net:3128" ); 
                
curl_setopt $chCURLOPT_SSL_VERIFYPEERFALSE ); 
                
curl_setopt $chCURLOPT_URL$domain ); 
                
curl_setopt $chCURLOPT_TIMEOUT15 );
                
$response = @curl_exec$ch ); 
                
$curl_err curl_error$ch ); 
                
curl_close$ch );
            }
        } else {
            unset( 
$AWC['IN']['ipnkey'] );
            
$response "VERIFIED";
        }    
                
        if ( !
strcmp$response"VERIFIED" ) ){
            
//if ($AWC['IN']['receiver_email']===$vbulletin->options[$AWC['IN']['sid'].'_paypal_email'] || $vbulletin->options[$AWC['IN']['sid'].'_paypal_bypass']){
                
unset( $AWC['IN']['do'], $AWC['IN']['currency_code'] ); 
                
$items = array();

                ( 
$hook vBulletinHook::fetch_hook'awc_payment_methods' ) ) ? eval( $hook ) : false;
                                            
                if ( 
in_array$AWC['IN']['item_number'], $items ) ){
                    
                    if ( 
$TRANS->var_check'payment_status''Pending' ) || $TRANS->var_check'payment_status''Processed' ) || $TRANS->var_check'payment_status''Completed' ) || $TRANS->var_check'payment_status''Canceled-Reversal' ) || $TRANS->var_check'payment_status''Refunded' ) || $TRANS->var_check'payment_status''Reversed' ) || $TRANS->var_check'payment_status''Denied' ) || $TRANS->var_check'payment_status''Failed' ) ){
                        
                        if ( 
$TRANS->var_check'payment_status''Canceled-Reversal' ) ){
                            
$AWC['IN']['txn_id'] = $AWC['IN']['parent_txn_id']; 
                            
$AWC['IN']['payment_status'] = 'Completed';
                        }

                        if ( 
$TRANS->var_check'payment_status''Refunded' ) || $TRANS->var_check'payment_status''Reversed' ) ){
                            
$AWC['IN']['txn_id'] = $AWC['IN']['parent_txn_id']; 
                        }
                        
                        if ( 
$TRANS->var_check'payment_status''Pending' ) && $vbulletin->options[$AWC['IN']['sid'].'_paypal_approve_pending'] ){
                            
$AWC['IN']['payment_status'] = 'Completed';
                        }
                        
                        
$payment_sql $vbulletin->db->query_read("
                            SELECT txn_id 
                            FROM `"
.TABLE_PREFIX."awc_payments` 
                            WHERE txn_id = '"
.$AWC['IN']['txn_id']."'
                        "
);
                        
                        if ( 
$vbulletin->db->num_rows$payment_sql ) == && $TRANS->var_check'payment_status''Refunded' ) === && $TRANS->var_check'payment_status''Reversed' ) === && $TRANS->var_check'payment_status''Denied' ) === && $TRANS->var_check'payment_status''Failed' ) === ){
                            
$db_string null
                            
$db_string $BASE->compile_db_insert_string$AWC['IN'] ); 
                            
                            
$vbulletin->db->query_write("
                                INSERT INTO `"
.TABLE_PREFIX."awc_payments` 
                                    ("
.$db_string['FIELD_NAMES'].") 
                                VALUES 
                                    ("
.$db_string['FIELD_VALUES'].")
                            "
); 
                            
$AWC['IN']['id'] = $vbulletin->db->insert_id();
                            
                            if ( 
$TRANS->var_check'payment_status''Completed' ) && $AWC['IN']['userid'] > ){
                                
$TRANS->updates();
                            }
                            
                            if ( 
$vbulletin->options['awc_ns_en'] ){
                                
                                if ( 
$vbulletin->options['awc_ns_tn_en'] ){
                                    
$msg_rec_ids explode","$vbulletin->options['awc_ns_tn_rec'] ); 
                                    foreach ( 
$msg_rec_ids AS $msg_rec_id ){
                                        
$TRANS->notify_send'new'$msg_rec_id );
                                    }
                                }
                                
                                if ( 
$AWC['IN']['userid'] > ){
                                    
                                    if ( 
$TRANS->var_check'payment_status''Completed' ) ){
                                        
                                        if ( 
$vbulletin->options['awc_ns_tt_en'] ){
                                            
$TRANS->notify_send'thanks'$AWC['IN']['userid'] );
                                        }
                                    } else {
                                        
                                        if ( 
$vbulletin->options['awc_ns_ts_en'] ){
                                            
$TRANS->notify_send'status'$AWC['IN']['userid'] );
                                        }
                                    }
                                }
                            }
                        } else {
                            
                            if ( 
$TRANS->var_check'payment_status''Refunded' ) || $TRANS->var_check'payment_status''Reversed' ) || $TRANS->var_check'payment_status''Denied' ) || $TRANS->var_check'payment_status''Failed' ) ){
                                
$awc_delete_user 0;
                                
$payment_info $AWC['IN'];
        
                                if ( !empty( 
$payment_info ) ){
        
                                    if ( empty( 
$payment_info['mc_fee'] ) ){
                                        
$payment_info['mc_fee'] = 0;
                                    }
        
                                    if ( empty( 
$payment_info['mc_gross'] ) ){
                                        
$payment_info['mc_gross'] = 0;
                                    }
                                    
                                    
$last_payment_sql $vbulletin->db->query_read("
                                        SELECT payment_date 
                                        FROM `"
.TABLE_PREFIX."awc_payments` 
                                        WHERE userid = "
.$payment_info['userid'].
                                        AND sid = '"
.$payment_info['sid']."' 
                                        AND ( txn_id <> '"
.$AWC['IN']['txn_id']."' || txn_id IS NULL ) 
                                        ORDER BY payment_date DESC 
                                        LIMIT 0,1
                                    "
);
        
                                    if ( 
$vbulletin->db->num_rows$last_payment_sql ) ){
                                        
$last_payment_info $vbulletin->db->fetch_array$last_payment_sql );
        
                                        if ( empty( 
$payment_info['mc_fee'] ) ){
                                            
$payment_info['mc_fee'] = 0;
                                        }
        
                                        if ( empty( 
$payment_info['mc_gross'] ) ){
                                            
$payment_info['mc_gross'] = 0;
                                        }
                                        
                                        
$vbulletin->db->query_write("
                                            UPDATE `"
.TABLE_PREFIX."awc_users` 
                                            SET ugp_time = "
.$last_payment_info['payment_date'].", total = total - ".$payment_info['mc_gross'].", fees = fees - ".$payment_info['mc_fee'].", times = times - 1 
                                            WHERE userid = "
.$payment_info['userid'].
                                            AND sid = '"
.$payment_info['sid']."'
                                        "
);
        
                                        if ( 
date'my'time() ) == date'my'$payment_info['payment_date'] ) ){
                                            
                                            
$vbulletin->db->query_write("
                                                UPDATE `"
.TABLE_PREFIX."awc_users` 
                                                SET mtotal = mtotal - "
.$payment_info['mc_gross'].", mfees = mfees - ".$payment_info['mc_fee'].", mtimes = mtimes - 1 
                                                WHERE userid = "
.$payment_info['userid'].
                                                AND sid = '"
.$payment_info['sid']."'
                                            "
);
                                        }
        
                                        if ( 
date'y'time() ) == date'y'$payment_info['payment_date'] ) ){
                                            
                                            
$vbulletin->db->query_write("
                                                UPDATE `"
.TABLE_PREFIX."awc_users` 
                                                SET ytotal = ytotal - "
.$payment_info['mc_gross'].", yfees = yfees - ".$payment_info['mc_fee'].", ytimes = ytimes - 1 
                                                WHERE userid = "
.$payment_info['userid'].
                                                AND sid = '"
.$payment_info['sid']."'
                                            "
);
                                        }
                                    } else {
                                        
$awc_delete_user 1;
                                    }
        
                                    ( 
$hook vBulletinHook::fetch_hook'awc_admin_transdelete' ) ) ? eval( $hook ) : false;
        
                                }
Reply With Quote
  #15  
Old 10-09-2013, 10:22 PM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Remaining of the file, had to split it because of this :/ The text that you have entered is too long (21080 characters). Please shorten it to 20000 characters long.

PHP Code:
if ( $awc_delete_user == ){
                                    
                                    
$vbulletin->db->query_write("
                                        DELETE FROM `"
.TABLE_PREFIX."awc_users` 
                                        WHERE userid = "
.$payment_info['userid'].
                                        AND sid = '"
.$payment_info['sid']."'
                                    "
);
                                }
    
                                
$vbulletin->db->query_write("
                                    DELETE FROM `"
.TABLE_PREFIX."awc_payments` 
                                    WHERE txn_id = '"
.$payment_info['txn_id']."'
                                "
);                            
                            } else {
                                
                                
$payment_sql $vbulletin->db->query_read("
                                    SELECT txn_id, txn_type 
                                    FROM `"
.TABLE_PREFIX."awc_payments` 
                                    WHERE txn_id = '"
.$AWC['IN']['txn_id']."' 
                                    AND payment_status = '"
.$AWC['IN']['payment_status']."'
                                "
);
                                
                                if ( 
$vbulletin->db->num_rows$payment_sql ) == && $AWC['IN']['userid'] > ){
                                    
                                    if ( 
$TRANS->var_check'payment_status''Completed' ) ){
                                        
$TRANS->updates();
                                    }
                                    
                                    if ( 
$vbulletin->options['awc_ns_en'] ){
                                        
                                        if ( 
$TRANS->var_check'payment_status''Completed' ) ){
                                            
                                            if ( 
$vbulletin->options['awc_ns_tt_en'] ){
                                                
$TRANS->notify_send'thanks'$AWC['IN']['userid'] );
                                            }
                                        } else {
                                            
                                            if ( 
$vbulletin->options['awc_ns_ts_en'] ){
                                                
$TRANS->notify_send'status'$AWC['IN']['userid'] );
                                            }
                                        }
                                    }
                                }
                                
$db_string null
                                
$db_string $BASE->compile_db_update_string$AWC['IN'] ); 
                                
                                
$vbulletin->db->query_write("
                                    UPDATE `"
.TABLE_PREFIX."awc_payments` 
                                    SET "
.$db_string.
                                    WHERE txn_id = '"
.$AWC['IN']['txn_id']."'
                                "
);
                            }
                        }
                    }
                }
            
//}
        
} else if ( !strcmp$response"INVALID" ) ){
            
            if ( 
$vbulletin->options['awc_ns_en'] && $vbulletin->options['awc_ns_ti_en'] ){
                
$msg_rec_ids explode","$vbulletin->options['awc_ns_ti_rec'] ); 
                foreach ( 
$msg_rec_ids AS $msg_rec_id ){
                    
$TRANS->notify_send'invalid'$msg_rec_id );
                }
            }
        } else {
            
        }
        
fclose$socket ); 
        exit;
    }

}
?> 
Reply With Quote
  #16  
Old 10-10-2013, 12:30 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just follow the guide at vbulletin.com except there are 4 lots of changes in that one.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:41 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04636 seconds
  • Memory Usage 2,704KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete