| @@ -82,8 +82,9 @@ | ||
| 82 | 82 | $paypal['subscr_gateway'] = (!empty($_REQUEST['s2member_paypal_proxy'])) ? esc_html(trim(stripslashes($_REQUEST['s2member_paypal_proxy']))) : 'paypal'; |
| 83 | 83 | |
| 84 | 84 | $coupon = (!empty($_REQUEST['s2member_paypal_proxy_coupon']) && is_array($_REQUEST['s2member_paypal_proxy_coupon'])) ? stripslashes_deep($_REQUEST['s2member_paypal_proxy_coupon']) : array(); |
| 85 | 85 | $coupon = (isset($coupon['full_coupon_code'], $coupon['coupon_code'], $coupon['affiliate_id']) && is_string($coupon['full_coupon_code']) && is_string($coupon['coupon_code']) && is_string($coupon['affiliate_id'])) ? $coupon : array('full_coupon_code' => '', 'coupon_code' => '', 'affiliate_id' => ''); |
| 86 | + $coupon = c_ws_plugin__s2member_utils_strings::strip_php_tags_deep($coupon); //260910.2249 Normalize proxy coupon data consistently with other notification values. | |
| 86 | 87 | |
| 87 | 88 | if(!empty($paypal['txn_type']) && $paypal['txn_type'] === 'merch_pmt') |
| 88 | 89 | // This is mostly irrelevant, but it helps to keep the logs cleaner. |
| 89 | 90 | sleep(15); // Wait for Pro-Form procesing to complete. |
| @@ -97,11 +98,14 @@ | ||
| 97 | 98 | //250522 At least set it to an empty string. |
| 98 | 99 | else if(empty($paypal['custom'])) |
| 99 | 100 | $paypal['custom'] = ''; |
| 100 | 101 | |
| 102 | + //260910.0356 Resolve the expected host consistently across different web-server request environments. | |
| 103 | + $ipn_host = (!empty($_SERVER['HTTP_HOST']) && is_string($_SERVER['HTTP_HOST'])) ? preg_replace('/\:([0-9]+)$/', '', $_SERVER['HTTP_HOST']) : (string)parse_url(home_url('/'), PHP_URL_HOST); | |
| 104 | + | |
| 101 | 105 | //250606 Added option to skip domain validation. |
| 102 | 106 | if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['skip_ipn_domain_validation'] |
| 103 | - || (!empty($paypal['custom']) && preg_match('/^'.preg_quote(preg_replace('/\:([0-9]+)$/', '', $_SERVER['HTTP_HOST']), '/').'/i', $paypal['custom']))) | |
| 107 | + || ($ipn_host !== '' && !empty($paypal['custom']) && preg_match('/^'.preg_quote($ipn_host, '/').'/i', $paypal['custom']))) | |
| 104 | 108 | { |
| 105 | 109 | if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['skip_ipn_domain_validation']) |
| 106 | 110 | $paypal['s2member_log'][] = 's2Member originating domain validation was skipped.'; |
| 107 | 111 | else |