示例#1
0
$mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
$message =& $messages[$mbx_response['UIDVALIDITY']][$passed_id];
$message_ent = $message->getEntity($ent_id);
if ($passed_ent_id) {
    $message =& $message->getEntity($passed_ent_id);
}
$header = $message_ent->header;
$type0 = $header->type0;
$type1 = $header->type1;
$charset = $header->getParameter('charset');
$encoding = strtolower($header->encoding);
$msg_url = 'read_body.php?' . $QUERY_STRING;
$msg_url = set_url_var($msg_url, 'ent_id', 0);
$dwnld_url = '../src/download.php?' . $QUERY_STRING . '&absolute_dl=true';
$unsafe_url = 'view_text.php?' . $QUERY_STRING;
$unsafe_url = set_url_var($unsafe_url, 'view_unsafe_images', 1);
$body = mime_fetch_body($imapConnection, $passed_id, $ent_id);
$body = decodeBody($body, $encoding);
if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
    if (mb_detect_encoding($body) != 'ASCII') {
        $body = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $body);
    }
}
if ($type1 == 'html' || isset($override_type1) && $override_type1 == 'html') {
    $ishtml = TRUE;
    // html attachment with character set information
    if (!empty($charset)) {
        $body = charset_decode($charset, $body, false, true);
    }
    $body = magicHTML($body, $passed_id, $message, $mailbox);
} else {
/**
 * Adds href and text keys to attachment_common array for vcard attachments
 * @param array $Args attachment $type hook arguments
 * @since 1.2.0
 */
function attachment_common_link_vcard(&$Args)
{
    global $base_uri;
    sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
    $Args[0]['attachment_common']['href'] = $base_uri . 'src/vcard.php?' . $QUERY_STRING;
    $Args[0]['attachment_common']['href'] = set_url_var($Args[0]['attachment_common']['href'], 'ent_id', $Args[4]);
    $Args[0]['attachment_common']['text'] = _("View Business Card");
    $Args[5] = $Args[0]['attachment_common']['href'];
}
示例#3
0
require_once SM_PATH . 'include/load_prefs.php';
/* globals */
sqgetGlobalVar('username', $username, SQ_SESSION);
sqgetGlobalVar('key', $key, SQ_COOKIE);
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
sqgetGlobalVar('ent_id', $ent_id, SQ_GET);
sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
/* end globals */
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
sqimap_mailbox_select($imapConnection, $mailbox);
displayPageHeader($color, 'None');
echo '<br /><table width="100%" border="0" cellspacing="0" cellpadding="2" ' . 'align="center">' . "\n" . '<tr><td bgcolor="' . $color[0] . '">' . '<b><center>' . _("Viewing a Business Card") . " - ";
$msg_url = 'read_body.php?mailbox=' . urlencode($mailbox) . '&amp;startMessage=' . urlencode($startMessage) . '&amp;passed_id=' . urlencode($passed_id);
$msg_url = set_url_var($msg_url, 'ent_id', 0);
echo '<a href="' . $msg_url . '">' . _("View message") . '</a>';
echo '</center></b></td></tr>';
$message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
$entity_vcard = getEntity($message, $ent_id);
$vcard = mime_fetch_body($imapConnection, $passed_id, $ent_id);
$vcard = decodeBody($vcard, $entity_vcard->header->encoding);
$vcard = explode("\n", $vcard);
foreach ($vcard as $l) {
    $k = substr($l, 0, strpos($l, ':'));
    $v = substr($l, strpos($l, ':') + 1);
    $attributes = explode(';', $k);
    $k = strtolower(array_shift($attributes));
    foreach ($attributes as $attr) {
        if ($attr == 'quoted-printable') {
            $v = quoted_printable_decode($v);
function attachment_common_link_vcard(&$Args)
{
    sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
    $Args[1]['attachment_common']['href'] = SM_PATH . 'src/vcard.php?' . $QUERY_STRING;
    $Args[1]['attachment_common']['href'] = set_url_var($Args[1]['attachment_common']['href'], 'ent_id', $Args[5]);
    $Args[1]['attachment_common']['text'] = _("Business Card");
    $Args[6] = $Args[1]['attachment_common']['href'];
}
示例#5
0
} else {
    // Move messages
    if (count($id)) {
        // move messages only when target mailbox is not the same as source mailbox
        if ($mailbox != $targetMailbox) {
            sqimap_msgs_list_move($imapConnection, $id, $targetMailbox);
            if ($auto_expunge) {
                $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true);
            } else {
                $cnt = 0;
            }
            if ($startMessage + $cnt - 1 >= $mbx_response['EXISTS']) {
                if ($startMessage > $show_num) {
                    $location = set_url_var($location, 'startMessage', $startMessage - $show_num, false);
                } else {
                    $location = set_url_var($location, 'startMessage', 1, false);
                }
            }
        }
    } else {
        $exception = true;
    }
}
// Log out this session
sqimap_logout($imapConnection);
if ($exception) {
    displayPageHeader($color, $mailbox);
    error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color);
} else {
    header("Location: {$location}");
    exit;
示例#6
0
/**
 * This function is used to add, modify or delete more than
 * one GET variable at a time in a URL.  This simply takes
 * an array of variables (key/value pairs) and passes them
 * one at a time to {@link set_url_var}.
 * 
 * Note that the value for any one of the variables may be
 * an array, and it will be handled properly.
 *
 * As with set_url_var, any of the variable values may be
 * set to NULL to remove it from the URI.
 *
 * Also, to ensure compatibility with older versions, use
 * $val='0' to set $var to 0. 
 *
 * @param string  $uri      URI that must be modified
 * @param array   $values   List of GET variable names and their values
 * @param boolean $sanitize Controls sanitizing of ampersand in URIs
 *
 * @return string The modified URI
 *
 * @since 1.5.2
 *
 */
function set_uri_vars($uri, $values, $sanitize = TRUE)
{
    foreach ($values as $key => $value) {
        if (is_array($value)) {
            $i = 0;
            foreach ($value as $val) {
                $uri = set_url_var($uri, $key . '[' . $i++ . ']', $val, $sanitize);
            }
        } else {
            $uri = set_url_var($uri, $key, $value, $sanitize);
        }
    }
    return $uri;
}
示例#7
0
文件: read_body.php 项目: jprice/EHCP
function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response)
{
    global $base_uri, $draft_folder, $where, $what, $color, $sort, $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment;
    $topbar_delimiter = '&nbsp;|&nbsp;';
    $urlMailbox = urlencode($mailbox);
    $s = '<table width="100%" cellpadding="3" cellspacing="0" align="center"' . ' border="0" bgcolor="' . $color[9] . '"><tr>' . html_tag('td', '', 'left', '', 'width="33%"') . '<small>';
    $msgs_url = $base_uri . 'src/';
    if (isset($where) && isset($what)) {
        $msgs_url .= 'search.php?where=' . urlencode($where) . '&amp;what=' . urlencode($what) . '&amp;mailbox=' . $urlMailbox;
        $msgs_str = _("Search Results");
    } else {
        $msgs_url .= 'right_main.php?sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;mailbox=' . $urlMailbox;
        $msgs_str = _("Message List");
    }
    $s .= '<a href="' . $msgs_url . '">' . $msgs_str . '</a>';
    $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox . '&amp;message=' . $passed_id . '&amp;';
    if (!(isset($passed_ent_id) && $passed_ent_id)) {
        if ($where && $what) {
            $delete_url .= 'where=' . urlencode($where) . '&amp;what=' . urlencode($what);
        } else {
            $delete_url .= 'sort=' . $sort . '&amp;startMessage=' . $startMessage;
        }
        $s .= $topbar_delimiter;
        $s .= '<a href="' . $delete_url . '">' . _("Delete") . '</a>';
    }
    $comp_uri = 'src/compose.php' . '?passed_id=' . $passed_id . '&amp;mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage . (isset($passed_ent_id) ? '&amp;passed_ent_id=' . urlencode($passed_ent_id) : '');
    if ($mailbox == $draft_folder && $save_as_draft) {
        $comp_alt_uri = $comp_uri . '&amp;smaction=draft';
        $comp_alt_string = _("Resume Draft");
    } else {
        if (handleAsSent($mailbox)) {
            $comp_alt_uri = $comp_uri . '&amp;smaction=edit_as_new';
            $comp_alt_string = _("Edit Message as New");
        }
    }
    if (isset($comp_alt_uri)) {
        $s .= $topbar_delimiter;
        $s .= makeComposeLink($comp_alt_uri, $comp_alt_string);
    }
    $s .= '</small></td><td align="center" width="33%"><small>';
    if (!(isset($where) && isset($what)) && !$passed_ent_id) {
        $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
        $next = findNextMessage($passed_id);
        if ($prev != -1) {
            $uri = $base_uri . 'src/read_body.php?passed_id=' . $prev . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
            $s .= '<a href="' . $uri . '">' . _("Previous") . '</a>';
        } else {
            $s .= _("Previous");
        }
        $s .= $topbar_delimiter;
        if ($next != -1) {
            $uri = $base_uri . 'src/read_body.php?passed_id=' . $next . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
            $s .= '<a href="' . $uri . '">' . _("Next") . '</a>';
        } else {
            $s .= _("Next");
        }
    } else {
        if (isset($passed_ent_id) && $passed_ent_id) {
            /* code for navigating through attached message/rfc822 messages */
            $url = set_url_var($PHP_SELF, 'passed_ent_id', 0);
            $s .= '<a href="' . $url . '">' . _("View Message") . '</a>';
            $entities = array();
            $entity_count = array();
            $c = 0;
            foreach ($message->parent->entities as $ent) {
                if ($ent->type0 == 'message' && $ent->type1 == 'rfc822') {
                    $c++;
                    $entity_count[$c] = $ent->entity_id;
                    $entities[$ent->entity_id] = $c;
                }
            }
            $prev_link = _("Previous");
            if (!empty($entities[$passed_ent_id]) && $entities[$passed_ent_id] > 1) {
                $prev_ent_id = $entity_count[$entities[$passed_ent_id] - 1];
                $prev_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $prev_ent_id) . '">' . $prev_link . '</a>';
            }
            $next_link = _("Next");
            if (!empty($entities[$passed_ent_id]) && $entities[$passed_ent_id] < $c) {
                $next_ent_id = $entity_count[$entities[$passed_ent_id] + 1];
                $next_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $next_ent_id) . '">' . $next_link . '</a>';
            }
            $s .= $topbar_delimiter . $prev_link;
            $par_ent_id = $message->parent->entity_id;
            if ($par_ent_id) {
                $par_ent_id = substr($par_ent_id, 0, -2);
                $s .= $topbar_delimiter;
                $url = set_url_var($PHP_SELF, 'passed_ent_id', $par_ent_id);
                $s .= '<a href="' . $url . '">' . _("Up") . '</a>';
            }
            $s .= $topbar_delimiter . $next_link;
        }
    }
    $s .= '</small></td>' . "\n" . html_tag('td', '', 'right', '', 'width="33%" nowrap') . '<small>';
    $comp_action_uri = $comp_uri . '&amp;smaction=forward';
    $s .= makeComposeLink($comp_action_uri, _("Forward"));
    if ($enable_forward_as_attachment) {
        $comp_action_uri = $comp_uri . '&amp;smaction=forward_as_attachment';
        $s .= $topbar_delimiter;
        $s .= makeComposeLink($comp_action_uri, _("Forward as Attachment"));
    }
    $comp_action_uri = $comp_uri . '&amp;smaction=reply';
    $s .= $topbar_delimiter;
    $s .= makeComposeLink($comp_action_uri, _("Reply"));
    $comp_action_uri = $comp_uri . '&amp;smaction=reply_all';
    $s .= $topbar_delimiter;
    $s .= makeComposeLink($comp_action_uri, _("Reply All"));
    $s .= '</small></td></tr></table>';
    $ret = concat_hook_function('read_body_menu_top', $s);
    if ($ret != '') {
        $s = $ret;
    }
    echo $s;
    do_hook('read_body_menu_bottom');
}
示例#8
0
function formatRecipientString($recipients, $item)
{
    global $show_more_cc, $show_more, $show_more_bcc, $PHP_SELF;
    $string = '';
    if (is_array($recipients) && isset($recipients[0])) {
        $show = false;
        if ($item == 'to') {
            if ($show_more) {
                $show = true;
                $url = set_url_var($PHP_SELF, 'show_more', 0);
            } else {
                $url = set_url_var($PHP_SELF, 'show_more', 1);
            }
        } else {
            if ($item == 'cc') {
                if ($show_more_cc) {
                    $show = true;
                    $url = set_url_var($PHP_SELF, 'show_more_cc', 0);
                } else {
                    $url = set_url_var($PHP_SELF, 'show_more_cc', 1);
                }
            } else {
                if ($item == 'bcc') {
                    if ($show_more_bcc) {
                        $show = true;
                        $url = set_url_var($PHP_SELF, 'show_more_bcc', 0);
                    } else {
                        $url = set_url_var($PHP_SELF, 'show_more_bcc', 1);
                    }
                }
            }
        }
        $cnt = count($recipients);
        foreach ($recipients as $r) {
            $add = decodeHeader($r->getAddress(true), true . false);
            if ($string) {
                $string .= '<BR>' . $add;
            } else {
                $string = $add;
                if ($cnt > 1) {
                    $string .= '&nbsp;(<A HREF="' . $url;
                    if ($show) {
                        $string .= '">' . _("less") . '</A>)';
                    } else {
                        $string .= '">' . _("more") . '</A>)';
                        break;
                    }
                }
            }
        }
    }
    return $string;
}
示例#9
0
function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color)
{
    global $base_uri, $where, $what, $show_html_default, $oTemplate, $download_href, $PHP_SELF, $unsafe_image_toggle_href, $unsafe_image_toggle_text;
    $urlMailbox = urlencode($mailbox);
    $urlPassed_id = urlencode($passed_id);
    $urlPassed_ent_id = urlencode($passed_ent_id);
    $query_string = 'mailbox=' . $urlMailbox . '&amp;passed_id=' . $urlPassed_id . '&amp;passed_ent_id=' . $urlPassed_ent_id;
    if (!empty($where)) {
        $query_string .= '&amp;where=' . urlencode($where);
    }
    if (!empty($what)) {
        $query_string .= '&amp;what=' . urlencode($what);
    }
    $url = $base_uri . 'src/view_header.php?' . $query_string;
    $links = array();
    $links[] = array('URL' => $url, 'Text' => _("View Full Header"));
    if (checkForJavaScript()) {
        $links[] = array('URL' => 'javascript:printThis();', 'Text' => _("Print"));
    } else {
        $links[] = array('URL' => set_url_var($PHP_SELF, 'print', '1'), 'Text' => _("Print"), 'Target' => '_blank');
    }
    $links[] = array('URL' => $download_href, 'Text' => _("Download this as a file"));
    $toggle = html_toggle_href($mailbox, $passed_id, $passed_ent_id, $message);
    if (!empty($toggle)) {
        $links[] = array('URL' => $toggle, 'Text' => $show_html_default == 1 ? _("View as plain text") : _("View as HTML"));
    }
    if (!empty($unsafe_image_toggle_href)) {
        $links[] = array('URL' => $unsafe_image_toggle_href, 'Text' => $unsafe_image_toggle_text);
    }
    do_hook('read_body_header_right', $links);
    $oTemplate->assign('links', $links);
    return $oTemplate->fetch('read_toolbar.tpl');
}
示例#10
0
/**
 * Format message toolbar
 *
 * @param string $mailbox Name of current mailbox
 * @param int $passed_id UID of current message
 * @param int $passed_ent_id Id of entity within message
 * @param object $message Current message object
 * @param object $mbx_response
 */
