Пример #1
0
function MsgParseBody($struct)
{
    global $filelist;
    global $errors;
    $ctype_p = strtolower(trim($struct->ctype_primary));
    $ctype_s = strtolower(trim($struct->ctype_secondary));
    switch ($ctype_p) {
        case "multipart":
            switch ($ctype_s) {
                case "alternative":
                    // Handle multipart/alternative parts
                    $alt_entity = FindMultiAlt($struct->parts);
                    // Ignore if we return false NEEDS WORK
                    if ($alt_entity) {
                        MsgParseBody($alt_entity);
                    }
                    break;
                case "related":
                    // Handle multipart/related parts
                    $rel_entities = FindMultiRel($struct);
                    foreach ($rel_entities as $ent) {
                        MsgParseBody($ent);
                    }
                    break;
                default:
                    // Probably multipart/mixed here
                    // Recursively process nested mime entities
                    if (is_array($struct->parts) || is_object($struct->parts)) {
                        foreach ($struct->parts as $cur_part) {
                            MsgParseBody($cur_part);
                        }
                    } else {
                        $errors['Invalid or Corrupt MIME Detected.'] = true;
                    }
                    break;
            }
            break;
        case "text":
            // Do not display attached text types
            if (property_exists($struct, "d_parameters")) {
                if ($attachment = $struct->d_parameters['filename'] or $attachment = $struct->d_parameters['name']) {
                    array_push($filelist, $attachment);
                    break;
                }
            }
            switch ($ctype_s) {
                // Plain text
                case "plain":
                    MsgBodyPlainText($struct->body);
                    break;
                    // HTML text
                // HTML text
                case "html":
                    MsgBodyHtmlText($struct->body);
                    break;
                    // Text type we do not support
                // Text type we do not support
                default:
                    $errors['Portions of text could not be displayed'] = true;
            }
            break;
        default:
            // Save the listed filename or notify the
            // reader that this mail is not displayed completely
            $attachment = $struct->d_parameters['filename'];
            $attachment ? array_push($filelist, $attachment) : ($errors['Unsupported MIME objects present'] = true);
    }
}
Пример #2
0
/**
* Include Template class
*/
include_once 'lib/Template.class.php';
/**
* Include control panel-specific output functions
*/
include_once 'templates/common.template.php';
/**
* Include viewmail template class
*/
include_once 'templates/viewmail.template.php';
/**
* Include MailEngine class
*/
include_once 'lib/MailEngine.class.php';
if (!Auth::is_logged_in()) {
    Auth::print_login_msg();
    // Check if user is logged in
}
$t = new Template(translate('ViewOriginal'));
$t->printHTMLHeader();
$t->startMain();
//$mail_id = CmnFns::get_mail_id();
$mail_id = CmnFns::getGlobalVar('mail_id', GET);
$recip_email = CmnFns::getGlobalVar('recip_email', GET);
$m = new MailEngine($mail_id, $recip_email);
MsgOriginalOptions();
MsgBodyPlainText($m->raw);
$t->endMain();
$t->printHTMLFooter();