$sid_s = $sid;
}
+ $body = mime_fetch_body ($imap_stream, $id, $ent_id);
+ echo decodeBody($body, $encoding);
+ return;
+/*
fputs ($imap_stream, "$sid FETCH $id BODY[$ent_id]\r\n");
$cnt = 0;
$continue = true;
// 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++;
+ 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 ]----------------------------------------------------------- */
+/* findDisplayEntity
+ * Checks to see if $message contains content of type $type0/$type1
+ * returns the first entity number it finds of that type, or NULL if
+ * none is found. Takes optional argument $start to allow the caller
+ * to continue where they left off
+ */
+function findDisplayEntity($message, $type0, $type1, $start=0) {
+ if ($message) {
+ for ($i = $start;isset($message->entities[$i]); $i++) {
+ $entity = $message->entities[$i];
+ if ($entity->type0 == $type0 && $entity->type1 == $type1) {
+ return $i;
+ }
+ }
+ }
+ return NULL;
+}
// This is here for debugging purposese. It will print out a list
// of all the entity IDs that are in the $message object.
if (!count($att_ar)) return '';
- $attachments = "<TABLE WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR=\"$color[0]\"><TR>\n" .
- "<TH ALIGN=\"left\" BGCOLOR=\"$color[9]\"><B>\n" .
- _("Attachments") . ':' .
- "</B></TH></TR><TR><TD>\n" .
- "<TABLE CELLSPACING=0 CELLPADDING=1 BORDER=0>\n";
+ $attachments = '';
$urlMailbox = urlencode($mailbox);
$Links = $HookResults[1];
$DefaultLink = $HookResults[6];
- $attachments .= '<TR><TD> </TD><TD>' .
+ $attachments .= '<TR><TD>' .
"<A HREF=\"$DefaultLink\">$display_filename</A> </TD>" .
'<TD><SMALL><b>' . show_readable_size($header->size) .
'</b> </small></TD>' .
$attachments .= '<a href="' . $Val['href'] . '">' . $Val['text'] . '</a>';
}
unset($Links);
+ $attachments .= "</TD></TR>\n";
} else {
$filename = decodeHeader($header->getParameter('filename'));
if (trim($filename) == '') {
$Links = $HookResults[1];
$DefaultLink = $HookResults[6];
- $attachments .= '<TR><TD> </TD><TD>' .
+ $attachments .= '<TR><TD>' .
"<A HREF=\"$DefaultLink\">$display_filename</A> </TD>" .
'<TD><SMALL><b>' . show_readable_size($header->size) .
'</b> </small></TD>' .
}
$attachments .= '<a href="' . $Val['href'] . '">' . $Val['text'] . '</a>';
}
-
+ $attachments .= "</TD></TR>\n";
unset($Links);
}
- }
- $attachments .= "</SMALL></TD></TR>\n";
-
- $attachments .= "</TABLE></TD></TR></TABLE>";
+ }
return $attachments;
}
return $trusted;
}
-?>
\ No newline at end of file
+?>