X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=3f0f0bbe8ebf805a98678772dd46d978ec841249;hb=9d9430d6b34c5157d887bbfdbcfba6b17a48acd3;hp=0aa2c9ef5b46366ec484ab9e161a3f671532bef6;hpb=54817114a34450766c7d5967fbc409b4136de8a6;p=squirrelmail.git diff --git a/src/read_body.php b/src/read_body.php index 0aa2c9ef..3f0f0bbe 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -139,22 +139,8 @@ function printer_friendly_link() { } function ServerMDNSupport( $read ) { - - $num = 0; - $resp = ''; - while ($num < count($read) ) { - $resp .= $read[$num]; - $num++; - } - $read[] = split(' * ', $resp); - $num = 0; - $ret = FALSE; - while ( !$ret && $num < count($read) ) { - if ( ereg('PERMANENTFLAGS', $read[$num] ) ) { - $ret = ( ereg('mdnsent',strtolower($read[$num]) ) || ereg("\\\*", $read[$num] ) ); - } - $num++; - } + /* escaping $ doesn't work -> \x36 */ + $ret = preg_match( '/(\x36MDNSent|\\\*)/i', $read ); return ( $ret ); } @@ -162,9 +148,7 @@ function SendMDN ( $recipient , $sender) { global $imapConnection, $mailbox, $username, $attachment_dir, $SERVER_NAME, $version, $attachments, $identity, $data_dir, $passed_id; - $message = sqimap_get_message($imapConnection, $passed_id, $mailbox); - $header = $message->header; - + $header = sqimap_get_message_header($imapConnection, $passed_id, $mailbox); $hashed_attachment_dir = getHashedDir($username, $attachment_dir); // part 1 (RFC2298) @@ -185,12 +169,7 @@ function SendMDN ( $recipient , $sender) { "\t" . _("Sent:") . ' ' . $senton . "\r\n" . "\r\n" . sprintf( _("Was displayed on %s"), $now ); -/* - $body = sprintf( _("This message sent on %s to %s with subject \"%s\" has been displayed on %s."), - $senton, $to, $subject, $now ) . - "\r\n" . - _("This is no guarantee that the message has been read or understood.") . "\r\n"; -*/ + // part2 (RFC2298) $original_recipient = $to; @@ -226,20 +205,13 @@ function SendMDN ( $recipient , $sender) { function ToggleMDNflag ( $set ) { - global $imapConnection, $passed_id, $mailbox; - - if ( $set ) { - $sg = '+'; - - } else { - $sg = '-'; - } - - $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)'; sqimap_mailbox_select($imapConnection, $mailbox); - $read = sqimap_run_command ($imapConnection, $cmd, true, $response, $readmessage); - + + $sg = $set?'+':'-'; + $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)'; + $read = sqimap_run_command ($imapConnection, $cmd, true, $response, + $readmessage); } function ClearAttachments() { @@ -268,8 +240,11 @@ function ClearAttachments() { $passed_id */ +if ( isset( $mailbox ) ) { + $mailbox = urldecode( $mailbox ); +} $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); -$read = sqimap_mailbox_select($imapConnection, $mailbox); +$read = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true); do_hook('html_top'); @@ -279,7 +254,7 @@ do_hook('html_top'); if( $default_use_mdn && ( $mdn_user_support = getPref($data_dir, $username, 'mdn_user_support', $default_use_mdn) ) ) { - $supportMDN = ServerMDNSupport($read); + $supportMDN = ServerMDNSupport($read["PERMANENTFLAGS"]); $flags = sqimap_get_flags ($imapConnection, $passed_id); $FirstTimeSee = !(in_array( 'Seen', $flags )); } @@ -518,6 +493,9 @@ if (isset ($message->header->cc[0]) && trim($message->header->cc[0])) { } } } +else { + $cc_string = ''; +} /** FORMAT THE BCC STRING **/ $i = 0; @@ -559,6 +537,9 @@ if (isset ($message->header->bcc[0]) && trim($message->header->bcc[0])){ } } } +else { + $bcc_string = ''; +} if ($default_use_priority) { $priority_level = substr($message->header->priority,0,1); @@ -619,7 +600,11 @@ if ($where && $what) { echo _("Delete") . ' '; if (($mailbox == $draft_folder) && ($save_as_draft)) { echo '| ". + "src/compose.php?mailbox=$mailbox&send_to=$to_string&send_to_cc=$cc_string&send_to_bcc=$bcc_string&subject=$url_subj&draft_id=$passed_id&ent_num=$ent_num\""; + if ($compose_new_win == '1') { + echo 'TARGET="compose_window" onClick="comp_in_new()"'; + } + echo '>'. _("Resume Draft") . ''; } @@ -656,17 +641,29 @@ echo '' . '' . '" . + ."mailbox=$urlMailbox&ent_num=$ent_num\""; + if ($compose_new_win == '1') { + echo 'TARGET="compose_window" onClick="comp_in_new()"'; + } + echo '>'. _("Forward") . ' | ' . '" . + "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\""; + if ($compose_new_win == '1') { + echo 'TARGET="compose_window" onClick="comp_in_new()"'; + } + echo '>'. _("Reply") . ' | ' . '" . + "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\""; + if ($compose_new_win == '1') { + echo 'TARGET="compose_window" onClick="comp_in_new()"'; + } + echo '>'. _("Reply All") . '  ' . '' . @@ -732,7 +729,7 @@ echo "\n" . '' . "\n" . '' . "\n"; /** cc **/ -if (isset($cc_string)) { +if (isset($cc_string) && $cc_string <> '') { echo '' . "" . 'Cc:' . @@ -743,7 +740,7 @@ if (isset($cc_string)) { } /** bcc **/ -if (isset($bcc_string)) { +if (isset($bcc_string) && $bcc_string <> '') { echo ''. "" . 'Bcc:' . @@ -752,16 +749,14 @@ if (isset($bcc_string)) { '' . '' . "\n"; } -if ($default_use_priority) { - if (isset($priority_string)) { - echo '' . - "" . - _("Priority") . ': '. - "" . - "$priority_string " . - '' . - "" . "\n"; - } +if ($default_use_priority && isset($priority_string) && $priority_string <> '' ) { + echo '' . + "" . + _("Priority") . ': '. + "" . + "$priority_string " . + '' . + "" . "\n"; } if ($show_xmailer_default) { @@ -788,7 +783,7 @@ if ($default_use_mdn) { if ($mdn_user_support) { // debug gives you the capability to remove mdn-flags - $debug = false; + $MDNDebug = false; $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY.PEEK[HEADER.FIELDS (Disposition-Notification-To)]", true, $response, $readmessage); $MDN_to = substr($read[1], strpos($read[1], ' ')); @@ -806,7 +801,7 @@ if ($default_use_mdn) { $sendreceipt = 'removeMDN'; $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\""; $sendreceipt=""; - if ($debug ) { + if ($MDNDebug ) { echo '' . "" . _("Read receipt") . ': ' . @@ -827,7 +822,7 @@ if ($default_use_mdn) { } } // when deleted or draft flag is set don't offer to send a MDN response - else if ( ereg('Draft',$read[0] || ereg('Deleted',$read[0])) ) { + else if ( ereg('\\Draft',$read[0] || ereg('\\Deleted',$read[0])) ) { echo '' . "" . _("Read receipt") . ': '. @@ -899,7 +894,7 @@ if ($default_use_mdn) { $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\""; $sendreceipt=""; - if ($debug && $supportMDN) { + if ($MDNDebug && $supportMDN) { echo " \n" . " \n" . " "._("Read receipt").": \n".