fix enter button to submit form with certain browsers. Thanks Ryan
[squirrelmail.git] / functions / mime.php
index e9a6b4a970b51b862c19199fa97e43bfcfb091c2..d68b9507b6bef30d8d02279a5e25fa52758851db 100644 (file)
@@ -371,14 +371,19 @@ function mime_match_parenthesis ($pos, $structure) {
 }
 
 function mime_fetch_body ($imap_stream, $id, $ent_id ) {
-    // do a bit of error correction.  If we couldn't find the entity id, just guess
-    // that it is the first one.  That is usually the case anyway.
-    if (!$ent_id)
+
+    /*
+     * do a bit of error correction.  If we couldn't find the entity id, just guess
+     * that it is the first one.  That is usually the case anyway.
+     */
+    if (!$ent_id) {
         $ent_id = 1;
+    }
     $data = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent_id]", true, $response, $message);
     $topline = array_shift($data);
-    while (! ereg('\\* [0-9]+ FETCH ', $topline) && $data)
+    while (! ereg('\\* [0-9]+ FETCH ', $topline) && $data) {
         $topline = array_shift($data);
+    }
     $wholemessage = implode('', $data);
     if (ereg('\\{([^\\}]*)\\}', $topline, $regs)) {
         $ret = substr( $wholemessage, 0, $regs[1] );
@@ -431,14 +436,13 @@ function mime_fetch_body ($imap_stream, $id, $ent_id ) {
                "<A HREF=\"../src/retrievalerror.php?$par\">Submit message</A><BR>" .
                '<tt>' . _("Response:") . "$response<BR>" .
                _("Message:") . " $message<BR>" .
-               _("FETCH line:") . " $topline<BR></tt></font></b>";
-
+               _("FETCH line:") . " $topline ....<BR></tt></font></b>";
+               
         $data = sqimap_run_command ($imap_stream, "FETCH $passed_id BODY[]", true, $response, $message);
         array_shift($data);
         $wholemessage = implode('', $data);
 
         $ret = "---------------\n$wholemessage";
-
     }
     return( $ret );
 }
@@ -915,8 +919,8 @@ function MagicHTML( $body, $id ) {
             case '/HEA':
             case '!DOC':
             case 'META':
-            case 'DIV ':
-            case '/DIV':
+            //case 'DIV ':
+            //case '/DIV':
             case '!-- ':
                 $i += 4;
                 while ( $body{$i}  <> '>' &&
@@ -1155,7 +1159,7 @@ function stripEvent( &$i, $j, &$body, $id, $base ) {
                     $src = '../images/' . _("sec_remove_eng.png");
                 }
                 $ret .= 'src="' . $src . '" ';
-                $i = $k - 3;
+                $i = $k - 2;
             } else {
                 $ret .= 'src';
                 $i = $i + 3;