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:  * Represents external pop3 account information.
  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:  * This class provides a representation of pop3 mail accounts.
 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: class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Object_Top
 29: {
 30:     /** Define attributes specific to this object type */
 31: 
 32:     /** Server the account resides on */
 33:     const ATTRIBUTE_SERVER = 'externalPop3AccountServer';
 34: 
 35:     /** User name for the account */
 36:     const ATTRIBUTE_LOGINNAME = 'externalPop3AccountLoginName';
 37: 
 38:     /** Password for the account */
 39:     const ATTRIBUTE_PASSWORD = 'externalPop3EncryptedAccountPassword';
 40: 
 41:     /** Description of the account */
 42:     const ATTRIBUTE_DESCRIPTION = 'externalPop3AccountDescription';
 43: 
 44:     /** Mail address of the account */
 45:     const ATTRIBUTE_MAIL = 'externalPop3AccountMail';
 46: 
 47:     /** Port to connect to */
 48:     const ATTRIBUTE_PORT = 'externalPop3AccountPort';
 49: 
 50:     /** Use SSL when fetching mail from the account? */
 51:     const ATTRIBUTE_USESSL = 'externalPop3AccountUseSSL';
 52: 
 53:     /** Use TLS when fetching mail from the account? */
 54:     const ATTRIBUTE_USETLS = 'externalPop3AccountUseTLS';
 55: 
 56:     /** Login method for the external account */
 57:     const ATTRIBUTE_LOGINMETHOD = 'externalPop3AccountLoginMethod';
 58: 
 59:     /** Validate the server certificate when connecting via SSL/TLS? */
 60:     const ATTRIBUTE_CHECKCERTIFICATE = 'externalPop3AccountCheckServerCertificate';
 61: 
 62:     /** Should the fetched mail be deleted on the external account or not? */
 63:     const ATTRIBUTE_KEEPMAILONSERVER = 'externalPop3AccountKeepMailOnServer';
 64: 
 65:     /** The uid of the owner of this account */
 66:     const ATTRIBUTE_OWNERUID = 'externalPop3AccountOwnerUid';
 67: 
 68:     /** The specific object class of this object type */
 69:     const OBJECTCLASS_KOLABEXTERNALPOP3ACCOUNT = 'kolabExternalPop3Account';
 70: 
 71:     /**
 72:      * A structure to initialize the attribute structure for this class.
 73:      *
 74:      * @var array
 75:      */
 76:     static public $init_attributes = array(
 77:         'defined' => array(
 78:             self::ATTRIBUTE_SERVER,
 79:             self::ATTRIBUTE_LOGINNAME,
 80:             self::ATTRIBUTE_PASSWORD,
 81:             self::ATTRIBUTE_DESCRIPTION,
 82:             self::ATTRIBUTE_MAIL,
 83:             self::ATTRIBUTE_PORT,
 84:             self::ATTRIBUTE_USESSL,
 85:             self::ATTRIBUTE_USETLS,
 86:             self::ATTRIBUTE_LOGINMETHOD,
 87:             self::ATTRIBUTE_CHECKCERTIFICATE,
 88:             self::ATTRIBUTE_KEEPMAILONSERVER,
 89:         ),
 90:         'derived' => array(
 91:             self::ATTRIBUTE_OWNERUID => array(
 92:                 'method' => 'getParentUid',
 93:             ),
 94:         ),
 95:         'collapsed' => array(
 96:             self::ATTRIBUTE_OWNERUID => array(
 97:                 'base' => array(
 98:                     self::ATTRIBUTE_OWNERUID
 99:                 ),
100:                 'method' => 'removeAttribute',
101:             ),
102:         ),
103:         'required' => array(
104:             self::ATTRIBUTE_MAIL,
105:             self::ATTRIBUTE_SERVER,
106:             self::ATTRIBUTE_LOGINNAME,
107:             self::ATTRIBUTE_PASSWORD,
108:         ),
109:         'object_classes' => array(
110:             self::OBJECTCLASS_KOLABEXTERNALPOP3ACCOUNT,
111:         ),
112:     );
113: 
114:     /**
115:      * Generates an ID for the given information.
116:      *
117:      * @param array &$info The data of the object.
118:      *
119:      * @return string|PEAR_Error The ID.
120:      */
121:     public function generateId(array &$info)
122:     {
123:         if (!isset($info[self::ATTRIBUTE_OWNERUID])) {
124:             $uid = $this->get(self::ATTRIBUTE_OWNERUID);
125:             if (empty($uid)) {
126:                 throw new Horde_Kolab_Server_Exception("No parent object provided!",
127:                                                        Horde_Kolab_Server_Exception::INVALID_INFORMATION);
128:             }
129:         } else {
130:             if (is_array($info[self::ATTRIBUTE_OWNERUID])) {
131:                 $uid = $info[self::ATTRIBUTE_OWNERUID][0];
132:             } else {
133:                 $uid = $info[self::ATTRIBUTE_OWNERUID];
134:             }
135:         }
136: 
137:         $object = $this->server->fetch($uid);
138:         if (!$object->exists()) {
139:             throw new Horde_Kolab_Server_Exception(sprintf("The parent object %s does not exist!",
140:                                                            $uid),
141:                                                    Horde_Kolab_Server_Exception::INVALID_INFORMATION);
142:         }
143: 
144:         if (!isset($info[self::ATTRIBUTE_MAIL])) {
145:             $mail = $this->get(self::ATTRIBUTE_MAIL);
146:             if (empty($mail)) {
147:                 throw new Horde_Kolab_Server_Exception("No mail given!",
148:                                                        Horde_Kolab_Server_Exception::INVALID_INFORMATION);
149:             }
150:         } else {
151:             if (is_array($info[self::ATTRIBUTE_MAIL])) {
152:                 $mail = $info[self::ATTRIBUTE_MAIL][0];
153:             } else {
154:                 $mail = $info[self::ATTRIBUTE_MAIL];
155:             }
156:         }
157: 
158:         $base = substr($uid, 0, strpos($uid, $this->server->getBaseUid()) - 1);
159: 
160:         unset($info[self::ATTRIBUTE_OWNERUID]);
161: 
162:         return self::ATTRIBUTE_MAIL . '=' . $this->server->structure->quoteForUid($mail) . ',' . $base;
163:     }
164: 
165:     /**
166:      * Returns the set of search operations supported by this object type.
167:      *
168:      * @return array An array of supported search operations.
169:      */
170:     static public function getSearchOperations()
171:     {
172:         $searches = array(
173: /*             'pop3AccountsForMail', */
174:         );
175:         return $searches;
176:     }
177: 
178:     /**
179:      * Returns the UIDs of the pop3 accounts for the user with the given mail
180:      * address.
181:      *
182:      * @param Horde_Kolab_Server $server The server to query.
183:      * @param string             $mail   Search objects with this mail alias.
184:      *
185:      * @return mixed The UIDs or false if there was no result.
186:      *
187:      * @throws Horde_Kolab_Server_Exception
188:      */
189:     static public function pop3AccountsForMail($server, $mail)
190:     {
191:         $uid = $server->uidForMail($mail, Horde_Kolab_Server_Object::RESULT_SINGLE);
192:         return self::objectsForUid($server, $uid, self::OBJECTCLASS_KOLABEXTERNALPOP3ACCOUNT);
193:     }
194: 
195: }
API documentation generated by ApiGen