Postie - Version 1.8.18

Version Description

(2016-11-16) = * Fix issue where inline PDF was not being detected as a PDF. * Fix issue where outlook.com is setting an incorrect mime type on images.

Download this release

Release Info

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

Code changes from version 1.8.17 to 1.8.18

Files changed (7) hide show
  1. docs/Changes.txt +4 -0
  2. docs/Postie.txt +1 -1
  3. docs/TODO.txt +6 -7
  4. lib/fMailbox.php +43 -25
  5. postie-functions.php +2 -2
  6. postie.php +3 -3
  7. readme.txt +5 -1
docs/Changes.txt CHANGED
@@ -32,6 +32,10 @@ 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.17 (2016-11-03) =
36
  * Fix bugs in cURL connection.
37
 
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.
38
+
39
  = 1.8.17 (2016-11-03) =
40
  * Fix bugs in cURL connection.
41
 
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.17
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.18
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
docs/TODO.txt CHANGED
@@ -4,7 +4,9 @@ Header/footer stripper - user provides "selector" (xpath) to identify header/foo
4
  May need to remove parent (or granparent of element)
5
  How to help non-techies build the selector?
6
  CSS Inliner - use one of the online services to convert class styled html to inline styles. https://www.google.com/search?q=css+inline+tool&oq=css+inline+tool
7
- Email notifications - use postie_email_* filters and some new settings panels along with some templating
 
 
8
 
9
  Automatic updates for AddOns:
10
  https://github.com/seedprod/sellwp-updater
@@ -12,12 +14,13 @@ Automatic updates for AddOns:
12
 
13
  Bugs
14
  #img# caption feature not working
 
 
15
 
16
  Other
 
17
  Process single email at a time and don't delete unless successful
18
- Configurable message for "post confirmation" - variable substitution
19
  Add default comment status (like post status) wp_set_comment_status
20
- Option to send logs to support
21
  provide a location for custom icons. update docs about location.
22
  Make sure all failures are sent to admin (option?) failed attachments, etc.
23
  "yoast" style admin sidebar - see clicky by yoast
@@ -34,11 +37,9 @@ Verify that WP is honoring the wp_set_current_user() call. I.e. if the user is n
34
  Add Message-ID header value to custom field (postie_message_id?) to both posts and comments.
35
  Use In-Reply-To header value as a better way to detect replies
36
  automatically create category if it doesn't exist. new option to allow this feature?
37
- Comment not being created when subject contains category command []. I.e. listserv subject lines
38
  date: tag is being detected in body when not wanted
39
  Update tag_* and filter_* to handle HTML (per tag_Tags)
40
  dynamically determine video size (height/width) - https://code.google.com/p/phpvideotoolkit/
41
- plugin conflict - Image Rotation Fixer/Image Rotation Repair
42
  readme tips http://wp.smashingmagazine.com/2011/11/23/improve-wordpress-plugins-readme-txt/
43
  review http://codex.wordpress.org/Settings_API
44
  plugin structure http://www.yaconiello.com/blog/how-to-write-wordpress-plugin/
@@ -58,7 +59,6 @@ add hooks for post meta data change
58
  tags
59
  author
60
  add hooks for content changes
61
- attachment template
62
  subject/title
63
  post begin
64
  post end
@@ -72,7 +72,6 @@ hook for actions
72
  email connection failure
73
  mail read
74
  mail delete
