From 38a70baf59edffc26e796ff2397305f495bd5947 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 19 Nov 2010 15:17:44 +0100 Subject: [PATCH] Fix free/busy generation. --- kronolith/lib/FreeBusy.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/kronolith/lib/FreeBusy.php b/kronolith/lib/FreeBusy.php index 62a80240b..80c755faa 100644 --- a/kronolith/lib/FreeBusy.php +++ b/kronolith/lib/FreeBusy.php @@ -31,23 +31,22 @@ class Kronolith_FreeBusy $calendars = array($calendars); } - if ($user) { + if (!$user) { /* Find a share and retrieve owner. */ foreach ($calendars as $calendar) { - if (strpos($calendar, 'remote_') === 0) { + if (strpos($calendar, 'internal_') !== 0) { continue; } + $calendar = substr($calendar, 9); try { $share = $kronolith_shares->getShare($calendar); $user = $share->get('owner'); break; - } catch (Horde_Share_Exception $e) { + } catch (Horde_Exception $e) { /* Might be a Kronolith_Resource. */ if (Kronolith_Resource::isResourceCalendar($calendar)) { $user = $calendar; break; - } else { - throw ($e); } } } @@ -78,11 +77,8 @@ class Kronolith_FreeBusy /* Fetch events. */ $busy = array(); foreach ($calendars as $calendar) { - if (strpos($calendar, 'remote_') === 0) { - $driver = Kronolith::getDriver('Ical', substr($calendar, 7)); - } else { - $driver = Kronolith::getDriver(null, $calendar); - } + @list($type, $calendar) = explode('_', $calendar, 2); + $driver = Kronolith::getDriver($type, $calendar); $events = $driver->listEvents(new Horde_Date($startstamp), $enddate, true); Kronolith::mergeEvents($busy, $events); -- 2.11.0