@@ -67,25 +67,25 @@ |
||
67 | 67 | if (is_array($elems)) { |
68 | 68 | foreach ($elems as $elem) { |
69 | 69 | switch ($elem['name']) { |
70 | - case '{' . Plugin::NS_CARDDAV . '}param-filter': |
|
71 | - $result['param-filters'][] = $elem['value']; |
|
72 | - break; |
|
73 | - case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
74 | - $result['is-not-defined'] = true; |
|
75 | - break; |
|
76 | - case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
77 | - $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
70 | + case '{' . Plugin::NS_CARDDAV . '}param-filter': |
|
71 | + $result['param-filters'][] = $elem['value']; |
|
72 | + break; |
|
73 | + case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
74 | + $result['is-not-defined'] = true; |
|
75 | + break; |
|
76 | + case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
77 | + $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
78 | 78 | |
79 | - if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
80 | - throw new BadRequest('Unknown match-type: ' . $matchType); |
|
81 | - } |
|
82 | - $result['text-matches'][] = [ |
|
83 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
84 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
85 | - 'value' => $elem['value'], |
|
86 | - 'match-type' => $matchType, |
|
87 | - ]; |
|
88 | - break; |
|
79 | + if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
80 | + throw new BadRequest('Unknown match-type: ' . $matchType); |
|
81 | + } |
|
82 | + $result['text-matches'][] = [ |
|
83 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
84 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
85 | + 'value' => $elem['value'], |
|
86 | + 'match-type' => $matchType, |
|
87 | + ]; |
|
88 | + break; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -61,22 +61,22 @@ |
||
61 | 61 | if (is_array($elems)) { |
62 | 62 | foreach ($elems as $elem) { |
63 | 63 | switch ($elem['name']) { |
64 | - case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
65 | - $result['is-not-defined'] = true; |
|
66 | - break; |
|
67 | - case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
68 | - $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
64 | + case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
65 | + $result['is-not-defined'] = true; |
|
66 | + break; |
|
67 | + case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
68 | + $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
69 | 69 | |
70 | - if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
71 | - throw new BadRequest('Unknown match-type: ' . $matchType); |
|
72 | - } |
|
73 | - $result['text-match'] = [ |
|
74 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
75 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
76 | - 'value' => $elem['value'], |
|
77 | - 'match-type' => $matchType, |
|
78 | - ]; |
|
79 | - break; |
|
70 | + if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
71 | + throw new BadRequest('Unknown match-type: ' . $matchType); |
|
72 | + } |
|
73 | + $result['text-match'] = [ |
|
74 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
75 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
76 | + 'value' => $elem['value'], |
|
77 | + 'match-type' => $matchType, |
|
78 | + ]; |
|
79 | + break; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -64,28 +64,28 @@ |
||
64 | 64 | if (is_array($elems)) { |
65 | 65 | foreach ($elems as $elem) { |
66 | 66 | switch ($elem['name']) { |
67 | - case '{' . Plugin::NS_CALDAV . '}param-filter': |
|
68 | - $result['param-filters'][] = $elem['value']; |
|
69 | - break; |
|
70 | - case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
71 | - $result['is-not-defined'] = true; |
|
72 | - break; |
|
73 | - case '{' . Plugin::NS_CALDAV . '}time-range': |
|
74 | - $result['time-range'] = [ |
|
75 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | - ]; |
|
78 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | - } |
|
81 | - break; |
|
82 | - case '{' . Plugin::NS_CALDAV . '}text-match': |
|
83 | - $result['text-match'] = [ |
|
84 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | - 'value' => $elem['value'], |
|
87 | - ]; |
|
88 | - break; |
|
67 | + case '{' . Plugin::NS_CALDAV . '}param-filter': |
|
68 | + $result['param-filters'][] = $elem['value']; |
|
69 | + break; |
|
70 | + case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
71 | + $result['is-not-defined'] = true; |
|
72 | + break; |
|
73 | + case '{' . Plugin::NS_CALDAV . '}time-range': |
|
74 | + $result['time-range'] = [ |
|
75 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | + ]; |
|
78 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | + } |
|
81 | + break; |
|
82 | + case '{' . Plugin::NS_CALDAV . '}text-match': |
|
83 | + $result['text-match'] = [ |
|
84 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | + 'value' => $elem['value'], |
|
87 | + ]; |
|
88 | + break; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -60,16 +60,16 @@ |
||
60 | 60 | if (is_array($elems)) { |
61 | 61 | foreach ($elems as $elem) { |
62 | 62 | switch ($elem['name']) { |
63 | - case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
64 | - $result['is-not-defined'] = true; |
|
65 | - break; |
|
66 | - case '{' . Plugin::NS_CALDAV . '}text-match': |
|
67 | - $result['text-match'] = [ |
|
68 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
69 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
70 | - 'value' => $elem['value'], |
|
71 | - ]; |
|
72 | - break; |
|
63 | + case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
64 | + $result['is-not-defined'] = true; |
|
65 | + break; |
|
66 | + case '{' . Plugin::NS_CALDAV . '}text-match': |
|
67 | + $result['text-match'] = [ |
|
68 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
69 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
70 | + 'value' => $elem['value'], |
|
71 | + ]; |
|
72 | + break; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -64,27 +64,27 @@ |
||
64 | 64 | if (is_array($elems)) { |
65 | 65 | foreach ($elems as $elem) { |
66 | 66 | switch ($elem['name']) { |
67 | - case '{' . Plugin::NS_CALDAV . '}comp-filter': |
|
68 | - $result['comp-filters'][] = $elem['value']; |
|
69 | - break; |
|
70 | - case '{' . Plugin::NS_CALDAV . '}prop-filter': |
|
71 | - $result['prop-filters'][] = $elem['value']; |
|
72 | - break; |
|
73 | - case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
74 | - $result['is-not-defined'] = true; |
|
75 | - break; |
|
76 | - case '{' . Plugin::NS_CALDAV . '}time-range': |
|
77 | - if ('VCALENDAR' === $result['name']) { |
|
78 | - throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
79 | - } |
|
80 | - $result['time-range'] = [ |
|
81 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
82 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
83 | - ]; |
|
84 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
85 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
86 | - } |
|
87 | - break; |
|
67 | + case '{' . Plugin::NS_CALDAV . '}comp-filter': |
|
68 | + $result['comp-filters'][] = $elem['value']; |
|
69 | + break; |
|
70 | + case '{' . Plugin::NS_CALDAV . '}prop-filter': |
|
71 | + $result['prop-filters'][] = $elem['value']; |
|
72 | + break; |
|
73 | + case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
74 | + $result['is-not-defined'] = true; |
|
75 | + break; |
|
76 | + case '{' . Plugin::NS_CALDAV . '}time-range': |
|
77 | + if ('VCALENDAR' === $result['name']) { |
|
78 | + throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
79 | + } |
|
80 | + $result['time-range'] = [ |
|
81 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
82 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
83 | + ]; |
|
84 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
85 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
86 | + } |
|
87 | + break; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -178,27 +178,27 @@ discard block |
||
178 | 178 | |
179 | 179 | foreach ($params as $key => $value) { |
180 | 180 | switch ($key) { |
181 | - case 'encoding': |
|
182 | - $this->_encoding = $value; |
|
183 | - $headers['Content-Transfer-Encoding'] = $value; |
|
184 | - break; |
|
185 | - |
|
186 | - case 'cid': |
|
187 | - $headers['Content-ID'] = '<' . $value . '>'; |
|
188 | - break; |
|
189 | - |
|
190 | - case 'location': |
|
191 | - $headers['Content-Location'] = $value; |
|
192 | - break; |
|
193 | - |
|
194 | - case 'body_file': |
|
195 | - $this->_body_file = $value; |
|
196 | - break; |
|
197 | - |
|
198 | - // for backward compatibility |
|
199 | - case 'dfilename': |
|
200 | - $params['filename'] = $value; |
|
201 | - break; |
|
181 | + case 'encoding': |
|
182 | + $this->_encoding = $value; |
|
183 | + $headers['Content-Transfer-Encoding'] = $value; |
|
184 | + break; |
|
185 | + |
|
186 | + case 'cid': |
|
187 | + $headers['Content-ID'] = '<' . $value . '>'; |
|
188 | + break; |
|
189 | + |
|
190 | + case 'location': |
|
191 | + $headers['Content-Location'] = $value; |
|
192 | + break; |
|
193 | + |
|
194 | + case 'body_file': |
|
195 | + $this->_body_file = $value; |
|
196 | + break; |
|
197 | + |
|
198 | + // for backward compatibility |
|
199 | + case 'dfilename': |
|
200 | + $params['filename'] = $value; |
|
201 | + break; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
@@ -480,18 +480,18 @@ discard block |
||
480 | 480 | function _getEncodedData($data, $encoding) |
481 | 481 | { |
482 | 482 | switch ($encoding) { |
483 | - case 'quoted-printable': |
|
484 | - return $this->_quotedPrintableEncode($data); |
|
485 | - break; |
|
483 | + case 'quoted-printable': |
|
484 | + return $this->_quotedPrintableEncode($data); |
|
485 | + break; |
|
486 | 486 | |
487 | - case 'base64': |
|
488 | - return rtrim(chunk_split(base64_encode($data), 76, $this->_eol)); |
|
489 | - break; |
|
487 | + case 'base64': |
|
488 | + return rtrim(chunk_split(base64_encode($data), 76, $this->_eol)); |
|
489 | + break; |
|
490 | 490 | |
491 | - case '8bit': |
|
492 | - case '7bit': |
|
493 | - default: |
|
494 | - return $data; |
|
491 | + case '8bit': |
|
492 | + case '7bit': |
|
493 | + default: |
|
494 | + return $data; |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
@@ -522,48 +522,48 @@ discard block |
||
522 | 522 | $data = ''; |
523 | 523 | |
524 | 524 | switch ($encoding) { |
525 | - case 'quoted-printable': |
|
526 | - while (!feof($fd)) { |
|
527 | - $buffer = $this->_quotedPrintableEncode(fgets($fd)); |
|
528 | - if ($fh) { |
|
529 | - fwrite($fh, $buffer); |
|
530 | - } else { |
|
531 | - $data .= $buffer; |
|
532 | - } |
|
533 | - } |
|
534 | - break; |
|
535 | - |
|
536 | - case 'base64': |
|
537 | - while (!feof($fd)) { |
|
538 | - // Should read in a multiple of 57 bytes so that |
|
539 | - // the output is 76 bytes per line. Don't use big chunks |
|
540 | - // because base64 encoding is memory expensive |
|
541 | - $buffer = fread($fd, 57 * 9198); // ca. 0.5 MB |
|
542 | - $buffer = base64_encode($buffer); |
|
543 | - $buffer = chunk_split($buffer, 76, $this->_eol); |
|
544 | - if (feof($fd)) { |
|
545 | - $buffer = rtrim($buffer); |
|
546 | - } |
|
525 | + case 'quoted-printable': |
|
526 | + while (!feof($fd)) { |
|
527 | + $buffer = $this->_quotedPrintableEncode(fgets($fd)); |
|
528 | + if ($fh) { |
|
529 | + fwrite($fh, $buffer); |
|
530 | + } else { |
|
531 | + $data .= $buffer; |
|
532 | + } |
|
533 | + } |
|
534 | + break; |
|
547 | 535 | |
548 | - if ($fh) { |
|
549 | - fwrite($fh, $buffer); |
|
550 | - } else { |
|
551 | - $data .= $buffer; |
|
552 | - } |
|
553 | - } |
|
554 | - break; |
|
555 | - |
|
556 | - case '8bit': |
|
557 | - case '7bit': |
|
558 | - default: |
|
559 | - while (!feof($fd)) { |
|
560 | - $buffer = fread($fd, 1048576); // 1 MB |
|
561 | - if ($fh) { |
|
562 | - fwrite($fh, $buffer); |
|
563 | - } else { |
|
564 | - $data .= $buffer; |
|
565 | - } |
|
566 | - } |
|
536 | + case 'base64': |
|
537 | + while (!feof($fd)) { |
|
538 | + // Should read in a multiple of 57 bytes so that |
|
539 | + // the output is 76 bytes per line. Don't use big chunks |
|
540 | + // because base64 encoding is memory expensive |
|
541 | + $buffer = fread($fd, 57 * 9198); // ca. 0.5 MB |
|
542 | + $buffer = base64_encode($buffer); |
|
543 | + $buffer = chunk_split($buffer, 76, $this->_eol); |
|
544 | + if (feof($fd)) { |
|
545 | + $buffer = rtrim($buffer); |
|
546 | + } |
|
547 | + |
|
548 | + if ($fh) { |
|
549 | + fwrite($fh, $buffer); |
|
550 | + } else { |
|
551 | + $data .= $buffer; |
|
552 | + } |
|
553 | + } |
|
554 | + break; |
|
555 | + |
|
556 | + case '8bit': |
|
557 | + case '7bit': |
|
558 | + default: |
|
559 | + while (!feof($fd)) { |
|
560 | + $buffer = fread($fd, 1048576); // 1 MB |
|
561 | + if ($fh) { |
|
562 | + fwrite($fh, $buffer); |
|
563 | + } else { |
|
564 | + $data .= $buffer; |
|
565 | + } |
|
566 | + } |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | fclose($fd); |
@@ -890,61 +890,61 @@ discard block |
||
890 | 890 | $text = !$html && strlen($this->_txtbody); |
891 | 891 | |
892 | 892 | switch (true) { |
893 | - case $text && !$attachments: |
|
894 | - $message =& $this->_addTextPart($null, $this->_txtbody); |
|
895 | - break; |
|
896 | - |
|
897 | - case !$text && !$html && $attachments: |
|
898 | - $message =& $this->_addMixedPart(); |
|
899 | - for ($i = 0; $i < count($this->_parts); $i++) { |
|
900 | - $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
901 | - } |
|
902 | - break; |
|
903 | - |
|
904 | - case $text && $attachments: |
|
905 | - $message =& $this->_addMixedPart(); |
|
906 | - $this->_addTextPart($message, $this->_txtbody); |
|
907 | - for ($i = 0; $i < count($this->_parts); $i++) { |
|
908 | - $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
909 | - } |
|
910 | - break; |
|
911 | - |
|
912 | - case $html && !$attachments && !$html_images: |
|
913 | - if (isset($this->_txtbody)) { |
|
914 | - $message =& $this->_addAlternativePart($null); |
|
915 | - $this->_addTextPart($message, $this->_txtbody); |
|
916 | - $this->_addHtmlPart($message); |
|
917 | - } else { |
|
918 | - $message =& $this->_addHtmlPart($null); |
|
919 | - } |
|
920 | - break; |
|
921 | - |
|
922 | - case $html && !$attachments && $html_images: |
|
923 | - // * Content-Type: multipart/alternative; |
|
924 | - // * text |
|
925 | - // * Content-Type: multipart/related; |
|
926 | - // * html |
|
927 | - // * image... |
|
928 | - if (isset($this->_txtbody)) { |
|
929 | - $message =& $this->_addAlternativePart($null); |
|
893 | + case $text && !$attachments: |
|
894 | + $message =& $this->_addTextPart($null, $this->_txtbody); |
|
895 | + break; |
|
896 | + |
|
897 | + case !$text && !$html && $attachments: |
|
898 | + $message =& $this->_addMixedPart(); |
|
899 | + for ($i = 0; $i < count($this->_parts); $i++) { |
|
900 | + $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
901 | + } |
|
902 | + break; |
|
903 | + |
|
904 | + case $text && $attachments: |
|
905 | + $message =& $this->_addMixedPart(); |
|
930 | 906 | $this->_addTextPart($message, $this->_txtbody); |
931 | - |
|
932 | - $ht =& $this->_addRelatedPart($message); |
|
933 | - $this->_addHtmlPart($ht); |
|
934 | - for ($i = 0; $i < count($this->_html_images); $i++) { |
|
935 | - $this->_addHtmlImagePart($ht, $this->_html_images[$i]); |
|
936 | - } |
|
937 | - } else { |
|
938 | - // * Content-Type: multipart/related; |
|
939 | - // * html |
|
940 | - // * image... |
|
941 | - $message =& $this->_addRelatedPart($null); |
|
942 | - $this->_addHtmlPart($message); |
|
943 | - for ($i = 0; $i < count($this->_html_images); $i++) { |
|
944 | - $this->_addHtmlImagePart($message, $this->_html_images[$i]); |
|
945 | - } |
|
946 | - } |
|
947 | - /* |
|
907 | + for ($i = 0; $i < count($this->_parts); $i++) { |
|
908 | + $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
909 | + } |
|
910 | + break; |
|
911 | + |
|
912 | + case $html && !$attachments && !$html_images: |
|
913 | + if (isset($this->_txtbody)) { |
|
914 | + $message =& $this->_addAlternativePart($null); |
|
915 | + $this->_addTextPart($message, $this->_txtbody); |
|
916 | + $this->_addHtmlPart($message); |
|
917 | + } else { |
|
918 | + $message =& $this->_addHtmlPart($null); |
|
919 | + } |
|
920 | + break; |
|
921 | + |
|
922 | + case $html && !$attachments && $html_images: |
|
923 | + // * Content-Type: multipart/alternative; |
|
924 | + // * text |
|
925 | + // * Content-Type: multipart/related; |
|
926 | + // * html |
|
927 | + // * image... |
|
928 | + if (isset($this->_txtbody)) { |
|
929 | + $message =& $this->_addAlternativePart($null); |
|
930 | + $this->_addTextPart($message, $this->_txtbody); |
|
931 | + |
|
932 | + $ht =& $this->_addRelatedPart($message); |
|
933 | + $this->_addHtmlPart($ht); |
|
934 | + for ($i = 0; $i < count($this->_html_images); $i++) { |
|
935 | + $this->_addHtmlImagePart($ht, $this->_html_images[$i]); |
|
936 | + } |
|
937 | + } else { |
|
938 | + // * Content-Type: multipart/related; |
|
939 | + // * html |
|
940 | + // * image... |
|
941 | + $message =& $this->_addRelatedPart($null); |
|
942 | + $this->_addHtmlPart($message); |
|
943 | + for ($i = 0; $i < count($this->_html_images); $i++) { |
|
944 | + $this->_addHtmlImagePart($message, $this->_html_images[$i]); |
|
945 | + } |
|
946 | + } |
|
947 | + /* |
|
948 | 948 | // #13444, #9725: the code below was a non-RFC compliant hack |
949 | 949 | // * Content-Type: multipart/related; |
950 | 950 | // * Content-Type: multipart/alternative; |
@@ -963,39 +963,39 @@ discard block |
||
963 | 963 | $this->_addHtmlImagePart($message, $this->_html_images[$i]); |
964 | 964 | } |
965 | 965 | */ |
966 | - break; |
|
967 | - |
|
968 | - case $html && $attachments && !$html_images: |
|
969 | - $message =& $this->_addMixedPart(); |
|
970 | - if (isset($this->_txtbody)) { |
|
971 | - $alt =& $this->_addAlternativePart($message); |
|
972 | - $this->_addTextPart($alt, $this->_txtbody); |
|
973 | - $this->_addHtmlPart($alt); |
|
974 | - } else { |
|
975 | - $this->_addHtmlPart($message); |
|
976 | - } |
|
977 | - for ($i = 0; $i < count($this->_parts); $i++) { |
|
978 | - $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
979 | - } |
|
980 | - break; |
|
981 | - |
|
982 | - case $html && $attachments && $html_images: |
|
983 | - $message =& $this->_addMixedPart(); |
|
984 | - if (isset($this->_txtbody)) { |
|
985 | - $alt =& $this->_addAlternativePart($message); |
|
986 | - $this->_addTextPart($alt, $this->_txtbody); |
|
987 | - $rel =& $this->_addRelatedPart($alt); |
|
988 | - } else { |
|
989 | - $rel =& $this->_addRelatedPart($message); |
|
990 | - } |
|
991 | - $this->_addHtmlPart($rel); |
|
992 | - for ($i = 0; $i < count($this->_html_images); $i++) { |
|
993 | - $this->_addHtmlImagePart($rel, $this->_html_images[$i]); |
|
994 | - } |
|
995 | - for ($i = 0; $i < count($this->_parts); $i++) { |
|
996 | - $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
997 | - } |
|
998 | - break; |
|
966 | + break; |
|
967 | + |
|
968 | + case $html && $attachments && !$html_images: |
|
969 | + $message =& $this->_addMixedPart(); |
|
970 | + if (isset($this->_txtbody)) { |
|
971 | + $alt =& $this->_addAlternativePart($message); |
|
972 | + $this->_addTextPart($alt, $this->_txtbody); |
|
973 | + $this->_addHtmlPart($alt); |
|
974 | + } else { |
|
975 | + $this->_addHtmlPart($message); |
|
976 | + } |
|
977 | + for ($i = 0; $i < count($this->_parts); $i++) { |
|
978 | + $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
979 | + } |
|
980 | + break; |
|
981 | + |
|
982 | + case $html && $attachments && $html_images: |
|
983 | + $message =& $this->_addMixedPart(); |
|
984 | + if (isset($this->_txtbody)) { |
|
985 | + $alt =& $this->_addAlternativePart($message); |
|
986 | + $this->_addTextPart($alt, $this->_txtbody); |
|
987 | + $rel =& $this->_addRelatedPart($alt); |
|
988 | + } else { |
|
989 | + $rel =& $this->_addRelatedPart($message); |
|
990 | + } |
|
991 | + $this->_addHtmlPart($rel); |
|
992 | + for ($i = 0; $i < count($this->_html_images); $i++) { |
|
993 | + $this->_addHtmlImagePart($rel, $this->_html_images[$i]); |
|
994 | + } |
|
995 | + for ($i = 0; $i < count($this->_parts); $i++) { |
|
996 | + $this->_addAttachmentPart($message, $this->_parts[$i]); |
|
997 | + } |
|
998 | + break; |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | if (!isset($message)) { |
@@ -1357,32 +1357,32 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | // See get() |
1359 | 1359 | switch (true) { |
1360 | - case $text && !$attachments: |
|
1361 | - $headers['Content-Type'] = 'text/plain'; |
|
1362 | - break; |
|
1363 | - |
|
1364 | - case !$text && !$html && $attachments: |
|
1365 | - case $text && $attachments: |
|
1366 | - case $html && $attachments && !$html_images: |
|
1367 | - case $html && $attachments && $html_images: |
|
1368 | - $headers['Content-Type'] = 'multipart/mixed'; |
|
1369 | - break; |
|
1370 | - |
|
1371 | - case $html && !$attachments && !$html_images && isset($this->_txtbody): |
|
1372 | - case $html && !$attachments && $html_images && isset($this->_txtbody): |
|
1373 | - $headers['Content-Type'] = 'multipart/alternative'; |
|
1374 | - break; |
|
1375 | - |
|
1376 | - case $html && !$attachments && !$html_images && !isset($this->_txtbody): |
|
1377 | - $headers['Content-Type'] = 'text/html'; |
|
1378 | - break; |
|
1379 | - |
|
1380 | - case $html && !$attachments && $html_images && !isset($this->_txtbody): |
|
1381 | - $headers['Content-Type'] = 'multipart/related'; |
|
1382 | - break; |
|
1383 | - |
|
1384 | - default: |
|
1385 | - return $headers; |
|
1360 | + case $text && !$attachments: |
|
1361 | + $headers['Content-Type'] = 'text/plain'; |
|
1362 | + break; |
|
1363 | + |
|
1364 | + case !$text && !$html && $attachments: |
|
1365 | + case $text && $attachments: |
|
1366 | + case $html && $attachments && !$html_images: |
|
1367 | + case $html && $attachments && $html_images: |
|
1368 | + $headers['Content-Type'] = 'multipart/mixed'; |
|
1369 | + break; |
|
1370 | + |
|
1371 | + case $html && !$attachments && !$html_images && isset($this->_txtbody): |
|
1372 | + case $html && !$attachments && $html_images && isset($this->_txtbody): |
|
1373 | + $headers['Content-Type'] = 'multipart/alternative'; |
|
1374 | + break; |
|
1375 | + |
|
1376 | + case $html && !$attachments && !$html_images && !isset($this->_txtbody): |
|
1377 | + $headers['Content-Type'] = 'text/html'; |
|
1378 | + break; |
|
1379 | + |
|
1380 | + case $html && !$attachments && $html_images && !isset($this->_txtbody): |
|
1381 | + $headers['Content-Type'] = 'multipart/related'; |
|
1382 | + break; |
|
1383 | + |
|
1384 | + default: |
|
1385 | + return $headers; |
|
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | $this->_checkParams(); |