Reinserting support for the "iframe_height" option. This might be done in a better...
[squirrelmail.git] / functions / mime.php
index 735115d9dc86ecb14946049357b36acc3cd35c48..c151ecf6f5cb2d6d30c52a7426fad33f3827ccc0 100644 (file)
@@ -421,6 +421,7 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma
 
                 global $oTemplate;
                 $oTemplate->assign('iframe_url', $iframeurl);
+                $oTemplate->assign('iframe_height', $iframe_height);
                 $oTemplate->assign('html_body', $html_body);
 
                 $body = $oTemplate->fetch('read_html_iframe.tpl');
@@ -561,6 +562,9 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) {
          * for a more generic type. Finally, a hook for ALL attachment
          * types is run as well.
          */
+        // First remember the default link.
+        $defaultlink_orig = $defaultlink;
+
         /* The API for this hook has changed as of 1.5.2 so that all plugin
            arguments are passed in an array instead of each their own plugin
            argument, and arguments are passed by reference, so instead of
@@ -569,7 +573,7 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) {
         $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, 
                     &$defaultlink, &$display_filename, &$where, &$what);
         do_hook("attachment $type0/$type1", $temp);
-        if(count($links) <= 1) {
+        if(count($links) <= 1 && $defaultlink == $defaultlink_orig) {
             /* The API for this hook has changed as of 1.5.2 so that all plugin
                arguments are passed in an array instead of each their own plugin
                argument, and arguments are passed by reference, so instead of
@@ -586,6 +590,12 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) {
            arguments themselves. */
         $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, 
                       &$defaultlink, &$display_filename, &$where, &$what);
+        // Do not let a generic plugin change the default link if a more
+        // specialized one already did it...
+        if ($defaultlink != $defaultlink_orig) {
+            $dummy = '';
+            $temp[5] = &$dummy;
+        }
         do_hook("attachment */*", $temp);
 
         $this_attachment = array();