PHP Класс MailCollector, glpi

Наследование: extends CommonDBTM
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$addtobody Message to add to body to build ticket
$altfiles structure used to store alt files attached to a mail
$body_converted Body converted
$charset working charset of the mail
$dohistory
$fetch_emails Number of fetched emails
$files structure used to store files attached to a mail
$filesize_max Max size for attached files
$marubox IMAP / POP connection
$maxfetch_emails Maximum number of emails to fetch : default to 10
$mid ID of the current message
$rightname
$structure structure used to store the mail structure
$tags Tag used to recognize embedded images of a mail

Открытые методы

Метод Описание
buildTicket ( $i, $options = [] ) : ticket function buildTicket - Builds,and returns, the major structure of the ticket to be entered.
canCreate ( )
canPurge ( )
cleanDBonPurge ( )
cleanMailContent ( $string, $striptags = true ) : cleaned Clean mail content : HTML + XSS + blacklisted content
close_mailbox ( ) Close The Mail Box
collect ( $mailgateID, $display ) : if Constructor
connect ( ) Connect to the mail box
cronInfo ( $name )
cronMailgate ( $task ) : -1 Cron action on mailgate : retrieve mail and create tickets
cronMailgateError ( $task ) Send Alarms on mailgate errors
decodeMimeString ( $mimeStr, $inputCharset = 'utf-8', $targetCharset = 'utf-8', $fallbackCharset = 'iso-8859-1' ) : decoded Receive a string with a mail header and returns it decoded to a specified charset.
defineTabs ( $options = [] )
deleteMails ( $mid, $folder = '' ) : boolean Delete mail from that mail box
deleteOrImportSeveralEmails ( $emails_ids = [], $action, $entity )
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
getAdditionalMenuOptions ( )
getAdditionnalHeaders ( $mid )
getAttached ( $mid, $path, $maxsize ) : array Public function : get attached documents in a mail
getBody ( $mid ) Get The actual mail content from this mail
getHeaders ( $mid ) : Return This function is use full to Get Header info from particular mail
getNumberOfActiveMailCollectors ( )
getNumberOfMailCollectors ( )
getRecursiveAttached ( $mid, $path, $maxsize, $structure, $part = "" ) Private function : Recursivly get attached documents
getSearchOptions ( )
getStructure ( $mid ) get the message structure if not already retrieved
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTotalMails ( ) : an Used to get total unread mail from that mailbox
getTypeName ( $nb )
get_mime_type ( &$structure ) : mime Get Mime type Internal Private Use
get_part ( $stream, $msg_number, $mime_type, $structure = false, $part_number = false ) : data Get Part Of Message Internal Private Use
mb_list_lowerencodings ( ) return supported encodings in lowercase.
post_getEmpty ( )
prepareInputForAdd ( $input )
prepareInputForUpdate ( $input )
sendMailRefusedResponse ( $to = '', $subject = '' )
showForm ( $ID, $options = [] ) : boolean Print the mailgate form
showGetMessageForm ( $ID )
showMaxFilesize ( $name, $value )
showSystemInformations ( $width )
textCleaner ( $text ) : clean function textCleaner - Strip out unwanted/unprintable characters from the subject.
title ( )
unsetUndisclosedFields ( &$fields )

Приватные методы

Метод Описание
getDecodedFetchbody ( $structure, $mid, $part ) : boolean | string Summary of getDecodedFetchbody used to get decoded part from email

Описание методов

buildTicket() публичный Метод

function buildTicket - Builds,and returns, the major structure of the ticket to be entered.
public buildTicket ( $i, $options = [] ) : ticket
$i mail ID
$options array of possible options
Результат ticket fields array

canCreate() статический публичный Метод

static public canCreate ( )

canPurge() статический публичный Метод

static public canPurge ( )

cleanDBonPurge() публичный Метод

public cleanDBonPurge ( )

cleanMailContent() публичный Метод

Clean mail content : HTML + XSS + blacklisted content
public cleanMailContent ( $string, $striptags = true ) : cleaned
$string text to clean
$striptags remove html tags
Результат cleaned text

close_mailbox() публичный Метод

Close The Mail Box
public close_mailbox ( )

collect() публичный Метод

Constructor
public collect ( $mailgateID, $display ) : if
$mailgateID ID of the mailgate
$display display messages in MessageAfterRedirect or just return error (default 0=)
Результат if $display = false return messages result string

connect() публичный Метод

Connect to the mail box
public connect ( )

cronInfo() статический публичный Метод

static public cronInfo ( $name )
$name

cronMailgate() статический публичный Метод

Cron action on mailgate : retrieve mail and create tickets
static public cronMailgate ( $task ) : -1
$task
Результат -1

cronMailgateError() статический публичный Метод

Send Alarms on mailgate errors
static public cronMailgateError ( $task )
$task for log

decodeMimeString() публичный Метод

If the charset specified into a piece of text from header isn't supported by "mb", the "fallbackCharset" will be used to try to decode it.
public decodeMimeString ( $mimeStr, $inputCharset = 'utf-8', $targetCharset = 'utf-8', $fallbackCharset = 'iso-8859-1' ) : decoded
$mimeStr mime header string
$inputCharset input charset (default 'utf-8')
$targetCharset target charset (default 'utf-8')
$fallbackCharset charset used if input charset not supported by mb (default 'iso-8859-1')
Результат decoded string

defineTabs() публичный Метод

См. также: CommonGLPI::defineTabs()
public defineTabs ( $options = [] )

