squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

imap_mailbox.php File Reference

Go to the source code of this file.

Namespaces

 squirrelmail
 

Functions

 sortSpecialMbx ($a, $b)
 
 find_mailbox_name ($mailbox)
 
 check_is_noselect ($lsub_line)
 
 readMailboxParent ($haystack, $needle)
 
 isBoxBelow ( $subbox, $parentbox)
 
 isSpecialMailbox ($box, $include_subs=true)
 
 isInboxMailbox ($box, $include_subs=TRUE)
 
 isTrashMailbox ($box, $include_subs=true)
 
 isSentMailbox ($box, $include_subs=true)
 
 isDraftMailbox ($box, $include_subs=true)
 
 sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors=true, $id='')
 
 sqimap_mailbox_exists ($imap_stream, $mailbox)
 
 sqimap_mailbox_select ($imap_stream, $mailbox)
 
 sqimap_mailbox_create ($imap_stream, $mailbox, $type)
 
 sqimap_subscribe ($imap_stream, $mailbox)
 
 sqimap_unsubscribe ($imap_stream, $mailbox)
 
 sqimap_mailbox_delete ($imap_stream, $mailbox)
 
 sqimap_mailbox_is_subscribed ($imap_stream, $folder)
 
 sqimap_mailbox_rename ( $imap_stream, $old_name, $new_name)
 
 sqimap_mailbox_parse ($line, $line_lsub)
 
 user_strcasecmp ($a, $b)
 
 sqimap_mailbox_option_list ($imap_stream, $show_selected=0, $folder_skip=0, $boxes=0, $flag='noselect', $use_long_format=false)
 
 mailtree_sort (&$lsub)
 
 sqimap_mailbox_list ($imap_stream, $force=false)
 
 sqimap_mailbox_list_all ($imap_stream)
 

Variables

global $boxesnew
 

Function Documentation

◆ check_is_noselect()

check_is_noselect (   $lsub_line)
Returns
bool whether this is a Noselect mailbox.

Definition at line 51 of file imap_mailbox.php.

Referenced by mail_fetch_check_noselect().

◆ find_mailbox_name()

find_mailbox_name (   $mailbox)

Definition at line 39 of file imap_mailbox.php.

References $mailbox.

Referenced by sqimap_mailbox_list(), and sqimap_mailbox_list_all().

◆ isBoxBelow()

isBoxBelow (   $subbox,
  $parentbox 
)

Check if $subbox is below the specified $parentbox

Definition at line 77 of file imap_mailbox.php.

Referenced by isDraftMailbox(), isInboxMailbox(), isSentMailbox(), isTrashMailbox(), and sqimap_mailbox_list().

◆ isDraftMailbox()

isDraftMailbox (   $box,
  $include_subs = true 
)

Detects if mailbox is a Drafts folder or subfolder of Drafts

Parameters
string$boxmailbox 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.
Returns
bool whether this is a Draft folder
Since
1.4.0

Definition at line 188 of file imap_mailbox.php.

References $draft_folder, $save_as_draft, and isBoxBelow().

Referenced by handleAsSent(), and isSpecialMailbox().

◆ isInboxMailbox()

isInboxMailbox (   $box,
  $include_subs = TRUE 
)

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

Parameters
string$boxThe mailbox name to test
boolean$include_subsIf true, subfolders of system folders are special. If false, subfolders are not special mailboxes.
Returns
boolean Whether this is the Inbox or a child thereof.
Since
1.4.22

Definition at line 144 of file imap_mailbox.php.

References isBoxBelow().

Referenced by isSpecialMailbox().

◆ isSentMailbox()

isSentMailbox (   $box,
  $include_subs = true 
)

Detects if mailbox is a Sent folder or subfolder of Sent

Parameters
string$boxmailbox 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.
Returns
bool whether this is a Sent folder
Since
1.4.0

Definition at line 173 of file imap_mailbox.php.

References $sent_folder, and isBoxBelow().

Referenced by handleAsSent(), and isSpecialMailbox().

◆ isSpecialMailbox()

isSpecialMailbox (   $box,
  $include_subs = true 
)

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.

FIXME: make $subfolders_of_inbox_are_special a configuration setting in conf.pl and config.php 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.

Parameters
string$boxmailbox 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.
Returns
boolean
Since
1.2.3

Definition at line 118 of file imap_mailbox.php.

References $ret, boolean_hook_function(), isDraftMailbox(), isInboxMailbox(), isSentMailbox(), and isTrashMailbox().

Referenced by formatMailboxName(), and sqimap_mailbox_list().

◆ isTrashMailbox()

isTrashMailbox (   $box,
  $include_subs = true 
)

Detects if mailbox is a Trash folder or subfolder of Trash

Parameters
string$boxmailbox 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.
Returns
bool whether this is a Trash folder
Since
1.4.0

Definition at line 158 of file imap_mailbox.php.

References $move_to_trash, $trash_folder, and isBoxBelow().

Referenced by isSpecialMailbox().

