diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php index baeedd0a2..1be5cd49b 100644 --- a/e107_handlers/file_class.php +++ b/e107_handlers/file_class.php @@ -484,6 +484,15 @@ class e_file if(vartrue($options['decode'], false)) $address = urldecode($address); + $urlData = parse_url($address); + $referer = $urlData['scheme']."://".$urlData['host']; + + if(empty($referer)) + { + $referer = e_REQUEST_HTTP; + } + + // Keep this in first position. if (function_exists("curl_init")) // Preferred. { @@ -493,11 +502,27 @@ class e_file curl_setopt($cu, CURLOPT_HEADER, 0); curl_setopt($cu, CURLOPT_TIMEOUT, $timeout); curl_setopt($cu, CURLOPT_SSL_VERIFYPEER, FALSE); - curl_setopt($cu, CURLOPT_REFERER, e_REQUEST_HTTP); + curl_setopt($cu, CURLOPT_REFERER, $referer); curl_setopt($cu, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($cu, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($cu, CURLOPT_COOKIEFILE, e_SYSTEM.'cookies.txt'); curl_setopt($cu, CURLOPT_COOKIEJAR, e_SYSTEM.'cookies.txt'); + + if(defined('e_CURL_PROXY')) + { + curl_setopt($cu, CURLOPT_PROXY, e_CURL_PROXY); // PROXY details with port + } + + if(defined('e_CURL_PROXYUSERPWD')) + { + curl_setopt($cu, CURLOPT_PROXYUSERPWD, e_CURL_PROXYUSERPWD); // Use if proxy have username and password + } + + if(defined('e_CURL_PROXYTYPE')) + { + curl_setopt($cu, CURLOPT_PROXYTYPE, e_CURL_PROXYTYPE); // If expected to cal + } + if($postData !== null) { curl_setopt($cu, CURLOPT_POST, true);