Пример #1
0
function display_parts($structure)
{
    global $lang;
    global $smarty;
    $primary = strtolower(trim($structure->ctype_primary));
    $secondary = strtolower(trim($structure->ctype_secondary));
    $ctype = $primary . "/" . $secondary;
    $messagepart = "";
    $message_charset = get_charset($structure);
    switch ($primary) {
        case "multipart":
            if (!array_key_exists('parts', $structure)) {
                $ret = "[" . $lang['text_invalid'] . "]<br>";
                break;
            }
            // Recursively decode each of the sub-parts of this
            // part in turn.
            foreach ($structure->parts as $part) {
                $messagepart .= display_parts($part);
            }
            $smarty->assign("messagepart", $messagepart);
            $smarty->assign("contenttype", $ctype);
            $ret = $smarty->fetch("view-message.tpl");
            break;
        case "text":
            switch ($secondary) {
                // Simple text, just word-wrap it to keep it to
                // a sane width.
                case "plain":
                    $messagepart = "<pre>" . sanitize_html(wordwrap(iconv($message_charset, 'utf-8', $structure->body), 70)) . "</pre>";
                    $smarty->assign("messagepart", $messagepart);
                    $smarty->assign("contenttype", $ctype);
                    $ret = $smarty->fetch("view-message.tpl");
                    break;
                    // HTML content, clean it up a bit and display it.
                // HTML content, clean it up a bit and display it.
                case "html":
                    $messagepart = sanitize_html(iconv($message_charset, 'utf-8', $structure->body));
                    $smarty->assign("messagepart", $messagepart);
                    $smarty->assign("contenttype", $ctype);
                    $ret = $smarty->fetch("view-message.tpl");
                    break;
                    // Some other odd text format we don't support, ignore it.
                // Some other odd text format we don't support, ignore it.
                default:
                    $ret = "[" . $lang['text_unsupported'] . ": " . $ctype . "]<br>";
            }
            break;
        default:
            // An unsupported content type, ignore it.
            $ret = "[" . $lang['text_unsupported'] . ": " . $ctype . "]<br>";
    }
    return $ret;
}
Пример #2
0
 if (extension_loaded('mcrypt')) {
     if (text_is_encrypted($contents)) {
         $key = get_encryption_key();
         $contents = decrypt_text($key, $contents);
     }
 }
 $smarty->assign("spamreport_rows", display_spam_report($id));
 if (!$raw) {
     // Try to decode the mail and display all of its parts.
     $mail = new Mail_mimeDecode(get_magic_quotes_gpc() ? stripslashes($contents) : $contents);
     $args['include_bodies'] = true;
     $args['decode_bodies'] = true;
     $args['decode_headers'] = false;
     // the inconv decoding will handle the headers
     $structure = $mail->decode($args);
     $smarty->assign("message", display_parts($structure));
     $headers = $structure->headers;
     foreach ($headers as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $itemkey => $item) {
                 $headers["{$key}"][$itemkey] = htmlspecialchars(last_ditch_mime_decode(iconv_mime_decode($item, 2, 'utf-8'), get_charset($structure)), ENT_QUOTES, 'utf-8');
             }
         } else {
             $headers["{$key}"] = htmlspecialchars(last_ditch_mime_decode(iconv_mime_decode($value, 2, 'utf-8'), get_charset($structure)), ENT_QUOTES, 'utf-8');
         }
     }
     if (isset($headers['content-type'])) {
         unset($headers['content-type']);
     }
     $smarty->assign('headers', $headers);
     $smarty->assign('sender_email', $sender_email);
Пример #3
0
$smarty->assign('part', $rs->fields['count']);
/* Lets Grab Technicians Names */
$q = "SELECT EMPLOYEE_LOGIN, EMPLOYEE_ID FROM " . PRFX . "TABLE_EMPLOYEE WHERE EMPLOYEE_STATUS=1";
if (!($rs = $db->execute($q))) {
    force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
    exit;
}
$tech = $rs->GetMenu2('assign_val', $login, $login_id);
$smarty->assign('tech', $tech);
if (!($single_work_order = display_single_open_workorder($db, $VAR['wo_id']))) {
    force_page('core', "error&menu=1&error_msg=The Work Order you requested was not found&type=error");
    exit;
}
$smarty->assign('single_workorder_array', $single_work_order);
$smarty->assign('work_order_notes', display_workorder_notes($db, $VAR['wo_id']));
$smarty->assign('order', display_parts($db, $VAR['wo_id']));
$smarty->assign('work_order_status', display_workorder_status($db, $VAR['wo_id']));
$smarty->assign('work_order_sched', get_work_order_schedule($db, $VAR['wo_id']));
$smarty->assign('resolution', display_resolution($db, $VAR['wo_id']));
if (isset($VAR['submit'])) {
    $sql = "DELETE FROM " . PRFX . "TABLE_WORK_ORDER WHERE WORK_ORDER_ID=" . $db->qstr($wo_id);
    if (!($result = $db->Execute($sql))) {
        force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
        exit;
    }
    //Write comment to log
    $month = date("M");
    $day = date("d");
    $year = date("Y");
    $time = date("H") . ":" . date("i") . ":" . date("s");
    //get environment variables