1 <?php 2 /** 3 * Copyright 2011-2017 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file LICENSE for license information (LGPL). If you 6 * did not receive this file, see http://www.horde.org/licenses/lgpl21. 7 * 8 * @category Horde 9 * @copyright 2011-2017 Horde LLC 10 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 11 * @package Imap_Client 12 */ 13 14 /** 15 * Provides common methods shared in all ACL classes (see RFC 2086/4314). 16 * 17 * @author Michael Slusarz <slusarz@horde.org> 18 * @category Horde 19 * @copyright 2011-2017 Horde LLC 20 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 21 * @package Imap_Client 22 */ 23 class Horde_Imap_Client_Data_AclCommon 24 { 25 /** Constants for getString(). */ 26 const RFC_2086 = 1; 27 const RFC_4314 = 2; 28 29 /** 30 * List of virtual rights (RFC 4314 [2.1.1]). 31 * 32 * @var array 33 */ 34 protected $_virtual = array( 35 Horde_Imap_Client::ACL_CREATE => array( 36 Horde_Imap_Client::ACL_CREATEMBOX, 37 Horde_Imap_Client::ACL_DELETEMBOX 38 ), 39 Horde_Imap_Client::ACL_DELETE => array( 40 Horde_Imap_Client::ACL_DELETEMSGS, 41 // Don't put this first - we do checks on the existence of the 42 // first element in this array to determine the RFC type, and this 43 // is duplicate of right contained in ACL_CREATE. 44 Horde_Imap_Client::ACL_DELETEMBOX, 45 Horde_Imap_Client::ACL_EXPUNGE 46 ) 47 ); 48 49 /** 50 * Returns the raw string to use in IMAP server calls. 51 * 52 * @param integer $type The RFC type to use (RFC_* constant). 53 * 54 * @return string The string representation of the ACL. 55 */ 56 public function getString($type = self::RFC_4314) 57 { 58 $acl = strval($this); 59 60 if ($type == self::RFC_2086) { 61 foreach ($this->_virtual as $key => $val) { 62 $acl = str_replace($val, '', $acl, $count); 63 if ($count) { 64 $acl .= $key; 65 } 66 } 67 } 68 69 return $acl; 70 } 71 72 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body