fixes for getting textOnly entities
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 30 May 2002 20:55:35 +0000 (20:55 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 30 May 2002 20:55:35 +0000 (20:55 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2917 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mime.php

index 202028ee3840cf3499757d2dd6ec953020ed5bf4..68d82a4339a37a5757dde62169445d9f702209c8 100644 (file)
@@ -617,14 +617,14 @@ function getEntity ($message, $ent_id) {
  * figures out what entity to display and returns the $message object
  * for that entity.
  */
-function findDisplayEntity ($msg, $textOnly = 1, $entity = array() )   {
+function findDisplayEntity ($msg, $textOnly = true, $entity = array() )   {
     global $show_html_default;
     
     $found = false;    
     if ($msg) {
         $type = $msg->header->type0.'/'.$msg->header->type1;
         if ( $type == 'multipart/alternative') {
-           $msg = findAlternativeEntity($msg);
+           $msg = findAlternativeEntity($msg, $textOnly);
            if (count($msg->entities) == 0) {
                $entity[] = $msg->header->entity_id;
            } else {
@@ -687,12 +687,12 @@ function findDisplayEntityHTML ($message) {
     return 0;
 }
 
-function findAlternativeEntity ($message) {
+function findAlternativeEntity ($message, $textOnly) {
     global $show_html_default;
     /* if we are dealing with alternative parts then we choose the best 
      * viewable message supported by SM.
      */
-    if ($show_html_default) {     
+    if ($show_html_default && !$textOnly) {     
        $alt_order = array ('text/plain','text/html');
     } else {
        $alt_order = array ('text/plain');