| ';
- $body .= "$display_filename | ";
- $body .= '' . show_readable_size($message->header->size) .
- ' | ';
- $body .= "[ $type0/$type1 ] | ";
- $body .= '';
- if ($message->header->description)
- $body .= '' . htmlspecialchars($message->header->description) . '';
- $body .= ' | ';
-
-
- $SkipSpaces = 1;
- foreach ($Links as $Val)
- {
- if ($SkipSpaces)
- {
- $SkipSpaces = 0;
- }
- else
- {
- $body .= ' | ';
- }
- $body .= '' . $Val['text'] . '';
- }
-
- unset($Links);
-
- $body .= " |
\n";
+ $filename = decodeHeader($message->header->filename);
+ if (trim($filename) == '') {
+ if (trim($name) == '') {
+ if ( trim( $message->header->id ) == '' )
+ $display_filename = 'untitled-[' . $message->header->entity_id . ']' ;
+ else
+ $display_filename = 'cid: ' . $message->header->id;
+ // $display_filename = 'untitled-[' . $message->header->entity_id . ']' ;
+ } else {
+ $display_filename = $name;
+ $filename = $name;
+ }
+ } else {
+ $display_filename = $filename;
+ }
+
+ $urlMailbox = urlencode($mailbox);
+ $ent = urlencode($message->header->entity_id);
+
+ $DefaultLink =
+ "../src/download.php?startMessage=$startMessage&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
+ if ($where && $what) {
+ $DefaultLink .= '&where=' . urlencode($where) . '&what=' . urlencode($what);
+ }
+ $Links['download link']['text'] = _("download");
+ $Links['download link']['href'] =
+ "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
+ $ImageURL = '';
+
+ /* this executes the attachment hook with a specific MIME-type.
+ * if that doens't have results, it tries if there's a rule
+ * for a more generic type. */
+ $HookResults = do_hook("attachment $type0/$type1", $Links,
+ $startMessage, $id, $urlMailbox, $ent, $DefaultLink,
+ $display_filename, $where, $what);
+ if(count($HookResults[1]) <= 1) {
+ $HookResults = do_hook("attachment $type0/*", $Links,
+ $startMessage, $id, $urlMailbox, $ent, $DefaultLink,
+ $display_filename, $where, $what);
+ }
+
+ $Links = $HookResults[1];
+ $DefaultLink = $HookResults[6];
+
+ $body .= '