Quando ho risposto ero un po' di fretta, completo la risposta.
Premetto che non uso virtuemart, ho solo scaricato lo zip dal sito.
Nel file paypal.php che si trova nella cartella com_virtuemart.3.2.10.9700_extract_firs t/com_virtuemart.3.2.10.9700_ext_aio/admin/plugins/vmpayment/paypal/paypal/helpers/
trovi la funzione che verifica gli ip di paypal, se non è un ip valido restituisce l'errore che hai scritto:
protected function checkPaypalIps ($paypal_data) {
/*
$test_ipn = (array_key_exists('test_ipn', $paypal_data)) ? $paypal_data['test_ipn'] : 0;
if ($test_ipn == 1) {
return true;
}
*/
/*
* adding an extra parameter because getting IP trough gethostbynamel is not a unfortunatly reliable method
*/
if (isset($this->_method->check_ips) and $this->_method->check_ips==0) {
return true;
}
$order_number = $paypal_data['invoice'];
// Get the list of IP addresses for www.paypal.com and notify.paypal.com
if ($this->_method->sandbox) {
// $paypal_iplist = gethostbynamel('ipn.sandbox.paypal.com');
// $paypal_iplist = (array)$paypal_iplist;
// QUORVIA 2017April24
$paypal_sandbox_iplist_ipn = gethostbynamel('ipn.sandbox.paypal.com');
$paypal_sandbox_iplist_ipnpb = gethostbynamel('ipnpb.sandbox.paypal.com');
$paypal_iplist = array_merge(
$paypal_sandbox_iplist_ipn,
$paypal_sandbox_iplist_ipnpb
); // end quorvia
} else {
// JH 2017-04-23
// QUORVIA 2017April24
// Get IP through DNS call
// Reporting and order management
$paypal_iplist_ipnpb = gethostbynamel('ipnpb.paypal.com');
$paypal_iplist_notify = gethostbynamel('notify.paypal.com');
$paypal_iplist = array_merge( // JH 2017-04-23
// List of Reporting and order management
$paypal_iplist_ipnpb,
$paypal_iplist_notify
);
// JH
$this->debugLog($paypal_iplist, 'checkPaypalIps PRODUCTION', 'debug', false);
}
$remoteIPAddress=$this->getRemoteIPAddress();
$this->debugLog($remoteIPAddress, 'checkPaypalIps REMOTE ADDRESS', 'debug', false);
// test if the remote IP connected here is a valid IP address
if (!in_array($remoteIPAddress, $paypal_iplist)) {
$text = "Error with REMOTE IP ADDRESS = " . $remoteIPAddress . ".
The remote address of the script posting to this notify script does not match a valid PayPal IP address\n
These are the valid IP Addresses: " . implode(",", $paypal_iplist) . "The Order ID received was: " . $order_number;
$this->debugLog($text, 'checkPaypalIps', 'error', false);
return false;
}
return true;
}
Nello stesso file trovi la funzione getRemoteIPAddress:
function getRemoteIPAddress() {
if (!class_exists('ShopFunctions'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php');
return ShopFunctions::getClientIP();
}
Quindi nel file shopfunctions.php nella cartella com_virtuemart.3.2.10.9700_extract_firs t/com_virtuemart.3.2.10.9700/administrator/components/com_virtuemart/helpers/
troverai:
static function getClientIP() {
$ip_keys = array('X_FORWARDED_FOR', 'X-Forwarded-Proto','REMOTE_ADDR');
$extra = VmConfig::get('revproxvar','');
if(!empty($extra)){
$extra = explode(',',$extra);
$ip_keys = array_merge($extra, $ip_keys);
}
foreach ($ip_keys as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
// trim for safety measures
$ip = trim($ip);
vmdebug('getClientIP',$ip);
// attempt to validate IP
if (self::validateIp($ip)) {
return $ip;
}
}
}
}
return false;
}
Come vedi lo script prova X_FORWARDED_FOR, X-Forwarded-Proto e REMOTE_ADDR (almeno credo....)