* Changed some regexps into string matches and the like
[squirrelmail.git] / functions / mime.php
index eb2330ec4f4bf09d7a40439362eb80bc897bc142..2af69c78fff7b2ed0d551bb31eac5d6f626f6d47 100644 (file)
       fputs ($imap_stream, "a010 FETCH $id BODY[$ent_id]\r\n");
       $data = sqimap_read_data ($imap_stream, 'a010', 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)) {
+      if (ereg('\\{([^\\}]*)\\}', $topline, $regs)) {
          return substr($wholemessage, 0, $regs[1]);
       }
       else if (ereg('"([^"]*)"', $topline, $regs)) {
    // This functions decode strings that is encoded according to 
    // RFC1522 (MIME Part Two: Message Header Extensions for Non-ASCII Text).
    function decodeHeader ($string) {
-      if (eregi('=\?([^?]+)\?(q|b)\?([^?]+)\?=', 
+      if (eregi('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=', 
                 $string, $res)) {
          if (ucfirst($res[2]) == "B") {
             $replace = base64_decode($res[3]);
          $replace = charset_decode ($res[1], $replace);
 
          $string = eregi_replace
-            ('=\?([^?]+)\?(q|b)\?([^?]+)\?=',
+            ('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=',
              $replace, $string);
          // In case there should be more encoding in the string: recurse
          return (decodeHeader($string));