function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removedVar, $nav_on_top = TRUE)
{
    global $base_uri, $draft_folder, $where, $what, $color, $sort, $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, $data_dir, $username, $delete_prev_next_display, $compose_new_win, $javascript_on;
    //FIXME cleanup argument list, use $aMailbox where possible
    $mailbox = $aMailbox['NAME'];
    $topbar_delimiter = '&nbsp;|&nbsp;';
    $double_delimiter = '&nbsp;&nbsp;&nbsp;&nbsp;';
    $urlMailbox = urlencode($mailbox);
    $msgs_url = $base_uri . 'src/';
    // BEGIN NAV ROW - PREV/NEXT, DEL PREV/NEXT, LINKS TO INDEX, etc.
    $nav_row = '<tr><td align="left" colspan="2" style="border: 1px solid ' . $color[9] . ';"><small>';
    // Create Prev & Next links
    // Handle nested entities first (i.e. Mime Attach parts)
    if (isset($passed_ent_id) && $passed_ent_id) {
        // code for navigating through attached message/rfc822 messages
        $url = set_url_var($PHP_SELF, 'passed_ent_id', 0);
        $entities = array();
        $entity_count = array();
        $c = 0;
        foreach ($message->parent->entities as $ent) {
            if ($ent->type0 == 'message' && $ent->type1 == 'rfc822') {
                $c++;
                $entity_count[$c] = $ent->entity_id;
                $entities[$ent->entity_id] = $c;
            }
        }
        $prev_link = _("Previous");
        if ($entities[$passed_ent_id] > 1) {
            $prev_ent_id = $entity_count[$entities[$passed_ent_id] - 1];
            $prev_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $prev_ent_id) . '">' . $prev_link . '</a>';
        }
        $next_link = _("Next");
        if ($entities[$passed_ent_id] < $c) {
            $next_ent_id = $entity_count[$entities[$passed_ent_id] + 1];
            $next_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $next_ent_id) . '">' . $next_link . '</a>';
        }
        $par_ent_id = $message->parent->entity_id;
        $up_link = '';
        if ($par_ent_id) {
            $par_ent_id = substr($par_ent_id, 0, -2);
            if ($par_ent_id != 0) {
                $up_link = $topbar_delimiter;
                $url = set_url_var($PHP_SELF, 'passed_ent_id', $par_ent_id);
                $up_link .= '<a href="' . $url . '">' . _("Up") . '</a>';
            }
        }
        $nav_row .= $prev_link . $up_link . $topbar_delimiter . $next_link;
        $nav_row .= $double_delimiter . '[<a href="' . $url . '">' . _("View Message") . '</a>]';
        // Prev/Next links for regular messages
    } else {
        if (true) {
            //!(isset($where) && isset($what)) ) {
            /**
             * Check if cache is still valid
             */
            if (!is_array($aMailbox['UIDSET'][$what])) {
                fetchMessageHeaders($imapConnection, $aMailbox);
            }
            $prev = findPreviousMessage($aMailbox['UIDSET'][$what], $passed_id);
            $next = findNextMessage($aMailbox['UIDSET'][$what], $passed_id);
            $prev_link = _("Previous");
            if ($prev >= 0) {
                $uri = $base_uri . 'src/read_body.php?passed_id=' . $prev . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . "&amp;where={$where}&amp;what={$what}" . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
                $prev_link = '<a href="' . $uri . '">' . $prev_link . '</a>';
            }
            $next_link = _("Next");
            if ($next >= 0) {
                $uri = $base_uri . 'src/read_body.php?passed_id=' . $next . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . "&amp;where={$where}&amp;what={$what}" . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
                $next_link = '<a href="' . $uri . '">' . $next_link . '</a>';
            }
            // Only bother with Delete & Prev and Delete & Next IF
            // top display is enabled.
            if ($delete_prev_next_display == 1 && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
                $del_prev_link = _("Delete & Prev");
                if ($prev >= 0) {
                    $uri = $base_uri . 'src/read_body.php?passed_id=' . $prev . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0' . "&amp;where={$where}&amp;what={$what}" . '&amp;delete_id=' . $passed_id;
                    $del_prev_link = '<a href="' . $uri . '">' . $del_prev_link . '</a>';
                }
                $del_next_link = _("Delete & Next");
                if ($next >= 0) {
                    $uri = $base_uri . 'src/read_body.php?passed_id=' . $next . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0' . "&amp;where={$where}&amp;what={$what}" . '&amp;delete_id=' . $passed_id;
                    $del_next_link = '<a href="' . $uri . '">' . $del_next_link . '</a>';
                }
            }
            $nav_row .= '[' . $prev_link . $topbar_delimiter . $next_link . ']';
            if (isset($del_prev_link) && isset($del_next_link)) {
                $nav_row .= $double_delimiter . '[' . $del_prev_link . $topbar_delimiter . $del_next_link . ']';
            }
        }
    }
    // Start with Search Results or Message List link.
    $msgs_url .= "{$where}?where=read_body.php&amp;what={$what}&amp;mailbox=" . $urlMailbox . "&amp;startMessage={$startMessage}";
    if ($where == 'search.php') {
        $msgs_str = _("Search Results");
    } else {
        $msgs_str = _("Message List");
    }
    $nav_row .= $double_delimiter . '[<a href="' . $msgs_url . '">' . $msgs_str . '</a>]';
    $nav_row .= '</small></td></tr>';
    // BEGIN MENU ROW - DELETE/REPLY/FORWARD/MOVE/etc.
    $menu_row = '<tr bgcolor="' . $color[0] . '"><td><small>';
    $comp_uri = $base_uri . 'src/compose.php' . '?passed_id=' . $passed_id . '&amp;mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage . (isset($passed_ent_id) ? '&amp;passed_ent_id=' . $passed_ent_id : '');
    // Start form for reply/reply all/forward..
    $target = '';
    $on_click = '';
    $method = 'method="post" ';
    if ($compose_new_win == '1') {
        if ($javascript_on) {
            $on_click = ' onclick="comp_in_new_form(\'' . $comp_uri . '\', this, this.form)"';
            $comp_uri = 'javascript:void(0)';
            $method = 'method="get" ';
        } else {
            $target = 'target="_blank"';
        }
    }
    $menu_row .= "\n" . '<form name="composeForm" action="' . $comp_uri . '" ' . $method . $target . ' style="display: inline">' . "\n";
    // If Draft folder - create Resume link
    if ($mailbox == $draft_folder && $save_as_draft) {
        $new_button = 'smaction_draft';
        $comp_alt_string = _("Resume Draft");
    } else {
        if (handleAsSent($mailbox)) {
            // If in Sent folder, edit as new
            $new_button = 'smaction_edit_new';
            $comp_alt_string = _("Edit Message as New");
        }
    }
    // Show Alt URI for Draft/Sent
    if (isset($comp_alt_string)) {
        $menu_row .= getButton('submit', $new_button, $comp_alt_string, $on_click) . "\n";
    }
    $menu_row .= getButton('submit', 'smaction_reply', _("Reply"), $on_click) . "\n";
    $menu_row .= getButton('submit', 'smaction_reply_all', _("Reply All"), $on_click) . "\n";
    $menu_row .= getButton('submit', 'smaction_forward', _("Forward"), $on_click);
    if ($enable_forward_as_attachment) {
        $menu_row .= '<input type="checkbox" name="smaction_attache" />' . _("As Attachment") . '&nbsp;&nbsp;' . "\n";
    }
    $menu_row .= '</form>&nbsp;';
    if (in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
        // Form for deletion. Form is handled by the originating display in $where. This is right_main.php or search.php
        $delete_url = $base_uri . "src/{$where}";
        $menu_row .= '<form name="deleteMessageForm" action="' . $delete_url . '" method="post" style="display: inline">';
        if (!(isset($passed_ent_id) && $passed_ent_id)) {
            $menu_row .= addHidden('mailbox', $aMailbox['NAME']);
            $menu_row .= addHidden('msg[0]', $passed_id);
            $menu_row .= addHidden('startMessage', $startMessage);
            $menu_row .= getButton('submit', 'delete', _("Delete"));
            $menu_row .= '<input type="checkbox" name="bypass_trash" />' . _("Bypass Trash");
        } else {
            $menu_row .= getButton('submit', 'delete', _("Delete"), '', FALSE) . "\n";
            // delete button is disabled
        }
        $menu_row .= '</form>';
    }
    // Add top move link
    $menu_row .= '</small></td><td align="right">';
    if (!(isset($passed_ent_id) && $passed_ent_id) && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) {
        $menu_row .= '<form name="moveMessageForm" action="' . $base_uri . 'src/' . $where . '?' . '" method="post" style="display: inline">' . '<small>' . addHidden('mailbox', $aMailbox['NAME']) . addHidden('msg[0]', $passed_id) . _("Move to:") . '<select name="targetMailbox" style="padding: 0px; margin: 0px">';
        if (isset($lastTargetMailbox) && !empty($lastTargetMailbox)) {
            $menu_row .= sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)));
        } else {
            $menu_row .= sqimap_mailbox_option_list($imapConnection);
        }
        $menu_row .= '</select> ';
        $menu_row .= getButton('submit', 'moveButton', _("Move")) . "\n" . '</form>';
    }
    $menu_row .= '</td></tr>';
    // echo rows, with hooks
    $ret = do_hook_function('read_body_menu_top', array($nav_row, $menu_row));
    if (is_array($ret)) {
        if (isset($ret[0]) && !empty($ret[0])) {
            $nav_row = $ret[0];
        }
        if (isset($ret[1]) && !empty($ret[1])) {
            $menu_row = $ret[1];
        }
    }
    echo '<table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
    echo $nav_on_top ? $nav_row . $menu_row : $menu_row . $nav_row;
    echo '</table>' . "\n";
    do_hook('read_body_menu_bottom');
}