diff --git a/api/src/Framework.php b/api/src/Framework.php index 8192d6460f..8707d25f90 100644 --- a/api/src/Framework.php +++ b/api/src/Framework.php @@ -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'])) diff --git a/calendar/inc/class.calendar_holidays.inc.php b/calendar/inc/class.calendar_holidays.inc.php index c6915bd54b..f63862f08c 100644 --- a/calendar/inc/class.calendar_holidays.inc.php +++ b/calendar/inc/class.calendar_holidays.inc.php @@ -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); }