75
- content part
76
  collect and send last debug log and system info (see http://wordpress.org/plugins/send-system-info/)
77
  Support EXIF orientation via PHP Exif Library https://github.com/lsolesen/pel
78
 
4
  May need to remove parent (or granparent of element)
5
  How to help non-techies build the selector?
6
  CSS Inliner - use one of the online services to convert class styled html to inline styles. https://www.google.com/search?q=css+inline+tool&oq=css+inline+tool
7
+ Email notifications - use postie_email_* filters and some new settings panels along with some templating. User can select which post status fire the email.
8
+ Configurable message for "post confirmation" - variable substitution, by post status
9
+ Free addon to send logs to support
10
 
11
  Automatic updates for AddOns:
12
  https://github.com/seedprod/sellwp-updater
14
 
15
  Bugs
16
  #img# caption feature not working
17
+ plugin conflict - Image Rotation Fixer/Image Rotation Repair
18
+ Comment not being created when subject contains category command []. I.e. listserv subject lines
19
 
20
  Other
21
+ Use media_handle_upload() to add attachments
22
  Process single email at a time and don't delete unless successful
 
23
  Add default comment status (like post status) wp_set_comment_status
 
24
  provide a location for custom icons. update docs about location.
25
  Make sure all failures are sent to admin (option?) failed attachments, etc.
26
  "yoast" style admin sidebar - see clicky by yoast
37
  Add Message-ID header value to custom field (postie_message_id?) to both posts and comments.
38
  Use In-Reply-To header value as a better way to detect replies
39
  automatically create category if it doesn't exist. new option to allow this feature?
 
40
  date: tag is being detected in body when not wanted
41
  Update tag_* and filter_* to handle HTML (per tag_Tags)
42
  dynamically determine video size (height/width) - https://code.google.com/p/phpvideotoolkit/
 
43
  readme tips http://wp.smashingmagazine.com/2011/11/23/improve-wordpress-plugins-readme-txt/
44
  review http://codex.wordpress.org/Settings_API
45
  plugin structure http://www.yaconiello.com/blog/how-to-write-wordpress-plugin/
59
  tags
60
  author
61
  add hooks for content changes
 
62
  subject/title
63
  post begin
64
  post end
72
  email connection failure
73
  mail read
74
  mail delete
 
75
  collect and send last debug log and system info (see http://wordpress.org/plugins/send-system-info/)
76
  Support EXIF orientation via PHP Exif Library https://github.com/lsolesen/pel
77
 
lib/fMailbox.php CHANGED
@@ -111,7 +111,7 @@ class fMailbox {
111
  }
112
 
113
  if (preg_match_all('#=\?([^\?]+)\?([QB])\?([^\?]+)\?=#i', $part, $matches, PREG_SET_ORDER)) {
114
- DebugEcho("decodeHeader: found encoded value: '$part'");
115
  $isencoded = true;
116
  foreach ($matches as $match) {
117
  if (strtoupper($match[2]) == 'Q') {
@@ -121,10 +121,10 @@ class fMailbox {
121
  '_' => ' '
122
  )
123
  ));
124
- DebugEcho("decodeHeader: Q encoding: '$part_string'");
125
  } else {
126
  $part_string = base64_decode($match[3]);
127
- DebugEcho("decodeHeader: B encoding: '$part_string'");
128
  }
129
  $lower_encoding = strtolower($match[1]);
130
  $last_key = count($part_with_encoding) - 1;
@@ -135,7 +135,7 @@ class fMailbox {
135
  }
136
  }
137
  } else {
138
- DebugEcho("decodeHeader: found non-encoded value: '$part'");
139
  if ($isencoded) {
140
  $part = trim($part);
141
  }
@@ -147,7 +147,7 @@ class fMailbox {
147
  $part_with_encoding[] = array('encoding' => 'iso-8859-1', 'string' => $part);
148
  }
149
  } else {
150
- DebugEcho("decodeHeader: skipping whitespace in encoded header");
151
  }
152
  }
153
  }
@@ -157,7 +157,7 @@ class fMailbox {
157
  //DebugDump($part);
158
  $output .= self::iconv($part['encoding'], 'UTF-8', $part['string']);
159
  }
160
- DebugEcho("decodeHeader: $output");
161
 
162
  return $output;
163
  }
@@ -226,6 +226,41 @@ class fMailbox {
226
  $content = $data;
227
  }
228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  if ($structure['type'] == 'text') {
230
 
231
  $charset = 'iso-8859-1';
@@ -260,8 +295,6 @@ class fMailbox {
260
  return $info;
261
  }
262
 
263
-
264
- $has_disposition = !empty($structure['disposition']);
265
  $is_text = $structure['type'] == 'text' && $structure['subtype'] == 'plain';
266
  $is_html = $structure['type'] == 'text' && $structure['subtype'] == 'html';
267
 
@@ -273,25 +306,10 @@ class fMailbox {
273
  $has_disposition = TRUE;
274
  }
275
 
276
-
277
  // Attachments or inline content
278
  if ($has_disposition) {
279
  DebugEcho("handlePart: disposition set to " . $structure['disposition']);
280
-
281
- $filename = '';
282
- foreach ($structure['disposition_fields'] as $field => $value) {
283
- if (strtolower($field) == 'filename') {
284
- $filename = $value;
285
- break;
286
- }
287
- }
288
- foreach ($structure['type_fields'] as $field => $value) {
289
- if (strtolower($field) == 'name') {
290
- $filename = $value;
291
- break;
292
- }
293
- }
294
-
295
  // This automatically handles primary content that has a content-disposition header on it
296
  if ($structure['disposition'] == 'inline' && $filename === '') {
297
  DebugEcho("handlePart: inline un-named");
@@ -308,7 +326,6 @@ class fMailbox {
308
  }
309
  }
310
 
311
-
312
  if ($is_html && !isset($info['html'])) {
313
  $info['html'] = $content;
314
  return $info;
@@ -323,6 +340,7 @@ class fMailbox {
323
  $info[$structure['disposition']] = array();
324
  }
325
 
 
326
  $info[$structure['disposition']][] = array(
327
  'filename' => $filename,
328
  'mimetype' => $structure['type'] . '/' . $structure['subtype'],
111
  }
112
 
113
  if (preg_match_all('#=\?([^\?]+)\?([QB])\?([^\?]+)\?=#i', $part, $matches, PREG_SET_ORDER)) {
114
+ //DebugEcho("decodeHeader: found encoded value: '$part'");
115
  $isencoded = true;
116
  foreach ($matches as $match) {
117
  if (strtoupper($match[2]) == 'Q') {
121
  '_' => ' '
122
  )
123
  ));
124
+ //DebugEcho("decodeHeader: Q encoding: '$part_string'");
125
  } else {
126
  $part_string = base64_decode($match[3]);
127
+ //DebugEcho("decodeHeader: B encoding: '$part_string'");
128
  }
129
  $lower_encoding = strtolower($match[1]);
130
  $last_key = count($part_with_encoding) - 1;
135
  }
136
  }
