From: Jan Schneider Date: Mon, 9 Aug 2010 12:52:43 +0000 (+0200) Subject: Use Kronolith::(un)subscribeRemoteCalendar(). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=94ecea550f9a7a31c7edeaa3e253bfd7ee182efa;p=horde.git Use Kronolith::(un)subscribeRemoteCalendar(). --- diff --git a/kronolith/lib/Api.php b/kronolith/lib/Api.php index 661e8c269..edbb5c614 100644 --- a/kronolith/lib/Api.php +++ b/kronolith/lib/Api.php @@ -1235,8 +1235,9 @@ class Kronolith_Api extends Horde_Registry_Api * * @param array $calendar Calendar description hash, with required 'type' * parameter. Currently supports 'http' and - * 'webcal' for remote calendars. @throws - * Kronolith_Exception + * 'webcal' for remote calendars. + * + * @throws Kronolith_Exception */ public function subscribe($calendar) { @@ -1247,26 +1248,7 @@ class Kronolith_Api extends Horde_Registry_Api switch ($calendar['type']) { case 'http': case 'webcal': - $username = isset($calendar['username']) ? $calendar['username'] : null; - $password = isset($calendar['password']) ? $calendar['password'] : null; - - $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals')); - if (!is_array($cals)) { - $cals = array(); - } - $array_key = count($cals); - foreach ($cals as $key => $cal) { - if ($cal['url'] == $calendar['url']) { - $array_key = $key; - break; - } - } - - $cals[$array_key] = array('name' => $calendar['name'], - 'url' => $calendar['url'], - 'user' => $username, - 'password' => $password); - $GLOBALS['prefs']->setValue('remote_cals', serialize($cals)); + Kronolith::subscribeRemoteCalendar($calendar); break; case 'external': @@ -1286,8 +1268,9 @@ class Kronolith_Api extends Horde_Registry_Api * * @param array $calendar Calendar description array, with required 'type' * parameter. Currently supports 'http' and - * 'webcal' for remote calendars. @throws - * Kronolith_Exception + * 'webcal' for remote calendars. + * + * @throws Kronolith_Exception */ public function unsubscribe($calendar) { @@ -1298,15 +1281,7 @@ class Kronolith_Api extends Horde_Registry_Api switch ($calendar['type']) { case 'http': case 'webcal': - $cals = unserialize($GLOBALS['prefs']->getValue('remote_cals')); - foreach ($cals as $key => $cal) { - if ($cal['url'] == $calendar['url']) { - unset($cals[$key]); - break; - } - } - - $GLOBALS['prefs']->setValue('remote_cals', serialize($cals)); + Kronolith::subscribeRemoteCalendar($calendar['url']); break; case 'external':