newmail plugin strings
[squirrelmail.git] / functions / mime.php
index aacc7268f47f126ad83f2a0159a4aced13cb419c..74dd9258d1d25ac2c39710b7ded9d5e8a5e6ffc0 100644 (file)
@@ -12,6 +12,7 @@
    define('mime_php', true);
 
    require_once('../functions/imap.php');
+   require_once('../functions/attachment_common.php');
 
    /** Setting up the objects that have the structure for the message **/
 
@@ -24,6 +25,7 @@
       var $cc = array(), $bcc = array(), $reply_to = '', $subject = '';
       var $id = 0, $mailbox = '', $description = '', $filename = '';
       var $entity_id = 0, $message_id = 0, $name = '';
+      // var $priority = "";
    }
 
    class message {
         } else if (ereg('"([^"]*)"', $topline, $regs)) {
             $ret = $regs[1];
         } else {
-            $ret = "Body retrieval error.  Please report this bug!\n" .
-                   "Response:  $response\n" .
-                   "Message:  $message\n" .
-                   "FETCH line:  $topline" .
-                   "---------------\n$wholemessage";
-    
-            foreach ($data as $d) {
-              $ret .= htmlspecialchars($d) . "\n";
+            global $where, $what, $mailbox, $passed_id, $startMessage;
+            $par = "mailbox=".urlencode($mailbox)."&passed_id=$passed_id";
+            if (isset($where) && isset($what)) {
+                $par .= "&where=".urlencode($where)."&what=".urlencode($what);
+            } else {
+                $par .= "&startMessage=$startMessage&show_more=0";
             }
+            $par .= '&response='.urlencode($response).'&message='.urlencode($message).
+                    '&topline='.urlencode($topline);
+
+            echo   '<b><font color=$color[2]>Body retrieval error. The reason for this is most probably that<BR> ' .
+                   'the message is malformed. Please help us making future versions<BR> ' .
+                   "better by submitting this message to the developers knowledgebase!<BR>\n" .
+                   "<A HREF=\"../src/retrievalerror.php?$par\">Submit message</A><BR>" .
+
+                   "<tt>Response:  $response<BR>" .
+                   "Message:  $message<BR>" .
+                   "FETCH line:  $topline<BR></tt></font></b>";
+
+            fputs ($imap_stream, "$sid FETCH $passed_id BODY[]\r\n");
+            $data = sqimap_read_data ($imap_stream, $sid, true, $response, $message);
+            array_shift($data);
+            $wholemessage = implode('', $data);
+
+            $ret = "---------------\n$wholemessage";
+    
         }
         return( $ret );
     }
                                    $style .= $body{$i};
                                $i++;
                             }
-                            stripComments( &$i, $j, &$body );
+                            stripComments( $i, $j, $body );
                             $style = strtoupper( trim( $style ) );
                             if( $style == 'BODY' ) {
                                 // Next we look into the definitions of the body style
                                 }
                                 $styleblk .= $body{$i};
                             }
-                            stripComments( &$i, $j, &$body );
+                            stripComments( $i, $j, $body );
                             if( $body{$i} <> '>' )
                                 $i++;
                         }
                             $ret .= '<b>' . _("Title:") . " </b>$title<br>\n";
                         $ret .= "<TABLE";
                         $i += 5;
+                       if (! isset($base))
+                          $base = '';
                         $ret .= stripEvent( $i, $j, $body, $id, $base );
                         //if( $bgcolor <> '' )
                             $ret .= " bgcolor=$bgcolor";
                     default:
                         // Following tags can contain some event handler, lets search it
                         stripComments( $i, $j, $body );
+                       if (! isset($base))
+                          $base = '';
                         $ret .= stripEvent( $i, $j, $body, $id, $base ) . '>';
                         // $ret .= "<!-- $tag detected -->";
                 }
         return( $ret );
 
     }
-?>
\ No newline at end of file
+?>