thomascube
2010-03-02 7c9d922b96f9a88b350d6e07f5bde84ccc40f9b0
program/lib/tnef_decoder.inc
@@ -102,7 +102,7 @@
function tnef_decode_attribute($attribute, &$buf)
{
   global $debug, $download;
   global $debug;
   $length = tnef_geti32($buf);
   $value = tnef_getx($length, $buf); //data
@@ -116,9 +116,9 @@
   switch($attribute)
   {
      case TNEF_BODYTEXT:
         if (!$download)
         if ($debug)
         {
            printf("<b>Embedded message:</b><pre>%s</pre>",$value);
            printf("<b>Embedded message:</b><pre>%s</pre>", $value);
         }
         break;
@@ -185,17 +185,17 @@
      switch($attr_name)
      {
         case TNEF_MAPI_ATTACH_LONG_FILENAME: // used in preference to AFILENAME value
            $attachment_data[0]['name'] = ereg_replace('.*[\/](.*)$', '\1', $value); // strip path
            $attachment_data[0]['name'] = preg_replace('/.*[\/](.*)$/', '\1', $value); // strip path
            break;
         case TNEF_MAPI_ATTACH_MIME_TAG: // Is this ever set, and what is format?
            $attachment_data[0]['type0'] = ereg_replace('^(.*)/.*', '\1', $value);
            $attachment_data[0]['type1'] = ereg_replace('.*/(.*)$', '\1', $value);
            $attachment_data[0]['type0'] = preg_replace('/^(.*)\/.*/', '\1', $value);
            $attachment_data[0]['type1'] = preg_replace('/.*\/(.*)$/', '\1', $value);
            break;
         case TNEF_MAPI_ATTACH_DATA:
            tnef_getx(16, $value); // skip the next 16 bytes (unknown data)
            array_shift($attachment_data); // eliminate the current (bogus) attachment
       array_shift($attachment_data); // eliminate the current (bogus) attachment
            do_tnef_decode($value, $attachment_data); // recursively process the attached message
            break;
@@ -247,7 +247,7 @@
      case TNEF_AFILENAME: // filename
         $length = tnef_geti32($buf);
         $attachment_data[0]['name'] = ereg_replace('.*[\/](.*)$',
         $attachment_data[0]['name'] = preg_replace('/.*[\/](.*)$/',
                                                    '\1',
                                                    tnef_getx($length, $buf)); // strip path
         tnef_geti16($buf); //checksum
@@ -349,4 +349,4 @@
}
?>
?>