Description The imap_status function, which was added in PHP 3.0.4, returns the status information on a given mailbox.. imap_subscribe Syntax int imap_subscribeint imap_stream, string
Trang 1• \ \ Answered
• \ \ Flagged
• \ \ Deleted
• \ \ Draft
• \ \ Recent
imap_sort()
Syntax
array imap_sort(int imap_stream, int sort, int reverse, int flags)
Description
The imap_sort() function, which was added in PHP 3.0.3, returns an array of message headers sorted based on sort If reverse is 1, the sorting is based on
sort , but in reverse order The sort itself can be based on any one of the items in
Table 6.15
Table 6.15 Possible Sort Criteria
SORTARRIVAL Arrival date
SORTFROM Mailbox in first From address
SORTSUBJECT Message subject
SORTTO Mailbox in first To address
SORTCC Mailbox in first cc address
SORTSIZE Size of message in octets
The flags are a bit mask of one or more of the items in Table 6.16
Table 6.16 Possible Bit Mask Values
SE_UID Return UIDs instead of sequence numbers
SE_NOPREFETCH Don't prefetch searched messages
imap_status()
Syntax
object imap_status(int imap_stream, string mailbox, int flags)
Trang 2Description
The imap_status() function, which was added in PHP 3.0.4, returns the status information on a given mailbox This information is in the form of an object
Possible flags are shown and defined in Table 6.17
Table 6.17 Flags That Can Be Passed to the imap_status() Function
SA_ALL Set all the properties defined in this table
SA_MESSAGES Set status->messages to the number of messages in mailbox SA_RECENT Set status->recent to the number of recent messages in mailbox SA_UIDNEXT Set status->uidnext to the next UID to be used in mailbox
SA_UIDVALIDITY Set status->uidvalidity to a constant that changes when UIDs for
mailbox may no longer be valid
SA_UNSEEN Set status->unseen to the number of new messages in mailbox
imap_subscribe()
Syntax
int imap_subscribe(int imap_stream, string mailbox)
Description
The imap_subscribe() function enables you to subscribe to a new mailbox on the
imap_stream If successful, the function returns 1; otherwise it returns 0 on error
imap_uid()
Syntax
int imap_uid(int imap_stream, int message_num)
Description
The imap_uid() function, which was added in PHP 3.0.3, returns the UID for the message specified by message_num Because the message_num can change, this
function is often used to obtain a truly unique identifier specified by the UID
imap_undelete()
Syntax
Trang 3int imap_undelete(int imap_stream, int message_num)
Description
The imap_undelete() function removes the deletion flag from the specified
message_num If the function is successful, it will return 1; otherwise, 0 will be returned in the instance of an error
Note
In some releases of PHP 3, you might find that this function does not appear to work If so, try passing a third, empty parameter to the function
imap_unsubscribe()
Syntax
int imap_unsubscribe(int imap_stream, string mailbox)
Description
The imap_unsubscribe() function will unsubscribe to mailbox If the function is
successful, it will return 1; otherwise, 0 will be returned in the instance of an error
imap_utf7_decode()
Syntax
string imap_utf7_decode(string text)
Description
The imap_utf7_decode() function, which was added in PHP 3.0.15, decodes the modified UTF-7 text and returns 8-bit data If the text passed was not valid, then false will be returned You can find more information on the modified UTF-7 encoding
in Section 5.1.3 of the Request For Comments (RFC) 2060, which can be found at http://www.ietf.org/rfc/rfc2060.txt
imap_utf7_encode()
Trang 4Syntax
string imap_utf7_encode(string text)
Description
The imap_utf7_encode() function, which was added in PHP 3.0.15, coverts 8-bit data, specified by text , into modified UTF-7 text If the text passed was not valid,
false will be returned You can find more information on the modified UTF-7 encoding
in of the Request For Comments (RFC) 2060, which can be found at http://www.ietf.org/rfc/rfc2060.txt
imap_utf8()
Syntax
string imap_utf8(string text)
Description
The imap_utf8() function, which was added in PHP 3.0.13, converts text to UTF-8,
as defined in the Request For Comments (RFC) 2044 You can read more about
UTF-8 at http://www.ietf.org/rfc/rfc2044.txt
LDAP
The Lightweight Directory Access Protocol (LDAP) is used to locate people, organizations, and resources, such as files, on a network These directory servers are
a special kind of database that holds its information in a tree-like structure
Unlike files that are stored on a filesystem and referenced by a path, LDAP entries are referenced by their distinguished name, or DN For instance, the following might
be an entry:
cn=John Doe,o=PHP Programmers Corp,st=NC,countryname=USA
Because the sequence is read from right to left, you see the tree appear as follows:
• countryname—Name of the country in which John works
• st—Name of the state John works in (assuming that he works in the United States, of course)
• o—Name of the company for which John works
Trang 5• cn—Full name of John
This, of course, enables you to sort by the values easily, without entries losing their place in the overall structure, or tree You can read the Request For Comments (RFC)
at http://www.ietf.org/rfc/rfc1959.txt
ldap_add()
Syntax
int ldap_add(int ldap_pointer, string distinguished_name, array fields)
Description
The ldap_add() function adds additional fields to the entry defined by
distinguished_name If the function was successful, it will return 1; otherwise, it will return 0 on error
ldap_bind()
Syntax
int ldap_bind(int ldap_pointer [, string rdn [, string password]])
Description
The ldap_bind() function binds the directory to a specified relative distinguished name (RDN) and password If rdn and password are not passed, an anonymous bind
is attempted If the function is successful, 1 is returned; otherwise, an error is returned
ldap_close()
Syntax
int ldap_close(int ldap_pointer)
Description
The ldap_close() function closes a link to a specified LDAP server If successful, 1 is returned; otherwise, an error is returned