$cal = Util::getFormData('cal');
list($driver, $calendar) = explode('|', $cal);
$kronolith_driver = Kronolith::getDriver($driver, $calendar);
+ if ($driver == 'Ical') {
+ $kronolith_driver->setParam('timeout', 15);
+ }
$events = $kronolith_driver->listEvents($start, $end, true, false, true);
if (is_a($events, 'PEAR_Error')) {
$notification->push($events, 'horde.error');
return isset($this->_params[$param]) ? $this->_params[$param] : null;
}
+ /**
+ * Sets a configuration for this driver.
+ *
+ * @param string $param A parameter name.
+ * @param mixed $value The parameter value.
+ */
+ public function setParam($param, $value)
+ {
+ $this->_params[$param] = $value;
+ }
+
public function open($calendar)
{
$this->_calendar = $calendar;
$driver = Kronolith::getDriver('Ical');
foreach ($GLOBALS['display_remote_calendars'] as $url) {
$driver->open($url);
+ foreach (Kronolith::getRemoteParams($url) as $param => $value) {
+ $driver->setParam($param, $value);
+ }
$events = $driver->listEvents($startDate, $endDate, true);
if (!is_a($events, 'PEAR_Error')) {
Kronolith::mergeEvents($results, $events);
if (!empty($GLOBALS['conf']['http']['proxy']['proxy_host'])) {
$params['proxy'] = $GLOBALS['conf']['http']['proxy'];
}
-
- /* Check for HTTP authentication credentials */
- $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
- foreach ($cals as $cal) {
- if ($cal['url'] == $calendar) {
- $user = isset($cal['user']) ? $cal['user'] : '';
- $password = isset($cal['password']) ? $cal['password'] : '';
- $key = Auth::getCredential('password');
- if ($key && $user) {
- require_once 'Horde/Secret.php';
- $user = Secret::read($key, base64_decode($user));
- $password = Secret::read($key, base64_decode($password));
- }
- if (!empty($user)) {
- $params['user'] = $user;
- $params['password'] = $password;
- }
- break;
- }
- }
-
+ $params = Kronolith::getRemoteParams($calendar);
break;
case 'Horde':
}
/**
+ * Check for HTTP authentication credentials
+ */
+ public static function getRemoteParams($calendar)
+ {
+ if (empty($calendar)) {
+ return array();
+ }
+
+ $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
+ foreach ($cals as $cal) {
+ if ($cal['url'] == $calendar) {
+ $user = isset($cal['user']) ? $cal['user'] : '';
+ $password = isset($cal['password']) ? $cal['password'] : '';
+ $key = Auth::getCredential('password');
+ if ($key && $user) {
+ $user = Horde_Secret::read($key, base64_decode($user));
+ $password = Horde_Secret::read($key, base64_decode($password));
+ }
+ if (!empty($user)) {
+ return array('user' => $user, 'password' => $password);
+ }
+ }
+ }
+
+ return array();
+ }
+
+ /**
* Get a named Kronolith_View_* object and load it with the
* appropriate date parameters.
*