From: Jan Schneider Date: Tue, 21 Dec 2010 23:51:11 +0000 (+0100) Subject: Fix _listShares() and more method incompatibilities. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=74caec38e292f1649a9551c1abccc3082c95ab43;p=horde.git Fix _listShares() and more method incompatibilities. --- diff --git a/framework/Share/lib/Horde/Share/Base.php b/framework/Share/lib/Horde/Share/Base.php index b62ec5f8a..934ad8595 100644 --- a/framework/Share/lib/Horde/Share/Base.php +++ b/framework/Share/lib/Horde/Share/Base.php @@ -252,7 +252,7 @@ abstract class Horde_Share_Base * * @return array The requested shares. */ - public function getShares($cids) + public function getShares(array $cids) { $all_shares = $missing_ids = array(); foreach ($cids as $cid) { diff --git a/framework/Share/lib/Horde/Share/Datatree.php b/framework/Share/lib/Horde/Share/Datatree.php index 22731557a..ec79b5bda 100644 --- a/framework/Share/lib/Horde/Share/Datatree.php +++ b/framework/Share/lib/Horde/Share/Datatree.php @@ -111,7 +111,7 @@ class Horde_Share_Datatree extends Horde_Share_Base * @return array The requested shares. * @throws Horde_Share_Exception */ - protected function _getShares($ids) + protected function _getShares(array $ids) { $shares = array(); $objects = $this->_datatree->getObjects($ids, 'DataTreeObject_Share'); @@ -152,29 +152,27 @@ class Horde_Share_Datatree extends Horde_Share_Base * Returns an array of all shares that $userid has access to. * * @param string $userid The userid of the user to check access for. - * @param integer $perm The level of permissions required. - * @param mixed $attributes Restrict the shares counted to those - * matching $attributes. An array of - * attribute/values pairs or a share owner - * username. + * @param array $params See listShares(). * * @return array The shares the user has access to. * @throws Horde_Share_Exception */ - protected function _listShares($userid, $perm = Horde_Perms::SHOW, - $attributes = null, $from = 0, $count = 0, - $sort_by = null, $direction = 0) + protected function _listShares($userid, array $params = array()) { - $key = serialize(array($userid, $perm, $attributes)); + $key = serialize(array($userid, $params['perm'], $params['attributes'])); if (empty($this->_listCache[$key])) { - $criteria = $this->getShareCriteria($userid, $perm, $attributes); + $criteria = $this->getShareCriteria($userid, $params['perm'], + $params['attributes']); $sharelist = $this->_datatree->getByAttributes($criteria, DATATREE_ROOT, - true, 'id', $from, - $count, $sort_by, - null, $direction); + true, 'id', + $params['from'], + $params['count'], + $params['sort_by'], + null, + $params['direction']); if ($sharelist instanceof PEAR_Error) { - throw new Horde_Share_Exception($sharelist->getMessage()); + throw new Horde_Share_Exception($sharelist); } $this->_listCache[$key] = array_keys($sharelist); } @@ -228,7 +226,7 @@ class Horde_Share_Datatree extends Horde_Share_Base * * @param Horde_Share_Object_datatree $share The new share object. */ - protected function _addShare($share) + protected function _addShare(Horde_Share_Object $share) { return $this->_datatree->add($share->datatreeObject); } @@ -238,7 +236,7 @@ class Horde_Share_Datatree extends Horde_Share_Base * * @param Horde_Share_Object_datatree $share The share to remove. */ - protected function _removeShare($share) + protected function _removeShare(Horde_Share_Object $share) { return $this->_datatree->remove($share->datatreeObject); } diff --git a/framework/Share/lib/Horde/Share/Kolab.php b/framework/Share/lib/Horde/Share/Kolab.php index f1017fc12..044b3f572 100644 --- a/framework/Share/lib/Horde/Share/Kolab.php +++ b/framework/Share/lib/Horde/Share/Kolab.php @@ -71,7 +71,7 @@ class Horde_Share_Kolab extends Horde_Share_Base * * @param Horde_Share_Object $object */ - public function initShareObject($object) + public function initShareObject(Horde_Share_Object $object) { $object->setShareOb($this); }