summaryrefslogtreecommitdiff
path: root/security/mailzu/files/patch-lib_MailMime.class.php
blob: d8c05a9b0ebd05b4c042ee8b5217600f53209be1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- lib/MailMime.class.php.orig	2007-06-14 19:00:15 UTC
+++ lib/MailMime.class.php
@@ -59,9 +59,15 @@ function MsgParseBody($struct) {
 
         global $filelist;
         global $errors;
-        $ctype_p = strtolower(trim($struct->ctype_primary));
-        $ctype_s = strtolower(trim($struct->ctype_secondary));
 
+        if ( is_object( $struct) ) {
+            $ctype_p = strtolower(trim($struct->ctype_primary));
+            $ctype_s = strtolower(trim($struct->ctype_secondary));
+        } else {
+            $ctype_p = $struct;
+            $ctype_s = "";
+        }
+
         switch ($ctype_p) {
           case "multipart":
             switch ($ctype_s) {
@@ -94,8 +100,14 @@ function MsgParseBody($struct) {
 
           case "text":
             // Do not display attached text types
-            if ($attachment = $struct->d_parameters['filename'] or
-                  $attachment = $struct->d_parameters['name']) {
+            if ( isset($struct->d_parameters['filename']) ) {
+                $attachment = $struct->d_parameters['filename'];
+            } elseif ( isset($struct->d_parameters['name']) ) {
+                $attachment = $struct->d_parameters['name'];
+            } else {
+                $attachment = NULL;
+            }
+            if ($attachment) {
                 array_push($filelist, $attachment);
                 break;
             }
@@ -117,7 +129,9 @@ function MsgParseBody($struct) {
           default:
             // Save the listed filename or notify the
             // reader that this mail is not displayed completely
-            $attachment = $struct->d_parameters['filename'];
+            if ( isset( $struct->d_parameters['filename'] )) {
+               $attachment = $struct->d_parameters['filename'];
+            } else { $attachment = NULL; }
             $attachment ? array_push($filelist, $attachment) : $errors['Unsupported MIME objects present'] = true;
 
         }
@@ -137,9 +151,9 @@ function FindMultiAlt($parts) {
     foreach ($parts as $cur_part) {
       $type = GetCtype($cur_part);
       if ($type == 'multipart/related') {
-      $type = $cur_part->d_parameters['type'];
-      // Mozilla bug. Mozilla does not provide the parameter type.
-      if (!$type) $type = 'text/html';
+        if ( isset( $cur_part->d_parameters['type'] )) { $type = $cur_part->d_parameters['type']; }
+        // Mozilla bug. Mozilla does not provide the parameter type.
+        if (!$type) $type = 'text/html';
       }
       $altCount = count($alt_pref);
       for ($j = $best_view; $j < $altCount; ++$j) {
@@ -163,7 +177,8 @@ function FindMultiAlt($parts) {
 */
 function FindMultiRel($struct) {
   $entities = array();
-  $type = $struct->d_parameters['type'];
+  $type = "";
+  if ( isset( $cur_part->d_parameters['type'] )) { $type = $cur_part->d_parameters['type']; }
   // Mozilla bug. Mozilla does not provide the parameter type.
   if (!$type) $type = 'text/html';
   // Bad Headers sometimes have invalid MIME....