Overview

Packages

  • Kolab
    • Server

Classes

  • Horde_Kolab_Server_Composite
  • Horde_Kolab_Server_Connection_File
  • Horde_Kolab_Server_Connection_Mock
  • Horde_Kolab_Server_Connection_Mock_Ldap
  • Horde_Kolab_Server_Connection_Mock_Search
  • Horde_Kolab_Server_Connection_Simpleldap
  • Horde_Kolab_Server_Connection_Splittedldap
  • Horde_Kolab_Server_Decorator_Clean
  • Horde_Kolab_Server_Decorator_Count
  • Horde_Kolab_Server_Decorator_Log
  • Horde_Kolab_Server_Decorator_Map
  • Horde_Kolab_Server_Exception
  • Horde_Kolab_Server_Exception_Bindfailed
  • Horde_Kolab_Server_Exception_Novalue
  • Horde_Kolab_Server_Factory
  • Horde_Kolab_Server_Ldap
  • Horde_Kolab_Server_Ldap_Changes
  • Horde_Kolab_Server_Ldap_Filtered
  • Horde_Kolab_Server_Ldap_Standard
  • Horde_Kolab_Server_List_Base
  • Horde_Kolab_Server_Object_Attribute_Base
  • Horde_Kolab_Server_Object_Attribute_Createtimestamp
  • Horde_Kolab_Server_Object_Attribute_Createtimestampdate
  • Horde_Kolab_Server_Object_Attribute_Decorator
  • Horde_Kolab_Server_Object_Attribute_Default
  • Horde_Kolab_Server_Object_Attribute_Empty
  • Horde_Kolab_Server_Object_Attribute_External
  • Horde_Kolab_Server_Object_Attribute_Field
  • Horde_Kolab_Server_Object_Attribute_Firstnamelastname
  • Horde_Kolab_Server_Object_Attribute_Guid
  • Horde_Kolab_Server_Object_Attribute_Id
  • Horde_Kolab_Server_Object_Attribute_Internal
  • Horde_Kolab_Server_Object_Attribute_Locked
  • Horde_Kolab_Server_Object_Attribute_Modifytimestamp
  • Horde_Kolab_Server_Object_Attribute_Modifytimestampdate
  • Horde_Kolab_Server_Object_Attribute_Objectclass
  • Horde_Kolab_Server_Object_Attribute_Openldapaci
  • Horde_Kolab_Server_Object_Attribute_Required
  • Horde_Kolab_Server_Object_Attribute_Single
  • Horde_Kolab_Server_Object_Attribute_Value
  • Horde_Kolab_Server_Object_Attribute_Writelock
  • Horde_Kolab_Server_Object_Base
  • Horde_Kolab_Server_Object_Factory
  • Horde_Kolab_Server_Object_Groupofnames
  • Horde_Kolab_Server_Object_Hash
  • Horde_Kolab_Server_Object_Inetorgperson
  • Horde_Kolab_Server_Object_Kolab
  • Horde_Kolab_Server_Object_Kolab_Address
  • Horde_Kolab_Server_Object_Kolab_Administrator
  • Horde_Kolab_Server_Object_Kolab_Adminrole
  • Horde_Kolab_Server_Object_Kolab_Distlist
  • Horde_Kolab_Server_Object_Kolab_Domainmaintainer
  • Horde_Kolab_Server_Object_Kolab_Maintainer
  • Horde_Kolab_Server_Object_Kolab_User
  • Horde_Kolab_Server_Object_Kolabgermanbankarrangement
  • Horde_Kolab_Server_Object_Kolabgroupofnames
  • Horde_Kolab_Server_Object_Kolabinetorgperson
  • Horde_Kolab_Server_Object_Kolabpop3account
  • Horde_Kolab_Server_Object_Kolabsharedfolder
  • Horde_Kolab_Server_Object_Mcached
  • Horde_Kolab_Server_Object_Organizationalperson
  • Horde_Kolab_Server_Object_Person
  • Horde_Kolab_Server_Object_Top
  • Horde_Kolab_Server_Objects_Base
  • Horde_Kolab_Server_Query_Element_And
  • Horde_Kolab_Server_Query_Element_Approx
  • Horde_Kolab_Server_Query_Element_Begins
  • Horde_Kolab_Server_Query_Element_Contains
  • Horde_Kolab_Server_Query_Element_Ends
  • Horde_Kolab_Server_Query_Element_Equals
  • Horde_Kolab_Server_Query_Element_Greater
  • Horde_Kolab_Server_Query_Element_Group
  • Horde_Kolab_Server_Query_Element_Less
  • Horde_Kolab_Server_Query_Element_Mapped
  • Horde_Kolab_Server_Query_Element_Not
  • Horde_Kolab_Server_Query_Element_Or
  • Horde_Kolab_Server_Query_Element_Single
  • Horde_Kolab_Server_Query_Ldap
  • Horde_Kolab_Server_Result_Ldap
  • Horde_Kolab_Server_Schema_Base
  • Horde_Kolab_Server_Schema_Decorator_Cache
  • Horde_Kolab_Server_Search_Base
  • Horde_Kolab_Server_Search_Operation_Addressesforuidormail
  • Horde_Kolab_Server_Search_Operation_Attributes
  • Horde_Kolab_Server_Search_Operation_Base
  • Horde_Kolab_Server_Search_Operation_Children
  • Horde_Kolab_Server_Search_Operation_Constraint_Single
  • Horde_Kolab_Server_Search_Operation_Constraint_Strict
  • Horde_Kolab_Server_Search_Operation_Groupsformember
  • Horde_Kolab_Server_Search_Operation_Guid
  • Horde_Kolab_Server_Search_Operation_Guidforalias
  • Horde_Kolab_Server_Search_Operation_Guidforcn
  • Horde_Kolab_Server_Search_Operation_Guidforkolabusers
  • Horde_Kolab_Server_Search_Operation_Guidformail
  • Horde_Kolab_Server_Search_Operation_Guidformailoralias
  • Horde_Kolab_Server_Search_Operation_Guidforuid
  • Horde_Kolab_Server_Search_Operation_Guidforuidormail
  • Horde_Kolab_Server_Search_Operation_Guidforuidormailoralias
  • Horde_Kolab_Server_Search_Operation_Mailforuidormail
  • Horde_Kolab_Server_Search_Operation_Restrictgroups
  • Horde_Kolab_Server_Search_Operation_Restrictkolab
  • Horde_Kolab_Server_Structure_Attribute_Double
  • Horde_Kolab_Server_Structure_Attribute_Value
  • Horde_Kolab_Server_Structure_Base
  • Horde_Kolab_Server_Structure_Kolab
  • Horde_Kolab_Server_Structure_Ldap

