}
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 );
}
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)
$subject = $header->subject;
$now = getLongDateString( time() );
- $body = sprintf( _("This message sent on %s to %s with subject \"%s\" has been displayed on %s."),
- $senton, $to, $subject, $now ) .
+
+ $body = _("Your message") . "\r\n\r\n" .
+ "\t" . _("To:") . ' ' . $to . "\r\n" .
+ "\t" . _("Subject:") . ' ' . $subject . "\r\n" .
+ "\t" . _("Sent:") . ' ' . $senton . "\r\n" .
"\r\n" .
- _("This is no guarantee that the message has been read or understood.") . "\r\n";
+ sprintf( _("Was displayed on %s"), $now );
// part2 (RFC2298)
$MDN_to = trim($recipient);
$reply_id = 0;
- return (SendMessage($MDN_to,'','',"Read: $subject", $body,$reply_id, True, 3) );
+ return (SendMessage($MDN_to,'','', _("Read:") . ' ' . $subject, $body,$reply_id, True, 3) );
}
function ToggleMDNflag ( $set ) {
-
- global $imapConnection, $passed_id;
-
- $myflag = '$MDNSent';
- if ($set) {
- $read = sqimap_run_command ($imapConnection, "STORE $passed_id +FLAGS ($myflag)", true,
- $response, $readmessage);
- } else {
- $read = sqimap_run_command ($imapConnection, "STORE $passed_id -FLAGS ($myflag)", true,
- $response, $readmessage);
- }
+ global $imapConnection, $passed_id, $mailbox;
+ sqimap_mailbox_select($imapConnection, $mailbox);
+
+ $sg = $set?'+':'-';
+ $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
+ $read = sqimap_run_command ($imapConnection, $cmd, true, $response,
+ $readmessage);
}
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');
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 = TRUE;
- $num=0;
- while ($num < count($flags)) {
- if ($flags[$num] == 'Seen') {
- $FirstTimeSee = false;
- }
- $num++;
- }
-
+ $FirstTimeSee = !(in_array( 'Seen', $flags ));
}
displayPageHeader($color, $mailbox);
}
}
}
+else {
+ $cc_string = '';
+}
/** FORMAT THE BCC STRING **/
$i = 0;
}
}
}
+else {
+ $bcc_string = '';
+}
if ($default_use_priority) {
$priority_level = substr($message->header->priority,0,1);
echo _("Delete") . '</A> ';
if (($mailbox == $draft_folder) && ($save_as_draft)) {
echo '| <A HREF="' . $base_uri .
- "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\">".
+ "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") . '</a>';
}
'<SMALL>' .
'<A HREF="' . $base_uri . "src/compose.php?forward_id=$passed_id&forward_subj=$url_subj&".
($default_use_priority?"mailprio=$priority_level&":"")
- ."mailbox=$urlMailbox&ent_num=$ent_num\">" .
+ ."mailbox=$urlMailbox&ent_num=$ent_num\"";
+ if ($compose_new_win == '1') {
+ echo 'TARGET="compose_window" onClick="comp_in_new()"';
+ }
+ echo '>'.
_("Forward") .
'</A> | ' .
'<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replyto&reply_subj=$url_subj&".
($default_use_priority?"mailprio=$priority_level&":"").
- "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
+ "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") .
'</A> | ' .
'<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&".
($default_use_priority?"mailprio=$priority_level&":"").
- "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
+ "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") .
'</A> ' .
'</SMALL>' .
'</TD>' . "\n" .
'</TR>' . "\n";
/** cc **/
-if (isset($cc_string)) {
+if (isset($cc_string) && $cc_string <> '') {
echo '<TR>' .
"<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
'Cc:' .
}
/** bcc **/
-if (isset($bcc_string)) {
+if (isset($bcc_string) && $bcc_string <> '') {
echo '<TR>'.
"<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
'Bcc:' .
'</TD>' .
'</TR>' . "\n";
}
-if ($default_use_priority) {
- if (isset($priority_string)) {
- echo '<TR>' .
- "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
- _("Priority") . ': '.
- "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
- "<B>$priority_string</B> " .
- '</TD>' .
- "</TR>" . "\n";
- }
+if ($default_use_priority && isset($priority_string) && $priority_string <> '' ) {
+ echo '<TR>' .
+ "<TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>" .
+ _("Priority") . ': '.
+ "</TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>" .
+ "<B>$priority_string</B> " .
+ '</TD>' .
+ "</TR>" . "\n";
}
if ($show_xmailer_default) {
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], ' '));
$read = sqimap_run_command ($imapConnection, "FETCH $passed_id FLAGS", true,
$response, $readmessage);
- $str = strtolower($read[0]);
- if (ereg('mdnsent', $str ) ) {
- $MDN_flag_present = true;
- }
+
+ $MDN_flag_present = preg_match( '/.*\$MDNSent/i', $read[0]);
+
if (trim($MDN_to) &&
(!isset( $sendreceipt ) || $sendreceipt == '' ) ) {
if ( $MDN_flag_present && $supportMDN) {
- $sendreceipt="removeMDN";
+ $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 '<TR>' .
"<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
_("Read receipt") . ': ' .
}
} // 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 '<TR>' .
"<TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>" .
_("Read receipt") . ': '.
}
}
- if ( !isset( $sendreceipt ) ) {
+ if ( !isset( $sendreceipt ) || $sendreceipt == '' ) {
} else if ( $sendreceipt == 'send' ) {
if ( !$MDN_flag_present) {
if (isset($identity) ) {
- $final_recipient = getPref($data_dir, $username, 'email_address' . '0');
- } else $final_recipient = getPref($data_dir, $username, 'email_address');
+ $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' );
+ } else {
+ $final_recipient = getPref($data_dir, $username, 'email_address', '' );
+ }
$final_recipient = trim($final_recipient);
if ($final_recipient == '' ) {
- $final_recipient = getPref($data_dir, $username, 'email_address');
+ $final_recipient = getPref($data_dir, $username, 'email_address', '' );
}
- if ( SendMDN( $MDN_to, $final_recipient ) > 0 && $supportMDN == true ) {
- ToggleMDNflag ( true);
+ if ( SendMDN( $MDN_to, $final_recipient ) > 0 && $supportMDN ) {
+ ToggleMDNflag( true);
}
}
$sendreceipt = 'removeMDN';
$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 " <TR>\n" .
" <TD BGCOLOR=\"$color[9]\" ALIGN=RIGHT VALIGN=TOP>\n" .
" "._("Read receipt").": \n".