◆ mailtree_sort()

mailtree_sort ( $lsub)

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

Definition at line 577 of file imap_mailbox.php.

References $mailbox.

Referenced by sqimap_mailbox_list().

◆ readMailboxParent()

readMailboxParent (   $haystack,
  $needle 
)

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)

Definition at line 60 of file imap_mailbox.php.

References $ret.

Referenced by sqimap_mailbox_list_all(), and sqimap_mailbox_parse().

◆ sortSpecialMbx()

sortSpecialMbx (   $a,
  $b 
)

Definition at line 20 of file imap_mailbox.php.

◆ sqimap_mailbox_create()

sqimap_mailbox_create (   $imap_stream,
  $mailbox,
  $type 
)

◆ sqimap_mailbox_delete()

sqimap_mailbox_delete (   $imap_stream,
  $mailbox 
)

◆ sqimap_mailbox_exists()

sqimap_mailbox_exists (   $imap_stream,
  $mailbox 
)

◆ sqimap_mailbox_expunge()

sqimap_mailbox_expunge (   $imap_stream,
  $mailbox,
  $handle_errors = true,
  $id = '' 
)

◆ sqimap_mailbox_is_subscribed()

sqimap_mailbox_is_subscribed (   $imap_stream,
  $folder 
)

Determines if the user is subscribed to the folder or not

Definition at line 348 of file imap_mailbox.php.

References $imap_stream, and sqimap_mailbox_list().

Referenced by mail_fetch_check_folder(), sent_subfolders_update_sentfolder(), and sqimap_mailbox_rename().

◆ sqimap_mailbox_list()

◆ sqimap_mailbox_list_all()

sqimap_mailbox_list_all (   $imap_stream)

◆ sqimap_mailbox_option_list()

sqimap_mailbox_option_list (   $imap_stream,
  $show_selected = 0,
  $folder_skip = 0,
  $boxes = 0,
  $flag = 'noselect',
  $use_long_format = false 
)

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.

Definition at line 521 of file imap_mailbox.php.

References $boxes, $data_dir, $imap_stream, $show_selected, $username, _(), getPref(), imap_utf7_decode_local(), NULL, and sqimap_mailbox_list().

Referenced by SquirrelOption\createWidget_FolderList(), get_move_target_list(), and getMbxList().

◆ sqimap_mailbox_parse()

sqimap_mailbox_parse (   $line,
  $line_lsub 
)

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

Definition at line 427 of file imap_mailbox.php.

References $cnt, $folder_prefix, $g, $mailbox, imap_utf7_decode_local(), readMailboxParent(), and readShortMailboxName().

Referenced by sqimap_mailbox_list().

◆ sqimap_mailbox_rename()

◆ sqimap_mailbox_select()

sqimap_mailbox_select (   $imap_stream,
  $mailbox 
)

Selects a mailbox

Default UW IMAP server configuration allows to access other files on server. $imap_server_type is not checked because interface can be used with 'other' or any other server type setting. $mailbox variable can be modified in any script that uses variable from GET or POST. This code blocks all standard SquirrelMail IMAP API requests that use mailbox with full path (/etc/passwd) or with ../ characters in path (../../etc/passwd)

Definition at line 238 of file imap_mailbox.php.

References $auto_expunge, $cnt, $color, $imap_stream, $mailbox, $message, $read, _(), error_box(), SM_PATH, sprintf, sqimap_logout(), and sqimap_run_command().

Referenced by deliverMessage(), Deliver\mail(), newMail(), showMessagesForMailbox(), spam_filters(), spamcop_while_sending(), start_filters(), user_filters(), walkTreeInPostOrderCreatingFoldersUnderTrash(), and walkTreeInPreOrderEmptyTrash().

◆ sqimap_subscribe()

sqimap_subscribe (   $imap_stream,
  $mailbox 
)

Subscribes to an existing folder.

Definition at line 312 of file imap_mailbox.php.

References $imap_stream, $message, and sqimap_run_command().

Referenced by sent_subfolders_update_sentfolder(), sqimap_mailbox_create(), sqimap_mailbox_delete(), and sqimap_mailbox_rename().

◆ sqimap_unsubscribe()

sqimap_unsubscribe (   $imap_stream,
  $mailbox 
)

Unsubscribes from an existing folder

Definition at line 320 of file imap_mailbox.php.

References $imap_stream, $message, and sqimap_run_command().

Referenced by sqimap_mailbox_delete(), and sqimap_mailbox_rename().

◆ user_strcasecmp()

user_strcasecmp (   $a,
  $b 
)

Sorting function used to sort mailbox names.

  • Original patch from dave_.nosp@m.mich.nosp@m.merhu.nosp@m.izen.nosp@m.@yaho.nosp@m.o.co.nosp@m.m
  • 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 :)

Definition at line 501 of file imap_mailbox.php.

Variable Documentation

◆ $boxesnew

global $boxesnew

UTF7 support

Definition at line 16 of file imap_mailbox.php.

Referenced by sqimap_mailbox_list().