Postie - Version 1.8.35

Version Description

(2017-03-21) = * Check for blank image file extension and replace with mime subtype to get around new filetype checking in WordPress 4.7.2 https://core.trac.wordpress.org/ticket/39550 * Additional logging of message and part headers * Fix base64 header decoding so trailing space isn't removed * Fix header decoding to remove extra utf-8 byte order mark * Add current WordPress time to logging

Download this release

Release Info

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

Code changes from version 1.8.34 to 1.8.35

Files changed (6) hide show
  1. docs/Changes.txt +7 -0
  2. docs/Postie.txt +1 -1
  3. lib/fMailbox.php +17 -5
  4. postie-functions.php +122 -115
  5. postie.php +3 -3
  6. readme.txt +8 -1
docs/Changes.txt CHANGED
@@ -35,6 +35,13 @@ 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.8.34 (2017-03-15) =
39
  * Fix bug when sending reject email
40
 
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.8.35 (2017-03-21) =
39
+ * Check for blank image file extension and replace with mime subtype to get around new filetype checking in WordPress 4.7.2 https://core.trac.wordpress.org/ticket/39550
40
+ * Additional logging of message and part headers
41
+ * Fix base64 header decoding so trailing space isn't removed
42
+ * Fix header decoding to remove extra utf-8 byte order mark
43
+ * Add current WordPress time to logging
44
+
45
  = 1.8.34 (2017-03-15) =
46
  * Fix bug when sending reject email
