From 4669e892dbef020106d7439541fbd3d550d6f959 Mon Sep 17 00:00:00 2001 From: stekkel Date: Thu, 20 May 2004 16:20:42 +0000 Subject: [PATCH] Respect the permanentflags output. Do not show the alter flags buttons /links if the mailbox does not allow it. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7499 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 98 ++++++++++++++++++----------------- functions/mailbox_display.php | 72 +++++++++++++------------ src/read_body.php | 95 +++++++++++++++++---------------- 3 files changed, 140 insertions(+), 125 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 51149e30..13238ee3 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -1,5 +1,4 @@ mailboxname_full; } - return strnatcasecmp($acmp, $bcmp); + return strnatcasecmp($acmp, $bcmp); } function compact_mailboxes_response($ary) { /* * Workaround for mailboxes returned as literal - * FIXME : Doesn't work if the mailbox name is multiple lines + * FIXME : Doesn't work if the mailbox name is multiple lines * (larger then fgets buffer) */ for ($i = 0, $iCnt=count($ary); $i < $iCnt; $i++) { @@ -157,13 +156,13 @@ function readMailboxParent($haystack, $needle) { return( $ret ); } -/** +/** * Check if $subbox is below the specified $parentbox */ function isBoxBelow( $subbox, $parentbox ) { global $delimiter; - /* - * Eliminate the obvious mismatch, where the + /* + * Eliminate the obvious mismatch, where the * subfolder path is shorter than that of the potential parent */ if ( strlen($subbox) < strlen($parentbox) ) { @@ -250,17 +249,17 @@ function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, /** * Expunge specified message, updated $msgs and $msort - * - * Until Marc and I come up with a better way to maintain - * these stupid arrays, we'll use this wrapper function to + * + * Until Marc and I come up with a better way to maintain + * these stupid arrays, we'll use this wrapper function to * remove the message with the matching UID .. the order * won't be changed - the array element for the message * will just be removed. */ function sqimap_mailbox_expunge_dmn($message_id, $aMbxResponse, &$server_sort_array) { - global $msgs, $msort, $sort, $imapConnection, - $mailbox, $auto_expunge, + global $msgs, $msort, $sort, $imapConnection, + $mailbox, $auto_expunge, $sort, $allow_server_sort, $thread_sort_messages, $allow_thread_sort, $username, $data_dir; $cnt = 0; @@ -270,15 +269,15 @@ function sqimap_mailbox_expunge_dmn($message_id, $aMbxResponse, &$server_sort_ar } // Got to grab this out of prefs, since it isn't saved from mailbox_view.php if ($allow_thread_sort) { - $thread_sort_messages = getPref($data_dir, $username, "thread_$mailbox",0); + $thread_sort_messages = getPref($data_dir, $username, "thread_$mailbox",0); } for ($i = 0; $i < count($msort); $i++) { if ($msgs[$i]['ID'] == $message_id) { - break; + break; } } - + if ( isset($msgs) ) { unset($msgs[$i]); $msgs = array_values($msgs); @@ -303,7 +302,7 @@ function sqimap_mailbox_expunge_dmn($message_id, $aMbxResponse, &$server_sort_ar if ( $allow_thread_sort && $thread_sort_messages ) { $server_sort_array = get_thread_sort($imapConnection); } elseif ( $allow_server_sort ) { - if (is_array($server_sort_array)) { + if (is_array($server_sort_array)) { $key = array_search($message_id,$server_sort_array,true); if ($key !== false) { unset($server_sort_array[$key]); @@ -353,15 +352,18 @@ function sqimap_mailbox_select ($imap_stream, $mailbox) { } else { if (preg_match("/PERMANENTFLAGS(.*)/i",$read[$i], $regs)) { $regs[1]=trim(preg_replace ( array ("/\(/","/\)/","/\]/") ,'', $regs[1])) ; - $result['PERMANENTFLAGS'] = $regs[1]; + $result['PERMANENTFLAGS'] = explode(' ',strtolower($regs[1])); } else if (preg_match("/FLAGS(.*)/i",$read[$i], $regs)) { $regs[1]=trim(preg_replace ( array ("/\(/","/\)/") ,'', $regs[1])) ; - $result['FLAGS'] = $regs[1]; + $result['FLAGS'] = explode(' ',strtolower($regs[1])); } } } + if (!isset($result['PERMANENTFLAGS'])) { + $result['PERMANENTFLAGS'] = $result['FLAGS']; + } if (preg_match('/^\[(.+)\]/',$message, $regs)) { - $result['RIGHTS']=$regs[1]; + $result['RIGHTS']=strtoupper($regs[1]); } return $result; @@ -541,7 +543,7 @@ function sqimap_mailbox_parse ($line, $line_lsub) { $boxesall[$g]['flags'] = array(); if (isset($line[$g])) { ereg("\(([^)]*)\)",$line[$g],$regs); - // FIXME Flags do contain the \ character. \NoSelect \NoInferiors + // FIXME Flags do contain the \ character. \NoSelect \NoInferiors // and $MDNSent <= last one doesn't have the \ // It's better to follow RFC3501 instead of using our own naming. $flags = trim(strtolower(str_replace('\\', '',$regs[1]))); @@ -571,7 +573,7 @@ function sqimap_mailbox_parse ($line, $line_lsub) { * \NoSelect and \NoInferiors * $use_long_format - override folder display preference and always show full folder name. */ -function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0, +function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0, $flag = 'noselect', $use_long_format = false ) { global $username, $data_dir; $mbox_options = ''; @@ -592,13 +594,13 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk if ($folder_skip != 0 && in_array($box, $folder_skip) ) { continue; } - $lowerbox = strtolower($box); + $lowerbox = strtolower($box); // mailboxes are casesensitive => inbox.sent != inbox.Sent // nevermind, to many dependencies this should be fixed! - + if (strtolower($box) == 'inbox') { // inbox is special and not casesensitive $box2 = _("INBOX"); - } else { + } else { switch ($shorten_box_names) { case 2: /* delimited, style = 2 */ @@ -623,7 +625,7 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk } /** - * Returns sorted mailbox lists in several different ways. + * Returns sorted mailbox lists in several different ways. * See comment on sqimap_mailbox_parse() for info about the returned array. */ @@ -647,10 +649,10 @@ function sqimap_mailbox_list($imap_stream, $force=false) { $lsub = 'LIST (SUBSCRIBED)'; } else { $lsub = 'LSUB'; - } - + } + if ($noselect_fix_enable) { - + $lsub_args = "$lsub \"$folder_prefix\" \"*%\""; } else { $lsub_args = "$lsub \"$folder_prefix\" \"*\""; @@ -658,7 +660,7 @@ function sqimap_mailbox_list($imap_stream, $force=false) { /* LSUB array */ $lsub_ary = sqimap_run_command ($imap_stream, $lsub_args, true, $response, $message); - $lsub_ary = compact_mailboxes_response($lsub_ary); + $lsub_ary = compact_mailboxes_response($lsub_ary); $sorted_lsub_ary = array(); for ($i = 0, $cnt = count($lsub_ary);$i < $cnt; $i++) { @@ -693,9 +695,9 @@ function sqimap_mailbox_list($imap_stream, $force=false) { $read = sqimap_run_command ($imap_stream, 'LIST "" ' . sqimap_encode_mailbox_name($mbx), true, $response, $message); - + $read = compact_mailboxes_response($read); - + if (isset($read[0])) { $sorted_list_ary[$i] = $read[0]; } else { @@ -846,7 +848,7 @@ function sqimap_mailbox_tree($imap_stream) { if (preg_match("/^\*\s+LSUB.*\s\"?INBOX\"?[^(\/\.)].*$/i",$lsub_ary[$i])) { $lsub_ary[$i] = strtoupper($lsub_ary[$i]); // in case of an unsubscribed inbox an imap server can - // return the inbox in the lsub results with a \NoSelect + // return the inbox in the lsub results with a \NoSelect // flag. if (!preg_match("/\*\s+LSUB\s+\(.*\\\\NoSelect.*\).*/i",$lsub_ary[$i])) { $has_inbox = true; @@ -854,7 +856,7 @@ function sqimap_mailbox_tree($imap_stream) { // remove the result and request it again with a list // response at a later stage. unset($lsub_ary[$i]); - // re-index the array otherwise the addition of the LIST + // re-index the array otherwise the addition of the LIST // response will fail in PHP 4.1.2 and probably other older versions $lsub_ary = array_values($lsub_ary); } @@ -874,7 +876,7 @@ function sqimap_mailbox_tree($imap_stream) { } /* - * Section about removing the last element was removed + * Section about removing the last element was removed * We don't return "* OK" anymore from sqimap_read_data */ @@ -884,14 +886,14 @@ function sqimap_mailbox_tree($imap_stream) { $mbx = find_mailbox_name($lsub_ary[$i]); // only do the noselect test if !uw, is checked later. FIX ME see conf.pl setting - if ($imap_server_type != "uw") { + if ($imap_server_type != "uw") { $noselect = check_is_noselect($lsub_ary[$i]); $noinferiors = check_is_noinferiors($lsub_ary[$i]); } if (substr($mbx, -1) == $delimiter) { $mbx = substr($mbx, 0, strlen($mbx) - 1); } - $sorted_lsub_ary[] = array ('mbx' => $mbx, 'noselect' => $noselect, 'noinferiors' => $noinferiors); + $sorted_lsub_ary[] = array ('mbx' => $mbx, 'noselect' => $noselect, 'noinferiors' => $noinferiors); } // FIX ME this requires a config setting inside conf.pl instead of checking on server type if ($imap_server_type == "uw") { @@ -902,7 +904,7 @@ function sqimap_mailbox_tree($imap_stream) { $mbx = stripslashes($aMbx['mbx']); sqimap_prepare_pipelined_query('LIST "" ' . sqimap_encode_mailbox_name($mbx), $tag, $aQuery, false); $aTag[$tag] = $mbx; - } + } $sorted_lsub_ary = array(); // execute all the queries at once $aResponse = sqimap_run_pipelined_command ($imap_stream, $aQuery, false, $aServerResponse, $aServerMessage); @@ -958,7 +960,7 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false,$imap_stream) { $mbx = new mailboxes(); $mailbox = $mbx_ary[$i]['mbx']; - /* + /* sent subfolders messes up using existing code as subfolders were marked, but the parents were ordered somewhere else in the list, despite having "special folders at top" option set. @@ -1001,7 +1003,7 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false,$imap_stream) { $mbx->is_special |= ($mbx->is_draft = isDraftMailbox($mailbox)); if (!$mbx->is_special) $mbx->is_special = boolean_hook_function('special_mailbox', $mailbox, 1); - + if (isset($mbx_ary[$i]['unseen'])) { $mbx->unseen = $mbx_ary[$i]['unseen']; } @@ -1051,7 +1053,7 @@ function sqimap_tree_to_ref_array(&$mbx_tree,&$aMbxs) { sqimap_tree_to_ref_array($mbx_tree->mbxs[$i],$aMbxs); } } -} +} function sqimap_get_status_mbx_tree($imap_stream,&$mbx_tree) { global $unseen_notify, $unseen_type, $trash_folder,$move_to_trash; @@ -1103,7 +1105,7 @@ function sqimap_get_status_mbx_tree($imap_stream,&$mbx_tree) { $oMbx =& $aMbxs[$i]; if (strtoupper($oMbx->mailboxname_full) == 'INBOX' || ($move_to_trash && $oMbx->mailboxname_full == $trash_folder)) { - if ($unseen_type == 2 || + if ($unseen_type == 2 || ($oMbx->mailboxname_full == $trash_folder && $move_to_trash)) { $aStatus = sqimap_status_messages($imap_stream,$oMbx->mailboxname_full); $oMbx->unseen = $aStatus['UNSEEN']; @@ -1122,7 +1124,7 @@ function sqimap_get_status_mbx_tree($imap_stream,&$mbx_tree) { } } } - } -} + } +} ?> diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 48fbb313..485e8856 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -59,7 +59,7 @@ function elapsed($start) function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, $start_msg, $where, $what) { global $checkall, - $color, $msgs, $msort, $td_str, $msg, + $color, $msgs, $msort, $td_str, $msg, $default_use_priority, $message_highlight_list, $index_order, @@ -111,7 +111,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, else $bHandleAsSent = $bSentFolder; // If this is a Sent message, display To address instead of From - if ($bHandleAsSent) + if ($bHandleAsSent) $msg['FROM'] = $msg['TO']; // Passing 1 below results in only 1 address being parsed, thus defeating the following code $msg['FROM'] = parseAddress($msg['FROM']/*,1*/); @@ -217,7 +217,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, $headertest = strtolower(decodeHeader($msg[$match_type], true, false)); if (strstr('^^' . $headertest, $high_val)) { $hlt_color = $message_highlight_list_part['color']; - break 3; + break 3; } break; } @@ -237,7 +237,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, switch ($index_order_part) { case 1: /* checkbox */ echo html_tag( 'td', - addCheckBox("msg[$t]", $checkall, $msg['ID']), + addCheckBox("msg[$t]", $checkall, $msg['ID']), 'center', $hlt_color ); break; @@ -656,7 +656,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, @@ -669,9 +669,9 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
-
@@ -681,7 +681,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
-
@@ -853,7 +853,7 @@ function displayMessageArray($imapConnection, $num_msgs, $start_msg, * To finish the table, you need to do a ""; * * @param mixed $imapConnection - * @param array $mbxresponse the array with the results of SELECT against the current mailbox + * @param array $mbxresponse the array with the results of SELECT against the current mailbox * @param string $mailbox the current mailbox * @param mixed $sort the current sorting method (-1 for no sorting available [searches]) * @param mixed $msg_cnt_str @@ -943,40 +943,48 @@ function mail_message_listing_beginning ($imapConnection, ' . _("Bypass Trash"); - echo ' '; - if (!$auto_expunge) { + if (array_search('\\deleted',$mbxresponse['PERMANENTFLAGS'], true) !== FALSE) { + echo getButton('SUBMIT', 'delete',_("Delete")); + echo '' . _("Bypass Trash"); + echo ' '; + } + if (!$auto_expunge && $mbxresponse['RIGHTS'] != 'READ-ONLY') { echo getButton('SUBMIT', 'expungeButton',_("Expunge")) .' ' . _("mailbox") . "\n"; echo ' '; } do_hook('mailbox_display_buttons'); ?> - - + '; //echo $thread_link_str; //previous behaviour - getMbxList($imapConnection); - echo getButton('SUBMIT', 'moveButton',_("Move")) . "\n"; - ?> + getMbxList($imapConnection); + echo getButton('SUBMIT', 'moveButton',_("Move")) . "\n + "; + } + ?> - + @@ -1006,7 +1014,7 @@ function mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $colo /* space between list and footer */ ?> - + @@ -1048,7 +1056,7 @@ function printHeader($mailbox, $sort, $color, $showsort=true, $start_msg=1) { $widths = array(1=>1,2=>25,3=>5,4=>0,5=>1,6=>5); $subjectwidth = 100; foreach($index_order as $item) { - $subjectwidth -= $widths[$item]; + $subjectwidth -= $widths[$item]; } foreach ($index_order as $item) { @@ -1426,7 +1434,7 @@ function get_paginator_str($box, $start_msg, $end_msg, $num_msgs, /* Compute the 'show all' string. */ $all_str = "" . _("Show All") . ''; + . ">" . _("Show All") . ''; } $result .= ($pg_str != '' ? $spc . '['.$spc.$pg_str.']' . $spc : ''); @@ -1456,7 +1464,7 @@ function truncateWithEntities($subject, $trim_at) * see if this is entities-encoded string * If so, Iterate through the whole string, find out * the real number of characters, and if more - * than $trim_at, substr with an updated trim value. + * than $trim_at, substr with an updated trim value. */ $trim_val = $trim_at; $ent_offset = 0; @@ -1507,12 +1515,12 @@ function processSubject($subject, $threadlevel = 0) { * FIXME: Undocumented function * * @param mixed $imapConnection - * @param mixed $boxes + * @param mixed $boxes */ function getMbxList($imapConnection, $boxes = 0) { global $lastTargetMailbox; echo '   '; } @@ -1579,7 +1587,7 @@ function getEndMessage($start_msg, $show_num, $num_msgs) { */ function handleAsSent($mailbox) { global $handleAsSent_result; - + /* First check if this is the sent or draft folder. */ $handleAsSent_result = isSentMailbox($mailbox) || isDraftMailbox($mailbox); diff --git a/src/read_body.php b/src/read_body.php index 99cb4ce8..a9e7de0e 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -38,7 +38,7 @@ require_once(SM_PATH . 'functions/mailbox_display.php'); * @return the index of the next valid message from the array */ function findNextMessage($passed_id) { - global $msort, $msgs, $sort, + global $msort, $msgs, $sort, $thread_sort_messages, $allow_server_sort, $server_sort_array; if (!is_array($server_sort_array)) { @@ -54,7 +54,7 @@ function findNextMessage($passed_id) { break; } $result = $server_sort_array[$key + 1]; - break; + break; } } } else { @@ -120,7 +120,7 @@ function findPreviousMessage($numMessages, $passed_id) { * Displays a link to a page where the message is displayed more * "printer friendly". * @param string $mailbox Name of current mailbox - * @param int $passed_id + * @param int $passed_id */ function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) { global $javascript_on, $color; @@ -150,14 +150,16 @@ function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) { return $result; } -function ServerMDNSupport($read) { - /* escaping $ doesn't work -> \x36 */ - $ret = preg_match('/(\x36MDNSent|\\\\\*)/i', $read); - return $ret; +function ServerMDNSupport($aFlags) { + /* escaping $ doesn't work -> \x36 */ + return (array_search('$mdnsent',$aFlags,true) !== false || + array_search('\\*',$aFlags,true) !== false) ? true : false; + //$ret = preg_match('/(\x36MDNSent|\\\\\*)/i', $read); + //return $ret; } function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { - global $username, $attachment_dir, + global $username, $attachment_dir, $version, $attachments, $squirrelmail_language, $default_charset, $languages, $useSendmail, $domain, $sent_folder, $popuser, $data_dir, $username; @@ -224,7 +226,7 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { sprintf( _("Was displayed on %s"), $now ); $special_encoding = ''; - if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && + if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) { $body = $languages[$squirrelmail_language]['XTRA_CODE']('encode', $body); if (strtolower($default_charset) == 'iso-2022-jp') { @@ -320,7 +322,7 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) { function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id) { $sg = $set?'+':'-'; $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)'; - $read = sqimap_run_command ($imapConnection, $cmd, true, $response, + $read = sqimap_run_command ($imapConnection, $cmd, true, $response, $readmessage, TRUE); } @@ -398,7 +400,7 @@ function formatRecipientString($recipients, $item ) { return $string; } -function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, +function formatEnvheader($mailbox, $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, @@ -431,8 +433,8 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, if ($message->is_mdnsent) { $env[_("Read receipt")] = _("sent"); } else { - $env[_("Read receipt")] = _("requested"); - if (!(handleAsSent($mailbox) || + $env[_("Read receipt")] = _("requested"); + if (!(handleAsSent($mailbox) || $message->is_deleted || $passed_ent_id)) { $mdn_url = $PHP_SELF . '&sendreceipt=1'; @@ -479,8 +481,8 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, } /** - * Format message toolbar - * + * 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 @@ -489,7 +491,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, */ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response, $nav_on_top = TRUE) { global $base_uri, $draft_folder, $where, $what, $color, $sort, - $startMessage, $PHP_SELF, $save_as_draft, + $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox, $data_dir, $username, $delete_prev_next_display, $compose_new_win, $javascript_on; @@ -573,14 +575,15 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp // Only bother with Delete & Prev and Delete & Next IF // top display is enabled. - if ( $delete_prev_next_display == 1 ) { + if ( $delete_prev_next_display == 1 && + array_search('\\deleted', $mbx_response['PERMANENTFLAGS'],true) !== false) { $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'. '&delete_id='.$passed_id; - $del_prev_link = ''.$del_prev_link.''; + $del_prev_link = ''.$del_prev_link.''; } $del_next_link = _("Delete & Next"); @@ -621,8 +624,8 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp '&mailbox=' . $urlMailbox . '&startMessage=' . $startMessage . (isset($passed_ent_id) ? '&passed_ent_id='.$passed_ent_id : ''); - - // Start form for reply/reply all/forward.. + + // Start form for reply/reply all/forward.. $target = ''; $on_click=''; $method='method="post" '; @@ -659,33 +662,35 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp $menu_row .= ' '; + if (array_search('\\deleted', $mbx_response['PERMANENTFLAGS'],true) !== false) { // Form for deletion - $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox; - $menu_row .= '
'; + $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox; + $menu_row .= ''; - if (!(isset($passed_ent_id) && $passed_ent_id)) { - $menu_row .= addHidden('message', $passed_id); + if (!(isset($passed_ent_id) && $passed_ent_id)) { + $menu_row .= addHidden('message', $passed_id); - if ($where && $what) { - $menu_row .= addHidden('where', $where); - $menu_row .= addHidden('what', $what); - } else { - $menu_row .= addHidden('sort', $sort); - $menu_row .= addHidden('startMessage', $startMessage); + if ($where && $what) { + $menu_row .= addHidden('where', $where); + $menu_row .= addHidden('what', $what); + } else { + $menu_row .= addHidden('sort', $sort); + $menu_row .= addHidden('startMessage', $startMessage); + } + $menu_row .= getButton('SUBMIT', 'delete', _("Delete")); + $menu_row .= '' . _("Bypass Trash"); } - $menu_row .= getButton('SUBMIT', 'delete', _("Delete")); - $menu_row .= '' . _("Bypass Trash"); - } - else - $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled - - $menu_row .= ''; + else + $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled + $menu_row .= ''; + } // Add top move link $menu_row .= '
' . html_tag( 'td', '
'. $messagebody."\n", 'left') . ''; echo '
'; - if ( !(isset($passed_ent_id) && $passed_ent_id) ) { - + if ( !(isset($passed_ent_id) && $passed_ent_id) && + array_search('\\deleted', $mbx_response['PERMANENTFLAGS'],true) !== false) { + $current_box = 'mailbox='.$mailbox.'&sort='.$sort.'&startMessage='.$startMessage; // Set subsequent location based on whether or not there is a 'next' message. @@ -734,13 +739,13 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) { global $base_uri, $where, $what; - + $urlMailbox = urlencode($mailbox); $urlPassed_id = urlencode($passed_id); $urlPassed_ent_id = urlencode($passed_ent_id); - + $query_string = 'mailbox=' . $urlMailbox . '&passed_id=' . $urlPassed_id . '&passed_ent_id=' . $urlPassed_ent_id; - + if (!empty($where)) { $query_string .= '&where=' . urlencode($where); } @@ -925,7 +930,7 @@ echo html_tag( 'table' ,'' , 'left', '', 'cellpadding="1" cellspacing="5" border echo '
'; -echo ' '; +echo ' '; echo ' '; echo ' '; echo ' '; @@ -939,7 +944,7 @@ if ($attachmentsdisplay) { echo ' '; echo '
'; echo ' '; - echo ' ' . html_tag( 'td', '', 'left', $color[9] ); + echo ' ' . html_tag( 'td', '', 'left', $color[9] ); echo ' ' . _("Attachments") . ':'; echo ' '; echo '
'; @@ -978,7 +983,7 @@ formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response, FAL do_hook('read_body_bottom'); do_hook('html_bottom'); sqimap_logout($imapConnection); -/* sessions are written at the end of the script. it's better to register +/* sessions are written at the end of the script. it's better to register them at the end so we avoid double session_register calls */ sqsession_register($messages,'messages'); -- 2.25.1