Overview

Packages

  • Imap
    • Client

Classes

  • Horde_Imap_Client
  • Horde_Imap_Client_Auth_DigestMD5
  • Horde_Imap_Client_Base
  • Horde_Imap_Client_Cache
  • Horde_Imap_Client_Data_Acl
  • Horde_Imap_Client_Data_AclCommon
  • Horde_Imap_Client_Data_AclNegative
  • Horde_Imap_Client_Data_AclRights
  • Horde_Imap_Client_Data_Envelope
  • Horde_Imap_Client_Data_Fetch
  • Horde_Imap_Client_Data_Fetch_Pop3
  • Horde_Imap_Client_Data_Thread
  • Horde_Imap_Client_DateTime
  • Horde_Imap_Client_Exception
  • Horde_Imap_Client_Exception_NoSupportExtension
  • Horde_Imap_Client_Fetch_Query
  • Horde_Imap_Client_Ids
  • Horde_Imap_Client_Ids_Pop3
  • Horde_Imap_Client_Mailbox
  • Horde_Imap_Client_Search_Query
  • Horde_Imap_Client_Socket
  • Horde_Imap_Client_Socket_Pop3
  • Horde_Imap_Client_Sort
  • Horde_Imap_Client_Translation
  • Horde_Imap_Client_Utf7imap
  • Horde_Imap_Client_Utils
  • Horde_Imap_Client_Utils_Pop3
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Provides common methods shared in all ACL classes (see RFC 2086/4314).
 4:  *
 5:  * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file COPYING for license information (LGPL). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 9:  *
10:  * @author   Michael Slusarz <slusarz@horde.org>
11:  * @category Horde
12:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
13:  * @package  Imap_Client
14:  */
15: class Horde_Imap_Client_Data_AclCommon
16: {
17:     /* Constants for getString(). */
18:     const RFC_2086 = 1;
19:     const RFC_4314 = 2;
20: 
21:     /**
22:      * List of virtual rights (RFC 4314 [2.1.1]).
23:      *
24:      * @var array
25:      */
26:     protected $_virtual = array(
27:         Horde_Imap_Client::ACL_CREATE => array(
28:             Horde_Imap_Client::ACL_CREATEMBOX,
29:             Horde_Imap_Client::ACL_DELETEMBOX
30:         ),
31:         Horde_Imap_Client::ACL_DELETE => array(
32:             Horde_Imap_Client::ACL_DELETEMSGS,
33:             // Don't put this first - we do checks on the existence of the
34:             // first element in this array to determine the RFC type, and this
35:             // is duplicate of right contained in ACL_CREATE.
36:             Horde_Imap_Client::ACL_DELETEMBOX,
37:             Horde_Imap_Client::ACL_EXPUNGE
38:         )
39:     );
40: 
41:     /**
42:      * Returns the raw string to use in IMAP server calls.
43:      *
44:      * @param integer $type  The RFC type to use (RFC_* constant).
45:      *
46:      * @return string  The string representation of the ACL.
47:      */
48:     public function getString($type = self::RFC_4314)
49:     {
50:         $acl = strval($this);
51: 
52:         if ($type == self::RFC_2086) {
53:             foreach ($this->_virtual as $key => $val) {
54:                 $acl = str_replace($val, '', $acl, $count);
55:                 if ($count) {
56:                     $acl .= $key;
57:                 }
58:             }
59:         }
60: 
61:         return $acl;
62:     }
63: 
64: }
65: 
API documentation generated by ApiGen