Copyright 2002-2016 Horde LLC (http://www.horde.org/) Copyright 2002-2007 Infoteck Internet See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Joel Vandal (joel@scopserv.com)
Author: Mike Cochrame (mike@graftonhall.co.nz)
Author: Chuck Hagenbuch (chuck@horde.org)
Author: Jan Schneider (jan@horde.org)
Author: Gunnar Wrobel (wrobel@pardus.de)
Author: Michael J. Rubinsky (mrubinsk@horde.org)
Example #1
0
 /**
  * Returns the default share's ID, if it can be determined from the share
  * backend.
  *
  * @return string  The default share ID.
  */
 public function getDefaultShare()
 {
     $shares = $this->_shares->listShares($this->_user, array('attributes' => $this->_user));
     foreach ($shares as $id => $share) {
         if ($share->get('default')) {
             return $id;
         }
     }
 }
Example #2
0
 /**
  * Checks for existing locks.
  *
  * First this checks for share locks and if none exists, checks for item
  * locks (if item_uid defined).  It will return the first lock found.
  *
  * @param Horde_Lock  $locks  The lock object.
  * @param string $item_uid    A uid of an item from this share.
  *
  * @return array   Hash with the found lock information in 'lock' and the
  *                 lock type ('share' or 'item') in 'type', or an empty
  *                 array if there are no locks.
  */
 public function checkLocks(Horde_Lock $locks, $item_uid = null)
 {
     $shareid = $this->_share->getId();
     $locktype = Horde_Lock::TYPE_EXCLUSIVE;
     // Check for share locks
     try {
         $result = $locks->getLocks($this->_share->getShareOb()->getApp(), $shareid, $locktype);
     } catch (Horde_Lock_Exception $e) {
         Horde::log($e, 'ERR');
         throw new Horde_Exception_Wrapped($e);
     }
     if (empty($result) && !empty($item_uid)) {
         // Check for item locks
         $locktargettype = 'item';
         try {
             $result = $locks->getLocks($this->_share->getShareOb()->getApp() . ':' . $shareid, $item_uid, $locktype);
         } catch (Horde_Lock_Exception $e) {
             Horde::log($e, 'ERR');
             throw new Horde_Exception($e->getMessage());
         }
     } else {
         $locktargettype = 'share';
     }
     if (empty($result)) {
         return array();
     }
     return array('type' => $locktargettype, 'lock' => reset($result));
 }
Example #3
0
 /**
  * Constructor.
  *
  * @param string $app               The application that the shares belong
  *                                  to
  * @param string $user              The current user
  * @param Horde_Perms_Base $perms   The permissions object
  * @param Horde_Group_Base $groups  The Horde_Group driver.
  *
  */
 public function __construct($app, $user, Horde_Perms_Base $perms, Horde_Group_Base $groups)
 {
     switch ($app) {
         case 'mnemo':
         case 'jonah':
             $this->_type = 'note';
             break;
         case 'kronolith':
             $this->_type = 'event';
             break;
         case 'turba':
             $this->_type = 'contact';
             break;
         case 'nag':
             $this->_type = 'task';
             break;
         default:
             throw new Horde_Share_Exception(sprintf(Horde_Share_Translation::t("The Horde/Kolab integration engine does not support \"%s\""), $app));
     }
     parent::__construct($app, $user, $perms, $groups);
 }
Example #4
0
 /**
  *
  * @see Horde_Share_Base::__construct()
  */
 public function __construct($app, $user, Horde_Perms_Base $perms, Horde_Group_Base $groups)
 {
     parent::__construct($app, $user, $perms, $groups);
     $this->_table = $this->_app . '_shares';
 }