Postie - Version 1.8.19

Version Description

(2016-11-16) = * Fix issue where attachments not showing if both plain and html are blank and the attachment is part of a multipart (related) block.

Download this release

Release Info

Developer WayneAllen
Plugin Icon 128x128 Postie
Version 1.8.19
Comparing to
See all releases

Code changes from version 1.8.18 to 1.8.19

docs/Changes.txt CHANGED
@@ -32,6 +32,9 @@ All script, style and body tags are stripped from html emails.
32
  Attachments are now processed in the order they were attached.
33
 
34
  == CHANGELOG ==
 
 
 
35
  = 1.8.18 (2016-11-16) =
36
  * Fix issue where inline PDF was not being detected as a PDF.
37
  * Fix issue where outlook.com is setting an incorrect mime type on images.
32
  Attachments are now processed in the order they were attached.
33
 
34
  == CHANGELOG ==
35
+ = 1.8.19 (2016-11-16) =
36
+ * Fix issue where attachments not showing if both plain and html are blank and the attachment is part of a multipart (related) block.
37
+
38
  = 1.8.18 (2016-11-16) =
39
  * Fix issue where inline PDF was not being detected as a PDF.
40
  * Fix issue where outlook.com is setting an incorrect mime type on images.
docs/Postie.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.6.1
9
- Stable tag: 1.8.18
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.6.1
9
+ Stable tag: 1.8.19
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
lib/fMailbox.php CHANGED
@@ -226,11 +226,11 @@ class fMailbox {
226
  $content = $data;
227
  }
228
 
 
229
  $has_disposition = !empty($structure['disposition']);
