/** * Prints the table header for the messages list view * * @param array $aMailbox */ function printHeader($aMailbox) { global $index_order, $internal_date_sort, $color; if ($aMailbox['SORT_METHOD'] != 'THREAD') { $showsort = true; } else { $showsort = false; } echo html_tag('tr', '', 'center', $color[5]); /* calculate the width of the subject column based on the * widths of the other columns */ $widths = array(1 => 1, 2 => 25, 3 => 5, 4 => 0, 5 => 1, 6 => 5); $subjectwidth = 100; foreach ($index_order as $item) { $subjectwidth -= $widths[$item]; } foreach ($index_order as $item) { switch ($item) { case 1: /* checkbox */ echo html_tag('td', get_selectall_link($aMailbox), '', '', 'width="1%"'); break; case 5: /* flags */ echo html_tag('td', '', '', '', 'width="1%"'); break; case 2: /* from */ if (handleAsSent($aMailbox['NAME'])) { echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("To") . '</b>'; if ($showsort) { ShowSortButton($aMailbox, SQSORT_TO_ASC, SQSORT_TO_DEC); } } else { echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("From") . '</b>'; if ($showsort) { ShowSortButton($aMailbox, SQSORT_FROM_ASC, SQSORT_FROM_DEC); } } echo "</td>\n"; break; case 3: /* date */ echo html_tag('td', '', 'left', '', 'width="5%" nowrap') . '<b>' . _("Date") . '</b>'; if ($showsort) { if ($internal_date_sort) { ShowSortButton($aMailbox, SQSORT_INT_DATE_ASC, SQSORT_INT_DATE_DEC); } else { ShowSortButton($aMailbox, SQSORT_DATE_ASC, SQSORT_DATE_DEC); } } echo "</td>\n"; break; case 4: /* subject */ echo html_tag('td', '', 'left', '', 'width="' . $subjectwidth . '%"') . '<b>' . _("Subject") . '</b>'; if ($showsort) { ShowSortButton($aMailbox, SQSORT_SUBJ_ASC, SQSORT_SUBJ_DEC); } echo "</td>\n"; break; case 6: /* size */ echo html_tag('td', '', 'center', '', 'width="5%" nowrap') . '<b>' . _("Size") . '</b>'; if ($showsort) { ShowSortButton($aMailbox, SQSORT_SIZE_ASC, SQSORT_SIZE_DEC); } echo "</td>\n"; break; } } echo "</tr>\n"; }
function printHeader($mailbox, $sort, $color, $showsort = true) { global $index_order; echo html_tag('tr', '', 'center', $color[5]); /* calculate the width of the subject column based on the * widths of the other columns */ $widths = array(1 => 1, 2 => 25, 3 => 5, 4 => 0, 5 => 1, 6 => 5); $subjectwidth = 100; foreach ($index_order as $item) { $subjectwidth -= $widths[$item]; } foreach ($index_order as $item) { switch ($item) { case 1: /* checkbox */ /* checkbox */ case 5: /* flags */ echo html_tag('td', ' ', '', '', 'width="1%"'); break; case 2: /* from */ if (handleAsSent($mailbox)) { echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("To") . '</b>'; } else { echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("From") . '</b>'; } if ($showsort) { ShowSortButton($sort, $mailbox, 2, 3); } echo "</td>\n"; break; case 3: /* date */ echo html_tag('td', '', 'left', '', 'width="5%" nowrap') . '<b>' . _("Date") . '</b>'; if ($showsort) { ShowSortButton($sort, $mailbox, 0, 1); } echo "</td>\n"; break; case 4: /* subject */ echo html_tag('td', '', 'left', '', 'width="' . $subjectwidth . '%"') . '<b>' . _("Subject") . '</b>'; if ($showsort) { ShowSortButton($sort, $mailbox, 4, 5); } echo "</td>\n"; break; case 6: /* size */ echo html_tag('td', '', 'left', '', 'width="5%" nowrap') . '<b>' . _("Size") . '</b>'; if ($showsort) { ShowSortButton($sort, $mailbox, 8, 9); } echo "</td>\n"; break; } } echo "</tr>\n"; }
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 = ' | '; $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) . '&what=' . urlencode($what) . '&mailbox=' . $urlMailbox; $msgs_str = _("Search Results"); } else { $msgs_url .= 'right_main.php?sort=' . $sort . '&startMessage=' . $startMessage . '&mailbox=' . $urlMailbox; $msgs_str = _("Message List"); } $s .= '<a href="' . $msgs_url . '">' . $msgs_str . '</a>'; $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox . '&message=' . $passed_id . '&'; if (!(isset($passed_ent_id) && $passed_ent_id)) { if ($where && $what) { $delete_url .= 'where=' . urlencode($where) . '&what=' . urlencode($what); } else { $delete_url .= 'sort=' . $sort . '&startMessage=' . $startMessage; } $s .= $topbar_delimiter; $s .= '<a href="' . $delete_url . '">' . _("Delete") . '</a>'; } $comp_uri = 'src/compose.php' . '?passed_id=' . $passed_id . '&mailbox=' . $urlMailbox . '&startMessage=' . $startMessage . (isset($passed_ent_id) ? '&passed_ent_id=' . urlencode($passed_ent_id) : ''); if ($mailbox == $draft_folder && $save_as_draft) { $comp_alt_uri = $comp_uri . '&smaction=draft'; $comp_alt_string = _("Resume Draft"); } else { if (handleAsSent($mailbox)) { $comp_alt_uri = $comp_uri . '&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 . '&mailbox=' . $urlMailbox . '&sort=' . $sort . '&startMessage=' . $startMessage . '&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 . '&mailbox=' . $urlMailbox . '&sort=' . $sort . '&startMessage=' . $startMessage . '&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 . '&smaction=forward'; $s .= makeComposeLink($comp_action_uri, _("Forward")); if ($enable_forward_as_attachment) { $comp_action_uri = $comp_uri . '&smaction=forward_as_attachment'; $s .= $topbar_delimiter; $s .= makeComposeLink($comp_action_uri, _("Forward as Attachment")); } $comp_action_uri = $comp_uri . '&smaction=reply'; $s .= $topbar_delimiter; $s .= makeComposeLink($comp_action_uri, _("Reply")); $comp_action_uri = $comp_uri . '&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'); }
} $trash_folder = isset($trash_folder) ? $trash_folder : false; $sent_folder = isset($sent_folder) ? $sent_folder : false; $draft_folder = isset($draft_folder) ? $draft_folder : false; /** * until there is no per mailbox option screen to set prefs we override * the mailboxprefs by the default ones */ $aMailboxPref[MBX_PREF_LIMIT] = (int) $show_num; $aMailboxPref[MBX_PREF_AUTO_EXPUNGE] = (bool) $auto_expunge; $aMailboxPref[MBX_PREF_INTERNALDATE] = (bool) getPref($data_dir, $username, 'internal_date_sort'); $aMailboxPref[MBX_PREF_COLUMNS] = $index_order; /** * Replace From => To in case it concerns a draft or sent folder */ if (handleAsSent($mailbox) && !in_array(SQM_COL_TO, $aMailboxPref[MBX_PREF_COLUMNS])) { $aNewOrder = array(); // nice var name ;) foreach ($aMailboxPref[MBX_PREF_COLUMNS] as $iCol) { if ($iCol == SQM_COL_FROM) { $iCol = SQM_COL_TO; } $aNewOrder[] = $iCol; } $aMailboxPref[MBX_PREF_COLUMNS] = $aNewOrder; setUserPref($username, 'pref_' . $account . '_' . $mailbox, serialize($aMailboxPref)); } /** * Set the config options for the messages list */ $aColumns = array();
/** * Format message toolbar * * @param array $aMailbox Current mailbox information array * @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 void $removedVar This parameter is no longer used, but remains * so as not to break this function's prototype * (OPTIONAL) * @param boolean $nav_on_top When TRUE, the menubar is being constructed * for use at the top of the page, otherwise it * will be used for page bottom (OPTIONAL; * default = TRUE) */ function formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message, $removedVar = FALSE, $nav_on_top = TRUE) { global $base_uri, $draft_folder, $where, $what, $sort, $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, $delete_prev_next_display, $show_copy_buttons, $compose_new_win, $compose_width, $compose_height, $oTemplate; //FIXME cleanup argument list, use $aMailbox where possible $mailbox = $aMailbox['NAME']; $urlMailbox = urlencode($mailbox); // Create Prev & Next links // Handle nested entities first (i.e. Mime Attach parts) $prev_href = $next_href = $up_href = $del_href = $del_prev_href = $del_next_href = ''; $msg_list_href = $search_href = $view_msg_href = ''; 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; } } if (isset($entities[$passed_ent_id]) && $entities[$passed_ent_id] > 1) { $prev_ent_id = $entity_count[$entities[$passed_ent_id] - 1]; $prev_href = set_url_var($PHP_SELF, 'passed_ent_id', $prev_ent_id); } if (isset($entities[$passed_ent_id]) && $entities[$passed_ent_id] < $c) { $next_ent_id = $entity_count[$entities[$passed_ent_id] + 1]; $next_href = set_url_var($PHP_SELF, 'passed_ent_id', $next_ent_id); } $par_ent_id = $message->parent->entity_id; if ($par_ent_id) { $par_ent_id = substr($par_ent_id, 0, -2); if ($par_ent_id != 0) { $up_href = set_url_var($PHP_SELF, 'passed_ent_id', $par_ent_id); } } $view_msg_href = $url; // Prev/Next links for regular messages } else { if (true) { //!(isset($where) && isset($what)) ) { $prev = findPreviousMessage($aMailbox['UIDSET'][$what], $passed_id); $next = findNextMessage($aMailbox['UIDSET'][$what], $passed_id); if ($prev >= 0) { $prev_href = $base_uri . 'src/read_body.php?passed_id=' . $prev . '&mailbox=' . $urlMailbox . '&sort=' . $sort . "&where={$where}&what={$what}" . '&startMessage=' . $startMessage . '&show_more=0'; } if ($next >= 0) { $next_href = $base_uri . 'src/read_body.php?passed_id=' . $next . '&mailbox=' . $urlMailbox . '&sort=' . $sort . "&where={$where}&what={$what}" . '&startMessage=' . $startMessage . '&show_more=0'; } // 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)) { if ($prev >= 0) { $del_prev_href = $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 . '&smtoken=' . sm_generate_security_token(); } if ($next >= 0) { $del_next_href = $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 . '&smtoken=' . sm_generate_security_token(); } } } } $msg_list_href = get_message_list_uri($aMailbox['NAME'], $startMessage, $what); if ($where == 'search.php') { $search_href = str_replace('read_body.php', 'search.php', $msg_list_href); } else { $search_href = ''; } $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 = 'post'; $onsubmit = ''; if ($compose_new_win == '1') { if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) { $compose_width = '640'; } if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) { $compose_height = '550'; } if (checkForJavascript()) { $on_click = 'comp_in_new_form(\'' . $comp_uri . '\', this, this.form,' . $compose_width . ',' . $compose_height . ')'; $comp_uri = 'javascript:void(0)'; $method = 'get'; $onsubmit = 'return false'; } else { $target = '_blank'; } } $oTemplate->assign('nav_on_top', $nav_on_top); $oTemplate->assign('prev_href', $prev_href); $oTemplate->assign('up_href', $up_href); $oTemplate->assign('next_href', $next_href); $oTemplate->assign('del_prev_href', $del_prev_href); $oTemplate->assign('del_next_href', $del_next_href); $oTemplate->assign('view_msg_href', $view_msg_href); $oTemplate->assign('message_list_href', $msg_list_href); $oTemplate->assign('search_href', $search_href); $oTemplate->assign('form_extra', ''); $oTemplate->assign('form_method', $method); $oTemplate->assign('form_target', $target); $oTemplate->assign('form_onsubmit', $onsubmit); $oTemplate->assign('compose_href', $comp_uri); $oTemplate->assign('button_onclick', $on_click); $oTemplate->assign('forward_as_attachment_enabled', $enable_forward_as_attachment == 1); //FIXME: I am surprised these aren't already given to the template; probably needs to be given at a higher level, so I have NO IDEA if this is the right place to do this... adding them so template can construct its own API calls... we can build those herein too if preferrable $oTemplate->assign('mailbox', $aMailbox['NAME']); $oTemplate->assign('passed_id', $passed_id); $oTemplate->assign('what', $what); // If Draft folder - create Resume link $resume_draft = $edit_as_new = false; if (isDraftMailbox($mailbox) && $save_as_draft) { $resume_draft = true; } else { if (handleAsSent($mailbox)) { $edit_as_new = true; } } $oTemplate->assign('can_resume_draft', $resume_draft); $oTemplate->assign('can_edit_as_new', $edit_as_new); $oTemplate->assign('mailboxes', sqimap_mailbox_option_array($imapConnection)); if (in_array('\\deleted', $aMailbox['PERMANENTFLAGS'], true)) { $delete_url = $base_uri . "src/{$where}"; $oTemplate->assign('can_be_deleted', true); $oTemplate->assign('move_delete_form_action', $base_uri . 'src/' . $where); $oTemplate->assign('delete_form_extra', addHidden('mailbox', $aMailbox['NAME']) . "\n" . addHidden('msg[0]', $passed_id) . "\n" . addHidden('startMessage', $startMessage) . "\n"); if (!(isset($passed_ent_id) && $passed_ent_id)) { $oTemplate->assign('can_be_moved', true); $oTemplate->assign('move_form_extra', addHidden('mailbox', $aMailbox['NAME']) . "\n" . addHidden('msg[0]', $passed_id) . "\n"); $oTemplate->assign('last_move_target', isset($lastTargetMailbox) && !empty($lastTargetMailbox) ? $lastTargetMailbox : ''); $oTemplate->assign('can_be_copied', $show_copy_buttons == 1); } else { $oTemplate->assign('can_be_moved', false); $oTemplate->assign('move_form_extra', ''); $oTemplate->assign('last_move_target', ''); $oTemplate->assign('can_be_copied', false); } } else { $oTemplate->assign('can_be_deleted', false); $oTemplate->assign('move_delete_form_action', ''); $oTemplate->assign('delete_form_extra', ''); $oTemplate->assign('can_be_moved', false); $oTemplate->assign('move_form_extra', ''); $oTemplate->assign('last_move_target', ''); $oTemplate->assign('can_be_copied', false); } // access keys... only add to the top menubar, because adding // them twice makes them less functional (press access key, *then* // press <enter> to make it work) // if ($nav_on_top) { global $accesskey_read_msg_reply, $accesskey_read_msg_reply_all, $accesskey_read_msg_forward, $accesskey_read_msg_as_attach, $accesskey_read_msg_delete, $accesskey_read_msg_bypass_trash, $accesskey_read_msg_move, $accesskey_read_msg_move_to, $accesskey_read_msg_copy; } else { $accesskey_read_msg_reply = $accesskey_read_msg_reply_all = $accesskey_read_msg_forward = $accesskey_read_msg_as_attach = $accesskey_read_msg_delete = $accesskey_read_msg_bypass_trash = $accesskey_read_msg_move = $accesskey_read_msg_move_to = $accesskey_read_msg_copy = 'NONE'; } $oTemplate->assign('accesskey_read_msg_reply', $accesskey_read_msg_reply); $oTemplate->assign('accesskey_read_msg_reply_all', $accesskey_read_msg_reply_all); $oTemplate->assign('accesskey_read_msg_forward', $accesskey_read_msg_forward); $oTemplate->assign('accesskey_read_msg_as_attach', $accesskey_read_msg_as_attach); $oTemplate->assign('accesskey_read_msg_delete', $accesskey_read_msg_delete); $oTemplate->assign('accesskey_read_msg_bypass_trash', $accesskey_read_msg_bypass_trash); $oTemplate->assign('accesskey_read_msg_move_to', $accesskey_read_msg_move_to); $oTemplate->assign('accesskey_read_msg_move', $accesskey_read_msg_move); $oTemplate->assign('accesskey_read_msg_copy', $accesskey_read_msg_copy); global $null; do_hook('read_body_menu', $null); if ($nav_on_top) { $oTemplate->display('read_menubar_nav.tpl'); $oTemplate->display('read_menubar_buttons.tpl'); } else { $oTemplate->display('read_menubar_buttons.tpl'); $oTemplate->display('read_menubar_nav.tpl'); } }
/** * 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'); }