/functions/imap_mailbox.php

Description

imap_mailbox.php

This implements all functions that manipulate mailboxes

Includes
require_once (SM_PATH.'functions/imap_utf7_local.php') (line 16)

UTF7 support

Functions
check_is_noselect (line 51)
  • return: whether this is a Noselect mailbox.
bool check_is_noselect ( $lsub_line)
  • $lsub_line
find_mailbox_name (line 39)
void find_mailbox_name ( $mailbox)
  • $mailbox
isBoxBelow (line 77)

Check if $subbox is below the specified $parentbox

void isBoxBelow ( $subbox,  $parentbox)
  • $subbox
  • $parentbox
isDraftMailbox (line 188)

Detects if mailbox is a Drafts folder or subfolder of Drafts

  • return: whether this is a Draft folder
  • since: 1.4.0
bool isDraftMailbox (string $box, [boolean $include_subs = true])
  • string $box: mailbox name
  • boolean $include_subs: (since 1.5.2 and 1.4.9) if true, subfolders of system folders are special. if false, subfolders are not special mailboxes.
isInboxMailbox (line 144)

Detects if mailbox is the Inbox folder or subfolder of the Inbox

  • return: Whether this is the Inbox or a child thereof.
  • since: 1.4.22
boolean isInboxMailbox (string $box, [boolean $include_subs = TRUE])
  • string $box: The mailbox name to test
  • boolean $include_subs: If true, subfolders of system folders are special. If false, subfolders are not special mailboxes.
isSentMailbox (line 173)

Detects if mailbox is a Sent folder or subfolder of Sent

  • return: whether this is a Sent folder
  • since: 1.4.0
bool isSentMailbox (string $box, [boolean $include_subs = true])
  • string $box: mailbox name
  • boolean $include_subs: (since 1.5.2 and 1.4.9) if true, subfolders of system folders are special. if false, subfolders are not special mailboxes.
isSpecialMailbox (line 118)

Defines special mailboxes: given a mailbox name, it checks if this is a "special" one: INBOX, Trash, Sent or Draft.

Since 1.2.5 function includes special_mailbox hook.

Since 1.4.3 hook supports more than one plugin.

Since 1.4.22/1.5.2, the administrator can add $subfolders_of_inbox_are_special = TRUE; to config/config_local.php and all subfolders of the INBOX will be treated as special.

  • since: 1.2.3
boolean isSpecialMailbox (string $box, [boolean $include_subs = true])
  • string $box: mailbox name
  • boolean $include_subs: (since 1.5.2 and 1.4.9) if true, subfolders of system folders are special. if false, subfolders are not special mailboxes unless they are tagged as special in 'special_mailbox' hook.
isTrashMailbox (line 158)

Detects if mailbox is a Trash folder or subfolder of Trash

  • return: whether this is a Trash folder
  • since: 1.4.0
bool isTrashMailbox (string $box, [boolean $include_subs = true])
  • string $box: mailbox name
  • boolean $include_subs: (since 1.5.2 and 1.4.9) if true, subfolders of system folders are special. if false, subfolders are not special mailboxes.
mailtree_sort (line 592)

Mailboxes with some chars (like -) can mess up the order, this fixes it

void mailtree_sort ( &$lsub)
  • &$lsub
readMailboxParent (line 60)

If $haystack is a full mailbox name, and $needle is the mailbox

