Browse Source

Attachments now opened with binary flag, for windows compatibility

itsbruce 23 năm trước cách đây
mục cha
commit
007b1e3da7
5 tập tin đã thay đổi với 7 bổ sung7 xóa
  1. 2 2
      src/compose.php
  2. 2 2
      src/draft_actions.php
  3. 1 1
      src/move_messages.php
  4. 1 1
      src/read_body.php
  5. 1 1
      src/retrievalerror.php

+ 2 - 2
src/compose.php

@@ -645,7 +645,7 @@ function getAttachments($message, $session, $passed_id, $entities, $imapConnecti
             $newAttachment['session'] = $session;
 
             /* Write Attachment to file */
-            $fp = fopen ("$hashed_attachment_dir/$localfilename", 'w');
+            $fp = fopen ("$hashed_attachment_dir/$localfilename", 'wb');
             fputs($fp, decodeBody(mime_fetch_body($imapConnection,
                   $passed_id, $message->entity_id),
                   $message->header->encoding));
@@ -684,7 +684,7 @@ function getMessage_RFC822_Attachment($message, $session, $passed_id,
         $localfilename = GenerateRandomString(32, 'FILE', 7);
         $full_localfilename = "$hashed_attachment_dir/$localfilename";
             
-        $fp = fopen( $full_localfilename, 'w');
+        $fp = fopen( $full_localfilename, 'wb');
         fwrite ($fp, $body);
         fclose($fp);
         $newAttachment = array();

+ 2 - 2
src/draft_actions.php

@@ -162,7 +162,7 @@ function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $prio = 3, $
          $tmpDraftFile = "draft-" . GenerateRandomString(32, '', 7);
          $full_tmpDraftFile = "$hashed_attachment_dir/$tmpDraftFile";
     }
-    $fp = fopen($full_tmpDraftFile, 'w');
+    $fp = fopen($full_tmpDraftFile, 'wb');
 
     $headerlength = write822HeaderForDraft
         ($fp, $t, $c, $b, $subject, $more_headers, $session);
@@ -188,4 +188,4 @@ function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $prio = 3, $
     return $length;
 }
 
-?>
+?>

+ 1 - 1
src/move_messages.php

@@ -96,7 +96,7 @@ function attachSelectedMessages($msg, $imapConnection) {
         	$localfilename = GenerateRandomString(32, 'FILE', 7);
         	$full_localfilename = "$hashed_attachment_dir/$localfilename";
         	
-        	$fp = fopen( $full_localfilename, 'w');
+        	$fp = fopen( $full_localfilename, 'wb');
         	fwrite ($fp, $body);
         	fclose($fp);
     		$newAttachment = array();

+ 1 - 1
src/read_body.php

@@ -206,7 +206,7 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message) {
     $localfilename = GenerateRandomString(32, 'FILE', 7);
     $full_localfilename = "$hashed_attachment_dir/$localfilename";
 
-    $fp = fopen( $full_localfilename, 'w');
+    $fp = fopen( $full_localfilename, 'wb');
     fwrite ($fp, $part2);
     fclose($fp);
 

+ 1 - 1
src/retrievalerror.php

@@ -55,7 +55,7 @@ while (file_exists($full_localfilename)) {
 }
 
 /* Write Attachment to file */
-$fp = fopen ($full_localfilename, 'w');
+$fp = fopen ($full_localfilename, 'wb');
 fputs ($fp, $thebastard);
 fclose ($fp);