From 5f8a06ee3bcdb0aaea1729efe3cdbc848a809624 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Mon, 2 Mar 2009 08:02:04 +0000 Subject: [PATCH] Convert the Object specific classes to PHP5. --- .../Kolab_Server/lib/Horde/Kolab/Server/Object.php | 88 +++++++++++----------- .../lib/Horde/Kolab/Server/Object/address.php | 15 ++-- .../Horde/Kolab/Server/Object/administrator.php | 7 +- .../lib/Horde/Kolab/Server/Object/adminrole.php | 38 ++++++---- .../lib/Horde/Kolab/Server/Object/distlist.php | 8 +- .../Horde/Kolab/Server/Object/domainmaintainer.php | 24 +++--- .../lib/Horde/Kolab/Server/Object/group.php | 32 ++++---- .../lib/Horde/Kolab/Server/Object/maintainer.php | 6 +- .../lib/Horde/Kolab/Server/Object/server.php | 6 +- .../lib/Horde/Kolab/Server/Object/sharedfolder.php | 14 ++-- .../lib/Horde/Kolab/Server/Object/user.php | 32 ++++---- 11 files changed, 126 insertions(+), 144 deletions(-) diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php index d14b1c53a..3fb31106d 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php @@ -77,14 +77,14 @@ class Horde_Kolab_Server_Object * * @var Kolab_Server */ - var $_db; + protected $db; /** * UID of this object on the Kolab server. * * @var string */ - var $_uid; + protected $uid; /** * The cached LDAP result @@ -93,7 +93,7 @@ class Horde_Kolab_Server_Object * * @var mixed */ - var $_cache = false; + private $_cache = false; /** FIXME: Add an attribute cache for the get() function */ @@ -102,7 +102,7 @@ class Horde_Kolab_Server_Object * * @var string */ - var $filter = ''; + public static $filter = ''; /** * The group the UID must be member of so that this object really @@ -110,21 +110,21 @@ class Horde_Kolab_Server_Object * * @var string */ - var $required_group; + protected $required_group; /** * The LDAP attributes supported by this class. * * @var array */ - var $_supported_attributes = array(); + public $supported_attributes = array(); /** * Attributes derived from the LDAP values. * * @var array */ - var $_derived_attributes = array( + public $derived_attributes = array( KOLAB_ATTR_ID, ); @@ -133,14 +133,14 @@ class Horde_Kolab_Server_Object * * @var array */ - var $_required_attributes = array(); + public $required_attributes = array(); /** * The ldap classes for this type of object. * * @var array */ - var $_object_classes = array(); + protected $object_classes = array(); /** * Sort by this attributes (must be a LDAP attribute). @@ -157,21 +157,21 @@ class Horde_Kolab_Server_Object * @param string $uid UID of the object. * @param array $data A possible array of data for the object */ - function Horde_Kolab_Server_Object(&$db, $uid = null, $data = null) + public function __construct(&$db, $uid = null, $data = null) { - $this->_db = &$db; + $this->db = &$db; if (empty($uid)) { if (empty($data) || !isset($data[KOLAB_ATTR_UID])) { throw new Horde_Kolab_Server_Exception(_('Specify either the UID or a search result!')); } if (is_array($data[KOLAB_ATTR_UID])) { - $this->_uid = $data[KOLAB_ATTR_UID][0]; + $this->uid = $data[KOLAB_ATTR_UID][0]; } else { - $this->_uid = $data[KOLAB_ATTR_UID]; + $this->uid = $data[KOLAB_ATTR_UID]; } $this->_cache = $data; } else { - $this->_uid = $uid; + $this->uid = $uid; } } @@ -188,7 +188,7 @@ class Horde_Kolab_Server_Object * @return Horde_Kolab_Server_Object|PEAR_Error The newly created concrete * Horde_Kolab_Server_Object instance. */ - function &factory($type, $uid, &$storage, $data = null) + public function &factory($type, $uid, &$storage, $data = null) { $result = Horde_Kolab_Server_Object::loadClass($type); @@ -211,7 +211,7 @@ class Horde_Kolab_Server_Object * * @return true|PEAR_Error True if successfull. */ - function loadClass($type) + public static function loadClass($type) { if (!class_exists($type)) { throw new Horde_Kolab_Server_Exception('Class definition of ' . $type . ' not found.'); @@ -223,10 +223,10 @@ class Horde_Kolab_Server_Object * * @return NULL */ - function exists() + public function exists() { try { - $this->_read(); + $this->read(); } catch (Horde_Kolab_Server_Exception $e) { return false; } @@ -238,10 +238,10 @@ class Horde_Kolab_Server_Object * * @return NULL */ - function _read() + protected function read() { - $this->_cache = $this->_db->read($this->_uid, - $this->_supported_attributes); + $this->_cache = $this->db->read($this->uid, + $this->supported_attributes); } /** @@ -250,29 +250,31 @@ class Horde_Kolab_Server_Object * @param string $attr The attribute to read * * @return string the value of this attribute + * + * @todo: This needs to be magic */ - function get($attr) + public function get($attr) { if ($attr != KOLAB_ATTR_UID) { - if (!in_array($attr, $this->_supported_attributes) - && !in_array($attr, $this->_derived_attributes)) { + if (!in_array($attr, $this->supported_attributes) + && !in_array($attr, $this->derived_attributes)) { throw new Horde_Kolab_Server_Exception(sprintf(_("Attribute \"%s\" not supported!"), $attr)); } if (!$this->_cache) { - $this->_read(); + $this->read(); } } - if (in_array($attr, $this->_derived_attributes)) { - return $this->_derive($attr); + if (in_array($attr, $this->derived_attributes)) { + return $this->derive($attr); } switch ($attr) { case KOLAB_ATTR_UID: - return $this->_getUID(); + return $this->uid; case KOLAB_ATTR_FN: - return $this->_getFn(); + return $this->getFn(); case KOLAB_ATTR_SN: case KOLAB_ATTR_CN: case KOLAB_ATTR_GIVENNAME: @@ -301,7 +303,7 @@ class Horde_Kolab_Server_Object * * @return string the value of this attribute */ - function _get($attr, $single = true) + protected function _get($attr, $single = true) { if (isset($this->_cache[$attr])) { if ($single && is_array($this->_cache[$attr])) { @@ -320,11 +322,11 @@ class Horde_Kolab_Server_Object * * @return mixed The value of the attribute. */ - function _derive($attr) + protected function derive($attr) { switch ($attr) { case KOLAB_ATTR_ID: - $result = split(',', $this->_uid); + $result = split(',', $this->uid); if (substr($result[0], 0, 3) == 'cn=') { return substr($result[0], 3); } else { @@ -350,7 +352,7 @@ class Horde_Kolab_Server_Object * * @return array|PEAR_Error The hash representing this object. */ - function toHash($attrs = null) + public function toHash($attrs = null) { if (!isset($attrs)) { $attrs = array(); @@ -369,9 +371,9 @@ class Horde_Kolab_Server_Object * * @return string the UID of this object */ - function _getUid() + public function getUid() { - return $this->_uid; + return $this->uid; } /** @@ -381,7 +383,7 @@ class Horde_Kolab_Server_Object * * @return string the "first name" of this object */ - function _getFn() + protected function getFn() { $sn = $this->_get(KOLAB_ATTR_SN, true); $cn = $this->_get(KOLAB_ATTR_CN, true); @@ -394,7 +396,7 @@ class Horde_Kolab_Server_Object * @return mixed An array of group ids or a PEAR Error in case of * an error. */ - function getGroups() + public function getGroups() { return array(); } @@ -408,7 +410,7 @@ class Horde_Kolab_Server_Object * * @return string|PEAR_Error The server url or empty. */ - function getServer($server_type) + public function getServer($server_type) { throw new Horde_Kolab_Server_Exception('Not implemented!'); } @@ -422,7 +424,7 @@ class Horde_Kolab_Server_Object * * @return string|PEAR_Error The ID. */ - function generateId($info) + public static function generateId($info) { $id_mapfields = array('givenName', 'sn'); $id_format = '%s %s'; @@ -446,18 +448,18 @@ class Horde_Kolab_Server_Object * * @return boolean|PEAR_Error True on success. */ - function save($info) + public function save($info) { - foreach ($this->_required_attributes as $attribute) { + foreach ($this->required_attributes as $attribute) { if (!isset($info[$attribute])) { throw new Horde_Kolab_Server_Exception(sprintf(_("The value for \"%s\" is missing!"), $attribute)); } } - $info['objectClass'] = $this->_object_classes; + $info['objectClass'] = $this->object_classes; - $result = $this->_db->save($this->_uid, $info); + $result = $this->db->save($this->uid, $info); if ($result === false || is_a($result, 'PEAR_Error')) { return $result; } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/address.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/address.php index 5a1d857a8..b33d8bd69 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/address.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/address.php @@ -2,7 +2,6 @@ /** * An entry in the global addressbook. * - * * PHP version 5 * * @category Kolab @@ -16,7 +15,6 @@ * This class provides methods to deal with global address book * entries for Kolab. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -36,14 +34,14 @@ class Horde_Kolab_Server_Object_address extends Horde_Kolab_Server_Object * * @var string */ - var $filter = '(&(objectclass=inetOrgPerson)(!(uid=*))(sn=*))'; + public static $filter = '(&(objectclass=inetOrgPerson)(!(uid=*))(sn=*))'; /** * The attributes supported by this class * * @var array */ - var $_supported_attributes = array( + public $supported_attributes = array( KOLAB_ATTR_SN, KOLAB_ATTR_CN, KOLAB_ATTR_GIVENNAME, @@ -58,7 +56,7 @@ class Horde_Kolab_Server_Object_address extends Horde_Kolab_Server_Object * * @var array */ - var $_derived_attributes = array( + public $derived_attributes = array( KOLAB_ATTR_LNFN, KOLAB_ATTR_FNLN, ); @@ -68,7 +66,7 @@ class Horde_Kolab_Server_Object_address extends Horde_Kolab_Server_Object * * @var array */ - var $_required_attributes = array( + public $required_attributes = array( KOLAB_ATTR_SN, KOLAB_ATTR_GIVENNAME, ); @@ -78,7 +76,7 @@ class Horde_Kolab_Server_Object_address extends Horde_Kolab_Server_Object * * @var array */ - var $_object_classes = array( + protected $object_classes = array( KOLAB_OC_TOP, KOLAB_OC_INETORGPERSON, KOLAB_OC_KOLABINETORGPERSON, @@ -91,7 +89,7 @@ class Horde_Kolab_Server_Object_address extends Horde_Kolab_Server_Object * * @return array|PEAR_Error The hash representing this object. */ - function toHash($attrs = null) + public function toHash($attrs = null) { if (!isset($attrs)) { $attrs = array( @@ -100,5 +98,4 @@ class Horde_Kolab_Server_Object_address extends Horde_Kolab_Server_Object } return parent::toHash($attrs); } - } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/administrator.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/administrator.php index 090321b73..cb9ad6907 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/administrator.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/administrator.php @@ -2,7 +2,6 @@ /** * A system administrator. * - * * PHP version 5 * * @category Kolab @@ -12,13 +11,10 @@ * @link http://pear.horde.org/index.php?package=Kolab_Server */ -require_once 'Horde/Kolab/Server/Object/adminrole.php'; - /** * This class provides methods to deal with administrator * entries for Kolab. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -39,6 +35,5 @@ class Horde_Kolab_Server_Object_administrator extends Horde_Kolab_Server_Object_ * * @var string */ - var $required_group = 'cn=admin,cn=internal'; - + protected $required_group = 'cn=admin,cn=internal'; } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/adminrole.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/adminrole.php index 0a613d1fb..1a914c508 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/adminrole.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/adminrole.php @@ -2,7 +2,6 @@ /** * A Kolab object of type administrator. * - * * PHP version 5 * * @category Kolab @@ -15,7 +14,6 @@ /** * This class provides methods to deal with administrator object types. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -35,14 +33,14 @@ class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object * * @var string */ - var $filter = '(&(cn=*)(objectClass=inetOrgPerson)(!(uid=manager))(sn=*))'; + public static $filter = '(&(cn=*)(objectClass=inetOrgPerson)(!(uid=manager))(sn=*))'; /** * The attributes supported by this class * * @var array */ - var $_supported_attributes = array( + public $supported_attributes = array( KOLAB_ATTR_SN, KOLAB_ATTR_CN, KOLAB_ATTR_GIVENNAME, @@ -57,7 +55,7 @@ class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object * * @var array */ - var $_required_attributes = array( + public $required_attributes = array( KOLAB_ATTR_SN, KOLAB_ATTR_GIVENNAME, KOLAB_ATTR_USERPASSWORD, @@ -69,7 +67,7 @@ class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object * * @var array */ - var $_derived_attributes = array( + public $derived_attributes = array( KOLAB_ATTR_ID, KOLAB_ATTR_LNFN, ); @@ -79,20 +77,28 @@ class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object * * @var array */ - var $_object_classes = array( + protected $object_classes = array( KOLAB_OC_TOP, KOLAB_OC_INETORGPERSON, KOLAB_OC_KOLABINETORGPERSON, ); /** + * The group the UID must be member of so that this object really + * matches this class type. This may not include the root UID. + * + * @var string + */ + protected $required_group; + + /** * Convert the object attributes to a hash. * * @param string $attrs The attributes to return. * * @return array|PEAR_Error The hash representing this object. */ - function toHash($attrs = null) + public function toHash($attrs = null) { if (!isset($attrs)) { $attrs = array( @@ -110,7 +116,7 @@ class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object * * @return boolean|PEAR_Error True on success. */ - function save($info) + public function save($info) { if (!isset($info['cn'])) { if (!isset($info['sn']) || !isset($info['givenName'])) { @@ -121,18 +127,18 @@ class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object } $admins_uid = sprintf('%s,%s', $this->required_group, - $this->_db->getBaseUid()); + $this->db->getBaseUid()); - $admin_group = $this->_db->fetch($admins_uid, 'Horde_Kolab_Server_Object_group'); + $admin_group = $this->db->fetch($admins_uid, 'Horde_Kolab_Server_Object_group'); if (is_a($admin_group, 'PEAR_Error') || !$admin_group->exists()) { - $members = array($this->_uid); + $members = array($this->uid); //FIXME: This is not okay and also contains too much LDAP knowledge - $parts = split(',', $this->required_group); + $parts = split(',', $this->required_group); list($groupname) = sscanf($parts[0], 'cn=%s'); - $result = $this->_db->add(array(KOLAB_ATTR_CN => $groupname, + $result = $this->db->add(array(KOLAB_ATTR_CN => $groupname, 'type' => 'Horde_Kolab_Server_Object_group', KOLAB_ATTR_MEMBER => $members, KOLAB_ATTR_VISIBILITY => false)); @@ -140,13 +146,13 @@ class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object return $result; } } else { - $result = $admin_group->isMember($this->_uid); + $result = $admin_group->isMember($this->uid); if (is_a($result, 'PEAR_Error')) { return $result; } if ($result === false) { $members = $admin_group->getMembers(); - $members[] = $this->_uid; + $members[] = $this->uid; $admin_group->save(array(KOLAB_ATTR_MEMBER => $members)); } } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/distlist.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/distlist.php index 8923c88f5..3afc3cf53 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/distlist.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/distlist.php @@ -2,7 +2,6 @@ /** * Representation of a Kolab distribution list. * - * * PHP version 5 * * @category Kolab @@ -12,12 +11,9 @@ * @link http://pear.horde.org/index.php?package=Kolab_Server */ -require_once 'Horde/Kolab/Server/Object/group.php'; - /** * This class provides methods to deal with distribution lists for Kolab. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -37,7 +33,7 @@ class Horde_Kolab_Server_Object_distlist extends Horde_Kolab_Server_Object_group * * @var string */ - var $filter = '(&(objectClass=kolabGroupOfNames)(mail=*))'; + public static $filter = '(&(objectClass=kolabGroupOfNames)(mail=*))'; /** @@ -45,7 +41,7 @@ class Horde_Kolab_Server_Object_distlist extends Horde_Kolab_Server_Object_group * * @var array */ - var $_required_attributes = array( + public $required_attributes = array( KOLAB_ATTR_MAIL, ); }; diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/domainmaintainer.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/domainmaintainer.php index dcece44f3..17565acd4 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/domainmaintainer.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/domainmaintainer.php @@ -2,7 +2,6 @@ /** * A Kolab domain maintainer. * - * * PHP version 5 * * @category Kolab @@ -12,12 +11,9 @@ * @link http://pear.horde.org/index.php?package=Kolab_Server */ -require_once 'Horde/Kolab/Server/Object/adminrole.php'; - /** * This class provides methods associated to Kolab domain maintainers. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -37,7 +33,7 @@ class Horde_Kolab_Server_Object_domainmaintainer extends Horde_Kolab_Server_Obje * * @var array */ - var $_required_attributes = array( + public $required_attributes = array( KOLAB_ATTR_SN, KOLAB_ATTR_GIVENNAME, KOLAB_ATTR_USERPASSWORD, @@ -50,7 +46,7 @@ class Horde_Kolab_Server_Object_domainmaintainer extends Horde_Kolab_Server_Obje * * @var array */ - var $_derived_attributes = array( + public $derived_attributes = array( KOLAB_ATTR_ID, KOLAB_ATTR_LNFN, KOLAB_ATTR_DOMAIN, @@ -62,7 +58,7 @@ class Horde_Kolab_Server_Object_domainmaintainer extends Horde_Kolab_Server_Obje * * @var string */ - var $required_group = 'cn=domain-maintainer,cn=internal'; + protected $required_group = 'cn=domain-maintainer,cn=internal'; /** * Convert the object attributes to a hash. @@ -71,7 +67,7 @@ class Horde_Kolab_Server_Object_domainmaintainer extends Horde_Kolab_Server_Obje * * @return array|PEAR_Error The hash representing this object. */ - function toHash($attrs = null) + public function toHash($attrs = null) { if (!isset($attrs)) { $attrs = array( @@ -90,30 +86,30 @@ class Horde_Kolab_Server_Object_domainmaintainer extends Horde_Kolab_Server_Obje * * @return boolean|PEAR_Error True on success. */ - function save($info) + public function save($info) { foreach ($info[KOLAB_ATTR_DOMAIN] as $domain) { $domain_uid = sprintf('cn=%s,cn=domain,cn=internal,%s', - $domain, $this->_db->getBaseUid()); + $domain, $this->db->getBaseUid()); //FIXME: This should be made easier by the group object - $domain_group = $this->_db->fetch($domain_uid, 'Horde_Kolab_Server_Object_group'); + $domain_group = $this->db->fetch($domain_uid, 'Horde_Kolab_Server_Object_group'); if (is_a($domain_group, 'PEAR_Error')) { return $domain_group; } if (!$domain_group->exists()) { - $members = array($this->_uid); + $members = array($this->uid); $domain_group->save(array(KOLAB_ATTR_CN => $domain, KOLAB_ATTR_MEMBER => $members)); } else { - $result = $domain_group->isMember($this->_uid); + $result = $domain_group->isMember($this->uid); if (is_a($result, 'PEAR_Error')) { return $result; } if ($result === false) { $members = $domain_group->getMembers(); - $members[] = $this->_uid; + $members[] = $this->uid; $domain_group->save(array(KOLAB_ATTR_MEMBER => $members)); } } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/group.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/group.php index 92d3553fc..39c4fc8ed 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/group.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/group.php @@ -2,7 +2,6 @@ /** * Representation of a Kolab user group. * - * * PHP version 5 * * @category Kolab @@ -15,7 +14,6 @@ /** * This class provides methods to deal with groups for Kolab. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -35,14 +33,14 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @var string */ - var $filter = '(objectClass=kolabGroupOfNames)'; + public static $filter = '(objectClass=kolabGroupOfNames)'; /** * The attributes supported by this class * * @var array */ - var $_supported_attributes = array( + public $supported_attributes = array( KOLAB_ATTR_CN, KOLAB_ATTR_MAIL, KOLAB_ATTR_MEMBER, @@ -54,7 +52,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @var array */ - var $_derived_attributes = array( + public $derived_attributes = array( KOLAB_ATTR_ID, KOLAB_ATTR_VISIBILITY, ); @@ -64,7 +62,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @var array */ - var $_required_attributes = array( + public $required_attributes = array( KOLAB_ATTR_CN, ); @@ -73,7 +71,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @var array */ - var $_object_classes = array( + protected $object_classes = array( KOLAB_OC_TOP, KOLAB_OC_KOLABGROUPOFNAMES, ); @@ -83,7 +81,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @var string */ - var $sort_by = KOLAB_ATTR_MAIL; + public $sort_by = KOLAB_ATTR_MAIL; /** * Derive an attribute value. @@ -92,13 +90,13 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @return mixed The value of the attribute. */ - function _derive($attr) + protected function derive($attr) { switch ($attr) { case KOLAB_ATTR_VISIBILITY: return strpos($this->_uid, 'cn=internal') === false; default: - return parent::_derive($attr); + return parent::derive($attr); } } @@ -109,7 +107,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @return array|PEAR_Error The hash representing this object. */ - function toHash($attrs = null) + public function toHash($attrs = null) { if (!isset($attrs)) { $attrs = array( @@ -130,7 +128,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @return string|PEAR_Error The ID. */ - function generateId($info) + public static function generateId($info) { if (isset($info['mail'])) { return trim($info['mail'], " \t\n\r\0\x0B,"); @@ -146,7 +144,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @return boolean|PEAR_Error True on success. */ - function save($info) + public function save($info) { if (!isset($info['cn'])) { if (!isset($info['mail'])) { @@ -163,7 +161,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @return array|PEAR_Error The list of members in this group. */ - function getMembers() + public function getMembers() { return $this->_get(KOLAB_ATTR_MEMBER, false); } @@ -175,7 +173,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @return array|PEAR_Error True if successful. */ - function addMember($member) + public function addMember($member) { $members = $this->getMembers(); if (is_a($members, 'PEAR_Error')) { @@ -197,7 +195,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * * @return array|PEAR_Error True if successful. */ - function deleteMember($member) + public function deleteMember($member) { $members = $this->getMembers(); if (is_a($members, 'PEAR_Error')) { @@ -222,7 +220,7 @@ class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object * @return boolean|PEAR_Error True if the UID is a member of the group, * false otherwise. */ - function isMember($member) + public function isMember($member) { $members = $this->getMembers(); if (is_a($members, 'PEAR_Error') || !is_array($members)) { diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/maintainer.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/maintainer.php index 48d1e5902..d1dcb0758 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/maintainer.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/maintainer.php @@ -2,7 +2,6 @@ /** * A Kolab maintainer. * - * * PHP version 5 * * @category Kolab @@ -12,13 +11,10 @@ * @link http://pear.horde.org/index.php?package=Kolab_Server */ -require_once 'Horde/Kolab/Server/Object/adminrole.php'; - /** * This class provides methods to deal with maintainer * entries for Kolab. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -39,6 +35,6 @@ class Horde_Kolab_Server_Object_maintainer extends Horde_Kolab_Server_Object_adm * * @var string */ - var $required_group = 'cn=maintainer,cn=internal'; + protected $required_group = 'cn=maintainer,cn=internal'; } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/server.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/server.php index d6674fd1b..be2000483 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/server.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/server.php @@ -2,7 +2,6 @@ /** * The server configuration. * - * * PHP version 5 * * @category Kolab @@ -15,7 +14,6 @@ /** * This class provides methods to deal with Kolab server configuration. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -35,14 +33,14 @@ class Horde_Kolab_Server_Object_server extends Horde_Kolab_Server_Object * * @var string */ - var $filter = '(&((k=kolab))(objectclass=kolab))'; + public static $filter = '(&((k=kolab))(objectclass=kolab))'; /** * The attributes supported by this class * * @var array */ - var $_supported_attributes = array( + public $supported_attributes = array( KOLAB_ATTR_FBPAST, ); diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/sharedfolder.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/sharedfolder.php index 78207fbe8..7c0ec4178 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/sharedfolder.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/sharedfolder.php @@ -2,7 +2,6 @@ /** * A shared IMAP folder. * - * * PHP version 5 * * @category Kolab @@ -16,7 +15,6 @@ * This class provides methods to deal with shared folders * entries for Kolab. * - * * Copyright 2008-2009 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -36,14 +34,14 @@ class Horde_Kolab_Server_Object_sharedfolder extends Horde_Kolab_Server_Object * * @var string */ - var $filter = '(objectClass=kolabSharedFolder)'; + public static $filter = '(objectClass=kolabSharedFolder)'; /** * The attributes supported by this class * * @var array */ - var $_supported_attributes = array( + public $supported_attributes = array( KOLAB_ATTR_CN, KOLAB_ATTR_DELETED, KOLAB_ATTR_FOLDERTYPE, @@ -58,7 +56,7 @@ class Horde_Kolab_Server_Object_sharedfolder extends Horde_Kolab_Server_Object * * @var array */ - var $_required_attributes = array( + public $required_attributes = array( KOLAB_ATTR_CN, KOLAB_ATTR_HOMESERVER, ); @@ -68,7 +66,7 @@ class Horde_Kolab_Server_Object_sharedfolder extends Horde_Kolab_Server_Object * * @var array */ - var $_object_classes = array( + protected $object_classes = array( KOLAB_OC_TOP, KOLAB_OC_KOLABSHAREDFOLDER, ); @@ -82,7 +80,7 @@ class Horde_Kolab_Server_Object_sharedfolder extends Horde_Kolab_Server_Object * * @return string|PEAR_Error The ID. */ - function generateId($info) + public static function generateId($info) { return trim($info['cn'], " \t\n\r\0\x0B,"); } @@ -94,7 +92,7 @@ class Horde_Kolab_Server_Object_sharedfolder extends Horde_Kolab_Server_Object * * @return array|PEAR_Error The hash representing this object. */ - function toHash($attrs = null) + public function toHash($attrs = null) { if (!isset($attrs)) { $attrs = array( diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/user.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/user.php index d1345ca56..f74345ce7 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/user.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/user.php @@ -34,14 +34,14 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @var string */ - var $filter = '(&(objectClass=kolabInetOrgPerson)(uid=*)(mail=*)(sn=*))'; + public static $filter = '(&(objectClass=kolabInetOrgPerson)(uid=*)(mail=*)(sn=*))'; /** * The attributes supported by this class * * @var array */ - var $_supported_attributes = array( + public $supported_attributes = array( KOLAB_ATTR_SN, KOLAB_ATTR_CN, KOLAB_ATTR_GIVENNAME, @@ -63,7 +63,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @var array */ - var $_derived_attributes = array( + public $derived_attributes = array( KOLAB_ATTR_ID, KOLAB_ATTR_USERTYPE, KOLAB_ATTR_LNFN, @@ -75,7 +75,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @var array */ - var $_required_attributes = array( + public $required_attributes = array( KOLAB_ATTR_SN, KOLAB_ATTR_GIVENNAME, KOLAB_ATTR_USERPASSWORD, @@ -88,7 +88,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @var array */ - var $_object_classes = array( + protected $object_classes = array( KOLAB_OC_TOP, KOLAB_OC_INETORGPERSON, KOLAB_OC_KOLABINETORGPERSON, @@ -103,26 +103,26 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * @param string $dn UID of the object. * @param array $data A possible array of data for the object */ - function Horde_Kolab_Server_Object_user(&$db, $dn = null, $data = null) + public function __construct(&$db, $dn = null, $data = null) { global $conf; /** Allows to customize the supported user attributes. */ if (isset($conf['kolab']['server']['user_supported_attrs'])) { - $this->_supported_attributes = $conf['kolab']['server']['user_supported_attrs']; + $this->supported_attributes = $conf['kolab']['server']['user_supported_attrs']; } /** Allows to customize the required user attributes. */ if (isset($conf['kolab']['server']['user_required_attrs'])) { - $this->_required_attributes = $conf['kolab']['server']['user_required_attrs']; + $this->required_attributes = $conf['kolab']['server']['user_required_attrs']; } /** Allows to customize the user object classes. */ if (isset($conf['kolab']['server']['user_objectclasses'])) { - $this->_object_classes = $conf['kolab']['server']['user_object_classes']; + $this->object_classes = $conf['kolab']['server']['user_object_classes']; } - Horde_Kolab_Server_Object::Horde_Kolab_Server_Object($db, $dn, $data); + parent::__construct($db, $dn, $data); } /** @@ -132,7 +132,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @return mixed The value of the attribute. */ - function _derive($attr) + protected function derive($attr) { switch ($attr) { case KOLAB_ATTR_USERTYPE: @@ -157,7 +157,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @return array|PEAR_Error The hash representing this object. */ - function toHash($attrs = null) + public function toHash($attrs = null) { if (!isset($attrs)) { $attrs = array( @@ -176,7 +176,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * @return mixed|PEAR_Error An array of group ids, false if no groups were * found. */ - function getGroups() + public function getGroups() { return $this->_db->getGroups($this->_uid); } @@ -190,7 +190,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @return string The server url or empty on error. */ - function getServer($server_type) + public function getServer($server_type) { global $conf; @@ -237,7 +237,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * * @return string|PEAR_Error The ID. */ - function generateId($info) + public static function generateId($info) { global $conf; @@ -276,7 +276,7 @@ class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object * @throws Horde_Kolab_Server_Exception If the information to be saved is * invalid. */ - function save($info) + public function save($info) { if (!isset($info['cn'])) { if (!isset($info['sn']) || !isset($info['givenName'])) { -- 2.11.0