X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=e9a6dcfd98f378f0810a399d8b3c5af998960336;hb=39de750f7ebb151f2a03db2e9f0304b4d9b90c1b;hp=77d6020dc9c06c624bca45c16df1d8d1a8fde28e;hpb=abafb676191905f40ed21a163c95f4aa676e88ff;p=squirrelmail.git
diff --git a/src/read_body.php b/src/read_body.php
index 77d6020d..e9a6dcfd 100644
--- a/src/read_body.php
+++ b/src/read_body.php
@@ -1,9 +1,8 @@
$value) {
if ($passed_id == $value) {
- if ($key == 0) {
- break;
+ if ($key != 0) {
+ $result = $server_sort_array[$key - 1];
}
- $result = $server_sort_array[$key - 1];
break;
}
}
@@ -316,11 +314,11 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
return $success;
}
-function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id, $uid_support) {
+function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id) {
$sg = $set?'+':'-';
$cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
$read = sqimap_run_command ($imapConnection, $cmd, true, $response,
- $readmessage, $uid_support);
+ $readmessage, TRUE);
}
function ClearAttachments() {
@@ -488,20 +486,15 @@ 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, $uid_support,
+ $startMessage, $PHP_SELF, $save_as_draft,
$enable_forward_as_attachment, $imapConnection, $lastTargetMailbox,
- $data_dir, $username;
+ $data_dir, $username, $delete_prev_next_display,
+ $compose_new_win, $javascript_on;
$topbar_delimiter = ' | ';
$double_delimiter = ' ';
$urlMailbox = urlencode($mailbox);
- $comp_uri = 'src/compose.php' .
- '?passed_id=' . $passed_id .
- '&mailbox=' . $urlMailbox .
- '&startMessage=' . $startMessage .
- (isset($passed_ent_id)?'&passed_ent_id='.$passed_ent_id:'');
-
$msgs_url = $base_uri . 'src/';
// BEGIN NAV ROW - PREV/NEXT, DEL PREV/NEXT, LINKS TO INDEX, etc.
@@ -576,9 +569,8 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
}
// Only bother with Delete & Prev and Delete & Next IF
- // we have UID support, and top display is enabled.
- $delete_prev_next_display = getPref($data_dir, $username, 'delete_prev_next_display', 1);
- if ( $uid_support && $delete_prev_next_display == 1 ) {
+ // top display is enabled.
+ if ( $delete_prev_next_display == 1 ) {
$del_prev_link = _("Delete & Prev");
if ($prev >= 0) {
$uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
@@ -621,80 +613,115 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
// BEGIN MENU ROW - DELETE/REPLY/FORWARD/MOVE/etc.
$menu_row = '
';
+ $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".''.' '."\n";
+ // Form for deletion
+ $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox;
+ $menu_row .= '' . "\n";
// Add top move link
$menu_row .= ' | ';
- if (!(isset($passed_ent_id) && $passed_ent_id)) {
- $menu_row .= '';
+ $menu_row .= ' ';
+
+ $menu_row .= getButton('SUBMIT', 'moveButton',_("Move")) . "\n" . '';
}
$menu_row .= ' |
';
// echo rows, with hooks
- do_hook('read_body_menu_top');
+ $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 '';
echo $nav_on_top ? $nav_row . $menu_row : $menu_row . $nav_row;
echo '
'."\n";
@@ -776,7 +803,7 @@ if ( sqgetGlobalVar('startMessage', $temp) ) {
}
/* end of get globals */
-global $uid_support, $sqimap_capabilities, $lastTargetMailbox;
+global $sqimap_capabilities, $lastTargetMailbox;
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
@@ -791,25 +818,6 @@ if ( sqgetGlobalVar('delete_id', $delete_id, SQ_GET) ) {
sqimap_mailbox_expunge_dmn($delete_id);
}
-/**
- * Process Move from delete-move-next
- * but only if move_id and target_mailbox were set
- */
-if ( sqgetGlobalVar('move_id', $move_id, SQ_POST) &&
- sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_POST) ) {
- // Move message
- sqimap_messages_copy($imapConnection, $move_id, $move_id, $targetMailbox);
- sqimap_messages_flag($imapConnection, $move_id, $move_id, 'Deleted', true);
-
- sqimap_mailbox_expunge_dmn($move_id);
-
- if ($targetMailbox != $lastTargetMailbox) {
- $lastTargetMailbox = $targetMailbox;
- sqsession_register('lastTargetMailbox' , $lastTargetMailbox);
- }
-}
-
-
/**
* $message contains all information about the message
* including header and body
@@ -820,7 +828,7 @@ $uidvalidity = $mbx_response['UIDVALIDITY'];
if (!isset($messages[$uidvalidity])) {
$messages[$uidvalidity] = array();
}
-if (!isset($messages[$uidvalidity][$passed_id]) || !$uid_support) {
+if (!isset($messages[$uidvalidity][$passed_id])) {
$message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
$FirstTimeSee = !$message->is_seen;
$message->is_seen = true;
@@ -836,7 +844,7 @@ if (isset($passed_ent_id) && $passed_ent_id) {
if ($message->type0 != 'message' && $message->type1 != 'rfc822') {
$message = $message->parent;
}
- $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[$passed_ent_id.HEADER]", true, $response, $msg, $uid_support);
+ $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[$passed_ent_id.HEADER]", true, $response, $msg, TRUE);
$rfc822_header = new Rfc822Header();
$rfc822_header->parseHeader($read);
$message->rfc822_header = $rfc822_header;
@@ -860,7 +868,7 @@ if (isset($sendreceipt)) {
$final_recipient = trim(getPref($data_dir, $username, 'email_address', '' ));
$supportMDN = ServerMDNSupport($mbx_response["PERMANENTFLAGS"]);
if ( SendMDN( $mailbox, $passed_id, $final_recipient, $message, $imapConnection ) > 0 && $supportMDN ) {
- ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id, $uid_support);
+ ToggleMDNflag( true, $imapConnection, $mailbox, $passed_id);
$message->is_mdnsent = true;
$messages[$uidvalidity][$passed_id]=$message;
}