A preference-line can be of "unlimited" length now
[squirrelmail.git] / functions / mime.php
index 3b7936d58f50a63956e3ec3265092d830ec22f41..19fa5a83adde004d75fe329cae722b3a0134b4b2 100644 (file)
@@ -29,9 +29,8 @@ function mime_structure ($bodystructure, $flags=array()) {
     /* Isolate the body structure and remove beginning and end parenthesis. */
     $read = trim(substr ($bodystructure, strpos(strtolower($bodystructure), 'bodystructure') + 13));
     $read = trim(substr ($read, 0, -1));
-    $msg =& new Message();
-    $res  = $msg->parseStructure($read);
-    $msg  = $res[0];
+    $i = 0;
+    $msg = Message::parseStructure($read,$i);
     if (!is_object($msg)) {
         include_once(SM_PATH . 'functions/display_messages.php');
         global $color, $mailbox;
@@ -84,6 +83,8 @@ function mime_structure ($bodystructure, $flags=array()) {
     return $msg;
 }
 
+
+
 /* This starts the parsing of a particular structure.  It is called recursively,
  * so it can be passed different structures.  It returns an object of type
  * $message.
@@ -325,7 +326,7 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma
     global $startMessage, $username, $key, $imapServerAddress, $imapPort,
            $show_html_default, $has_unsafe_images, $sort;
 
-    if ( (float)substr(PHP_VERSION,0,3) < 4.1 ) {
+    if ( !check_php_version(4,1) ) {
         global $_GET;
     }
     if(isset($_GET['view_unsafe_images'])) {
@@ -411,7 +412,9 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
             $default_page = '../src/read_body.php';
             $rfc822_header = $att->rfc822_header;
             $filename = decodeHeader($rfc822_header->subject);
-
+            if (trim( $filename ) == '') {
+                $filename = 'untitled-[' . $ent . ']' ;
+           }           
             $from_o = $rfc822_header->from;
             if (is_object($from_o)) {
                 $from_name = $from_o->getAddress(false);
@@ -459,7 +462,7 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
         }
         $defaultlink = $default_page . "?startMessage=$startMessage"
                      . "&amp;passed_id=$id&amp;mailbox=$urlMailbox"
-                     . '&amp;ent_id='.$ent.$passed_ent_id_link;
+                     . '&amp;ent_id='.$ent.$passed_ent_id_link.'&amp;absolute_dl=true';
         if ($where && $what) {
            $defaultlink .= '&amp;where='. urlencode($where).'&amp;what='.urlencode($what);
         }
@@ -1502,8 +1505,8 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX'){
                       "head",
                       "base",
                       "link",
-                     "frame",
-                     "iframe"
+                      "frame",
+                      "iframe"
                       );
 
     $rm_tags_with_content = Array(
@@ -1589,6 +1592,9 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX'){
                           )
                 )
         );
+    if(isset($_GET['view_unsafe_images'])) {
+        $view_unsafe_images = $_GET['view_unsafe_images'];
+    }
     if (!$view_unsafe_images){
         /**
          * Remove any references to http/https if view_unsafe_images set