diff --git a/api/src/Framework.php b/api/src/Framework.php index ef149a0a2b..6cb7c28613 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 0b465cf5d6..f508c8ee8e 100644 --- a/calendar/inc/class.calendar_holidays.inc.php +++ b/calendar/inc/class.calendar_holidays.inc.php @@ -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); }