DomCI : Update all the PHPDoc
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3279 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
223
imap.php
223
imap.php
@@ -19,7 +19,18 @@ class imap
|
||||
private static $instance = array ();
|
||||
|
||||
/** The constructor
|
||||
The IMAP standard port is 143, but SSL tunnelled is 993 */
|
||||
* The IMAP standard port is 143, but SSL tunnelled is 993
|
||||
* @param string|null $imapserver The IMAP server to connect. Localhost is
|
||||
* used if not defined
|
||||
* @param integer|null $imapport The IMAP port to connect. 143 is used if not
|
||||
* defined
|
||||
* @param string|null $username The username to connect
|
||||
* @param string|null $password The password to connect
|
||||
* @param boolean|null $imapssl Use the SSL connection layer. Not used by
|
||||
* default
|
||||
* @param boolean|null $imapcertvalidate Check the certificates if using the
|
||||
* SSL connection. True by default
|
||||
*/
|
||||
public function __construct ($imapserver = "localhost", $imapport = 143,
|
||||
$username = null, $password = null,
|
||||
$imapssl = false, $imapcertvalidate = true)
|
||||
@@ -29,8 +40,19 @@ class imap
|
||||
}
|
||||
|
||||
/** The connect can be used when extends the imap class. The constructor can
|
||||
be override by the child class.
|
||||
The IMAP standard port is 143, but SSL tunnelled is 993 */
|
||||
* be override by the child class.
|
||||
* The IMAP standard port is 143, but SSL tunnelled is 993
|
||||
* @param string|null $imapserver The IMAP server to connect. Localhost is
|
||||
* used if not defined
|
||||
* @param integer|null $imapport The IMAP port to connect. 143 is used if not
|
||||
* defined
|
||||
* @param string|null $username The username to connect
|
||||
* @param string|null $password The password to connect
|
||||
* @param boolean|null $imapssl Use the SSL connection layer. Not used by
|
||||
* default
|
||||
* @param boolean|null $imapcertvalidate Check the certificates if using the
|
||||
* SSL connection. True by default
|
||||
*/
|
||||
public function connect ($imapserver = "localhost", $imapport = 143,
|
||||
$username = null, $password = null,
|
||||
$imapssl = false, $imapcertvalidate = true)
|
||||
@@ -75,8 +97,9 @@ class imap
|
||||
/// FOLDERS ///
|
||||
///////////////////
|
||||
/** Return an array of the existing folders. The sub-folders are with slash
|
||||
separator
|
||||
The names of folders are converted in UTF-8 */
|
||||
* separator
|
||||
* The names of folders are converted in UTF-8
|
||||
*/
|
||||
public function foldersList ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -87,7 +110,8 @@ class imap
|
||||
}
|
||||
|
||||
/** Return an array with folder name in key and attributes in value. The
|
||||
attributes allow to see if there is new mails in folders */
|
||||
* attributes allow to see if there is new mails in folders
|
||||
*/
|
||||
public function foldersListWithAttr ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -107,7 +131,9 @@ class imap
|
||||
}
|
||||
|
||||
/** Change to provided folder
|
||||
The folder name must be in UTF-8. The folder must be absolute */
|
||||
* The folder name must be in UTF-8. The folder must be absolute
|
||||
* @param string $folder Change to the provided folder
|
||||
*/
|
||||
public function changeFolder ($folder)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -124,7 +150,8 @@ class imap
|
||||
return $rc;
|
||||
}
|
||||
|
||||
/** Return the current folder in UTF-8 */
|
||||
/** Return the current folder in UTF-8
|
||||
*/
|
||||
public function getFolder ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -132,7 +159,9 @@ class imap
|
||||
return $this->curDir;
|
||||
}
|
||||
|
||||
/** Create a new folder, provided in UTF-8. The folder must be absolute */
|
||||
/** Create a new folder, provided in UTF-8. The folder must be absolute
|
||||
* @param string $folder Create the provided folder
|
||||
*/
|
||||
public function createFolder ($folder)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -145,6 +174,7 @@ class imap
|
||||
}
|
||||
|
||||
/** Delete an existing folder provided in UTF-8. The folder must be absolute
|
||||
* @param string $folder The folder to delete
|
||||
*/
|
||||
public function deleteFolder ($folder)
|
||||
{
|
||||
@@ -158,7 +188,8 @@ class imap
|
||||
}
|
||||
|
||||
/** Return the list of the folders substcribed by the user. The folders are
|
||||
in UTF-8 */
|
||||
* in UTF-8
|
||||
*/
|
||||
public function getSubscribe ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -178,7 +209,10 @@ class imap
|
||||
return $res;
|
||||
}
|
||||
|
||||
/** Add a subscription for a folder. The folder must be in UTF-8 */
|
||||
/** Add a subscription for a folder. The folder must be in UTF-8
|
||||
* @param string $folder Add the provided folder to the subscription file of
|
||||
* the user
|
||||
*/
|
||||
public function addSubscribe ($folder)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -188,7 +222,10 @@ class imap
|
||||
$this->mailbox.$folder);
|
||||
}
|
||||
|
||||
/** Remove a subscription for a folder. The folder must be in UTF-8 */
|
||||
/** Remove a subscription for a folder. The folder must be in UTF-8
|
||||
* @param string $folder Remove the provided folder to the subscription file
|
||||
* of the user
|
||||
*/
|
||||
public function delSubscribe ($folder)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -199,15 +236,17 @@ class imap
|
||||
}
|
||||
|
||||
/** Return the information concerning a folder. It return an object with the
|
||||
following properties :
|
||||
Date date of last change (current datetime)
|
||||
Driver driver
|
||||
Mailbox name of the mailbox
|
||||
Nmsgs number of messages
|
||||
Recent number of recent messages
|
||||
Unread number of unread messages
|
||||
Deleted number of deleted messages
|
||||
Size mailbox size */
|
||||
* following properties :
|
||||
* Date date of last change (current datetime)
|
||||
* Driver driver
|
||||
* Mailbox name of the mailbox
|
||||
* Nmsgs number of messages
|
||||
* Recent number of recent messages
|
||||
* Unread number of unread messages
|
||||
* Deleted number of deleted messages
|
||||
* Size mailbox size
|
||||
* @param string $folder The folder to get the informations
|
||||
*/
|
||||
public function getFolderInfo ($folder)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -225,6 +264,9 @@ class imap
|
||||
/// LIST MAILS ///
|
||||
//////////////////////
|
||||
/** Return an array of mailHeaders order by $field and by order ASC or DESC
|
||||
* @param array $mailHeaders The headers to sort
|
||||
* @param string $field The field to examine
|
||||
* @param boolean|null $orderAsc The order of sorting. Asc if not defined
|
||||
*/
|
||||
public function imapSortMail ($mailHeaders, $field, $orderAsc = TRUE)
|
||||
{
|
||||
@@ -249,12 +291,16 @@ class imap
|
||||
}
|
||||
|
||||
/** Fetch the headers for all messages in the current folder sorted by date
|
||||
Return an array of mail object containing information like the subject,
|
||||
the date, if the message is already read (recent), answered...
|
||||
(see http://www.php.net/manual/en/function.imap-fetch-overview.php)
|
||||
If the $from is negative, take the LAST $from mails
|
||||
If from is zero, it's value is override to 1
|
||||
For information, takes 0.4s to select 30 mails on 1552 **/
|
||||
* Return an array of mail object containing information like the subject,
|
||||
* the date, if the message is already read (recent), answered...
|
||||
* (see http://www.php.net/manual/en/function.imap-fetch-overview.php)
|
||||
* If the $from is negative, take the LAST $from mails
|
||||
* If from is zero, it's value is override to 1
|
||||
* For information, takes 0.4s to select 30 mails on 1552
|
||||
* @param integer|null $from The selector of the mails. 1 if not defined
|
||||
* @param integer|null $nbmails The number of mails returned by the method
|
||||
* 30 if not defined
|
||||
**/
|
||||
public function mailsDate ($from = 1, $nbmails = 30)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -301,7 +347,8 @@ class imap
|
||||
}
|
||||
|
||||
/** Return all the mails numbers order by thread in an array.
|
||||
[] => array ("msgno"=>msgno, "depth"=>depth) */
|
||||
* [] => array ("msgno"=>msgno, "depth"=>depth)
|
||||
*/
|
||||
public function mailsThread ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -331,7 +378,8 @@ class imap
|
||||
return $thread;
|
||||
}
|
||||
|
||||
/** Send back the number of mails in the mailbox */
|
||||
/** Send back the number of mails in the mailbox
|
||||
*/
|
||||
public function mailsNumber ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -341,7 +389,9 @@ class imap
|
||||
return $MC->Nmsgs;
|
||||
}
|
||||
|
||||
/** Return an array containing the msgno corresponding to the criteria */
|
||||
/** Return an array containing the msgno corresponding to the criteria
|
||||
* @param string $criteria The criteria to use for the IMAP search
|
||||
*/
|
||||
public function mailsSearch ($criteria)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -351,8 +401,11 @@ class imap
|
||||
}
|
||||
|
||||
/** Move the mail provided in the $folder in UTF-8.
|
||||
If $msgno is an array, all the mails with the contain msgno are deleted
|
||||
Expunge automatically the current folder to remove the old emails */
|
||||
* If $msgno is an array, all the mails with the contain msgno are deleted
|
||||
* Expunge automatically the current folder to remove the old emails
|
||||
* @param integer|array $msgno The message number(s) to copy
|
||||
* @param string $folder The destination folder of the move. Must exists
|
||||
*/
|
||||
public function mailMove ($msgno, $folder)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -372,7 +425,10 @@ class imap
|
||||
}
|
||||
|
||||
/** Copy the mail provided in the $folder in UTF-8.
|
||||
If $msgno is an array, all the mails with the contain msgno are copied */
|
||||
* If $msgno is an array, all the mails with the contain msgno are copied
|
||||
* @param integer|array $msgno The message number(s) to copy
|
||||
* @param string $folder The destination folder of the copy. Must exists
|
||||
*/
|
||||
public function mailCopy ($msgno, $folder)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -390,7 +446,8 @@ class imap
|
||||
}
|
||||
|
||||
/** Expunge the mailbox. If the autoexpunge is activated, it is normally not
|
||||
needed */
|
||||
* needed
|
||||
*/
|
||||
public function expunge ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -402,7 +459,9 @@ class imap
|
||||
/////////////////////////////
|
||||
/// GET/SET/DEL EMAIL ///
|
||||
/////////////////////////////
|
||||
/** Get an existing email in the current folder in raw format */
|
||||
/** Get an existing email in the current folder in raw format
|
||||
* @param integer $msgno The message number to examine
|
||||
*/
|
||||
public function getEmailRaw ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -418,7 +477,9 @@ class imap
|
||||
return $content;
|
||||
}
|
||||
|
||||
/** Get the headers of the email (in raw format) */
|
||||
/** Get the headers of the email (in raw format)
|
||||
* @param integer $msgno The message number to examine
|
||||
*/
|
||||
public function getEmailHeadersRaw ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -433,7 +494,9 @@ class imap
|
||||
return $content;
|
||||
}
|
||||
|
||||
/** Get all the body (and attached files) of an email in raw format */
|
||||
/** Get all the body (and attached files) of an email in raw format
|
||||
* @param integer $msgno The message number to examine
|
||||
*/
|
||||
public function getEmailBodyRaw ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -448,7 +511,9 @@ class imap
|
||||
return $content;
|
||||
}
|
||||
|
||||
/** Return email structure of the body */
|
||||
/** Return email structure of the body
|
||||
* @param integer $msgno The message number to examine
|
||||
*/
|
||||
public function getStructure ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -463,7 +528,9 @@ class imap
|
||||
return $structure;
|
||||
}
|
||||
|
||||
/** Return the structure of the mail body with the associated content */
|
||||
/** Return the structure of the mail body with the associated content
|
||||
* @param integer $msgno The message number to examine
|
||||
*/
|
||||
public function getStructureWithContent ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -591,9 +658,12 @@ class imap
|
||||
}
|
||||
|
||||
/** Return the content of a part of the mail body defined in the structure in
|
||||
an object, with the associated mimetype, the parameters like the charset
|
||||
if they are defined, the number of lines associated to this part in the
|
||||
mail and some other info */
|
||||
* an object, with the associated mimetype, the parameters like the charset
|
||||
* if they are defined, the number of lines associated to this part in the
|
||||
* mail and some other info
|
||||
* @param integer $msgno The message number to examine
|
||||
* @param integer $part The message part to get
|
||||
*/
|
||||
public function getStructureContent ($msgno, $part)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -605,7 +675,9 @@ class imap
|
||||
}
|
||||
|
||||
/** Return the part identifiers of the structure of the mail body. To be used
|
||||
in getStructureContent */
|
||||
* in getStructureContent
|
||||
* @param integer $msgno The message number to examine
|
||||
*/
|
||||
public function getStructureParts ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -617,9 +689,11 @@ class imap
|
||||
}
|
||||
|
||||
/** Delete all the mailIDs (msgno) provided in an array or a single mail if
|
||||
$msgno is not an array
|
||||
DO NOT MOVE THE MAIL IN TRASH, DESTROY THE MAIL REALLY
|
||||
Expunge the mails at the end of the operation */
|
||||
* $msgno is not an array
|
||||
* DO NOT MOVE THE MAIL IN TRASH, DESTROY THE MAIL REALLY
|
||||
* Expunge the mails at the end of the operation
|
||||
* @param array|integer $msgno The message number(s) to remove
|
||||
*/
|
||||
public function mailsDel ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -637,8 +711,10 @@ class imap
|
||||
}
|
||||
|
||||
/** Add a new mail in the current folder. The content must be a string
|
||||
containing all the mail (header and body). If the content is invalid, the
|
||||
directory listing can provide erroneous data */
|
||||
* containing all the mail (header and body). If the content is invalid, the
|
||||
* directory listing can provide erroneous data
|
||||
* @param string $content the content of the mail to add
|
||||
*/
|
||||
public function mailAdd ($content)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -657,7 +733,8 @@ class imap
|
||||
/////////////////
|
||||
/// QUOTA ///
|
||||
/////////////////
|
||||
/** Return the quota used by the user in Mo */
|
||||
/** Return the quota used by the user in Mo
|
||||
*/
|
||||
public function getQuota ()
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -675,13 +752,16 @@ class imap
|
||||
/// FLAGS ///
|
||||
/////////////////
|
||||
/** Set the flags of the msgno. If msgno is an array, the flags will be write
|
||||
on the list of mails. The others flags of the email are not modified.
|
||||
The flags must be an array containing :
|
||||
\Seen Message has been read
|
||||
\Answered Message has been answered
|
||||
\Flagged Message is "flagged" for urgent/special attention
|
||||
\Deleted Message is "deleted" for removal by later EXPUNGE
|
||||
\Draft Message has not completed composition (marked as a draft). */
|
||||
* on the list of mails. The others flags of the email are not modified.
|
||||
* The flags must be an array containing :
|
||||
* \Seen Message has been read
|
||||
* \Answered Message has been answered
|
||||
* \Flagged Message is "flagged" for urgent/special attention
|
||||
* \Deleted Message is "deleted" for removal by later EXPUNGE
|
||||
* \Draft Message has not completed composition (marked as a draft).
|
||||
* @param integer|array $msgno The messages number(s) to add the flags
|
||||
* @param array $flags The flags to add
|
||||
*/
|
||||
public function setFlag ($msgno, $flags)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -698,14 +778,17 @@ class imap
|
||||
}
|
||||
|
||||
/** Unset the flags of the msgno. If msgno is an array, the flags will be
|
||||
write on the list of mails. The others flags of the email are not
|
||||
modified.
|
||||
The flags must be an array containing :
|
||||
\Seen Message has been read
|
||||
\Answered Message has been answered
|
||||
\Flagged Message is "flagged" for urgent/special attention
|
||||
\Deleted Message is "deleted" for removal by later EXPUNGE
|
||||
\Draft Message has not completed composition (marked as a draft). */
|
||||
* write on the list of mails. The others flags of the email are not
|
||||
* modified.
|
||||
* The flags must be an array containing :
|
||||
* \Seen Message has been read
|
||||
* \Answered Message has been answered
|
||||
* \Flagged Message is "flagged" for urgent/special attention
|
||||
* \Deleted Message is "deleted" for removal by later EXPUNGE
|
||||
* \Draft Message has not completed composition (marked as a draft).
|
||||
* @param integer|array $msgno The messages number(s) to remove the flags
|
||||
* @param array $flags The flags to remove
|
||||
*/
|
||||
public function unsetFlag ($msgno, $flags)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -722,8 +805,10 @@ class imap
|
||||
}
|
||||
|
||||
/** Mark mail(s) as read.
|
||||
If msgno is an array, a list of mails will be modified.
|
||||
If msgno is an integer, only one mail will be modified */
|
||||
* If msgno is an array, a list of mails will be modified.
|
||||
* If msgno is an integer, only one mail will be modified
|
||||
* @param integer|array $msgno The messages number(s) to mark as read
|
||||
*/
|
||||
public function markMailAsRead ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
@@ -740,8 +825,10 @@ class imap
|
||||
}
|
||||
|
||||
/** Mark mail(s) as unread.
|
||||
If msgno is an array, a list of mails will be modified.
|
||||
If msgno is an integer, only one mail will be modified */
|
||||
* If msgno is an array, a list of mails will be modified.
|
||||
* If msgno is an integer, only one mail will be modified
|
||||
* @param integer|array $msgno The messages number(s) to mark as unread
|
||||
*/
|
||||
public function markMailAsUnread ($msgno)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
|
||||
Reference in New Issue
Block a user