+ 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" ';
+ $onsubmit='';
+ 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" ';
+ $onsubmit = 'onsubmit="return false" ';
+ } else {
+ $target = 'target="_blank"';