diff --git a/api/pipe.php b/api/pipe.php index a35d2af2099ec60ae77edece8a1b2d0416f42773..2c43e56814f959b3db8dde643750ac64c8d4d20d 100644 --- a/api/pipe.php +++ b/api/pipe.php @@ -100,8 +100,6 @@ if(preg_match ("[[#][0-9]{1,10}]",$var['subject'],$regs)) { $errors=array(); $msgid=0; if(!$ticket){ //New tickets... - # Apply filters against the new ticket - $ef = new EmailFilter($var); $ef->apply($var); $ticket=Ticket::create($var,$errors,'email'); if(!is_object($ticket) || $errors){ api_exit(EX_DATAERR,'Ticket create Failed '.implode("\n",$errors)."\n\n"); @@ -118,14 +116,10 @@ if(!$ticket){ //New tickets... } } //Ticket created...save attachments if enabled. -if($cfg->allowEmailAttachments()) { - if($attachments=$parser->getAttachments()){ - //print_r($attachments); - foreach($attachments as $k=>$attachment){ - if($attachment['filename'] && $cfg->canUploadFileType($attachment['filename'])) { - $ticket->saveAttachment(array('name' => $attachment['filename'], 'data' => $attachment['body']),$msgid,'M'); - } - } +if($cfg->allowEmailAttachments() && ($attachments=$parser->getAttachments())) { + foreach($attachments as $k=>$attachment) { + if($attachment['filename'] && $ost->isFileTypeAllowed($attachment['filename'])) + $ticket->saveAttachment(array('name' => $attachment['filename'], 'data' => $attachment['body']), $msgid, 'M'); } } api_exit(EX_SUCCESS); diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index 248a6ba81b6f52d9397414c1a08db92e5b88336e..fb17d8a26ac719854a683ba778c287321ddefea9 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -323,11 +323,13 @@ class MailFetcher { } function saveAttachments($ticket,$mid,$part,$index=0) { - global $cfg; + global $ost; if($part && $part->ifdparameters && ($filename=$part->dparameters[0]->value)){ //attachment $index=$index?$index:1; - if($ticket && $cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) { + if($ticket + && $ost->isFileTypeAllowed($filename) + && $ost->getConfig()->getMaxFileSize()>=$part->bytes) { //extract the attachments...and do the magic. $data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$index)); $ticket->saveAttachment(array('name'=>$filename, 'data'=>$data),$ticket->getLastMsgId(),'M');