Postie - Version 1.9.7

Version Description

(2017-10-19) = * Fix: more robustness if iconv fails

Download this release

Release Info

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

Code changes from version 1.9.6 to 1.9.7

Files changed (5) hide show
  1. docs/Changes.txt +3 -0
  2. docs/Postie.txt +1 -1
  3. lib/fMailbox.php +16 -3
  4. postie.php +3 -3
  5. readme.txt +4 -2
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.6 (2017-10-19) =
39
  * Fix: Post format was not being correctly set.
40
 
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.7 (2017-10-19) =
39
+ * Fix: more robustness if iconv fails
40
+
41
  = 1.9.6 (2017-10-19) =
42
  * Fix: Post format was not being correctly set.
43
 
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: 4.8.2
10
- Stable tag: 1.9.6
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: 4.8.2
10
+ Stable tag: 1.9.7
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
lib/fMailbox.php CHANGED
@@ -276,12 +276,19 @@ class fMailbox {
276
  break;
277
  }
278
  }
279
- DebugEcho("handlePart: converting $charset to UTF-8");
280
- $content = self::iconv($charset, 'UTF-8', $content);
 
 
 
 
 
 
281
  if ($structure['subtype'] == 'html') {
282
  DebugEcho("handlePart: fixing up html");
283
  $content = preg_replace('#(content=(["\'])text/html\s*;\s*charset=(["\']?))' . preg_quote($charset, '#') . '(\3\2)#i', '\1utf-8\4', $content);
284
  }
 
285
  //DebugDump($content);
286
  }
287
 
@@ -475,7 +482,13 @@ class fMailbox {
475
  * @return string The converted string
476
  */
477
  static private function iconv($in_charset, $out_charset, $string) {
478
- return self::remove_utf8_bom(iconv($in_charset, "$out_charset//IGNORE", $string));
 
 
 
 
 
 
479
  }
480
 
481
  /**
276
  break;
277
  }
278
  }
279
+
280
+ if (strtolower($charset) !== 'utf-8') {
281
+ DebugEcho("handlePart: converting $charset to UTF-8");
282
+ $content = self::iconv($charset, 'UTF-8', $content);
283
+ } else {
284
+ DebugEcho("handlePart: skipping charset conversion");
285
+ }
286
+
287
  if ($structure['subtype'] == 'html') {
288
  DebugEcho("handlePart: fixing up html");
289
  $content = preg_replace('#(content=(["\'])text/html\s*;\s*charset=(["\']?))' . preg_quote($charset, '#') . '(\3\2)#i', '\1utf-8\4', $content);
290
  }
291
+ DebugEcho("handlePart: text length: " . strlen($content));
292
  //DebugDump($content);
293
  }
294
 
482
  * @return string The converted string
483
  */
484
  static private function iconv($in_charset, $out_charset, $string) {
485
+ $s = iconv($in_charset, "$out_charset//IGNORE", $string);
486
+ if ($s === false) {
487
+ EchoError("iconv: error converting character set");
488
+ return $string;
489
+ } else {
490
+ return self::remove_utf8_bom($s);
491
+ }
492
  }
493
 
494
  /**
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.6
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,14 +28,14 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1749575 2017-10-19 22:56:15Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
- define('POSTIE_VERSION', '1.9.6');
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.7
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1749620 2017-10-20 02:25:15Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
+ define('POSTIE_VERSION', '1.9.7');
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: 4.8.2
10
- Stable tag: 1.9.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -243,6 +243,9 @@ All script, style and body tags are stripped from html emails.
243
  Attachments are now processed in the order they were attached.
244
 
245
  == CHANGELOG ==
 
 
 
246
  = 1.9.6 (2017-10-19) =
247
  * Fix: Post format was not being correctly set.
248
 
@@ -1571,4 +1574,3 @@ plugin. And the rest is history :)
1571
  *
1572
  = 0.1 - 2004-06 =
1573
  * First release
1574
-
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 4.8.2
10
+ Stable tag: 1.9.7
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
243
  Attachments are now processed in the order they were attached.
244
 
245
  == CHANGELOG ==
246
+ = 1.9.7 (2017-10-19) =
247
+ * Fix: more robustness if iconv fails
248
+
249
  = 1.9.6 (2017-10-19) =
250
  * Fix: Post format was not being correctly set.
251
 
1574
  *
1575
  = 0.1 - 2004-06 =
1576
  * First release