Postie - Version 1.9.31

Version Description

(2019-02-28) = * Additional logging to chase down customer issue

Download this release

Release Info

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

Code changes from version 1.9.30 to 1.9.31

docs/Changes.txt CHANGED
@@ -35,6 +35,9 @@ All script, style and body tags are stripped from html emails.
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
 
 
 
38
  = 1.9.30 (2019-02-25) =
39
  * WP 5.1 compatibility testing
40
  * Add setting to skip image resizing
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.31 (2019-02-28) =
39
+ * Additional logging to chase down customer issue
40
+
41
  = 1.9.30 (2019-02-25) =
42
  * WP 5.1 compatibility testing
43
  * Add setting to skip image resizing
docs/Postie.txt CHANGED
@@ -7,7 +7,7 @@ Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 5.1
10
- Stable tag: 1.9.30
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 5.1
10
+ Stable tag: 1.9.31
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
lib/fMailbox.php CHANGED
@@ -175,7 +175,7 @@ class fMailbox {
175
  * @return array The modified $info array
176
  */
177
  static private function handlePart($info, $structure) {
178
- //DebugEcho('handlePart: type ' . $structure['type'] . '/' . $structure['subtype']);
179
  if ($structure['type'] == 'multipart') {
180
  foreach ($structure['parts'] as $part) {
181
  $info = self::handlePart($info, $part);
@@ -235,7 +235,7 @@ class fMailbox {
235
  $has_disposition = !empty($structure['disposition']); // || !empty($structure['type_fields']);
236
 
237
  if ($has_disposition || !empty($structure['type_fields'])) {
238
- //DebugEcho('handlePart: has_disposition');
239
  //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
240
  foreach ($structure['disposition_fields'] as $field => $value) {
241
  if (strtolower($field) == 'filename') {
@@ -266,7 +266,7 @@ class fMailbox {
266
  }
267
  }
268
  } else {
269
- //DebugEcho('handlePart: no disposition');
270
  }
271
 
272
  if ($structure['type'] == 'text') {
@@ -291,7 +291,7 @@ class fMailbox {
291
  //DebugEcho("handlePart: fixing up html");
292
  $content = preg_replace('#(content=(["\'])text/html\s*;\s*charset=(["\']?))' . preg_quote($charset, '#') . '(\3\2)#i', '\1utf-8\4', $content);
293
  }
294
- //DebugEcho("handlePart: text length: " . strlen($content));
295
  //DebugDump($content);
296
  }
297
 
@@ -312,7 +312,9 @@ class fMailbox {
312
  }
313
 
314
  $is_text = $structure['type'] == 'text' && $structure['subtype'] == 'plain';
 
315
  $is_html = $structure['type'] == 'text' && $structure['subtype'] == 'html';
 
316
 
317
  if (!isset($info['text'])) {
318
  $info['text'] = '';
@@ -323,11 +325,13 @@ class fMailbox {
323
 
324
  // If the part doesn't have a disposition and is not the default text or html, set the disposition to inline
325
  if (!$has_disposition && ((!$is_text || !empty($info['text'])) && (!$is_html || !empty($info['html'])))) {
326
- //DebugEcho("handlePart: checking disposition");
327
  $is_web_image = $structure['type'] == 'image' && in_array($structure['subtype'], array('gif', 'png', 'jpeg', 'pjpeg'));
328
  $structure['disposition'] = $is_text || $is_html || $is_web_image ? 'inline' : 'attachment';
329
  $structure['disposition_fields'] = array();
330
  $has_disposition = TRUE;
 
 
331
  }
332
 
333
  // Attachments or inline content
@@ -335,7 +339,7 @@ class fMailbox {
335
  DebugEcho("handlePart: disposition set to " . $structure['disposition']);
336
  // This automatically handles primary content that has a content-disposition header on it
337
  if ($structure['disposition'] == 'inline' && $filename === '') {
338
- //DebugEcho("handlePart: inline un-named");
339
 
340
  if ($is_text) {
341
  if (empty($info['text'])) {
@@ -370,7 +374,7 @@ class fMailbox {
370
  $info[$structure['disposition']] = array();
371
  }
372
 
373
- //DebugEcho("handlePart: disposition: {$structure['disposition']} '$filename' {$structure['type']}/{$structure['subtype']}");
374
  $info[$structure['disposition']][] = array(
375
  'filename' => $filename,
376
  'mimetype' => $structure['type'] . '/' . $structure['subtype'],
175
  * @return array The modified $info array
176
  */
177
  static private function handlePart($info, $structure) {
178
+ DebugEcho('handlePart: type ' . $structure['type'] . '/' . $structure['subtype']);
179
  if ($structure['type'] == 'multipart') {
180
  foreach ($structure['parts'] as $part) {
181
  $info = self::handlePart($info, $part);
235
  $has_disposition = !empty($structure['disposition']); // || !empty($structure['type_fields']);
236
 
237
  if ($has_disposition || !empty($structure['type_fields'])) {
238
+ DebugEcho('handlePart: has_disposition ' . $structure['disposition']);
239
  //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
240
  foreach ($structure['disposition_fields'] as $field => $value) {
241
  if (strtolower($field) == 'filename') {
266
  }
267
  }
268
  } else {
269
+ DebugEcho('handlePart: no disposition');
270
  }
271
 
272
  if ($structure['type'] == 'text') {
291
  //DebugEcho("handlePart: fixing up html");
292
  $content = preg_replace('#(content=(["\'])text/html\s*;\s*charset=(["\']?))' . preg_quote($charset, '#') . '(\3\2)#i', '\1utf-8\4', $content);
293
  }
294
+ DebugEcho("handlePart: text length: " . strlen($content));
295
  //DebugDump($content);
296
  }
297
 
312
  }
313
 
314
  $is_text = $structure['type'] == 'text' && $structure['subtype'] == 'plain';
315
+ DebugEcho("handlePart: is_text: " . ($is_text ? 'true' : 'false'));
316
  $is_html = $structure['type'] == 'text' && $structure['subtype'] == 'html';
317
+ DebugEcho("handlePart: is_html: " . ($is_html ? 'true' : 'false'));
318
 
319
  if (!isset($info['text'])) {
320
  $info['text'] = '';
325
 
326
  // If the part doesn't have a disposition and is not the default text or html, set the disposition to inline
327
  if (!$has_disposition && ((!$is_text || !empty($info['text'])) && (!$is_html || !empty($info['html'])))) {
328
+ DebugEcho("handlePart: checking disposition");
329
  $is_web_image = $structure['type'] == 'image' && in_array($structure['subtype'], array('gif', 'png', 'jpeg', 'pjpeg'));
330
  $structure['disposition'] = $is_text || $is_html || $is_web_image ? 'inline' : 'attachment';
331
  $structure['disposition_fields'] = array();
332
  $has_disposition = TRUE;
333
+ } else {
334
+ DebugEcho("handlePart: not checking disposition");
335
  }
336
 
337
  // Attachments or inline content
339
  DebugEcho("handlePart: disposition set to " . $structure['disposition']);
340
  // This automatically handles primary content that has a content-disposition header on it
341
  if ($structure['disposition'] == 'inline' && $filename === '') {
342
+ DebugEcho("handlePart: inline un-named");
343
 
344
  if ($is_text) {
345
  if (empty($info['text'])) {
374
  $info[$structure['disposition']] = array();
375
  }
376
 
377
+ DebugEcho("handlePart: disposition: {$structure['disposition']} '$filename' {$structure['type']}/{$structure['subtype']}");
378
  $info[$structure['disposition']][] = array(
379
  'filename' => $filename,
380
  'mimetype' => $structure['type'] . '/' . $structure['subtype'],
lib/pSocketConnection.php CHANGED
@@ -35,7 +35,7 @@ class pSocketConnection extends pConnection {
35
  stream_context_set_option($context, "ssl", "verify_peer", false);
36
  stream_context_set_option($context, "ssl", "verify_peer_name", false);
37
  $this->socket = stream_socket_client($connstr, $error_number, $error_string, $this->timeout, STREAM_CLIENT_CONNECT, $context);
38
- DebugEcho("Socket error: $error_number - $error_string");
39
 
40
  if (!$this->socket) {
41
  throw new fConnectivityException('There was an error connecting to the server ' . $error_string);
35
  stream_context_set_option($context, "ssl", "verify_peer", false);
36
  stream_context_set_option($context, "ssl", "verify_peer_name", false);
37
  $this->socket = stream_socket_client($connstr, $error_number, $error_string, $this->timeout, STREAM_CLIENT_CONNECT, $context);
38
+ DebugEcho("Socket error: $error_number - $error_string ($this->socket)");
39
 
40
  if (!$this->socket) {
41
  throw new fConnectivityException('There was an error connecting to the server ' . $error_string);
postie.class.php CHANGED
@@ -265,6 +265,7 @@ class Postie {
265
  $attachment['template'] = $this->parse_template($file_id, $mimetype_primary, $config['generaltemplate'], $filename, $icon) . "\n";
266
  break;
267
  }
 
268
  }
269
  DebugEcho("save_attachments_worker: end");
270
  }
@@ -359,7 +360,8 @@ class Postie {
359
  } else {
360
  DebugEcho("save_attachment: generating file name");
361
  $filename = uniqid();
362
- $attachment['filename'] = $filename;
 
363
  }
364
 
365
  DebugEcho("save_attachment: pre sanitize file name '$filename'");
265
  $attachment['template'] = $this->parse_template($file_id, $mimetype_primary, $config['generaltemplate'], $filename, $icon) . "\n";
266
  break;
267
  }
268
+ DebugEcho("save_attachments_worker: done with $filename");
269
  }
270
  DebugEcho("save_attachments_worker: end");
271
  }
360
  } else {
361
  DebugEcho("save_attachment: generating file name");
362
  $filename = uniqid();
363
+ $mparts = explode('/', $attachment['mimetype']);
364
+ $attachment['filename'] = $filename . '.' .$mparts[1];
365
  }
366
 
367
  DebugEcho("save_attachment: pre sanitize file name '$filename'");
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.9.30
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,14 +28,14 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 2039380 2019-02-26 05:11:57Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
- define('POSTIE_VERSION', '1.9.30');
39
  define('POSTIE_ROOT', dirname(__FILE__));
40
  define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
41
 
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.9.31
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 2041873 2019-03-01 05:14:23Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
+ define('POSTIE_VERSION', '1.9.31');
39
  define('POSTIE_ROOT', dirname(__FILE__));
40
  define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
41
 
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 5.1
10
- Stable tag: 1.9.30
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -107,6 +107,9 @@ All script, style and body tags are stripped from html emails.
107
  Attachments are now processed in the order they were attached.
108
 
109
  == CHANGELOG ==
 
 
 
110
  = 1.9.30 (2019-02-25) =
111
  * WP 5.1 compatibility testing
112
  * Add setting to skip image resizing
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 5.1
10
+ Stable tag: 1.9.31
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
107
  Attachments are now processed in the order they were attached.
108
 
109
  == CHANGELOG ==
110
+ = 1.9.31 (2019-02-28) =
111
+ * Additional logging to chase down customer issue
112
+
113
  = 1.9.30 (2019-02-25) =
114
  * WP 5.1 compatibility testing
115
  * Add setting to skip image resizing