47
 
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.7.3
9
- Stable tag: 1.8.34
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.7.3
9
+ Stable tag: 1.8.35
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
lib/fMailbox.php CHANGED
@@ -99,7 +99,7 @@ class fMailbox {
99
  * @param string $text The header value to decode
100
  * @return string The decoded UTF-8
101
  */
102
- static private function decodeHeader($text) {
103
  $parts = preg_split('#(=\?[^\?]+\?[QB]\?[^\?]+\?=)#i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
104
 
105
  $part_with_encoding = array();
@@ -111,7 +111,8 @@ 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') {
@@ -131,9 +132,10 @@ class fMailbox {
131
  if (isset($part_with_encoding[$last_key]) && $part_with_encoding[$last_key]['encoding'] == $lower_encoding) {
132
  $part_with_encoding[$last_key]['string'] .= $part_string;
133
  } else {
134
- $part_with_encoding[] = array('encoding' => $lower_encoding, 'string' => $part_string);
135
  }
136
  }
 
137
  } else {
138
  //DebugEcho("decodeHeader: found non-encoded value: '$part'");
139
  if ($isencoded) {
@@ -159,7 +161,7 @@ class fMailbox {
159
  }
160
  //DebugEcho("decodeHeader: $output");
161
 
162
- return $output;
163
  }
164
 
165
  /**
@@ -439,6 +441,12 @@ class fMailbox {
439
  return TRUE;
440
  }
441
 
 
 
 
 
 
 
442
  /**
443
  * This works around a bug in MAMP 1.9.4+ and PHP 5.3 where iconv()
444
  * does not seem to properly assign the return value to a variable, but
@@ -450,7 +458,7 @@ class fMailbox {
450
  * @return string The converted string
451
  */
452
  static private function iconv($in_charset, $out_charset, $string) {
453
- return iconv($in_charset, "$out_charset//IGNORE", $string);
454
  }
455
 
456
  /**
@@ -647,6 +655,7 @@ class fMailbox {
647
  }
648
  $info['headers'][$header] = $value;
649
  }
 
650
  $info['raw_headers'] = $headers;
651
  $info['raw_message'] = $message;
652
 
@@ -734,6 +743,9 @@ class fMailbox {
734
  $headers = self::parseHeaders($headers);
735
  }
736
 
 
 
 
737
  if (!isset($headers['content-type'])) {
738
  $headers['content-type'] = array(
739
  'value' => 'text/plain',
99
  * @param string $text The header value to decode
100
  * @return string The decoded UTF-8
101
  */
102
+ static public function decodeHeader($text) {
103
  $parts = preg_split('#(=\?[^\?]+\?[QB]\?[^\?]+\?=)#i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
104
 
105
  $part_with_encoding = array();
111
  }
112
 
113
  if (preg_match_all('#=\?([^\?]+)\?([QB])\?([^\?]+)\?=#i', $part, $matches, PREG_SET_ORDER)) {
114
+ DebugEcho("decodeHeader: found encoded value: '$part'");
115
+ //DebugDump($matches);
116
  $isencoded = true;
117
  foreach ($matches as $match) {
118
  if (strtoupper($match[2]) == 'Q') {
132
  if (isset($part_with_encoding[$last_key]) && $part_with_encoding[$last_key]['encoding'] == $lower_encoding) {
133
  $part_with_encoding[$last_key]['string'] .= $part_string;
134
  } else {
135
+ $part_with_encoding[] = array('encoding' => $lower_encoding, 'string' => $part_string . ' ');
136
  }
137
  }
138
+ //DebugDump($part_with_encoding);
139
  } else {
140
  //DebugEcho("decodeHeader: found non-encoded value: '$part'");
141
  if ($isencoded) {
161
  }
162
  //DebugEcho("decodeHeader: $output");
163
 
164
+ return trim($output);
165
  }
166
 
167
  /**
441
  return TRUE;
442
  }
443
 
444
+ private static function remove_utf8_bom($text) {
445
+ $bom = pack('H*', 'EFBBBF');
446
+ $text = preg_replace("/^$bom/", '', $text);
447
+ return $text;
448
+ }
449
+
450
  /**
451
  * This works around a bug in MAMP 1.9.4+ and PHP 5.3 where iconv()
452
  * does not seem to properly assign the return value to a variable, but
458
  * @return string The converted string
459
  */
460
  static private function iconv($in_charset, $out_charset, $string) {
461
+ return self::remove_utf8_bom(iconv($in_charset, "$out_charset//IGNORE", $string));
462
  }
463
 
464
  /**
655
  }
656
  $info['headers'][$header] = $value;
657
  }
658
+
659
  $info['raw_headers'] = $headers;
660
  $info['raw_message'] = $message;
661
 
743
  $headers = self::parseHeaders($headers);
744
  }
745
 
746
+ DebugEcho('parseStructure: headers');
747
+ DebugDump($headers);
748
+
749
  if (!isset($headers['content-type'])) {
750
  $headers['content-type'] = array(
751
  'value' => 'text/plain',
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1615079 2017-03-15 15:20:35Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -891,7 +891,7 @@ function postie_save_attachments(&$email, $post_id, $poster, $config) {
891
 
892
  function postie_save_attachments_worker(&$attachments, $post_id, $poster, $config) {
893
  foreach ($attachments as &$attachment) {
894
- if (array_key_exists('filename', $attachment)) {
895
  DebugEcho('postie_save_attachments_worker: ' . $attachment['filename']);
896
 
897
  if (isBannedFileName($attachment['filename'], $config['banned_files_list'])) {
@@ -972,6 +972,7 @@ function postie_save_attachment(&$attachment, $post_id, $poster, $config) {
972
  if (isset($attachment['filename']) && !empty($attachment['filename'])) {
973
  $filename = $attachment['filename'];
974
  } else {
 
975
  $filename = uniqid();
976
  $attachment['filename'] = $filename;
977
  }
@@ -981,16 +982,22 @@ function postie_save_attachment(&$attachment, $post_id, $poster, $config) {
981
  $filename = sanitize_file_name($filename);
982
  $attachment['wp_filename'] = $filename;
983
 
984
- $fileext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
985
- $attachment['ext'] = $fileext;
986
-
987
  DebugEcho("postie_save_attachment: file name '$filename'");
988
- DebugEcho("postie_save_attachment: extension '$fileext'");
989
 
990
  $mparts = explode('/', $attachment['mimetype']);
991
  $mimetype_primary = $mparts[0];
992
  $mimetype_secondary = $mparts[1];
993
 
 
 
 
 
 
 
 
 
 
 
994
  $typeinfo = wp_check_filetype($filename);
995
  //DebugDump($typeinfo);
996
  if (!empty($typeinfo['type'])) {
@@ -2679,7 +2686,7 @@ function HasIconvInstalled($display = true) {
2679
  }
2680
 
2681
  /**
2682
- * Handles verifing that a list of functions exists
2683
  * @return boolean
2684
  * @param array
2685
  */
@@ -2839,22 +2846,22 @@ function postie_test_config() {
2839
  ?>
2840
  <div class="wrap">
2841
  <h1>Postie Configuration Test</h1>
2842
- <?php
2843
- postie_environment(true);
2844
- ?>
2845
 
2846
  <h2>Clock</h2>
2847
  <p>This shows what time it would be if you posted right now</p>
2848
- <?php
2849
- $wptz = get_option('gmt_offset');
2850
- $wptzs = get_option('timezone_string');
2851
- DebugEcho("Wordpress timezone: $wptzs ($wptz)", true);
2852
- DebugEcho("Current time: " . current_time('mysql'), true);
2853
- DebugEcho("Current time (gmt): " . current_time('mysql', 1), true);
2854
- DebugEcho("Postie time correction: {$config['time_offset']}", true);
2855
- $offsetdate = strtotime(current_time('mysql')) + $config['time_offset'];
2856
- DebugEcho("Post time: " . date('Y-m-d H:i:s', $offsetdate), true);
2857
- ?>
2858
  <h2>Encoding</h2>
2859
  <?php
2860
  $default_charset = ini_get('default_charset');
@@ -2955,120 +2962,120 @@ function postie_test_config() {
2955
  }
2956
  ?>
2957
  </div>
2958
- <?php
2959
- }
2960
 
2961
- function postie_get_conn_info($config) {
2962
- $conninfo = array();
2963
- $conninfo['mail_server'] = $config['mail_server'];
2964
- $conninfo['mail_port'] = $config['mail_server_port'];
2965
- $conninfo['mail_user'] = $config['mail_userid'];
2966
- $conninfo['mail_password'] = $config['mail_password'];
2967
- $conninfo['mail_protocol'] = $config['input_protocol'];
2968
- $conninfo['mail_tls'] = $config['email_tls'];
2969
- $conninfo['email_delete_after_processing'] = $config['delete_mail_after_processing'];
2970
- $conninfo['email_max'] = $config['maxemails'];
2971
- $conninfo['email_ignore_state'] = $config['ignore_mail_state'];
 
 
 
2972
 
2973
- return apply_filters('postie_preconnect', $conninfo);
 
 
2974
  }
2975
 
2976
- function postie_get_mail() {
2977
- if (!function_exists('file_get_html')) {
2978
- require_once (plugin_dir_path(__FILE__) . 'simple_html_dom.php');
2979
- }
 
 
 
 
 
 
2980
 
2981
- $config = config_Read();
2982
- if (true == $config['postie_log_error'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
2983
- add_action('postie_log_error', 'postie_log_error');
2984
- }
2985
- if (true == $config['postie_log_debug'] && !defined('POSTIE_DEBUG')) {
2986
- define('POSTIE_DEBUG', true);
2987
- }
2988
- if (true == $config['postie_log_debug'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
2989
- add_action('postie_log_debug', 'postie_log_debug');
2990
- }
2991
 
2992
- do_action('postie_session_start');
2993
- DebugEcho("Starting mail fetch");
 
 
 
 
 
2994
 
2995
- postie_environment();
2996
- $wp_content_path = dirname(dirname(dirname(__FILE__)));
2997
- DebugEcho("wp_content_path: $wp_content_path");
2998
- if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
2999
- DebugEcho("found filterPostie.php in $wp_content_path");
3000
- include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
3001
- }
3002
 
3003
- if (function_exists('memory_get_usage')) {
3004
- DebugEcho(__("memory at start of email processing: ", 'postie') . memory_get_usage());
3005
- }
3006
 
3007
- if (has_filter('postie_post')) {
3008
- echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
3009
- }
3010
 
3011
- if (!array_key_exists('maxemails', $config)) {
3012
- $config['maxemails'] = 0;
3013
- }
3014
 
3015
- $conninfo = postie_get_conn_info($config);
3016
 
3017
- $emails = postie_fetch_mail($conninfo['mail_server'], $conninfo['mail_port'], $conninfo['mail_user'], $conninfo['mail_password'], $conninfo['mail_protocol'], $conninfo['email_delete_after_processing'], $conninfo['email_max'], $config['input_connection']);
3018
 
3019
- $message = 'Done.';
3020
 
3021
- DebugEcho(sprintf(__("There are %d messages to process", 'postie'), count($emails)));
 
 
 
3022
 
3023
- //don't output the password
3024
- $tmp_config = $config;
3025
- unset($tmp_config['mail_password']);
3026
- DebugDump($tmp_config);
3027
-
3028
- //loop through messages
3029
- $message_number = 0;
3030
- foreach ($emails as $email) {
3031
- $message_number++;
3032
- DebugEcho("$message_number: ------------------------------------");
3033
- //DebugDump($email);
3034
- //sanity check to see if there is any info in the message
3035
- if ($email == NULL) {
3036
- $message = __('Dang, message is empty!', 'postie');
3037
- EchoError("$message_number: $message");
3038
- continue;
3039
- } else if ($email == 'already read') {
3040
- $message = __("Message is already marked 'read'.", 'postie');
3041
- DebugEcho("$message_number: $message");
3042
- continue;
3043
- }
3044
 
3045
- $tmp_config = $config;
3046
- if ($config['prefer_text_convert']) {
3047
- if ($config['prefer_text_type'] == 'plain' && trim($email['text']) == '' && trim($email['html']) != '') {
3048
- DebugEcho("postie_get_mail: switching to html");
3049
- $tmp_config['prefer_text_type'] = 'html';
3050
- }
3051
- if ($config['prefer_text_type'] == 'html' && trim($email['html']) == '' && trim($email['text']) != '') {
3052
- DebugEcho("postie_get_mail: switching to plain");
3053
- $tmp_config['prefer_text_type'] = 'plain';
3054
- }
3055
  }
3056
-
3057
- //Check poster to see if a valid person
3058
- $poster = ValidatePoster($email, $tmp_config);
3059
- if (!empty($poster)) {
3060
- PostEmail($poster, $email, $tmp_config);
3061
- DebugEcho("$message_number: processed");
3062
- } else {
3063
- EchoError("Ignoring email - not authorized.");
3064
  }
3065
- flush();
3066
  }
3067
- DebugEcho("Mail fetch complete, $message_number emails");
3068
- do_action('postie_session_end');
3069
 
3070
- if (function_exists('memory_get_usage')) {
3071
- DebugEcho("memory at end of email processing:" . memory_get_usage());
 
 
 
 
 
3072
  }
 
3073
  }
3074
-
 
 
 
 
 
 
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1618962 2017-03-21 22:42:36Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
891
 
892
  function postie_save_attachments_worker(&$attachments, $post_id, $poster, $config) {
893
  foreach ($attachments as &$attachment) {
894
+ if (array_key_exists('filename', $attachment) && !empty($attachment['filename'])) {
895
  DebugEcho('postie_save_attachments_worker: ' . $attachment['filename']);
896
 
897
  if (isBannedFileName($attachment['filename'], $config['banned_files_list'])) {
972
  if (isset($attachment['filename']) && !empty($attachment['filename'])) {
973
  $filename = $attachment['filename'];
974
  } else {
975
+ DebugEcho("postie_save_attachment: generating file name");
976
  $filename = uniqid();
977
  $attachment['filename'] = $filename;
978
  }
982
  $filename = sanitize_file_name($filename);
983
  $attachment['wp_filename'] = $filename;
984
 
 
 
 
985
  DebugEcho("postie_save_attachment: file name '$filename'");
 
986
 
987
  $mparts = explode('/', $attachment['mimetype']);
988
  $mimetype_primary = $mparts[0];
989
  $mimetype_secondary = $mparts[1];
990
 
991
+ $fileext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
992
+ $attachment['ext'] = $fileext;
993
+ if (empty($fileext) && $mimetype_primary == 'image') {
994
+ $attachment['ext'] = $mimetype_secondary;
995
+ $filename = $filename . '.' . $mimetype_secondary;
996
+ $attachment['wp_filename'] = $filename;
997
+ DebugEcho("postie_save_attachment: blank image extension, changed to $mimetype_secondary ($filename)");
998
+ }
999
+ DebugEcho("postie_save_attachment: extension '$fileext'");
1000
+
1001
  $typeinfo = wp_check_filetype($filename);
1002
  //DebugDump($typeinfo);
1003
  if (!empty($typeinfo['type'])) {
2686
  }
2687
 
2688
  /**
2689
+ * Handles verifying that a list of functions exists
2690
  * @return boolean
2691
  * @param array
2692
  */
2846
  ?>
2847
  <div class="wrap">
2848
  <h1>Postie Configuration Test</h1>
2849
+ <?php
2850
+ postie_environment(true);
2851
+ ?>
2852
 
2853
  <h2>Clock</h2>
2854
  <p>This shows what time it would be if you posted right now</p>
2855
+ <?php
2856
+ $wptz = get_option('gmt_offset');
2857
+ $wptzs = get_option('timezone_string');
2858
+ DebugEcho("Wordpress timezone: $wptzs ($wptz)", true);
2859
+ DebugEcho("Current time: " . current_time('mysql'), true);
2860
+ DebugEcho("Current time (gmt): " . current_time('mysql', 1), true);
2861
+ DebugEcho("Postie time correction: {$config['time_offset']}", true);
2862
+ $offsetdate = strtotime(current_time('mysql')) + $config['time_offset'];
2863
+ DebugEcho("Post time: " . date('Y-m-d H:i:s', $offsetdate), true);
2864
+ ?>
2865
  <h2>Encoding</h2>
2866
  <?php
2867
  $default_charset = ini_get('default_charset');
2962
  }
2963
  ?>
2964
  </div>
2965
+ <?php
2966
+ }
2967
 
2968
+ function postie_get_conn_info($config) {
2969
+ $conninfo = array();
2970
+ $conninfo['mail_server'] = $config['mail_server'];
2971
+ $conninfo['mail_port'] = $config['mail_server_port'];
2972
+ $conninfo['mail_user'] = $config['mail_userid'];
2973
+ $conninfo['mail_password'] = $config['mail_password'];
2974
+ $conninfo['mail_protocol'] = $config['input_protocol'];
2975
+ $conninfo['mail_tls'] = $config['email_tls'];
2976
+ $conninfo['email_delete_after_processing'] = $config['delete_mail_after_processing'];
2977
+ $conninfo['email_max'] = $config['maxemails'];
2978
+ $conninfo['email_ignore_state'] = $config['ignore_mail_state'];
2979
+
2980
+ return apply_filters('postie_preconnect', $conninfo);
2981
+ }
2982
 
2983
+ function postie_get_mail() {
2984
+ if (!function_exists('file_get_html')) {
2985
+ require_once (plugin_dir_path(__FILE__) . 'simple_html_dom.php');
2986
  }
2987
 
2988
+ $config = config_Read();
2989
+ if (true == $config['postie_log_error'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
2990
+ add_action('postie_log_error', 'postie_log_error');
2991
+ }
2992
+ if (true == $config['postie_log_debug'] && !defined('POSTIE_DEBUG')) {
2993
+ define('POSTIE_DEBUG', true);
2994
+ }
2995
+ if (true == $config['postie_log_debug'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
2996
+ add_action('postie_log_debug', 'postie_log_debug');
2997
+ }
2998
 
2999
+ do_action('postie_session_start');
3000
+ DebugEcho('Starting mail fetch');
3001
+ DebugEcho('WordPress datetime: ' . current_time('mysql'));
 
 
 
 
 
 
 
3002
 
3003
+ postie_environment();
3004
+ $wp_content_path = dirname(dirname(dirname(__FILE__)));
3005
+ DebugEcho("wp_content_path: $wp_content_path");
3006
+ if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . 'filterPostie.php')) {
3007
+ DebugEcho("found filterPostie.php in $wp_content_path");
3008
+ include_once ($wp_content_path . DIRECTORY_SEPARATOR . 'filterPostie.php');
3009
+ }
3010
 
3011
+ if (function_exists('memory_get_usage')) {
3012
+ DebugEcho(__("memory at start of email processing: ", 'postie') . memory_get_usage());
3013
+ }
 
 
 
 
3014
 
3015
+ if (has_filter('postie_post')) {
3016
+ echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
3017
+ }
3018
 
3019
+ if (!array_key_exists('maxemails', $config)) {
3020
+ $config['maxemails'] = 0;
3021
+ }
3022
 
3023
+ $conninfo = postie_get_conn_info($config);
 
 
3024
 
3025
+ $emails = postie_fetch_mail($conninfo['mail_server'], $conninfo['mail_port'], $conninfo['mail_user'], $conninfo['mail_password'], $conninfo['mail_protocol'], $conninfo['email_delete_after_processing'], $conninfo['email_max'], $config['input_connection']);
3026
 
3027
+ $message = 'Done.';
3028
 
3029
+ DebugEcho(sprintf(__("There are %d messages to process", 'postie'), count($emails)));
3030
 
3031
+ //don't output the password
3032
+ $tmp_config = $config;
3033
+ unset($tmp_config['mail_password']);
3034
+ DebugDump($tmp_config);
3035
 
3036
+ //loop through messages
3037
+ $message_number = 0;
3038
+ foreach ($emails as $email) {
3039
+ $message_number++;
3040
+ DebugEcho("$message_number: ------------------------------------");
3041
+ //DebugDump($email);
3042
+ //sanity check to see if there is any info in the message
3043
+ if ($email == NULL) {
3044
+ $message = __('Dang, message is empty!', 'postie');
3045
+ EchoError("$message_number: $message");
3046
+ continue;
3047
+ } else if ($email == 'already read') {
3048
+ $message = __("Message is already marked 'read'.", 'postie');
3049
+ DebugEcho("$message_number: $message");
3050
+ continue;
3051
+ }
 
 
 
 
 
3052
 
3053
+ $tmp_config = $config;
3054
+ if ($config['prefer_text_convert']) {
3055
+ if ($config['prefer_text_type'] == 'plain' && trim($email['text']) == '' && trim($email['html']) != '') {
3056
+ DebugEcho('postie_get_mail: switching to html');
3057
+ $tmp_config['prefer_text_type'] = 'html';
 
 
 
 
 
3058
  }
3059
+ if ($config['prefer_text_type'] == 'html' && trim($email['html']) == '' && trim($email['text']) != '') {
3060
+ DebugEcho('postie_get_mail: switching to plain');
3061
+ $tmp_config['prefer_text_type'] = 'plain';
 
 
 
 
 
3062
  }
 
3063
  }
 
 
3064
 
3065
+ //Check poster to see if a valid person
3066
+ $poster = ValidatePoster($email, $tmp_config);
3067
+ if (!empty($poster)) {
3068
+ PostEmail($poster, $email, $tmp_config);
3069
+ DebugEcho("$message_number: processed");
3070
+ } else {
3071
+ EchoError('Ignoring email - not authorized.');
3072
  }
3073
+ flush();
3074
  }
3075
+ DebugEcho("Mail fetch complete, $message_number emails");
3076
+ do_action('postie_session_end');
3077
+
3078
+ if (function_exists('memory_get_usage')) {
3079
+ DebugEcho('memory at end of email processing: ' . memory_get_usage());
3080
+ }
3081
+ }
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.34
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1615079 2017-03-15 15:20:35Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
@@ -50,7 +50,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
50
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
51
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-api.php");
52
 
53
- define('POSTIE_VERSION', '1.8.34');
54
  define("POSTIE_ROOT", dirname(__FILE__));
55
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
56
 
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.35
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1618966 2017-03-21 22:44:54Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
50
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
51
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-api.php");
52
 
53
+ define('POSTIE_VERSION', '1.8.35');
54
  define("POSTIE_ROOT", dirname(__FILE__));
55
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
56
 
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.7.3
9
- Stable tag: 1.8.34
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -242,6 +242,13 @@ All script, style and body tags are stripped from html emails.
242
  Attachments are now processed in the order they were attached.
243
 
244
  == CHANGELOG ==
 
 
 
 
 
 
 
245
  = 1.8.34 (2017-03-15) =
246
  * Fix bug when sending reject email
247
 
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.7.3
9
+ Stable tag: 1.8.35
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
242
  Attachments are now processed in the order they were attached.
243
 
244
  == CHANGELOG ==
245
+ = 1.8.35 (2017-03-21) =
246
+ * Check for blank image file extension and replace with mime subtype to get around new filetype checking in WordPress 4.7.2 https://core.trac.wordpress.org/ticket/39550
247
+ * Additional logging of message and part headers
248
+ * Fix base64 header decoding so trailing space isn't removed
249
+ * Fix header decoding to remove extra utf-8 byte order mark
250
+ * Add current WordPress time to logging
251
+
252
  = 1.8.34 (2017-03-15) =
253
  * Fix bug when sending reject email
254