Interfaces

  • Horde_Kolab_Server_Connection_Interface
  • Horde_Kolab_Server_Interface
  • Horde_Kolab_Server_List_Interface
  • Horde_Kolab_Server_Object_Attribute_Interface
  • Horde_Kolab_Server_Object_Interface
  • Horde_Kolab_Server_Object_Searches
  • Horde_Kolab_Server_Objects_Interface
  • Horde_Kolab_Server_Query_Element_Interface
  • Horde_Kolab_Server_Query_Interface
  • Horde_Kolab_Server_Result_Interface
  • Horde_Kolab_Server_Schema_Interface
  • Horde_Kolab_Server_Search_Interface
  • Horde_Kolab_Server_Search_Operation_Interface
  • Horde_Kolab_Server_Structure_Attribute_Interface
  • Horde_Kolab_Server_Structure_Interface
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * The base class representing Kolab object attributes.
  4:  *
  5:  * PHP version 5
  6:  *
  7:  * @category Kolab
  8:  * @package  Kolab_Server
  9:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 10:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 11:  * @link     http://pear.horde.org/index.php?package=Kolab_Server
 12:  */
 13: 
 14: /**
 15:  * The base class representing Kolab object attributes.
 16:  *
 17:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 18:  *
 19:  * See the enclosed file COPYING for license information (LGPL). If you
 20:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 21:  *
 22:  * @category Kolab
 23:  * @package  Kolab_Server
 24:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 25:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 26:  * @link     http://pear.horde.org/index.php?package=Kolab_Server
 27:  */
 28: abstract class Horde_Kolab_Server_Object_Attribute_Field
 29: extends Horde_Kolab_Server_Object_Attribute_Base
 30: {
 31: 
 32: 
 33:     /**
 34:      * Quote field separators within a LDAP value.
 35:      *
 36:      * @param string $string The string that should be quoted.
 37:      *
 38:      * @return string The quoted string.
 39:      */
 40:     protected function quote($string)
 41:     {
 42:         return str_replace(array('\\',   '$',),
 43:                            array('\\5c', '\\24',),
 44:                            $string);
 45:     }
 46: 
 47:     /**
 48:      * Unquote a LDAP value.
 49:      *
 50:      * @param string $string The string that should be unquoted.
 51:      *
 52:      * @return string The unquoted string.
 53:      */
 54:     protected function unquote($string)
 55:     {
 56:         return str_replace(array('\\5c', '\\24',),
 57:                            array('\\',   '$',),
 58:                            $string);
 59:     }
 60: 
 61: 
 62:     /**
 63:      * Get a derived attribute value by returning a given position in a
 64:      * delimited string.
 65:      *
 66:      * @param string $basekey   Name of the attribute that holds the
 67:      *                          delimited string.
 68:      * @param string $field     The position of the field to retrieve.
 69:      * @param string $separator The field separator.
 70:      * @param int    $max_count The maximal number of fields.
 71:      *
 72:      * @return mixed The value of the attribute.
 73:      */
 74:     protected function getField($basekey, $field = 0, $separator = '$', $max_count = null)
 75:     {
 76:         $base = $this->_get($basekey);
 77:         if (empty($base)) {
 78:             return;
 79:         }
 80:         if (!empty($max_count)) {
 81:             $fields = explode($separator, $base, $max_count);
 82:         } else {
 83:             $fields = explode($separator, $base);
 84:         }
 85:         return isset($fields[$field]) ? $this->unquote($fields[$field]) : null;
 86:     }
 87: 
 88: 
 89:     /**
 90:      * Set a collapsed attribute value.
 91:      *
 92:      * @param string  $key        The attribute to collapse into.
 93:      * @param array   $attributes The attributes to collapse.
 94:      * @param array   $info       The information currently working on.
 95:      * @param string  $separator  Separate the fields using this character.
 96:      * @param boolean $unset      Unset the base values.
 97:      *
 98:      * @return NULL.
 99:      */
100:     protected function setField($key, $attributes, &$info, $separator = '$', $unset = true)
101:     {
102:         /**
103:          * Check how many empty entries we have at the end of the array. We
104:          * may omit these together with their field separators.
105:          */
106:         krsort($attributes);
107:         $empty = true;
108:         $end   = count($attributes);
109:         foreach ($attributes as $attribute) {
110:             /**
111:              * We do not expect the callee to always provide all attributes
112:              * required for a collapsed attribute. So it is necessary to check
113:              * for old values here.
114:              */
115:             if (!isset($info[$attribute])) {
116:                 $old = $this->get($attribute);
117:                 if (!empty($old)) {
118:                     $info[$attribute] = $old;
119:                 }
120:             }
121:             if ($empty && empty($info[$attribute])) {
122:                 $end--;
123:             } else {
124:                 $empty = false;
125:             }
126:         }
127:         if ($empty) {
128:             return;
129:         }
130:         ksort($attributes);
131:         $unset = $attributes;
132:         $result = '';
133:         for ($i = 0; $i < $end; $i++) {
134:             $akey = array_shift($attributes);
135:             $value =  $info[$akey];
136:             if (is_array($value)) {
137:                 $value = $value[0];
138:             }
139:             $result .= $this->quote($value);
140:             if ($i != ($end - 1)) {
141:                 $result .= $separator;
142:             }
143:         }
144:         if ($unset === true) {
145:             foreach ($unset as $attribute) {
146:                 unset($info[$attribute]);
147:             }
148:         }
149:         $info[$key] = $result;
150:     }
151: }
API documentation generated by ApiGen