Pārlūkot izejas kodu

Allow plugins to customize attachment link (for instance, use image instead of text). Also, parse URIs out of HTML messages too (originally, the call was to remove mailto: links, but it made sense to simply use parseUrl(); if ppl don't like it, we can work it out.

pdontthink 20 gadi atpakaļ
vecāks
revīzija
a3f453d770
1 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  1. 6 1
      functions/mime.php

+ 6 - 1
functions/mime.php

@@ -516,7 +516,7 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
             } else {
                 $attachments .= '  |  ';
             }
-            $attachments .= '<a href="' . $val['href'] . '">' .  $val['text'] . '</a>';
+            $attachments .= '<a href="' . $val['href'] . '">' . (isset($val['text']) && !empty($val['text']) ? $val['text'] : '') . (isset($val['extra']) && !empty($val['extra']) ? $val['extra'] : '') . '</a>';
         }
         unset($links);
         $attachments .= "</td></tr>\n";
@@ -1993,6 +1993,11 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX') {
     if (preg_match("|$secremoveimg|i", $trusted)){
         $has_unsafe_images = true;
     }
+
+
+    // we want to parse mailto's and other URLs in HTML output too
+    parseUrl($trusted);
+
     return $trusted;
 }