コード例 #1
0
ファイル: Share.php プロジェクト: horde/horde
 /**
  * Return the owner to use when searching or creating contacts in
  * this address book.
  *
  * @return string  TODO
  * @throws Turba_Exception
  */
 protected function _getContactOwner()
 {
     $params = @unserialize($this->_share->get('params'));
     if (!empty($params['name'])) {
         return $params['name'];
     }
     throw new Turba_Exception(_("Unable to find contact owner."));
 }
コード例 #2
0
ファイル: Turba.php プロジェクト: jubinpatel/horde
 /**
  * Retrieve a new source config entry based on a Turba share.
  *
  * @param Horde_Share object  The share to base config on.
  *
  * @return array  The $cfgSource entry for this share source.
  */
 public static function getSourceFromShare(Horde_Share $share)
 {
     // Require a fresh config file.
     $cfgSources = self::availableSources();
     $params = @unserialize($share->get('params'));
     $newConfig = $cfgSources[$params['source']];
     $newConfig['params']['config'] = $cfgSources[$params['source']];
     $newConfig['params']['config']['params']['share'] = $share;
     $newConfig['params']['config']['params']['name'] = $params['name'];
     $newConfig['title'] = $share->get('name');
     $newConfig['type'] = 'share';
     $newConfig['use_shares'] = false;
     return $newConfig;
 }
コード例 #3
0
ファイル: Kronolith.php プロジェクト: AsylumCorp/horde
 /**
  * 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);
     }
 }