Be somewhat clearer in the error message: default_pref not readable
[squirrelmail.git] / functions / mime.php
index 4450529900b7abad21143a938f0db1a29a92931c..a312c831c2a4e63d04f5ca0bc8efe3b6ba16efcd 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" .
@@ -134,14 +134,12 @@ function mime_fetch_body($imap_stream, $id, $ent_id) {
         echo   '<tt><br>' .
                '<table width="80%"><tr>' .
                '<tr><td colspan=2>' .
-               _("Body retrieval error. The reason for this is most probably that the message is malformed. Please help us making future versions better by submitting this message to the developers knowledgebase!") .
-               " <A HREF=\"../src/retrievalerror.php?$par\"><br>" .
-               _("Submit message") . '</A><BR>&nbsp;' .
+               _("Body retrieval error. The reason for this is most probably that the message is malformed.") .
                '</td></tr>' .
-               '<td><b>' . _("Command:") . "</td><td>$cmd</td></tr>" .
-               '<td><b>' . _("Response:") . "</td><td>$response</td></tr>" .
-               '<td><b>' . _("Message:") . "</td><td>$message</td></tr>" .
-               '<td><b>' . _("FETCH line:") . "</td><td>$topline</td></tr>" .
+               '<tr><td><b>' . _("Command:") . "</td><td>$cmd</td></tr>" .
+               '<tr><td><b>' . _("Response:") . "</td><td>$response</td></tr>" .
+               '<tr><td><b>' . _("Message:") . "</td><td>$message</td></tr>" .
+               '<tr><td><b>' . _("FETCH line:") . "</td><td>$topline</td></tr>" .
                "</table><BR></tt></font><hr>";
 
         $data = sqimap_run_command ($imap_stream, "FETCH $passed_id BODY[]", true, $response, $message, $uid_support);
@@ -268,7 +266,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++) {
@@ -456,7 +454,7 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
                      . "&amp;passed_id=$id&amp;mailbox=$urlMailbox"
                      . '&amp;ent_id='.$ent.$passed_ent_id_link;
         if ($where && $what) {
-           $defaultlink = '&amp;where='. urlencode($where).'&amp;what='.urlencode($what);
+           $defaultlink .= '&amp;where='. urlencode($where).'&amp;what='.urlencode($what);
         }
         /* This executes the attachment hook with a specific MIME-type.
          * If that doesn't have results, it tries if there's a rule
@@ -622,17 +620,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;
-                }
+//                if (sq_check_save_extension($message->entities[$i])) {
+                    return $message->entities[$i]->entity_id;
+//                } 
             }
         }
     }
@@ -1498,7 +1494,9 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX'){
                       "html",
                       "head",
                       "base",
-                      "link"
+                      "link",
+                     "frame",
+                     "iframe"
                       );
 
     $rm_tags_with_content = Array(