try {
$share = $GLOBALS['kronolith_shares']->getShare($user);
$result = $GLOBALS['kronolith_shares']->removeShare($share);
- if ($result instanceof PEAR_Error) {
- $hasError = true;
- Horde::logMessage($result, 'ERR');
- }
} catch (Exception $e) {
Horde::logMessage($e, 'ERR');
}
/* Get a list of all shares this user has perms to and remove the
* perms */
- $shares = $GLOBALS['kronolith_shares']->listShares($user);
- if ($shares instanceof PEAR_Error) {
- Horde::logMessage($shares, 'ERR');
- }
- foreach ($shares as $share) {
- $share->removeUser($user);
+ try {
+ $shares = $GLOBALS['kronolith_shares']->listShares($user);
+ foreach ($shares as $share) {
+ $share->removeUser($user);
+ }
+ } catch (Horde_Share_Exception $e) {
+ Horde::logMessage($e, 'ERR');
}
}
return array();
}
- $calendars = $GLOBALS['kronolith_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null, 0, 0, 'name');
- if ($calendars instanceof PEAR_Error) {
- Horde::logMessage($calendars, 'ERR');
+ try {
+ $calendars = $GLOBALS['kronolith_shares']->listShares(Horde_Auth::getAuth(), $permission, $owneronly ? Horde_Auth::getAuth() : null, 0, 0, 'name');
+ } catch (Horde_Share_Exception $e) {
+ Horde::logMessage($e, 'ERR');
return array();
}
*/
public static function addShare($info)
{
- $calendar = $GLOBALS['kronolith_shares']->newShare(hash('md5', microtime()));
- if ($calendar instanceof PEAR_Error) {
- throw new Kronolith_Exception($calendar);
+ try {
+ $calendar = $GLOBALS['kronolith_shares']->newShare(hash('md5', microtime()));
+ } catch (Horde_Share_Exception $e) {
+ throw new Kronolith_Exception($e);
}
$calendar->set('name', $info['name']);
$tagger = self::getTagger();
$tagger->tag($calendar->getName(), $info['tags'], $calendar->get('owner'), 'calendar');
- $result = $GLOBALS['kronolith_shares']->addShare($calendar);
- if ($result instanceof PEAR_Error) {
- throw new Kronolith_Exception($result);
+ try {
+ $result = $GLOBALS['kronolith_shares']->addShare($calendar);
+ } catch (Horde_Share_Exception $e) {
+ throw new Kronolith_Exception($e);
}
$GLOBALS['display_calendars'][] = $calendar->getName();
$calendar->set('desc', $info['description']);
$calendar->set('owner', empty($info['system']) ? Horde_Auth::getAuth() : null);
- $result = $calendar->save();
- if ($result instanceof PEAR_Error) {
- throw new Kronolith_Exception(sprintf(_("Unable to save calendar \"%s\": %s"), $info['name'], $result->getMessage()));
+ try {
+ $result = $calendar->save();
+ } catch (Horde_Share_Exception $e) {
+ throw new Kronolith_Exception(sprintf(_("Unable to save calendar \"%s\": %s"), $info['name'], $e->getMessage()));
}
$tagger = self::getTagger();
}
// Remove share and all groups/permissions.
- $result = $GLOBALS['kronolith_shares']->removeShare($calendar);
- if ($result instanceof PEAR_Error) {
- throw new Kronolith_Exception($result);
+ try {
+ $result = $GLOBALS['kronolith_shares']->removeShare($calendar);
+ } catch (Horde_Share_Exception $e) {
+ throw new Kronolith_Exception($e);
}
}
$perm->addGroupPermission($group, Kronolith::PERMS_DELEGATE, false);
}
}
-
- $result = $share->setPermission($perm, false);
- if ($result instanceof PEAR_Error) {
- throw new Kronolith_Exception($result);
- } else {
- $result = $share->save();
- if ($result instanceof PEAR_Error) {
- throw new Kronolith_Exception($result);
- }
+ try {
+ $share->setPermission($perm, false);
+ $share->save();
+ } catch (Horde_Share_Exception $e) {
+ throw new Kronolith_Exception($e);
}
return $errors;
$groups = Group::singleton();
$calendar = $event->calendar;
$recipients = array();
- $share = $GLOBALS['kronolith_shares']->getShare($calendar);
- if ($share instanceof PEAR_Error) {
- throw new Kronolith_Exception($share);
+ try {
+ $share = $GLOBALS['kronolith_shares']->getShare($calendar);
+ } catch (Horde_Share_Exception $e) {
+ throw new Kronolith_Exception($e);
}
$identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getIdentity();