- fputs ($imap_stream, sqimap_session_id() . " FETCH $id BODY[$ent_id]\r\n");
- $cnt = 0;
- $continue = true;
- $read = fgets ($imap_stream,4096);
- // This could be bad -- if the section has sqimap_session_id() . ' OK'
- // or similar, it will kill the download.
- while (!ereg("^" . sqimap_session_id() . " (OK|BAD|NO)(.*)$", $read, $regs)) {
- if (trim($read) == ")==") {
- $read1 = $read;
- $read = fgets ($imap_stream,4096);
- if (ereg("^" . sqimap_session_id() . " (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++;
- }
+ fputs ($imap_stream, "$sid FETCH $id BODY[$ent_id]\r\n");
+ $cnt = 0;
+ $continue = true;
+ $read = fgets ($imap_stream,4096);
+ // This could be bad -- if the section has sqimap_session_id() . ' OK'
+ // or similar, it will kill the download.
+ while (!ereg("^".$sid." (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++;
+ }