Beispiel #1
0
 /**
  * Deletes a share.
  *
  * @param Horde_Share $calendar  The share to delete.
  *
  * @throws Kronolith_Exception
  */
 public static function deleteShare($calendar)
 {
     if (!$GLOBALS['registry']->getAuth() || $calendar->get('owner') != $GLOBALS['registry']->getAuth() && (!is_null($calendar->get('owner')) || !$GLOBALS['registry']->isAdmin())) {
         throw new Kronolith_Exception(_("You are not allowed to delete this calendar."));
     }
     // Delete the calendar.
     try {
         self::getDriver()->delete($calendar->getName());
     } catch (Exception $e) {
         throw new Kronolith_Exception(sprintf(_("Unable to delete \"%s\": %s"), $calendar->get('name'), $e->getMessage()));
     }
     // Remove share and all groups/permissions.
     try {
         $GLOBALS['injector']->getInstance('Kronolith_Shares')->removeShare($calendar);
     } catch (Horde_Share_Exception $e) {
         throw new Kronolith_Exception($e);
     }
 }
Beispiel #2
0
 /**
  * Return the name of this address book.
  *
  * @string Address book name
  */
 public function getName()
 {
     $share_parts = explode(':', $this->_share->getName());
     return array_pop($share_parts);
 }