230
-
231
  if ($has_disposition) {
232
  //ensure the mime type is correct before doing additional decoding. Some mail clients mark all attachments as text/plain regardless of real type - looking at you outlook.com
233
- $filename = '';
234
  foreach ($structure['disposition_fields'] as $field => $value) {
235
  if (strtolower($field) == 'filename') {
236
  DebugEcho("handlePart: disposition_fields filename: $value");
@@ -287,8 +287,9 @@ class fMailbox {
287
  $info['related'] = array();
288
  }
289
  $cid = $structure['content_id'][0] == '<' ? substr($structure['content_id'], 1, -1) : $structure['content_id'];
290
- DebugEcho('handlePart: cid: ' . $cid);
291
  $info['related']['cid:' . $cid] = array(
 
292
  'mimetype' => $structure['type'] . '/' . $structure['subtype'],
293
  'data' => $content
294
  );
@@ -309,7 +310,7 @@ class fMailbox {
309
  // Attachments or inline content
310
  if ($has_disposition) {
311
  DebugEcho("handlePart: disposition set to " . $structure['disposition']);
312
-
313
  // This automatically handles primary content that has a content-disposition header on it
314
  if ($structure['disposition'] == 'inline' && $filename === '') {
315
  DebugEcho("handlePart: inline un-named");
226
  $content = $data;
227
  }
228
 
229
+ $filename = '';
230
  $has_disposition = !empty($structure['disposition']);
231
+
232
  if ($has_disposition) {
233
  //ensure the mime type is correct before doing additional decoding. Some mail clients mark all attachments as text/plain regardless of real type - looking at you outlook.com
 
234
  foreach ($structure['disposition_fields'] as $field => $value) {
235
  if (strtolower($field) == 'filename') {
236
  DebugEcho("handlePart: disposition_fields filename: $value");
287
  $info['related'] = array();
288
  }
289
  $cid = $structure['content_id'][0] == '<' ? substr($structure['content_id'], 1, -1) : $structure['content_id'];
290
+ DebugEcho("handlePart: cid: $cid ($filename) {$structure['type']}/{$structure['subtype']}");
291
  $info['related']['cid:' . $cid] = array(
292
+ 'filename' => $filename,
293
  'mimetype' => $structure['type'] . '/' . $structure['subtype'],
294
  'data' => $content
295
  );
310
  // Attachments or inline content
311
  if ($has_disposition) {
312
  DebugEcho("handlePart: disposition set to " . $structure['disposition']);
313
+
314
  // This automatically handles primary content that has a content-disposition header on it
315
  if ($structure['disposition'] == 'inline' && $filename === '') {
316
  DebugEcho("handlePart: inline un-named");
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1535352 2016-11-16 22:25:00Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -214,6 +214,7 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
214
  }
215
  DebugEcho("filter_AttachmentTemplates: featured image: $fiid");
216
 
 
217
  foreach ($mimeDecodedEmail['attachment'] as $attachment) {
218
  DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
219
  $skip = ($fiid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
@@ -236,6 +237,8 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
236
  }
237
 
238
  if ($config['prefer_text_type'] == 'plain') {
 
 
239
  foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
240
  DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
241
  $skip = ($fiid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
@@ -256,6 +259,8 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
256
  DebugEcho("filter_AttachmentTemplates: skip attachment (alt) " . $attachment['wp_filename']);
257
  }
258
  }
 
 
259
  }
260
 
261
  if ($config['images_append']) {
@@ -3219,11 +3224,11 @@ function postie_get_mail() {
3219
 
3220
  $tmp_config = $config;
3221
  if ($config['prefer_text_convert']) {
3222
- if ($config['prefer_text_type'] == 'plain' && trim($email['text']) == '') {
3223
  DebugEcho("postie_get_mail: switching to html");
3224
  $tmp_config['prefer_text_type'] = 'html';
3225
  }
3226
- if ($config['prefer_text_type'] == 'html' && trim($email['html']) == '') {
3227
  DebugEcho("postie_get_mail: switching to plain");
3228
  $tmp_config['prefer_text_type'] = 'plain';
3229
  }
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1535894 2016-11-17 21:01:46Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
214
  }
215
  DebugEcho("filter_AttachmentTemplates: featured image: $fiid");
216
 
217
+ DebugEcho("filter_AttachmentTemplates: # attachments: " . count($mimeDecodedEmail['attachment']));
218
  foreach ($mimeDecodedEmail['attachment'] as $attachment) {
219
  DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
220
  $skip = ($fiid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
237
  }
238
 
239
  if ($config['prefer_text_type'] == 'plain') {
240
+ DebugEcho("filter_AttachmentTemplates: # inline: " . count($mimeDecodedEmail['inline']));
241
+ DebugEcho("filter_AttachmentTemplates: # related: " . count($mimeDecodedEmail['related']));
242
  foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
243
  DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
244
  $skip = ($fiid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
259
  DebugEcho("filter_AttachmentTemplates: skip attachment (alt) " . $attachment['wp_filename']);
260
  }
261
  }
262
+ } else {
263
+ DebugEcho("filter_AttachmentTemplates: skipping inline and related");
264
  }
265
 
266
  if ($config['images_append']) {
3224
 
3225
  $tmp_config = $config;
3226
  if ($config['prefer_text_convert']) {
3227
+ if ($config['prefer_text_type'] == 'plain' && trim($email['text']) == '' && trim($email['html']) != '') {
3228
  DebugEcho("postie_get_mail: switching to html");
3229
  $tmp_config['prefer_text_type'] = 'html';
3230
  }
3231
+ if ($config['prefer_text_type'] == 'html' && trim($email['html']) == '' && trim($email['text']) != '') {
3232
  DebugEcho("postie_get_mail: switching to plain");
3233
  $tmp_config['prefer_text_type'] = 'plain';
3234
  }
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
7
- Version: 1.8.18
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1535842 2016-11-17 18:25:08Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
@@ -49,7 +49,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/pPop3MailServer.php"
49
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
50
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
51
 
52
- define('POSTIE_VERSION', '1.8.18');
53
  define("POSTIE_ROOT", dirname(__FILE__));
54
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
55
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
7
+ Version: 1.8.19
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1535895 2016-11-17 21:02:56Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
49
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
50
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
51
 
52
+ define('POSTIE_VERSION', '1.8.19');
53
  define("POSTIE_ROOT", dirname(__FILE__));
54
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
55
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.6.1
9
- Stable tag: 1.8.18
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -240,6 +240,9 @@ All script, style and body tags are stripped from html emails.
240
  Attachments are now processed in the order they were attached.
241
 
242
  == CHANGELOG ==
 
 
 
243
  = 1.8.18 (2016-11-16) =
244
  * Fix issue where inline PDF was not being detected as a PDF.
245
  * Fix issue where outlook.com is setting an incorrect mime type on images.
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.6.1
9
+ Stable tag: 1.8.19
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
240
  Attachments are now processed in the order they were attached.
241
 
242
  == CHANGELOG ==
243
+ = 1.8.19 (2016-11-16) =
244
+ * Fix issue where attachments not showing if both plain and html are blank and the attachment is part of a multipart (related) block.
245
+
246
  = 1.8.18 (2016-11-16) =
247
  * Fix issue where inline PDF was not being detected as a PDF.
248
  * Fix issue where outlook.com is setting an incorrect mime type on images.