added unsave tags (commited to stable by Konstantin)
[squirrelmail.git] / functions / mime.php
index 4450529900b7abad21143a938f0db1a29a92931c..f912e8085e6528a368e52d59afa1795b63fab941 100644 (file)
@@ -12,8 +12,8 @@
  * $Id$
  */
 
-require_once('../functions/imap.php');
-require_once('../functions/attachment_common.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/attachment_common.php');
 
 /* --------------------------------------------------------------------------------- */
 /* MIME DECODING                                                                     */
@@ -33,7 +33,7 @@ function mime_structure ($bodystructure, $flags=array()) {
     $res  = $msg->parseStructure($read);
     $msg  = $res[0];
     if (!is_object($msg)) {
-        include_once( '../functions/display_messages.php' );
+        include_once(SM_PATH . 'functions/display_messages.php');
         global $color, $mailbox;
         displayPageHeader( $color, urldecode($mailbox) );
         echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n\n" .
@@ -268,7 +268,7 @@ function translateText(&$body, $wrap_at, $charset) {
     global $where, $what;   /* from searching */
     global $color;          /* color theme */
 
-    require_once('../functions/url_parser.php');
+    require_once(SM_PATH . 'functions/url_parser.php');
 
     $body_ary = explode("\n", $body);
     for ($i=0; $i < count($body_ary); $i++) {
@@ -622,17 +622,15 @@ function encodeHeader ($string) {
 }
 
 /* This function trys to locate the entity_id of a specific mime element */
-
 function find_ent_id($id, $message) {
-    $ret = '';
-    for ($i = 0; $ret == '' && $i < count($message->entities); $i++) {
-        if ($message->entities[$i]->header->type0 != 'multipart')  {
+    for ($i = 0, $ret = ''; $ret == '' && $i < count($message->entities); $i++) {
+        if ($message->entities[$i]->header->type0 == 'multipart')  {
             $ret = find_ent_id($id, $message->entities[$i]);
         } else {
             if (strcasecmp($message->entities[$i]->header->id, $id) == 0) {
                 if (sq_check_save_extension($message->entities[$i])) {
-                    $ret = $message->entities[$i]->entity_id;
-                }
+                    return $message->entities[$i]->entity_id;
+                } 
             }
         }
     }
@@ -1498,7 +1496,9 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX'){
                       "html",
                       "head",
                       "base",
-                      "link"
+                      "link",
+                     "frame",
+                     "iframe"
                       );
 
     $rm_tags_with_content = Array(