mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 01:28:53 +01:00
* Calendar: use proxy config from setup >> configuration to download holiday calendars
This commit is contained in:
parent
f7b995a24b
commit
3a6be10253
@ -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']))
|
||||
|
@ -158,7 +158,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();
|
||||
@ -186,12 +186,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