137
  } else {
138
+ //DebugEcho("decodeHeader: found non-encoded value: '$part'");
139
  if ($isencoded) {
140
  $part = trim($part);
141
  }
147
  $part_with_encoding[] = array('encoding' => 'iso-8859-1', 'string' => $part);
148
  }
149
  } else {
150
+ //DebugEcho("decodeHeader: skipping whitespace in encoded header");
151
  }
152
  }
153
  }
157
  //DebugDump($part);
158
  $output .= self::iconv($part['encoding'], 'UTF-8', $part['string']);
159
  }
160
+ //DebugEcho("decodeHeader: $output");
161
 
162
  return $output;
163
  }
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");
237
+ $filename = $value;
238
+ $ftype = wp_check_filetype($filename);
239
+ if ($ftype['type']) {
240
+ DebugEcho("handlePart: revised mimetype: {$ftype['type']}");
241
+ $mimes = explode('/', $ftype['type']);
242
+ $structure['type'] = $mimes[0];
243
+ $structure['subtype'] = $mimes[1];
244
+ }
245
+ break;
246
+ }
247
+ }
248
+ foreach ($structure['type_fields'] as $field => $value) {
249
+ if (strtolower($field) == 'name') {
250
+ DebugEcho("handlePart: type_fields filename: $value");
251
+ $filename = $value;
252
+ $ftype = wp_check_filetype($filename);
253
+ if ($ftype['type']) {
254
+ DebugEcho("handlePart: revised mimetype: {$ftype['type']}");
255
+ $mimes = explode('/', $ftype['type']);
256
+ $structure['type'] = $mimes[0];
257
+ $structure['subtype'] = $mimes[1];
258
+ }
259
+ break;
260
+ }
261
+ }
262
+ }
263
+
264
  if ($structure['type'] == 'text') {
265
 
266
  $charset = 'iso-8859-1';
295
  return $info;
296
  }
297
 
 
 
298
  $is_text = $structure['type'] == 'text' && $structure['subtype'] == 'plain';
299
  $is_html = $structure['type'] == 'text' && $structure['subtype'] == 'html';
300
 
306
  $has_disposition = TRUE;
307
  }
308
 
 
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");
326
  }
327
  }
328
 
 
329
  if ($is_html && !isset($info['html'])) {
330
  $info['html'] = $content;
331
  return $info;
340
  $info[$structure['disposition']] = array();
341
  }
342
 
343
+ DebugEcho("handlePart: disposition: $filename {$structure['type']} / {$structure['subtype']}");
344
  $info[$structure['disposition']][] = array(
345
  'filename' => $filename,
346
  'mimetype' => $structure['type'] . '/' . $structure['subtype'],
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1527513 2016-11-03 14:57:54Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -1090,7 +1090,7 @@ function postie_save_attachment(&$attachment, $post_id, $poster, $config) {
1090
  DebugEcho("postie_save_attachment: found pgp-signature - done");
1091
  break;
1092
  }
1093
- $file_id = postie_media_handle_upload($attachment, $post_id, $poster, $config['generate_thumbnails']);
1094
  if (!is_wp_error($file_id)) {
1095
  $attachment['wp_id'] = $file_id;
1096
  $file = wp_get_attachment_url($file_id);
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1535352 2016-11-16 22:25:00Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
1090
  DebugEcho("postie_save_attachment: found pgp-signature - done");
1091
  break;
1092
  }
1093
+ $file_id = postie_media_handle_upload($attachment, $post_id, $poster, $config['generate_thumbnails'], $mimetype_primary, $mimetype_secondary);
1094
  if (!is_wp_error($file_id)) {
1095
  $attachment['wp_id'] = $file_id;
1096
  $file = wp_get_attachment_url($file_id);
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.17
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1527766 2016-11-03 23:29:23Z 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.17');
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.18
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
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
  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
 
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.17
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -240,6 +240,10 @@ 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.17 (2016-11-03) =
244
  * Fix bugs in cURL connection.
245
 
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
  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.
246
+
247
  = 1.8.17 (2016-11-03) =
248
  * Fix bugs in cURL connection.
249