|
@@ -159,7 +159,7 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) {
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
-function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding) {
|
|
|
+function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding, $rStream) {
|
|
|
|
|
|
/* Don't kill the connection if the browser is over a dialup
|
|
|
* and it would take over 30 seconds to download it.
|
|
@@ -173,14 +173,18 @@ function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding) {
|
|
|
Instead, echo the decoded attachment directly to screen */
|
|
|
if (strtolower($encoding) == 'base64') {
|
|
|
if (!$ent_id) {
|
|
|
- $query = "FETCH $id BODY[]";
|
|
|
+ $query = "FETCH $id BODY[]";
|
|
|
} else {
|
|
|
- $query = "FETCH $id BODY[$ent_id]";
|
|
|
+ $query = "FETCH $id BODY[$ent_id]";
|
|
|
}
|
|
|
- sqimap_run_command($imap_stream,$query,true,$response,$message,TRUE,'sqimap_base64_decode','php://stdout',true);
|
|
|
+ sqimap_run_command($imap_stream,$query,true,$response,$message,TRUE,'sqimap_base64_decode',$rStream,true);
|
|
|
} else {
|
|
|
- $body = mime_fetch_body ($imap_stream, $id, $ent_id);
|
|
|
- echo decodeBody($body, $encoding);
|
|
|
+ $body = mime_fetch_body ($imap_stream, $id, $ent_id);
|
|
|
+ if (is_resource($rStream)) {
|
|
|
+ fputs($rStream,decodeBody($body,$encoding));
|
|
|
+ } else {
|
|
|
+ echo decodeBody($body, $encoding);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -199,33 +203,6 @@ function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding) {
|
|
|
*/
|
|
|
|
|
|
return;
|
|
|
-/*
|
|
|
- fputs ($imap_stream, "$sid FETCH $id BODY[$ent_id]\r\n");
|
|
|
- $cnt = 0;
|
|
|
- $continue = true;
|
|
|
- $read = fgets ($imap_stream,8192);
|
|
|
-
|
|
|
-
|
|
|
- // This could be bad -- if the section has sqimap_session_id() . ' OK'
|
|
|
- // or similar, it will kill the download.
|
|
|
- while (!ereg("^".$sid_s." (OK|BAD|NO)(.*)$", $read, $regs)) {
|
|
|
- if (trim($read) == ')==') {
|
|
|
- $read1 = $read;
|
|
|
- $read = fgets ($imap_stream,4096);
|
|
|
- if (ereg("^".$sid." (OK|BAD|NO)(.*)$", $read, $regs)) {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- echo decodeBody($read1, $encoding) .
|
|
|
- decodeBody($read, $encoding);
|
|
|
- }
|
|
|
- } else if ($cnt) {
|
|
|
- echo decodeBody($read, $encoding);
|
|
|
- }
|
|
|
- $read = fgets ($imap_stream,4096);
|
|
|
- $cnt++;
|
|
|
-// break;
|
|
|
- }
|
|
|
-*/
|
|
|
}
|
|
|
|
|
|
/* -[ END MIME DECODING ]----------------------------------------------------------- */
|