Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  /**
   3   * Copyright 2008-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 2008-2017 Horde LLC
  10   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  11   * @package   Imap_Client
  12   */
  13  
  14  /**
  15   * Base class for Horde_Imap_Client package. Defines common constants for use
  16   * in the package.
  17   *
  18   * @author    Michael Slusarz <slusarz@horde.org>
  19   * @category  Horde
  20   * @copyright 2008-2017 Horde LLC
  21   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  22   * @package   Imap_Client
  23   */
  24  class Horde_Imap_Client
  25  {
  26      /* Constants for openMailbox() */
  27      const OPEN_READONLY = 1;
  28      const OPEN_READWRITE = 2;
  29      const OPEN_AUTO = 3;
  30  
  31      /* Constants for listMailboxes() */
  32      const MBOX_SUBSCRIBED = 1;
  33      const MBOX_SUBSCRIBED_EXISTS = 2;
  34      const MBOX_UNSUBSCRIBED = 3;
  35      const MBOX_ALL = 4;
  36      /* @since 2.23.0 */
  37      const MBOX_ALL_SUBSCRIBED = 5;
  38  
  39      /* Constants for status() */
  40      const STATUS_MESSAGES = 1;
  41      const STATUS_RECENT = 2;
  42      const STATUS_UIDNEXT = 4;
  43      const STATUS_UIDVALIDITY = 8;
  44      const STATUS_UNSEEN = 16;
  45      const STATUS_ALL = 32;
  46      const STATUS_FIRSTUNSEEN = 64;
  47      const STATUS_FLAGS = 128;
  48      const STATUS_PERMFLAGS = 256;
  49      const STATUS_HIGHESTMODSEQ = 512;
  50      const STATUS_SYNCMODSEQ = 1024;
  51      const STATUS_SYNCFLAGUIDS = 2048;
  52      const STATUS_UIDNOTSTICKY = 4096;
  53      const STATUS_UIDNEXT_FORCE = 8192;
  54      const STATUS_SYNCVANISHED = 16384;
  55      /* @since 2.12.0 */
  56      const STATUS_RECENT_TOTAL = 32768;
  57      /* @since 2.14.0 */
  58      const STATUS_FORCE_REFRESH = 65536;
  59  
  60      /* Constants for search() */
  61      const SORT_ARRIVAL = 1;
  62      const SORT_CC = 2;
  63      const SORT_DATE = 3;
  64      const SORT_FROM = 4;
  65      const SORT_REVERSE = 5;
  66      const SORT_SIZE = 6;
  67      const SORT_SUBJECT = 7;
  68      const SORT_TO = 8;
  69      /* SORT_THREAD provided for completeness - it is not a valid sort criteria
  70       * for search() (use thread() instead). */
  71      const SORT_THREAD = 9;
  72      /* Sort criteria defined in RFC 5957 */
  73      const SORT_DISPLAYFROM = 10;
  74      const SORT_DISPLAYTO = 11;
  75      /* SORT_SEQUENCE does a simple numerical sort on the returned
  76       * UIDs/sequence numbers. */
  77      const SORT_SEQUENCE = 12;
  78      /* Fuzzy sort criteria defined in RFC 6203 */
  79      const SORT_RELEVANCY = 13;
  80      /* @since 2.4.0 */
  81      const SORT_DISPLAYFROM_FALLBACK = 14;
  82      /* @since 2.4.0 */
  83      const SORT_DISPLAYTO_FALLBACK = 15;
  84  
  85      /* Search results constants */
  86      const SEARCH_RESULTS_COUNT = 1;
  87      const SEARCH_RESULTS_MATCH = 2;
  88      const SEARCH_RESULTS_MAX = 3;
  89      const SEARCH_RESULTS_MIN = 4;
  90      const SEARCH_RESULTS_SAVE = 5;
  91      /* Fuzzy sort criteria defined in RFC 6203 */
  92      const SEARCH_RESULTS_RELEVANCY = 6;
  93  
  94      /* Constants for thread() */
  95      const THREAD_ORDEREDSUBJECT = 1;
  96      const THREAD_REFERENCES = 2;
  97      const THREAD_REFS = 3;
  98  
  99      /* Fetch criteria constants. */
 100      const FETCH_STRUCTURE = 1;
 101      const FETCH_FULLMSG = 2;
 102      const FETCH_HEADERTEXT = 3;
 103      const FETCH_BODYTEXT = 4;
 104      const FETCH_MIMEHEADER = 5;
 105      const FETCH_BODYPART = 6;
 106      const FETCH_BODYPARTSIZE = 7;
 107      const FETCH_HEADERS = 8;
 108      const FETCH_ENVELOPE = 9;
 109      const FETCH_FLAGS = 10;
 110      const FETCH_IMAPDATE = 11;
 111      const FETCH_SIZE = 12;
 112      const FETCH_UID = 13;
 113      const FETCH_SEQ = 14;
 114      const FETCH_MODSEQ = 15;
 115      /* @since 2.11.0 */
 116      const FETCH_DOWNGRADED = 16;
 117  
 118      /* Namespace constants. @deprecated */
 119      const NS_PERSONAL = 1;
 120      const NS_OTHER = 2;
 121      const NS_SHARED = 3;
 122  
 123      /* ACL constants (RFC 4314 [2.1]). */
 124      const ACL_LOOKUP = 'l';
 125      const ACL_READ = 'r';
 126      const ACL_SEEN = 's';
 127      const ACL_WRITE = 'w';
 128      const ACL_INSERT = 'i';
 129      const ACL_POST = 'p';
 130      const ACL_CREATEMBOX = 'k';
 131      const ACL_DELETEMBOX = 'x';
 132      const ACL_DELETEMSGS = 't';
 133      const ACL_EXPUNGE = 'e';
 134      const ACL_ADMINISTER = 'a';
 135      // Old constants (RFC 2086 [3]; RFC 4314 [2.1.1])
 136      const ACL_CREATE = 'c';
 137      const ACL_DELETE = 'd';
 138  
 139      /* System flags. */
 140      // RFC 3501 [2.3.2]
 141      const FLAG_ANSWERED = '\\answered';
 142      const FLAG_DELETED = '\\deleted';
 143      const FLAG_DRAFT = '\\draft';
 144      const FLAG_FLAGGED = '\\flagged';
 145      const FLAG_RECENT = '\\recent';
 146      const FLAG_SEEN = '\\seen';
 147      // RFC 3503 [3.3]
 148      const FLAG_MDNSENT = '$mdnsent';
 149      // RFC 5550 [2.8]
 150      const FLAG_FORWARDED = '$forwarded';
 151      // RFC 5788 registered keywords:
 152      // http://www.ietf.org/mail-archive/web/morg/current/msg00441.html
 153      const FLAG_JUNK = '$junk';
 154      const FLAG_NOTJUNK = '$notjunk';
 155  
 156      /* Special-use mailbox attributes (RFC 6154 [2]). */
 157      const SPECIALUSE_ALL = '\\All';
 158      const SPECIALUSE_ARCHIVE = '\\Archive';
 159      const SPECIALUSE_DRAFTS = '\\Drafts';
 160      const SPECIALUSE_FLAGGED = '\\Flagged';
 161      const SPECIALUSE_JUNK = '\\Junk';
 162      const SPECIALUSE_SENT = '\\Sent';
 163      const SPECIALUSE_TRASH = '\\Trash';
 164  
 165      /* Constants for sync(). */
 166      const SYNC_UIDVALIDITY = 0;
 167      const SYNC_FLAGS = 1;
 168      const SYNC_FLAGSUIDS = 2;
 169      const SYNC_NEWMSGS = 4;
 170      const SYNC_NEWMSGSUIDS = 8;
 171      const SYNC_VANISHED = 16;
 172      const SYNC_VANISHEDUIDS = 32;
 173      const SYNC_ALL = 64;
 174  
 175      /**
 176       * Capability dependencies.
 177       *
 178       * @deprecated
 179       *
 180       * @var array
 181       */
 182      public static $capability_deps = array(
 183          // RFC 7162 [3.2]
 184          'QRESYNC' => array(
 185              // QRESYNC requires CONDSTORE, but the latter is implied and is
 186              // not required to be listed.
 187              'ENABLE'
 188          ),
 189          // RFC 5182 [2.1]
 190          'SEARCHRES' => array(
 191              'ESEARCH'
 192          ),
 193          // RFC 5255 [3.1]
 194          'LANGUAGE' => array(
 195              'NAMESPACE'
 196          ),
 197          // RFC 5957 [1]
 198          'SORT=DISPLAY' => array(
 199              'SORT'
 200          )
 201      );
 202  
 203  }