separator character, returns the second last part of the full mailbox name (i.e. the mailbox's parent mailbox)

void readMailboxParent ( $haystack,  $needle)
  • $haystack
  • $needle
sortSpecialMbx (line 20)
void sortSpecialMbx ( $a,  $b)
  • $a
  • $b
sqimap_mailbox_create (line 308)

Creates a folder.

void sqimap_mailbox_create ( $imap_stream,  $mailbox,  $type)
  • $imap_stream
  • $mailbox
  • $type
sqimap_mailbox_delete (line 340)

Deletes the given folder

void sqimap_mailbox_delete ( $imap_stream,  $mailbox)
  • $imap_stream
  • $mailbox
sqimap_mailbox_exists (line 226)

Checks whether or not the specified mailbox exists

void sqimap_mailbox_exists ( $imap_stream,  $mailbox)
  • $imap_stream
  • $mailbox
sqimap_mailbox_expunge (line 198)

Expunges a mailbox, ie. delete all contents.

void sqimap_mailbox_expunge ( $imap_stream,  $mailbox, [ $handle_errors = true], [ $id = ''])
  • $imap_stream
  • $mailbox
  • $handle_errors
  • $id
sqimap_mailbox_is_subscribed (line 360)

Determines if the user is subscribed to the folder or not

void sqimap_mailbox_is_subscribed ( $imap_stream,  $folder)
  • $imap_stream
  • $folder
sqimap_mailbox_list (line 612)

Returns sorted mailbox lists in several different ways.

See comment on sqimap_mailbox_parse() for info about the returned array.

void sqimap_mailbox_list ( $imap_stream, [ $force = false])
  • $imap_stream
  • $force
sqimap_mailbox_list_all (line 797)

Returns a list of all folders, subscribed or not

void sqimap_mailbox_list_all ( $imap_stream)
  • $imap_stream
sqimap_mailbox_option_list (line 536)

Returns list of options (to be echoed into select statement based on available mailboxes and separators Caller should surround options with <select ...> </select> and any formatting.

$imap_stream - $imapConnection to query for mailboxes $show_selected - array containing list of mailboxes to pre-select (0 if none) $folder_skip - array of folders to keep out of option list (compared in lower) $boxes - list of already fetched boxes (for places like folder panel, where you know these options will be shown 3 times in a row.. (most often unset). $flag - flag to check for in mailbox flags, used to filter out mailboxes. 'noselect' by default to remove unselectable mailboxes. 'noinferiors' used to filter out folders that can not contain subfolders. NULL to avoid flag check entirely. $use_long_format - override folder display preference and always show full folder name.

void sqimap_mailbox_option_list ( $imap_stream, [ $show_selected = 0], [ $folder_skip = 0], [ $boxes = 0], [ $flag = 'noselect'], [ $use_long_format = false])
  • $imap_stream
  • $show_selected
  • $folder_skip
  • $boxes
  • $flag
  • $use_long_format
sqimap_mailbox_parse (line 439)

Formats a mailbox into parts for the $boxesall array

The parts are:

raw - Raw LIST/LSUB response from the IMAP server formatted - nicely formatted folder name unformatted - unformatted, but with delimiter at end removed unformatted-dm - folder name as it appears in raw response unformatted-disp - unformatted without $folder_prefix

void sqimap_mailbox_parse ( $line,  $line_lsub)
  • $line
  • $line_lsub
sqimap_mailbox_rename (line 373)

Renames a mailbox.

void sqimap_mailbox_rename ( $imap_stream,  $old_name,  $new_name)
  • $imap_stream
  • $old_name
  • $new_name
sqimap_mailbox_select (line 250)

Selects a mailbox

  • return: Void/unpredictable when handling errors internally or an array when $handle_errors is false; in that case, good responses are returned in an array, bad ones with an empty array.
mixed sqimap_mailbox_select ( $imap_stream,  $mailbox, [boolean $handle_errors = true])
  • boolean $handle_errors: When TRUE, IMAP errors are handled herein, causing an error to be displayed on screen and execution to stop and when FALSE, error status is returned to the caller (OPTIONAL; default is TRUE)
  • $imap_stream
  • $mailbox
sqimap_subscribe (line 324)

Subscribes to an existing folder.

void sqimap_subscribe ( $imap_stream,  $mailbox)
  • $imap_stream
  • $mailbox
sqimap_unsubscribe (line 332)

Unsubscribes from an existing folder

void sqimap_unsubscribe ( $imap_stream,  $mailbox)
  • $imap_stream
  • $mailbox
user_strcasecmp (line 516)

Sorting function used to sort mailbox names.

  • Original patch from [email protected]
  • Allows case insensitivity when sorting folders
  • Takes care of the delimiter being sorted to the end, causing subfolders to be listed in below folders that are prefixed with their parent folders name.
For example: INBOX.foo, INBOX.foobar, and INBOX.foo.bar Without special sort function: foobar between foo and foo.bar With special sort function: foobar AFTER foo and foo.bar :)

void user_strcasecmp ( $a,  $b)
  • $a
  • $b

Documentation generated on Mon, 13 Jan 2020 04:24:45 +0100 by phpDocumentor 1.4.3