deleteMails() публичный Метод

Delete mail from that mail box
public deleteMails ( $mid, $folder = '' ) : boolean
$mid String mail Id
$folder String folder to move (delete if empty) (default '')
Результат boolean

deleteOrImportSeveralEmails() публичный Метод

public deleteOrImportSeveralEmails ( $emails_ids = [], $action, $entity )
$emails_ids array
$action (default 0)
$entity (default 0)

displayTabContentForItem() статический публичный Метод

static public displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
$item CommonGLPI CommonGLPI object
$tabnum (default 1
$withtemplate (default 0)

getAdditionalMenuOptions() статический публичный Метод

См. также: CommonGLPI::getAdditionalMenuOptions()
static public getAdditionalMenuOptions ( )

getAdditionnalHeaders() публичный Метод

public getAdditionnalHeaders ( $mid )
$mid

getAttached() публичный Метод

Public function : get attached documents in a mail
public getAttached ( $mid, $path, $maxsize ) : array
$mid message id
$path temporary path
$maxsize of document to be retrieved
Результат array containing extracted filenames in file/_tmp

getBody() публичный Метод

Get The actual mail content from this mail
public getBody ( $mid )
$mid : mail Id

getHeaders() публичный Метод

This function is use full to Get Header info from particular mail
public getHeaders ( $mid ) : Return
$mid = Mail Id of a Mailbox
Результат Return Associative array with following keys subject => Subject of Mail to => To Address of that mail toOth => Other To address of mail toNameOth => To Name of Mail from => From address of mail fromName => Form Name of Mail

getNumberOfActiveMailCollectors() статический публичный Метод

getNumberOfMailCollectors() статический публичный Метод

static public getNumberOfMailCollectors ( )

getRecursiveAttached() публичный Метод

Private function : Recursivly get attached documents
public getRecursiveAttached ( $mid, $path, $maxsize, $structure, $part = "" )
$mid message id
$path temporary path
$maxsize of document to be retrieved
$structure of the message or part
$part part for recursive Result is stored in $this->files

getSearchOptions() публичный Метод

public getSearchOptions ( )

getStructure() публичный Метод

get the message structure if not already retrieved
public getStructure ( $mid )
$mid : Message ID.

getTabNameForItem() публичный Метод

См. также: CommonGLPI::getTabNameForItem()
public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTotalMails() публичный Метод

Used to get total unread mail from that mailbox
public getTotalMails ( ) : an
Результат an integer (Total Mail)

getTypeName() статический публичный Метод

static public getTypeName ( $nb )

get_mime_type() публичный Метод

Get Mime type Internal Private Use
public get_mime_type ( &$structure ) : mime
$structure mail structure
Результат mime type

get_part() публичный Метод

Get Part Of Message Internal Private Use
public get_part ( $stream, $msg_number, $mime_type, $structure = false, $part_number = false ) : data
$stream An IMAP stream returned by imap_open
$msg_number The message number
$mime_type mime type of the mail
$structure structure of the mail (false by default)
$part_number The part number (false by default)
Результат data of false if error

mb_list_lowerencodings() публичный Метод

return supported encodings in lowercase.

post_getEmpty() публичный Метод

public post_getEmpty ( )

prepareInputForAdd() публичный Метод

См. также: CommonDBTM::prepareInputForAdd()
public prepareInputForAdd ( $input )

prepareInputForUpdate() публичный Метод

См. также: CommonDBTM::prepareInputForUpdate()
public prepareInputForUpdate ( $input )

sendMailRefusedResponse() публичный Метод

public sendMailRefusedResponse ( $to = '', $subject = '' )
$to (default '')
$subject (default '')

showForm() публичный Метод

Print the mailgate form
public showForm ( $ID, $options = [] ) : boolean
$ID integer Id of the item to print
$options array - target filename : where to go when done.
Результат boolean item found

showGetMessageForm() публичный Метод

public showGetMessageForm ( $ID )
$ID

showMaxFilesize() статический публичный Метод

static public showMaxFilesize ( $name, $value )
$name
$value (default 0)

showSystemInformations() публичный Метод

public showSystemInformations ( $width )
$width

textCleaner() публичный Метод

function textCleaner - Strip out unwanted/unprintable characters from the subject.
public textCleaner ( $text ) : clean
$text text to clean
Результат clean text

title() публичный Метод

public title ( )

unsetUndisclosedFields() публичный статический Метод

public static unsetUndisclosedFields ( &$fields )

Описание свойств

$addtobody публичное свойство

Message to add to body to build ticket
public $addtobody

$altfiles публичное свойство

structure used to store alt files attached to a mail
public $altfiles

$body_converted публичное свойство

Body converted
public $body_converted

$charset публичное свойство

working charset of the mail
public $charset

$dohistory публичное свойство

public $dohistory

$fetch_emails публичное свойство

Number of fetched emails
public $fetch_emails

$files публичное свойство

structure used to store files attached to a mail
public $files

$filesize_max публичное свойство

Max size for attached files
public $filesize_max

$marubox публичное свойство

IMAP / POP connection
public $marubox

$maxfetch_emails публичное свойство

Maximum number of emails to fetch : default to 10
public $maxfetch_emails

$mid публичное свойство

ID of the current message
public $mid

$rightname статическое публичное свойство

static public $rightname

$structure публичное свойство

structure used to store the mail structure
public $structure

$tags публичное свойство

Tag used to recognize embedded images of a mail
public $tags