Ejemplo n.º 1
0
function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee)
{
    global $default_use_mdn, $default_use_priority, $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on, $squirrelmail_language;
    $header = $message->rfc822_header;
    $env = array();
    $env[_("Subject")] = decodeHeader($header->subject);
    $from_name = $header->getAddr_s('from');
    if (!$from_name) {
        $from_name = $header->getAddr_s('sender');
        if (!$from_name) {
            $from_name = _("Unknown sender");
        }
    }
    $env[_("From")] = decodeHeader($from_name);
    $env[_("Date")] = getLongDateString($header->date, $header->date_unparsed);
    $env[_("To")] = formatRecipientString($header->to, "to");
    $env[_("Cc")] = formatRecipientString($header->cc, "cc");
    $env[_("Bcc")] = formatRecipientString($header->bcc, "bcc");
    if ($default_use_priority) {
        $env[_("Priority")] = htmlspecialchars(getPriorityStr($header->priority));
    }
    if ($show_xmailer_default) {
        $env[_("Mailer")] = decodeHeader($header->xmailer);
    }
    if ($default_use_mdn) {
        if ($mdn_user_support) {
            if ($header->dnt) {
                if ($message->is_mdnsent) {
                    $env[_("Read receipt")] = _("sent");
                } else {
                    $env[_("Read receipt")] = _("requested");
                    if (!(handleAsSent($mailbox) || $message->is_deleted || $passed_ent_id)) {
                        $mdn_url = $PHP_SELF;
                        $mdn_url = set_url_var($mdn_url, 'mailbox', urlencode($mailbox));
                        $mdn_url = set_url_var($mdn_url, 'passed_id', $passed_id);
                        $mdn_url = set_url_var($mdn_url, 'passed_ent_id', $passed_ent_id);
                        $mdn_url = set_url_var($mdn_url, 'sendreceipt', 1);
                        if ($FirstTimeSee && $javascript_on) {
                            $script = '<script language="JavaScript" type="text/javascript">' . "\n";
                            $script .= '<!--' . "\n";
                            $script .= 'if(window.confirm("' . _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") . '")) {  ' . "\n" . '    sendMDN()' . '}' . "\n";
                            $script .= '// -->' . "\n";
                            $script .= '</script>' . "\n";
                            echo $script;
                        }
                        $env[_("Read receipt")] .= '&nbsp;<a href="' . $mdn_url . '">[' . _("Send read receipt now") . ']</a>';
                    }
                }
            }
        }
    }
    $s = '<table width="100%" cellpadding="0" cellspacing="2" border="0"';
    $s .= ' align="center" bgcolor="' . $color[0] . '">';
    foreach ($env as $key => $val) {
        if ($val) {
            $s .= '<tr>';
            $s .= html_tag('td', '<b>' . $key . ':&nbsp;&nbsp;</b>', 'right', '', 'valign="top" width="20%"') . "\n";
            $s .= html_tag('td', $val, 'left', '', 'valign="top" width="80%"') . "\n";
            $s .= '</tr>';
        }
    }
    echo '<table bgcolor="' . $color[9] . '" width="100%" cellpadding="1"' . ' cellspacing="0" border="0" align="center">' . "\n";
    echo '<tr><td height="5" colspan="2" bgcolor="' . $color[4] . '"></td></tr><tr><td align="center">' . "\n";
    echo $s;
    do_hook('read_body_header');
    formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color);
    echo '</table>';
    echo '</td></tr><tr><td height="5" colspan="2" bgcolor="' . $color[4] . '"></td></tr>' . "\n";
    echo '</table>';
}
Ejemplo n.º 2
0
/**
 * Return a string representing the priority of a message
 */
function priorityStr($p)
{
    return sm_encode_html_special_chars(getPriorityStr($p));
}
Ejemplo n.º 3
0
function obm_formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee)
{
    global $msn_user_support, $default_use_mdn, $default_use_priority, $show_xmailer_default, $mdn_user_support, $PHP_SELF, $javascript_on, $squirrelmail_language;
    $mailbox = $aMailbox['NAME'];
    $header = $message->rfc822_header;
    $env = array();
    $env[_("Subject")] = str_replace("&nbsp;", " ", decodeHeader($header->subject));
    $from_name = $header->getAddr_s('from');
    if (!$from_name) {
        $from_name = $header->getAddr_s('sender');
    }
    if (!$from_name) {
        $env[_("From")] = _("Unknown sender");
    } else {
        $env[_("From")] = decodeHeader($from_name);
    }
    $env[_("Date")] = getLongDateString($header->date);
    $env[_("To")] = formatRecipientString($header->to, "to");
    $env[_("Cc")] = formatRecipientString($header->cc, "cc");
    $env[_("Bcc")] = formatRecipientString($header->bcc, "bcc");
    if ($default_use_priority) {
        $env[_("Priority")] = htmlspecialchars(getPriorityStr($header->priority));
    }
    if ($show_xmailer_default) {
        $env[_("Mailer")] = decodeHeader($header->xmailer);
    }
    $s = '<table width="100%" cellpadding="0" cellspacing="2" border="0"';
    $s .= ' align="center" bgcolor="' . $color[0] . '">';
    foreach ($env as $key => $val) {
        if ($val) {
            $s .= '<tr>';
            $s .= html_tag('td', '<b>' . $key . ':&nbsp;&nbsp;</b>', 'right', '', 'valign="top" width="0%"') . "\n";
            $s .= html_tag('td', $val, 'left', '', 'valign="top" width="100%"') . "\n";
            $s .= '</tr>';
        }
    }
    echo '<table bgcolor="' . $color[9] . '" width="100%" cellpadding="1"' . ' cellspacing="0" border="0" align="center">' . "\n";
    echo '<tr><td height="5" colspan="2" bgcolor="' . $color[4] . '"></td></tr><tr><td align="center">' . "\n";
    echo $s;
    //do_hook('read_body_header');
    //formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color);
    echo '</table>';
    echo '</td></tr><tr><td height="5" colspan="2" bgcolor="' . $color[4] . '"></td></tr>' . "\n";
    echo '</table>';
}