$aMailboxPref[MBX_PREF_AUTO_EXPUNGE] = (bool) $auto_expunge; $aMailboxPref[MBX_PREF_INTERNALDATE] = (bool) getPref($data_dir, $username, 'internal_date_sort'); $aConfig['search'] = $search['search']; $aConfig['charset'] = $search['charset']; $aConfig['setindex'] = 1; // $what $where = 'search' $aMailbox = sqm_api_mailbox_select($imapConnection, $mbx, $aConfig, $aMailboxPref); /** * Handle form actions like flag / unflag, seen / unseen, delete */ if (sqgetGlobalVar('mailbox', $postMailbox, SQ_POST)) { if ($postMailbox === $mbx) { handleMessageListForm($imapConnection, $aMailbox); } } if (fetchMessageHeaders($imapConnection, $aMailbox)) { $msgsfound = true; echo '<br />'; asearch_print_mailbox_msgs($imapConnection, $aMailbox, $color); flush(); } /* add the mailbox to the cache */ $mailbox_cache[$aMailbox['NAME']] = $aMailbox; } } if (!$msgsfound) { echo '<br />' . html_tag('div', asearch_get_error_display($color, _("No Messages Found")), 'center') . "\n"; } } do_hook('search_bottom'); sqimap_logout($imapConnection);
/** * This function loops through a group of messages in the mailbox * and shows them to the user. * * @param resource $imapConnection * @param array $aMailbox associative array with mailbox related vars * @param array $aProps * @param int $iError error code, 0 is no error */ function showMessagesForMailbox($imapConnection, &$aMailbox, $aProps, &$iError) { global $PHP_SELF; global $boxes, $show_copy_buttons; $highlight_list = isset($aProps['config']['highlight_list']) ? $aProps['config']['highlight_list'] : false; $fancy_index_highlite = isset($aProps['config']['fancy_index_highlite']) ? $aProps['config']['fancy_index_highlite'] : true; $aColumnsDesc = isset($aProps['columns']) ? $aProps['columns'] : false; $iAccount = isset($aProps['account']) ? (int) $aProps['account'] : 0; $sMailbox = isset($aProps['mailbox']) ? $aProps['mailbox'] : false; $sTargetModule = isset($aProps['module']) ? $aProps['module'] : 'read_body'; $show_flag_buttons = isset($aProps['config']['show_flag_buttons']) ? $aProps['config']['show_flag_buttons'] : true; /* allows to control copy button in function call. If array key is not set, code follows user preferences */ if (isset($aProps['config']['show_copy_buttons'])) { $show_copy_buttons = $aProps['config']['show_copy_buttons']; } $lastTargetMailbox = isset($aProps['config']['lastTargetMailbox']) ? $aProps['config']['lastTargetMailbox'] : ''; $aOrder = array_keys($aProps['columns']); $trash_folder = isset($aProps['config']['trash_folder']) && $aProps['config']['trash_folder'] ? $aProps['config']['trash_folder'] : false; $sent_folder = isset($aProps['config']['sent_folder']) && $aProps['config']['sent_folder'] ? $aProps['config']['sent_folder'] : false; $draft_folder = isset($aProps['config']['draft_folder']) && $aProps['config']['draft_folder'] ? $aProps['config']['draft_folder'] : false; $page_selector = isset($aProps['config']['page_selector']) ? $aProps['config']['page_selector'] : false; $page_selector_max = isset($aProps['config']['page_selector_max']) ? $aProps['config']['page_selector_max'] : 10; $color = $aProps['config']['color']; /* * Form ID */ static $iFormId; if (!isset($iFormId)) { $iFormId = 1; } else { ++$iFormId; } // store the columns to fetch so we can pick them up in read_body // where we validate the cache. calcFetchColumns($aMailbox, $aProps); $iError = fetchMessageHeaders($imapConnection, $aMailbox); if ($iError) { return array(); } else { $aMessages = prepareMessageList($aMailbox, $aProps); } $iSetIndx = $aMailbox['SETINDEX']; $iLimit = $aMailbox['SHOWALL'][$iSetIndx] ? $aMailbox['EXISTS'] : $aMailbox['LIMIT']; $iEnd = $aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $aMailbox['EXISTS'] ? $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $aMailbox['EXISTS']; $iNumberOfMessages = $aMailbox['TOTAL'][$iSetIndx]; $iEnd = min($iEnd, $iNumberOfMessages); $php_self = $PHP_SELF; $urlMailbox = urlencode($aMailbox['NAME']); if (preg_match('/^(.+)\\?.+$/', $php_self, $regs)) { $source_url = $regs[1]; } else { $source_url = $php_self; } $baseurl = $source_url . '?mailbox=' . urlencode($aMailbox['NAME']) . '&account=' . $aMailbox['ACCOUNT'] . (strpos($source_url, 'src/search.php') ? '&smtoken=' . sm_generate_security_token() : ''); $where = urlencode($aMailbox['SEARCH'][$iSetIndx][0]); $what = urlencode($aMailbox['SEARCH'][$iSetIndx][1]); $baseurl .= '&where=' . $where . '&what=' . $what; /* build thread sorting links */ $newsort = $aMailbox['SORT']; if (sqimap_capability($imapConnection, 'THREAD')) { if ($aMailbox['SORT'] & SQSORT_THREAD) { $newsort -= SQSORT_THREAD; $thread_name = _("Unthread View"); } else { $thread_name = _("Thread View"); $newsort = $aMailbox['SORT'] + SQSORT_THREAD; } $thread_link_uri = $baseurl . '&srt=' . $newsort . '&startMessage=1'; } else { $thread_link_uri = ''; $thread_name = ''; } $sort = $aMailbox['SORT']; /* FIX ME ADD CHECKBOX CONTROL. No checkbox => no buttons */ /* future admin control over displayable buttons */ $aAdminControl = array('markFlagged' => 1, 'markUnflagged' => 1, 'markRead' => 1, 'markUnread' => 1, 'forward' => 1, 'delete' => 1, 'undeleteButton' => 1, 'bypass_trash' => 1, 'expungeButton' => 1, 'moveButton' => 1, 'copyButton' => 1); /* user prefs control */ $aUserControl = array('markFlagged' => $show_flag_buttons, 'markUnflagged' => $show_flag_buttons, 'markRead' => 1, 'markUnread' => 1, 'forward' => 1, 'delete' => 1, 'undeleteButton' => 1, 'bypass_trash' => 1, 'expungeButton' => 1, 'moveButton' => 1, 'copyButton' => $show_copy_buttons); $showDelete = $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) ? true : false; $showByPassTrash = $aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) && $trash_folder ? true : false; // $showUndelete = !$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) ? true : false; $showMove = $aMailbox['RIGHTS'] != 'READ-ONLY' ? true : false; $showExpunge = !$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true) ? true : false; /* Button options that depend on IMAP server and selected folder */ $aImapControl = array('markUnflagged' => in_array('\\flagged', $aMailbox['PERMANENTFLAGS'], true), 'markFlagged' => in_array('\\flagged', $aMailbox['PERMANENTFLAGS'], true), 'markRead' => in_array('\\seen', $aMailbox['PERMANENTFLAGS'], true), 'markUnread' => in_array('\\seen', $aMailbox['PERMANENTFLAGS'], true), 'forward' => 1, 'delete' => $showDelete, 'undeleteButton' => $showUndelete, 'bypass_trash' => $showByPassTrash, 'expungeButton' => $showExpunge, 'moveButton' => $showMove, 'copyButton' => 1); /* Button strings */ $aButtonStrings = array('markFlagged' => _("Flag"), 'markUnflagged' => _("Unflag"), 'markRead' => _("Read"), 'markUnread' => _("Unread"), 'forward' => _("Forward"), 'delete' => _("Delete"), 'undeleteButton' => _("Undelete"), 'bypass_trash' => _("Bypass Trash"), 'expungeButton' => _("Expunge"), 'moveButton' => _("Move"), 'copyButton' => _("Copy")); /* Button access keys */ global $accesskey_mailbox_flag, $accesskey_mailbox_unflag, $accesskey_mailbox_read, $accesskey_mailbox_unread, $accesskey_mailbox_forward, $accesskey_mailbox_delete, $accesskey_mailbox_undelete, $accesskey_mailbox_bypass_trash, $accesskey_mailbox_expunge, $accesskey_mailbox_move, $accesskey_mailbox_copy, $accesskey_mailbox_move_to; $aButtonAccessKeys = array('markFlagged' => $accesskey_mailbox_flag, 'markUnflagged' => $accesskey_mailbox_unflag, 'markRead' => $accesskey_mailbox_read, 'markUnread' => $accesskey_mailbox_unread, 'forward' => $accesskey_mailbox_forward, 'delete' => $accesskey_mailbox_delete, 'undeleteButton' => $accesskey_mailbox_undelete, 'bypass_trash' => $accesskey_mailbox_bypass_trash, 'expungeButton' => $accesskey_mailbox_expunge, 'moveButton' => $accesskey_mailbox_move, 'copyButton' => $accesskey_mailbox_copy); /** * Register buttons in order to an array * The key is the "name", the first element of the value array is the "value", second argument is the type. */ $aFormElements = array(); foreach ($aAdminControl as $k => $v) { if ($v & $aUserControl[$k] & $aImapControl[$k]) { switch ($k) { case 'markFlagged': case 'markUnflagged': case 'markRead': case 'markUnread': case 'delete': case 'undeleteButton': case 'expungeButton': case 'forward': $aFormElements[$k] = array('value' => $aButtonStrings[$k], 'type' => 'submit', 'accesskey' => isset($aButtonAccessKeys[$k]) ? $aButtonAccessKeys[$k] : 'NONE'); break; case 'bypass_trash': $aFormElements[$k] = array('value' => $aButtonStrings[$k], 'type' => 'checkbox', 'accesskey' => isset($aButtonAccessKeys[$k]) ? $aButtonAccessKeys[$k] : 'NONE'); break; case 'moveButton': case 'copyButton': $aFormElements['targetMailbox'] = array('options_list' => sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)), 0, $boxes), 'type' => 'select', 'accesskey' => $accesskey_mailbox_move_to); $aFormElements['mailbox'] = array('value' => $aMailbox['NAME'], 'type' => 'hidden'); $aFormElements['startMessage'] = array('value' => $aMailbox['PAGEOFFSET'], 'type' => 'hidden'); $aFormElements[$k] = array('value' => $aButtonStrings[$k], 'type' => 'submit', 'accesskey' => isset($aButtonAccessKeys[$k]) ? $aButtonAccessKeys[$k] : 'NONE'); break; } } $aFormElements['account'] = array('value' => $iAccount, 'type' => 'hidden'); } do_hook('message_list_controls', $aFormElements); /* * This is the beginning of the message list table. * It wraps around all messages */ $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $aMailbox['NAME']); $form_name = "FormMsgs" . $safe_name; //if (!sqgetGlobalVar('align',$align,SQ_SESSION)) { $align = array('left' => 'left', 'right' => 'right'); //} //sm_print_r($align); /* finally set the template vars */ // FIXME, before we support multiple templates we must review the names of the vars // BUMP! $aTemplate['color'] = $color; $aTemplate['form_name'] = "FormMsgs" . $safe_name; $aTemplate['form_id'] = 'mbx_' . $iFormId; $aTemplate['page_selector'] = $page_selector; $aTemplate['page_selector_max'] = $page_selector_max; $aTemplate['messagesPerPage'] = $aMailbox['LIMIT']; $aTemplate['showall'] = $aMailbox['SHOWALL'][$iSetIndx]; $aTemplate['end_msg'] = $iEnd; $aTemplate['align'] = $align; $aTemplate['iNumberOfMessages'] = $iNumberOfMessages; $aTemplate['aOrder'] = $aOrder; $aTemplate['aFormElements'] = $aFormElements; $aTemplate['sort'] = $sort; $aTemplate['pageOffset'] = $aMailbox['PAGEOFFSET']; $aTemplate['baseurl'] = $baseurl; $aTemplate['aMessages'] =& $aMessages; $aTemplate['trash_folder'] = $trash_folder; $aTemplate['sent_folder'] = $sent_folder; $aTemplate['draft_folder'] = $draft_folder; $aTemplate['thread_link_uri'] = $thread_link_uri; $aTemplate['thread_name'] = $thread_name; $aTemplate['php_self'] = str_replace('&', '&', $php_self); $aTemplate['mailbox'] = $sMailbox; //FIXME: javascript_on is always assigned to the template object in places like init.php; is there some reason to reassign it here? is there some chance that it was changed? if not, please remove this line! $aTemplate['javascript_on'] = isset($aProps['config']['javascript_on']) ? $aProps['config']['javascript_on'] : false; $aTemplate['enablesort'] = isset($aProps['config']['enablesort']) ? $aProps['config']['enablesort'] : false; $aTemplate['icon_theme'] = isset($aProps['config']['icon_theme']) ? $aProps['config']['icon_theme'] : false; $aTemplate['use_icons'] = isset($aProps['config']['use_icons']) ? $aProps['config']['use_icons'] : false; $aTemplate['alt_index_colors'] = isset($aProps['config']['alt_index_colors']) ? $aProps['config']['alt_index_colors'] : false; $aTemplate['fancy_index_highlite'] = $fancy_index_highlite; /** * Set up sort possibilities; one could argue that this is best * placed in the template, but most template authors won't understand * or need to understand it, so some advanced templates can override * it if they do something different. */ if (!($aTemplate['sort'] & SQSORT_THREAD) && $aTemplate['enablesort']) { $aTemplate['aSortSupported'] = array(SQM_COL_SUBJ => array(SQSORT_SUBJ_ASC, SQSORT_SUBJ_DESC), SQM_COL_DATE => array(SQSORT_DATE_DESC, SQSORT_DATE_ASC), SQM_COL_INT_DATE => array(SQSORT_INT_DATE_DESC, SQSORT_INT_DATE_ASC), SQM_COL_FROM => array(SQSORT_FROM_ASC, SQSORT_FROM_DESC), SQM_COL_TO => array(SQSORT_TO_ASC, SQSORT_TO_DESC), SQM_COL_CC => array(SQSORT_CC_ASC, SQSORT_CC_DESC), SQM_COL_SIZE => array(SQSORT_SIZE_ASC, SQSORT_SIZE_DESC)); } else { $aTemplate['aSortSupported'] = array(); } /** * Figure out which columns should serve as labels for checkbox: * we try to grab the two columns before and after the checkbox, * except the subject column, since it is the link that opens * the message view * * if $javascript_on is set, then the highlighting code takes * care of this; just skip it * * This code also might be more appropriate in a template file, but * we are moving this complex stuff out of the way of template * authors; advanced template sets are always free to override * the resultant values. * */ $show_label_columns = array(); $index_order_part = array(); if (!($aTemplate['javascript_on'] && $aTemplate['fancy_index_highlite'])) { $get_next_two = 0; $last_order_part = 0; $last_last_order_part = 0; foreach ($aTemplate['aOrder'] as $index_order_part) { if ($index_order_part == SQM_COL_CHECK) { $get_next_two = 1; if ($last_last_order_part != SQM_COL_SUBJ) { $show_label_columns[] = $last_last_order_part; } if ($last_order_part != SQM_COL_SUBJ) { $show_label_columns[] = $last_order_part; } } else { if ($get_next_two > 0 && $get_next_two < 3 && $index_order_part != SQM_COL_SUBJ) { $show_label_columns[] = $index_order_part; $get_next_two++; } } $last_last_order_part = $last_order_part; $last_order_part = $index_order_part; } } $aTemplate['show_label_columns'] = $show_label_columns; return $aTemplate; }
/** * This function loops through a group of messages in the mailbox * and shows them to the user. * * @param mixed $imapConnection * @param array $aMailbox associative array with mailbox related vars */ function showMessagesForMailbox($imapConnection, &$aMailbox) { global $color; // to retrieve the internaldate pref: (I know this is not the right place to do that, move up in front // and use a properties array as function argument to provide user preferences global $data_dir, $username; if (!fetchMessageHeaders($imapConnection, $aMailbox)) { return false; } $iSetIndx = $aMailbox['SETINDEX']; $iLimit = $aMailbox['SHOWALL'][$iSetIndx] ? $aMailbox['EXISTS'] : $aMailbox['LIMIT']; $iEnd = $aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $aMailbox['EXISTS'] ? $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $aMailbox['EXISTS']; $paginator_str = get_paginator_str($aMailbox['NAME'], $aMailbox['PAGEOFFSET'], $aMailbox['EXISTS'], $aMailbox['LIMIT'], $aMailbox['SHOWALL'][$iSetIndx]); $msg_cnt_str = get_msgcnt_str($aMailbox['PAGEOFFSET'], $iEnd, $aMailbox['EXISTS']); do_hook('mailbox_index_before'); ?> <table border="0" width="100%" cellpadding="0" cellspacing="0"> <tr> <td> <?php mail_message_listing_beginning($imapConnection, $aMailbox, $msg_cnt_str, $paginator_str); ?> </td> </tr> <tr><td height="5" bgcolor="<?php echo $color[4]; ?> "></td></tr> <tr> <td> <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="<?php echo $color[9]; ?> "> <tr> <td> <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="<?php echo $color[5]; ?> "> <tr> <td> <?php printHeader($aMailbox); displayMessageArray($imapConnection, $aMailbox); ?> </td> </tr> </table> </td> </tr> </table> <?php mail_message_listing_end($aMailbox['EXISTS'], $paginator_str, $msg_cnt_str); ?> </td> </tr> </table> <?php }
/** * 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 = ' | '; $double_delimiter = ' '; $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 . '&mailbox=' . $urlMailbox . '&sort=' . $sort . "&where={$where}&what={$what}" . '&startMessage=' . $startMessage . '&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 . '&mailbox=' . $urlMailbox . '&sort=' . $sort . "&where={$where}&what={$what}" . '&startMessage=' . $startMessage . '&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 . '&mailbox=' . $urlMailbox . '&sort=' . $sort . '&startMessage=' . $startMessage . '&show_more=0' . "&where={$where}&what={$what}" . '&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 . '&mailbox=' . $urlMailbox . '&sort=' . $sort . '&startMessage=' . $startMessage . '&show_more=0' . "&where={$where}&what={$what}" . '&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&what={$what}&mailbox=" . $urlMailbox . "&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 . '&mailbox=' . $urlMailbox . '&startMessage=' . $startMessage . (isset($passed_ent_id) ? '&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") . ' ' . "\n"; } $menu_row .= '</form> '; 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'); }