فهرست منبع

Patch to fix several problems in MagicHTML.
1. Now recognizes comments that dont have a space between <!-- and the text.
2. Fixed typo from EMBB to EMBE to handle EMBED tags.
3. Fixed BASE so it doesn't mangle BASEFONT tags.

indiri69 23 سال پیش
والد
کامیت
196981122a
1فایلهای تغییر یافته به همراه23 افزوده شده و 2 حذف شده
  1. 23 2
      functions/mime.php

+ 23 - 2
functions/mime.php

@@ -905,10 +905,18 @@ function MagicHTML( $body, $id ) {
                 $tag .= $body{$pos};
                 $pos ++;
             }
+            /*
+               A comment in HTML is only three characters and isn't
+               guaranteed to have a space after it.  This fudges so
+               it will be caught by the switch statement.
+            */
+            if (ereg("!--", $tag)) {
+                $tag = "!-- ";
+            }
             switch( strtoupper( $tag ) ) {
             // Strips the entire tag and contents
             case 'APPL':
-            case 'EMBB':
+            case 'EMBE':
             case 'FRAM':
             case 'SCRI':
             case 'OBJE':
@@ -1023,8 +1031,21 @@ function MagicHTML( $body, $id ) {
                     $ret .= '<font color=#000000>';
                 break;
             case 'BASE':
-                $i += 5;
+                $i += 4;
                 $base = '';
+                if ( strncasecmp($body{$i}, 'font', 4) ) {
+                    $i += 5;
+                    while ( !isNoSep( $body{$i} ) && $i < $j ) {
+                        $i++;
+                    }
+                    while ( $body{$i} <> '>' && $i < $j ) {
+                            $base .= $body{$i};
+                        $i++;
+                    }
+                    $ret .= "<BASEFONT $base>\n";
+                    break;
+                }
+                $i++;
                 while ( !isNoSep( $body{$i} ) &&
                        $i < $j ) {
                         $i++;