| @@ -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 | } | 
| @@ -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 | } | 
| @@ -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 | } | 
| @@ -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 | } | 
| @@ -177,27 +177,27 @@ discard block | ||
| 177 | 177 | |
| 178 | 178 |          foreach ($params as $key => $value) { | 
| 179 | 179 |              switch ($key) { | 
| 180 | - case 'encoding': | |
| 181 | - $this->_encoding = $value; | |
| 182 | - $headers['Content-Transfer-Encoding'] = $value; | |
| 183 | - break; | |
| 184 | - | |
| 185 | - case 'cid': | |
| 186 | - $headers['Content-ID'] = '<' . $value . '>'; | |
| 187 | - break; | |
| 188 | - | |
| 189 | - case 'location': | |
| 190 | - $headers['Content-Location'] = $value; | |
| 191 | - break; | |
| 192 | - | |
| 193 | - case 'body_file': | |
| 194 | - $this->_body_file = $value; | |
| 195 | - break; | |
| 196 | - | |
| 197 | - // for backward compatibility | |
| 198 | - case 'dfilename': | |
| 199 | - $params['filename'] = $value; | |
| 200 | - break; | |
| 180 | + case 'encoding': | |
| 181 | + $this->_encoding = $value; | |
| 182 | + $headers['Content-Transfer-Encoding'] = $value; | |
| 183 | + break; | |
| 184 | + | |
| 185 | + case 'cid': | |
| 186 | + $headers['Content-ID'] = '<' . $value . '>'; | |
| 187 | + break; | |
| 188 | + | |
| 189 | + case 'location': | |
| 190 | + $headers['Content-Location'] = $value; | |
| 191 | + break; | |
| 192 | + | |
| 193 | + case 'body_file': | |
| 194 | + $this->_body_file = $value; | |
| 195 | + break; | |
| 196 | + | |
| 197 | + // for backward compatibility | |
| 198 | + case 'dfilename': | |
| 199 | + $params['filename'] = $value; | |
| 200 | + break; | |
| 201 | 201 | } | 
| 202 | 202 | } | 
| 203 | 203 | |
| @@ -481,18 +481,18 @@ discard block | ||
| 481 | 481 | function _getEncodedData($data, $encoding) | 
| 482 | 482 |      { | 
| 483 | 483 |          switch ($encoding) { | 
| 484 | - case 'quoted-printable': | |
| 485 | - return $this->_quotedPrintableEncode($data); | |
| 486 | - break; | |
| 487 | - | |
| 488 | - case 'base64': | |
| 489 | - return rtrim(chunk_split(base64_encode($data), 76, $this->_eol)); | |
| 490 | - break; | |
| 491 | - | |
| 492 | - case '8bit': | |
| 493 | - case '7bit': | |
| 494 | - default: | |
| 495 | - return $data; | |
| 484 | + case 'quoted-printable': | |
| 485 | + return $this->_quotedPrintableEncode($data); | |
| 486 | + break; | |
| 487 | + | |
| 488 | + case 'base64': | |
| 489 | + return rtrim(chunk_split(base64_encode($data), 76, $this->_eol)); | |
| 490 | + break; | |
| 491 | + | |
| 492 | + case '8bit': | |
| 493 | + case '7bit': | |
| 494 | + default: | |
| 495 | + return $data; | |
| 496 | 496 | } | 
| 497 | 497 | } | 
| 498 | 498 | |
| @@ -523,48 +523,48 @@ discard block | ||
| 523 | 523 | $data = ''; | 
| 524 | 524 | |
| 525 | 525 |          switch ($encoding) { | 
| 526 | - case 'quoted-printable': | |
| 527 | -            while (!feof($fd)) { | |
| 528 | - $buffer = $this->_quotedPrintableEncode(fgets($fd)); | |
| 529 | -                if ($fh) { | |
| 530 | - fwrite($fh, $buffer); | |
| 531 | -                } else { | |
| 532 | - $data .= $buffer; | |
| 533 | - } | |
| 534 | - } | |
| 535 | - break; | |
| 536 | - | |
| 537 | - case 'base64': | |
| 538 | -            while (!feof($fd)) { | |
| 539 | - // Should read in a multiple of 57 bytes so that | |
| 540 | - // the output is 76 bytes per line. Don't use big chunks | |
| 541 | - // because base64 encoding is memory expensive | |
| 542 | - $buffer = fread($fd, 57 * 9198); // ca. 0.5 MB | |
| 543 | - $buffer = base64_encode($buffer); | |
| 544 | - $buffer = chunk_split($buffer, 76, $this->_eol); | |
| 545 | -                if (feof($fd)) { | |
| 546 | - $buffer = rtrim($buffer); | |
| 547 | - } | |
| 548 | - | |
| 549 | -                if ($fh) { | |
| 550 | - fwrite($fh, $buffer); | |
| 551 | -                } else { | |
| 552 | - $data .= $buffer; | |
| 553 | - } | |
| 554 | - } | |
| 555 | - break; | |
| 556 | - | |
| 557 | - case '8bit': | |
| 558 | - case '7bit': | |
| 559 | - default: | |
| 560 | -            while (!feof($fd)) { | |
| 561 | - $buffer = fread($fd, 1048576); // 1 MB | |
| 562 | -                if ($fh) { | |
| 563 | - fwrite($fh, $buffer); | |
| 564 | -                } else { | |
| 565 | - $data .= $buffer; | |
| 566 | - } | |
| 567 | - } | |
| 526 | + case 'quoted-printable': | |
| 527 | +            	while (!feof($fd)) { | |
| 528 | + $buffer = $this->_quotedPrintableEncode(fgets($fd)); | |
| 529 | +                	if ($fh) { | |
| 530 | + fwrite($fh, $buffer); | |
| 531 | +                	} else { | |
| 532 | + $data .= $buffer; | |
| 533 | + } | |
| 534 | + } | |
| 535 | + break; | |
| 536 | + | |
| 537 | + case 'base64': | |
| 538 | +            	while (!feof($fd)) { | |
| 539 | + // Should read in a multiple of 57 bytes so that | |
| 540 | + // the output is 76 bytes per line. Don't use big chunks | |
| 541 | + // because base64 encoding is memory expensive | |
| 542 | + $buffer = fread($fd, 57 * 9198); // ca. 0.5 MB | |
| 543 | + $buffer = base64_encode($buffer); | |
| 544 | + $buffer = chunk_split($buffer, 76, $this->_eol); | |
| 545 | +                	if (feof($fd)) { | |
| 546 | + $buffer = rtrim($buffer); | |
| 547 | + } | |
| 548 | + | |
| 549 | +                	if ($fh) { | |
| 550 | + fwrite($fh, $buffer); | |
| 551 | +                	} else { | |
| 552 | + $data .= $buffer; | |
| 553 | + } | |
| 554 | + } | |
| 555 | + break; | |
| 556 | + | |
| 557 | + case '8bit': | |
| 558 | + case '7bit': | |
| 559 | + default: | |
| 560 | +            	while (!feof($fd)) { | |
| 561 | + $buffer = fread($fd, 1048576); // 1 MB | |
| 562 | +                	if ($fh) { | |
| 563 | + fwrite($fh, $buffer); | |
| 564 | +                	} else { | |
| 565 | + $data .= $buffer; | |
| 566 | + } | |
| 567 | + } | |
| 568 | 568 | } | 
| 569 | 569 | |
| 570 | 570 | fclose($fd); | 
| @@ -885,61 +885,61 @@ discard block | ||
| 885 | 885 | $text = !$html && strlen($this->_txtbody); | 
| 886 | 886 | |
| 887 | 887 |          switch (true) { | 
| 888 | - case $text && !$attachments: | |
| 889 | - $message =& $this->_addTextPart($null, $this->_txtbody); | |
| 890 | - break; | |
| 891 | - | |
| 892 | - case !$text && !$html && $attachments: | |
| 893 | - $message =& $this->_addMixedPart(); | |
| 894 | -            for ($i = 0; $i < count($this->_parts); $i++) { | |
| 895 | - $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 896 | - } | |
| 897 | - break; | |
| 898 | - | |
| 899 | - case $text && $attachments: | |
| 900 | - $message =& $this->_addMixedPart(); | |
| 901 | - $this->_addTextPart($message, $this->_txtbody); | |
| 902 | -            for ($i = 0; $i < count($this->_parts); $i++) { | |
| 903 | - $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 904 | - } | |
| 905 | - break; | |
| 906 | - | |
| 907 | - case $html && !$attachments && !$html_images: | |
| 908 | -            if (isset($this->_txtbody)) { | |
| 909 | - $message =& $this->_addAlternativePart($null); | |
| 910 | - $this->_addTextPart($message, $this->_txtbody); | |
| 911 | - $this->_addHtmlPart($message); | |
| 912 | -            } else { | |
| 913 | - $message =& $this->_addHtmlPart($null); | |
| 914 | - } | |
| 915 | - break; | |
| 916 | - | |
| 917 | - case $html && !$attachments && $html_images: | |
| 918 | - // * Content-Type: multipart/alternative; | |
| 919 | - // * text | |
| 920 | - // * Content-Type: multipart/related; | |
| 921 | - // * html | |
| 922 | - // * image... | |
| 923 | -            if (isset($this->_txtbody)) { | |
| 924 | - $message =& $this->_addAlternativePart($null); | |
| 925 | - $this->_addTextPart($message, $this->_txtbody); | |
| 926 | - | |
| 927 | - $ht =& $this->_addRelatedPart($message); | |
| 928 | - $this->_addHtmlPart($ht); | |
| 929 | -                for ($i = 0; $i < count($this->_html_images); $i++) { | |
| 930 | - $this->_addHtmlImagePart($ht, $this->_html_images[$i]); | |
| 931 | - } | |
| 932 | -            } else { | |
| 933 | - // * Content-Type: multipart/related; | |
| 934 | - // * html | |
| 935 | - // * image... | |
| 936 | - $message =& $this->_addRelatedPart($null); | |
| 937 | - $this->_addHtmlPart($message); | |
| 938 | -                for ($i = 0; $i < count($this->_html_images); $i++) { | |
| 939 | - $this->_addHtmlImagePart($message, $this->_html_images[$i]); | |
| 940 | - } | |
| 941 | - } | |
| 942 | - /* | |
| 888 | + case $text && !$attachments: | |
| 889 | + $message =& $this->_addTextPart($null, $this->_txtbody); | |
| 890 | + break; | |
| 891 | + | |
| 892 | + case !$text && !$html && $attachments: | |
| 893 | + $message =& $this->_addMixedPart(); | |
| 894 | +            	for ($i = 0; $i < count($this->_parts); $i++) { | |
| 895 | + $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 896 | + } | |
| 897 | + break; | |
| 898 | + | |
| 899 | + case $text && $attachments: | |
| 900 | + $message =& $this->_addMixedPart(); | |
| 901 | + $this->_addTextPart($message, $this->_txtbody); | |
| 902 | +            	for ($i = 0; $i < count($this->_parts); $i++) { | |
| 903 | + $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 904 | + } | |
| 905 | + break; | |
| 906 | + | |
| 907 | + case $html && !$attachments && !$html_images: | |
| 908 | +            	if (isset($this->_txtbody)) { | |
| 909 | + $message =& $this->_addAlternativePart($null); | |
| 910 | + $this->_addTextPart($message, $this->_txtbody); | |
| 911 | + $this->_addHtmlPart($message); | |
| 912 | +            	} else { | |
| 913 | + $message =& $this->_addHtmlPart($null); | |
| 914 | + } | |
| 915 | + break; | |
| 916 | + | |
| 917 | + case $html && !$attachments && $html_images: | |
| 918 | + // * Content-Type: multipart/alternative; | |
| 919 | + // * text | |
| 920 | + // * Content-Type: multipart/related; | |
| 921 | + // * html | |
| 922 | + // * image... | |
| 923 | +            	if (isset($this->_txtbody)) { | |
| 924 | + $message =& $this->_addAlternativePart($null); | |
| 925 | + $this->_addTextPart($message, $this->_txtbody); | |
| 926 | + | |
| 927 | + $ht =& $this->_addRelatedPart($message); | |
| 928 | + $this->_addHtmlPart($ht); | |
| 929 | +                	for ($i = 0; $i < count($this->_html_images); $i++) { | |
| 930 | + $this->_addHtmlImagePart($ht, $this->_html_images[$i]); | |
| 931 | + } | |
| 932 | +            	} else { | |
| 933 | + // * Content-Type: multipart/related; | |
| 934 | + // * html | |
| 935 | + // * image... | |
| 936 | + $message =& $this->_addRelatedPart($null); | |
| 937 | + $this->_addHtmlPart($message); | |
| 938 | +                	for ($i = 0; $i < count($this->_html_images); $i++) { | |
| 939 | + $this->_addHtmlImagePart($message, $this->_html_images[$i]); | |
| 940 | + } | |
| 941 | + } | |
| 942 | + /* | |
| 943 | 943 | // #13444, #9725: the code below was a non-RFC compliant hack | 
| 944 | 944 | // * Content-Type: multipart/related; | 
| 945 | 945 | // * Content-Type: multipart/alternative; | 
| @@ -958,39 +958,39 @@ discard block | ||
| 958 | 958 | $this->_addHtmlImagePart($message, $this->_html_images[$i]); | 
| 959 | 959 | } | 
| 960 | 960 | */ | 
| 961 | - break; | |
| 962 | - | |
| 963 | - case $html && $attachments && !$html_images: | |
| 964 | - $message =& $this->_addMixedPart(); | |
| 965 | -            if (isset($this->_txtbody)) { | |
| 966 | - $alt =& $this->_addAlternativePart($message); | |
| 967 | - $this->_addTextPart($alt, $this->_txtbody); | |
| 968 | - $this->_addHtmlPart($alt); | |
| 969 | -            } else { | |
| 970 | - $this->_addHtmlPart($message); | |
| 971 | - } | |
| 972 | -            for ($i = 0; $i < count($this->_parts); $i++) { | |
| 973 | - $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 974 | - } | |
| 975 | - break; | |
| 976 | - | |
| 977 | - case $html && $attachments && $html_images: | |
| 978 | - $message =& $this->_addMixedPart(); | |
| 979 | -            if (isset($this->_txtbody)) { | |
| 980 | - $alt =& $this->_addAlternativePart($message); | |
| 981 | - $this->_addTextPart($alt, $this->_txtbody); | |
| 982 | - $rel =& $this->_addRelatedPart($alt); | |
| 983 | -            } else { | |
| 984 | - $rel =& $this->_addRelatedPart($message); | |
| 985 | - } | |
| 986 | - $this->_addHtmlPart($rel); | |
| 987 | -            for ($i = 0; $i < count($this->_html_images); $i++) { | |
| 988 | - $this->_addHtmlImagePart($rel, $this->_html_images[$i]); | |
| 989 | - } | |
| 990 | -            for ($i = 0; $i < count($this->_parts); $i++) { | |
| 991 | - $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 992 | - } | |
| 993 | - break; | |
| 961 | + break; | |
| 962 | + | |
| 963 | + case $html && $attachments && !$html_images: | |
| 964 | + $message =& $this->_addMixedPart(); | |
| 965 | +            	if (isset($this->_txtbody)) { | |
| 966 | + $alt =& $this->_addAlternativePart($message); | |
| 967 | + $this->_addTextPart($alt, $this->_txtbody); | |
| 968 | + $this->_addHtmlPart($alt); | |
| 969 | +            	} else { | |
| 970 | + $this->_addHtmlPart($message); | |
| 971 | + } | |
| 972 | +            	for ($i = 0; $i < count($this->_parts); $i++) { | |
| 973 | + $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 974 | + } | |
| 975 | + break; | |
| 976 | + | |
| 977 | + case $html && $attachments && $html_images: | |
| 978 | + $message =& $this->_addMixedPart(); | |
| 979 | +            	if (isset($this->_txtbody)) { | |
| 980 | + $alt =& $this->_addAlternativePart($message); | |
| 981 | + $this->_addTextPart($alt, $this->_txtbody); | |
| 982 | + $rel =& $this->_addRelatedPart($alt); | |
| 983 | +            	} else { | |
| 984 | + $rel =& $this->_addRelatedPart($message); | |
| 985 | + } | |
| 986 | + $this->_addHtmlPart($rel); | |
| 987 | +            	for ($i = 0; $i < count($this->_html_images); $i++) { | |
| 988 | + $this->_addHtmlImagePart($rel, $this->_html_images[$i]); | |
| 989 | + } | |
| 990 | +            	for ($i = 0; $i < count($this->_parts); $i++) { | |
| 991 | + $this->_addAttachmentPart($message, $this->_parts[$i]); | |
| 992 | + } | |
| 993 | + break; | |
| 994 | 994 | } | 
| 995 | 995 | |
| 996 | 996 |          if (!isset($message)) { | 
| @@ -1352,32 +1352,32 @@ discard block | ||
| 1352 | 1352 | |
| 1353 | 1353 | // See get() | 
| 1354 | 1354 |          switch (true) { | 
| 1355 | - case $text && !$attachments: | |
| 1356 | - $headers['Content-Type'] = 'text/plain'; | |
| 1357 | - break; | |
| 1358 | - | |
| 1359 | - case !$text && !$html && $attachments: | |
| 1360 | - case $text && $attachments: | |
| 1361 | - case $html && $attachments && !$html_images: | |
| 1362 | - case $html && $attachments && $html_images: | |
| 1363 | - $headers['Content-Type'] = 'multipart/mixed'; | |
| 1364 | - break; | |
| 1365 | - | |
| 1366 | - case $html && !$attachments && !$html_images && isset($this->_txtbody): | |
| 1367 | - case $html && !$attachments && $html_images && isset($this->_txtbody): | |
| 1368 | - $headers['Content-Type'] = 'multipart/alternative'; | |
| 1369 | - break; | |
| 1370 | - | |
| 1371 | - case $html && !$attachments && !$html_images && !isset($this->_txtbody): | |
| 1372 | - $headers['Content-Type'] = 'text/html'; | |
| 1373 | - break; | |
| 1374 | - | |
| 1375 | - case $html && !$attachments && $html_images && !isset($this->_txtbody): | |
| 1376 | - $headers['Content-Type'] = 'multipart/related'; | |
| 1377 | - break; | |
| 1378 | - | |
| 1379 | - default: | |
| 1380 | - return $headers; | |
| 1355 | + case $text && !$attachments: | |
| 1356 | + $headers['Content-Type'] = 'text/plain'; | |
| 1357 | + break; | |
| 1358 | + | |
| 1359 | + case !$text && !$html && $attachments: | |
| 1360 | + case $text && $attachments: | |
| 1361 | + case $html && $attachments && !$html_images: | |
| 1362 | + case $html && $attachments && $html_images: | |
| 1363 | + $headers['Content-Type'] = 'multipart/mixed'; | |
| 1364 | + break; | |
| 1365 | + | |
| 1366 | + case $html && !$attachments && !$html_images && isset($this->_txtbody): | |
| 1367 | + case $html && !$attachments && $html_images && isset($this->_txtbody): | |
| 1368 | + $headers['Content-Type'] = 'multipart/alternative'; | |
| 1369 | + break; | |
| 1370 | + | |
| 1371 | + case $html && !$attachments && !$html_images && !isset($this->_txtbody): | |
| 1372 | + $headers['Content-Type'] = 'text/html'; | |
| 1373 | + break; | |
| 1374 | + | |
| 1375 | + case $html && !$attachments && $html_images && !isset($this->_txtbody): | |
| 1376 | + $headers['Content-Type'] = 'multipart/related'; | |
| 1377 | + break; | |
| 1378 | + | |
| 1379 | + default: | |
| 1380 | + return $headers; | |
| 1381 | 1381 | } | 
| 1382 | 1382 | |
| 1383 | 1383 | $this->_checkParams(); |