mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-30 11:53:57 +01:00
* Calendar: use proxy config from setup >> configuration to download holiday calendars
This commit is contained in:
parent
659bf156f6
commit
892fc79421
@ -603,11 +603,12 @@ abstract class Framework extends Framework\Extra
|
||||
*
|
||||
* @param string $username =null username for regular basic Auth
|
||||
* @param string $password =null password --------- " ----------
|
||||
* @param array $opts =array() further params for http(s) context, eg. array('timeout' => 123)
|
||||
* @return resource|null context to use with file_get_context/fopen or null if no proxy configured
|
||||
*/
|
||||
public static function proxy_context($username=null, $password=null)
|
||||
public static function proxy_context($username=null, $password=null, array $opts = array())
|
||||
{
|
||||
$opts = array(
|
||||
$opts += array(
|
||||
'method' => 'GET',
|
||||
);
|
||||
if (!empty($GLOBALS['egw_info']['server']['httpproxy_server']))
|
||||
|
@ -153,7 +153,7 @@ class calendar_holidays
|
||||
error_log("No holiday iCal for '$country'!");
|
||||
return array();
|
||||
}
|
||||
if (!($f = fopen($url, 'r')))
|
||||
if (!($f = fopen($url, 'r', false, Api\Framework::proxy_context())))
|
||||
{
|
||||
error_log("Can NOT open holiday iCal '$url' for country '$country'!");
|
||||
return array();
|
||||
@ -181,12 +181,8 @@ class calendar_holidays
|
||||
|
||||
if (!isset($urls))
|
||||
{
|
||||
$ctx = stream_context_create(array(
|
||||
'http'=> array(
|
||||
'timeout' => 1,
|
||||
)
|
||||
));
|
||||
if (!($json = file_get_contents(self::EGW_HOLIDAY_URL.self::HOLIDAY_PATH, false, $ctx)))
|
||||
if (!($json = file_get_contents(self::EGW_HOLIDAY_URL.self::HOLIDAY_PATH, false,
|
||||
Api\Framework::proxy_context(null, null, array('timeout' => 1)))))
|
||||
{
|
||||
$json = file_get_contents(EGW_SERVER_ROOT.self::HOLIDAY_PATH);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user