mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-20 00:23:40 +02:00
feature #295, proxy support for fetchRemote
This commit is contained in:
@@ -2076,6 +2076,8 @@ function cat_admin_access($category_id)
|
||||
*/
|
||||
function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_agent='Piwigo', $step=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Try to retrieve data from local file?
|
||||
if (!url_is_remote($src))
|
||||
{
|
||||
@@ -2111,6 +2113,17 @@ function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_
|
||||
if (function_exists('curl_init') && function_exists('curl_exec'))
|
||||
{
|
||||
$ch = @curl_init();
|
||||
|
||||
if (isset($conf['use_proxy']) && $conf['use_proxy'])
|
||||
{
|
||||
@curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
|
||||
@curl_setopt($ch, CURLOPT_PROXY, $conf['proxy_server']);
|
||||
if (isset($conf['proxy_auth']) && !empty($conf['proxy_auth']))
|
||||
{
|
||||
@curl_setopt($ch, CURLOPT_PROXYUSERPWD, $conf['proxy_auth']);
|
||||
}
|
||||
}
|
||||
|
||||
@curl_setopt($ch, CURLOPT_URL, $src);
|
||||
@curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
||||
|
||||
Reference in New Issue
Block a user