function _getAttachmentDetails(&$mime_part, $return_body = FALSE, $return_filename = FALSE, $return_cid = FALSE) { $attachments = array(); if (isset($mime_part->parts)) { for ($i = 0; $i < count($mime_part->parts); $i++) { $t = Mime_Helper::_getAttachmentDetails($mime_part->parts[$i], $return_body, $return_filename, $return_cid); $attachments = array_merge($t, $attachments); } } $content_type = strtolower(@$mime_part->ctype_primary . '/' . @$mime_part->ctype_secondary); if ($content_type == '/') { $content_type = ''; } $found = 0; // get the proper filename $mime_part_filename = @$mime_part->ctype_parameters['name']; if (empty($mime_part_filename)) { $mime_part_filename = @$mime_part->d_parameters['filename']; } // hack in order to treat inline images as normal attachments // (since Eventum does not display those embedded within the message) if (@$mime_part->ctype_primary == 'image') { // if requested, return only the details of a particular filename if ($return_filename != FALSE && $mime_part_filename != $return_filename) { return array(); } // if requested, return only the details of // a particular attachment CID. Only really needed // as hack for inline images if ($return_cid != FALSE && @$mime_part->d_parameters['content-id'] != $return_cid) { return array(); } $found = 1; } else { if (!in_array($content_type, Mime_Helper::_getInvalidContentTypes()) && in_array(@strtolower($mime_part->disposition), Mime_Helper::_getValidDispositions()) && !empty($mime_part_filename)) { // if requested, return only the details of a particular filename if ($return_filename != FALSE && $mime_part_filename != $return_filename) { return array(); } $found = 1; } } if ($found) { $t = array('filename' => $mime_part_filename, 'cid' => @$mime_part->headers['content-id'], 'filetype' => $content_type); // only include the body of the attachment when // requested to save some memory if ($return_body == TRUE) { $t['blob'] =& $mime_part->body; } $attachments[] = $t; } return $attachments; }