Print javascript Content-Type to be HTML 4.0 complient
[squirrelmail.git] / src / read_body.php
index 8b8333138313d28837d19cefea7d3198e3894c21..3f0f0bbe8ebf805a98678772dd46d978ec841249 100644 (file)
@@ -207,11 +207,11 @@ function SendMDN ( $recipient , $sender) {
 function ToggleMDNflag ( $set ) {
     global $imapConnection, $passed_id, $mailbox;
     sqimap_mailbox_select($imapConnection, $mailbox);
-    if ( $set ) {
-        sqimap_messages_flag ($imapConnection,$passed_id,$passed_id,"\$MDNSent");    
-    } else {
-        sqimap_messages_remove_flag ($imapConnection,$passed_id,$passed_id,"\$MDNSent");    
-    }
+    
+    $sg =  $set?'+':'-';
+    $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)';
+    $read = sqimap_run_command ($imapConnection, $cmd, true, $response, 
+                                $readmessage);
 }
 
 function ClearAttachments() {
@@ -240,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, false, true);
+$read = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
 
 do_hook('html_top');
 
@@ -253,7 +256,7 @@ if( $default_use_mdn &&
 
     $supportMDN = ServerMDNSupport($read["PERMANENTFLAGS"]);
     $flags = sqimap_get_flags ($imapConnection, $passed_id);
-    $FirstTimeSee = !(in_array( '\\Seen', $flags ));
+    $FirstTimeSee = !(in_array( 'Seen', $flags ));
 }
 
 displayPageHeader($color, $mailbox);
@@ -780,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], ' '));
@@ -798,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       '<TR>' .
                                  "<TD BGCOLOR=\"$color[9]\"  ALIGN=RIGHT VALIGN=TOP>" .
                                        _("Read receipt") . ': ' .
@@ -891,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 "      <TR>\n" .
                     "         <TD BGCOLOR=\"$color[9]\"  ALIGN=RIGHT VALIGN=TOP>\n" .
                     "            "._("Read receipt").": \n".