Postie - Version 1.8.6

Version Description

(2016-10-19) * Fix bug where the featured image was not included even though config said it should be. * Ensure Socket connections try to connect with TLS 1.0, 1.1 and 1.2 if SSL is specified. * Additional logging to help diagnose cURL issue.

Download this release

Release Info

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

Code changes from version 1.8.5 to 1.8.6

config_form_attachments.php CHANGED
@@ -75,8 +75,9 @@
75
  } else {
76
  $select = ' ';
77
  }
78
- if ($key == 'custom')
79
  $value = $generaltemplate;
 
80
  echo '<option' . $select . 'value="' . esc_attr($value) . '" >' . $key . '</option>';
81
  }
82
  }
75
  } else {
76
  $select = ' ';
77
  }
78
+ if ($key == 'custom') {
79
  $value = $generaltemplate;
80
+ }
81
  echo '<option' . $select . 'value="' . esc_attr($value) . '" >' . $key . '</option>';
82
  }
83
  }
config_form_server.php CHANGED
@@ -27,8 +27,6 @@
27
  </td>
28
  </tr>
29
 
30
- <?php //echo BuildBooleanSelect(__("Use Transport Layer Security (TLS)", 'postie'), 'postie-settings[email_tls]', $email_tls, __("Choose Yes if your server requires TLS", 'postie')); ?>
31
-
32
  <tr>
33
  <th scope="row"><label for="postie-settings-mail_server_port"><?php _e('Port', 'postie') ?></label></th>
34
  <td valign="top">
@@ -70,73 +68,73 @@
70
  <td>
71
  <select name='postie-settings[interval]' id='postie-settings-interval'>
72
  <option value="weekly" <?php
73
- if ($interval == "weekly") {
74
- echo "selected='selected'";
75
- }
76
- ?>><?php _e('Once weekly', 'postie') ?>
77
  </option>
78
 
79
  <option value="daily"<?php
80
  if ($interval == "daily") {
81
  echo "selected='selected'";
82
  }
83
- ?>><?php _e('daily', 'postie') ?>
84
  </option>
85
 
86
  <option value="hourly" <?php
87
  if ($interval == "hourly") {
88
  echo "selected='selected'";
89
  }
90
- ?>><?php _e('hourly', 'postie') ?>
91
  </option>
92
 
93
  <option value="twiceperhour" <?php
94
  if ($interval == "twiceperhour") {
95
  echo "selected='selected'";
96
  }
97
- ?>><?php _e('twice per hour', 'postie') ?>
98
  </option>
99
 
100
  <option value="tenminutes" <?php
101
  if ($interval == "tenminutes") {
102
  echo "selected='selected'";
103
  }
104
- ?>><?php _e('every 10 minutes', 'postie') ?>
105
  </option>
106
 
107
  <option value="fiveminutes" <?php
108
  if ($interval == "fiveminutes") {
109
  echo "selected='selected'";
110
  }
111
- ?>><?php _e('every 5 minutes', 'postie') ?>
112
  </option>
113
 
114
  <option value="oneminute" <?php
115
  if ($interval == "oneminute") {
116
  echo "selected='selected'";
117
  }
118
- ?>><?php _e('every 1 minute', 'postie') ?>
119
  </option>
120
 
121
  <option value="thirtyseconds" <?php
122
  if ($interval == "thirtyseconds") {
123
  echo "selected='selected'";
124
  }
125
- ?>><?php _e('every 30 seconds', 'postie') ?>
126
  </option>
127
 
128
  <option value="fifteenseconds" <?php
129
  if ($interval == "fifteenseconds") {
130
  echo "selected='selected'";
131
  }
132
- ?>><?php _e('every 15 seconds', 'postie') ?>
133
  </option>
134
 
135
  <option value="manual" <?php
136
  if ($interval == "manual") {
137
  echo "selected='selected'";
138
  }
139
- ?>><?php _e('check manually', 'postie') ?>
140
  </option>
141
  </select>
142
  </td>
@@ -147,7 +145,11 @@
147
  </th>
148
  <td>
149
  <select name='postie-settings[maxemails]' id='postie-settings-maxemails'>
150
- <option value="0" <?php if ($maxemails == '0') echo "selected='selected'" ?>><?php _e('All', 'postie'); ?></option>
 
 
 
 
151
  <option value="1" <?php if ($maxemails == '1') echo "selected='selected'" ?>>1</option>
152
  <option value="2" <?php if ($maxemails == '2') echo "selected='selected'" ?>>2</option>
153
  <option value="5" <?php if ($maxemails == '5') echo "selected='selected'" ?>>5</option>
@@ -160,8 +162,8 @@
160
  <?php echo BuildBooleanSelect(__("Delete email after posting", 'postie'), 'postie-settings[delete_mail_after_processing]', $delete_mail_after_processing, __("Only set to no for testing purposes", 'postie')); ?>
161
  <?php //echo BuildBooleanSelect(__("Ignore mail state", 'postie'), 'postie-settings[ignore_mail_state]', $ignore_mail_state, __("Ignore whether the mails is 'read' or 'unread' If 'No' then only unread messages are processed. IMAP only", 'postie')); ?>
162
 
163
- <?php echo BuildBooleanSelect(__("Enable Error Logging", 'postie'), 'postie-settings[postie_log_error]', $postie_log_error, __("Log error messages to the web server error log.", 'postie')); ?>
164
- <?php echo BuildBooleanSelect(__("Enable Debug Logging", 'postie'), 'postie-settings[postie_log_debug]', $postie_log_debug, __("Log debug messages to the web server error log.", 'postie')); ?>
165
 
166
  </table>
167
  </div>
27
  </td>
28
  </tr>
29
 
 
 
30
  <tr>
31
  <th scope="row"><label for="postie-settings-mail_server_port"><?php _e('Port', 'postie') ?></label></th>
32
  <td valign="top">
68
  <td>
69
  <select name='postie-settings[interval]' id='postie-settings-interval'>
70
  <option value="weekly" <?php
71
+ if ($interval == "weekly") {
72
+ echo "selected='selected'";
73
+ }
74
+ ?>><?php _e('Once weekly', 'postie') ?>
75
  </option>
76
 
77
  <option value="daily"<?php
78
  if ($interval == "daily") {
79
  echo "selected='selected'";
80
  }
81
+ ?>><?php _e('daily', 'postie') ?>
82
  </option>
83
 
84
  <option value="hourly" <?php
85
  if ($interval == "hourly") {
86
  echo "selected='selected'";
87
  }
88
+ ?>><?php _e('hourly', 'postie') ?>
89
  </option>
90
 
91
  <option value="twiceperhour" <?php
92
  if ($interval == "twiceperhour") {
93
  echo "selected='selected'";
94
  }
95
+ ?>><?php _e('twice per hour', 'postie') ?>
96
  </option>
97
 
98
  <option value="tenminutes" <?php
99
  if ($interval == "tenminutes") {
100
  echo "selected='selected'";
101
  }
102
+ ?>><?php _e('every 10 minutes', 'postie') ?>
103
  </option>
104
 
105
  <option value="fiveminutes" <?php
106
  if ($interval == "fiveminutes") {
107
  echo "selected='selected'";
108
  }
109
+ ?>><?php _e('every 5 minutes', 'postie') ?>
110
  </option>
111
 
112
  <option value="oneminute" <?php
113
  if ($interval == "oneminute") {
114
  echo "selected='selected'";
115
  }
116
+ ?>><?php _e('every 1 minute', 'postie') ?>
117
  </option>
118
 
119
  <option value="thirtyseconds" <?php
120
  if ($interval == "thirtyseconds") {
121
  echo "selected='selected'";
122
  }
123
+ ?>><?php _e('every 30 seconds', 'postie') ?>
124
  </option>
125
 
126
  <option value="fifteenseconds" <?php
127
  if ($interval == "fifteenseconds") {
128
  echo "selected='selected'";
129
  }
130
+ ?>><?php _e('every 15 seconds', 'postie') ?>
131
  </option>
132
 
133
  <option value="manual" <?php
134
  if ($interval == "manual") {
135
  echo "selected='selected'";
136
  }
137
+ ?>><?php _e('check manually', 'postie') ?>
138
  </option>
139
  </select>
140
  </td>
145
  </th>
146
  <td>
147
  <select name='postie-settings[maxemails]' id='postie-settings-maxemails'>
148
+ <option value="0" <?php
149
+ if ($maxemails == '0') {
150
+ echo "selected='selected'";
151
+ }
152
+ ?>><?php _e('All', 'postie'); ?></option>
153
  <option value="1" <?php if ($maxemails == '1') echo "selected='selected'" ?>>1</option>
154
  <option value="2" <?php if ($maxemails == '2') echo "selected='selected'" ?>>2</option>
155
  <option value="5" <?php if ($maxemails == '5') echo "selected='selected'" ?>>5</option>
162
  <?php echo BuildBooleanSelect(__("Delete email after posting", 'postie'), 'postie-settings[delete_mail_after_processing]', $delete_mail_after_processing, __("Only set to no for testing purposes", 'postie')); ?>
163
  <?php //echo BuildBooleanSelect(__("Ignore mail state", 'postie'), 'postie-settings[ignore_mail_state]', $ignore_mail_state, __("Ignore whether the mails is 'read' or 'unread' If 'No' then only unread messages are processed. IMAP only", 'postie')); ?>
164
 
165
+ <?php echo BuildBooleanSelect(__("Enable Error Logging", 'postie'), 'postie-settings[postie_log_error]', $postie_log_error, __("Log error messages to the web server error log.", 'postie')); ?>
166
+ <?php echo BuildBooleanSelect(__("Enable Debug Logging", 'postie'), 'postie-settings[postie_log_debug]', $postie_log_debug, __("Log debug messages to the web server error log.", 'postie')); ?>
167
 
168
  </table>
169
  </div>
config_form_video.php CHANGED
@@ -22,8 +22,9 @@
22
  } else {
23
  $select = ' ';
24
  }
25
- if ($key == 'custom')
26
  $value = $video1template;
 
27
  echo '<option' . $select . 'value="' .
28
  esc_attr($value) . '" >' . $key . '</option>';
29
  }
@@ -69,8 +70,9 @@
69
  } else {
70
  $select = ' ';
71
  }
72
- if ($key == 'custom')
73
  $value = $video2template;
 
74
  echo '<option' . $select . 'value="' . esc_attr($value) . '" >' . $key . '</option>';
75
  }
76
  }
@@ -117,8 +119,9 @@
117
  } else {
118
  $select = ' ';
119
  }
120
- if ($key == 'custom')
121
  $value = $audiotemplate;
 
122
  echo '<option' . $select . 'value="' .
123
  esc_attr($value) . '" >' . $key . '</option>';
124
  }
22
  } else {
23
  $select = ' ';
24
  }
25
+ if ($key == 'custom') {
26
  $value = $video1template;
27
+ }
28
  echo '<option' . $select . 'value="' .
29
  esc_attr($value) . '" >' . $key . '</option>';
30
  }
70
  } else {
71
  $select = ' ';
72
  }
73
+ if ($key == 'custom') {
74
  $value = $video2template;
75
+ }
76
  echo '<option' . $select . 'value="' . esc_attr($value) . '" >' . $key . '</option>';
77
  }
78
  }
119
  } else {
120
  $select = ' ';
121
  }
122
+ if ($key == 'custom') {
123
  $value = $audiotemplate;
124
+ }
125
  echo '<option' . $select . 'value="' .
126
  esc_attr($value) . '" >' . $key . '</option>';
127
  }
docs/Changes.txt CHANGED
@@ -32,6 +32,11 @@ 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.5 (2016-10-18)
36
  * Fix to check if cURL is installed before using
37
 
32
  Attachments are now processed in the order they were attached.
33
 
34
  == CHANGELOG ==
35
+ = 1.8.6 (2016-10-19)
36
+ * Fix bug where the featured image was not included even though config said it should be.
37
+ * Ensure Socket connections try to connect with TLS 1.0, 1.1 and 1.2 if SSL is specified.
38
+ * Additional logging to help diagnose cURL issue.
39
+
40
  = 1.8.5 (2016-10-18)
41
  * Fix to check if cURL is installed before using
42
 
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.5
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.6
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
lib/pCurlConnection.php CHANGED
@@ -46,6 +46,15 @@ class pCurlConnection extends pConnection {
46
  curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
47
  curl_setopt($ch, CURLOPT_NOBODY, true);
48
 
 
 
 
 
 
 
 
 
 
49
  curl_setopt($ch, CURLOPT_VERBOSE, true);
50
  $verbose = fopen('php://temp', 'w+');
51
  curl_setopt($ch, CURLOPT_STDERR, $verbose);
@@ -54,9 +63,18 @@ class pCurlConnection extends pConnection {
54
 
55
  $res = curl_exec($ch);
56
 
 
 
 
 
 
 
 
 
 
57
  rewind($verbose);
58
  $verboseLog = stream_get_contents($verbose);
59
- //DebugEcho($verboseLog);
60
  fclose($verbose);
61
 
62
  if (false === $res) {
46
  curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
47
  curl_setopt($ch, CURLOPT_NOBODY, true);
48
 
49
+ $fp = tmpfile();
50
+ curl_setopt($ch, CURLOPT_FILE, $fp);
51
+ // curl_setopt($ch, CURLOPT_WRITEFUNCTION, function ($cp, $data) use ($fp) {
52
+ // echo "curl cb: $data\n";
53
+ // return fwrite($fp, $data);
54
+ // });
55
+
56
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
57
+
58
  curl_setopt($ch, CURLOPT_VERBOSE, true);
59
  $verbose = fopen('php://temp', 'w+');
60
  curl_setopt($ch, CURLOPT_STDERR, $verbose);
63
 
64
  $res = curl_exec($ch);
65
 
66
+ DebugEcho("curl return: $res");
67
+
68
+ rewind($fp);
69
+ while (!feof($fp)) {
70
+ $buffer = fgets($fp);
71
+ echo "curl: $buffer";
72
+ }
73
+ fclose($fp);
74
+
75
  rewind($verbose);
76
  $verboseLog = stream_get_contents($verbose);
77
+ DebugEcho("curl log: $verboseLog");
78
  fclose($verbose);
79
 
80
  if (false === $res) {
lib/pSocketConnection.php CHANGED
@@ -69,11 +69,17 @@ class pSocketConnection extends pConnection {
69
  if (!$this->secure && extension_loaded('openssl')) {
70
  $response = $this->write('STLS', 1);
71
  if ($response[0][0] == '+') {
 
 
 
 
 
 
72
  do {
73
  if (isset($res)) {
74
  sleep(0.1);
75
  }
76
- $res = stream_socket_enable_crypto($this->socket, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT);
77
  } while ($res === 0);
78
  if ($res === FALSE) {
79
  throw new fConnectivityException('Error establishing secure connection');
69
  if (!$this->secure && extension_loaded('openssl')) {
70
  $response = $this->write('STLS', 1);
71
  if ($response[0][0] == '+') {
72
+ $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
73
+
74
+ if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
75
+ $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
76
+ $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
77
+ }
78
  do {
79
  if (isset($res)) {
80
  sleep(0.1);
81
  }
82
+ $res = stream_socket_enable_crypto($this->socket, TRUE, $crypto_method);
83
  } while ($res === 0);
84
  if ($res === FALSE) {
85
  throw new fConnectivityException('Error establishing secure connection');
lib_autolink.php CHANGED
@@ -33,6 +33,7 @@ class PostieAutolink {
33
  while (($cursor < strlen($text)) && $loop) {
34
 
35
  $ok = 1;
 
36
  $matched = preg_match($sub, $text_l, $m, PREG_OFFSET_CAPTURE, $cursor);
37
 
38
  if (!$matched) {
@@ -66,7 +67,7 @@ class PostieAutolink {
66
  $cursor += $fail_len;
67
  $buffer .= $fail_text;
68
  }
69
-
70
  if ($ok) {
71
  #
72
  # check to see if we're inside a shortcode
@@ -109,6 +110,7 @@ class PostieAutolink {
109
  #
110
 
111
  if ($ok) {
 
112
  if (preg_match('/^([a-z0-9\-\.\/\-_%~!?=,:;&+*#@\(\)\$]+)/i', $post, $matches)) {
113
 
114
  $url = $hit . $matches[1];
@@ -306,6 +308,7 @@ class PostieAutolink {
306
  #
307
 
308
  if ($ok) {
 
309
  if (preg_match("!($atom(\.$atom)*)\$!", $pre, $matches)) {
310
 
311
  # move matched part of address into $hit
33
  while (($cursor < strlen($text)) && $loop) {
34
 
35
  $ok = 1;
36
+ $m = [];
37
  $matched = preg_match($sub, $text_l, $m, PREG_OFFSET_CAPTURE, $cursor);
38
 
39
  if (!$matched) {
67
  $cursor += $fail_len;
68
  $buffer .= $fail_text;
69
  }
70
+
71
  if ($ok) {
72
  #
73
  # check to see if we're inside a shortcode
110
  #
111
 
112
  if ($ok) {
113
+ $matches = [];
114
  if (preg_match('/^([a-z0-9\-\.\/\-_%~!?=,:;&+*#@\(\)\$]+)/i', $post, $matches)) {
115
 
116
  $url = $hit . $matches[1];
308
  #
309
 
310
  if ($ok) {
311
+ $matches = [];
312
  if (preg_match("!($atom(\.$atom)*)\$!", $pre, $matches)) {
313
 
314
  # move matched part of address into $hit
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1516992 2016-10-17 21:44:29Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -68,6 +68,10 @@ function postie_environment($force_display = false) {
68
  DebugEcho("TMP dir: " . get_temp_dir(), $force_display);
69
  DebugEcho("Postie is in " . plugin_dir_path(__FILE__), $force_display);
70
 
 
 
 
 
71
  if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
72
  DebugEcho("Alternate cron is enabled", $force_display);
73
  }
@@ -150,7 +154,7 @@ function DebugEcho($v, $force = false) {
150
  do_action('postie_log_debug', $v);
151
  }
152
 
153
- function tag_Date(&$content, $message_date, $isHtml) {
154
  //don't apply any offset here as it is accounted for later
155
  $html = LoadDOM($content);
156
  if ($html !== false) {
@@ -198,12 +202,13 @@ function tag_CustomImageField($post_ID, $email, $config) {
198
 
199
  function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $config) {
200
 
 
201
  $addimages = !($config['custom_image_field'] || $config['auto_gallery'] || preg_match("/\[gallery[^\[]*\]/", $content, $matches));
202
  $fiid = -1;
203
 
204
  DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
205
  $html = '';
206
- if ($config['include_featured_image']) {
207
  $fiid = get_post_thumbnail_id($post_id);
208
  }
209
 
@@ -319,7 +324,7 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
319
  DebugEcho("post excerpt: $content");
320
  }
321
 
322
- $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail);
323
  if ($fulldebug) {
324
  DebugEcho("post author: $content");
325
  }
@@ -454,7 +459,7 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
454
 
455
  //handle inline images after linkify
456
  if ('plain' == $config['prefer_text_type']) {
457
- $content = filter_ReplaceInlineImage($content, $mimeDecodedEmail, $config);
458
  if ($fulldebug) {
459
  DebugEcho("post filter_ReplaceInlineImage: $content");
460
  }
@@ -613,7 +618,7 @@ function LoadDOM($text) {
613
  * Otherwise we get them from the headers
614
  */
615
 
616
- function getPostAuthorDetails(&$subject, &$content, &$mimeDecodedEmail) {
617
 
618
  $theEmail = $mimeDecodedEmail['headers']['from']['mailbox'] . '@' . $mimeDecodedEmail['headers']['from']['host'];
619
 
@@ -684,10 +689,6 @@ function postie_get_parent_post(&$subject) {
684
  return $id;
685
  }
686
 
687
- function postie_ShowReadMe() {
688
- include(POSTIE_ROOT . DIRECTORY_SEPARATOR . "postie_read_me.php");
689
- }
690
-
691
  /**
692
  * This handles actually showing the form. Called by WordPress
693
  */
@@ -2023,7 +2024,7 @@ function filter_ReplaceImageCIDs($content, &$email) {
2023
  return $content;
2024
  }
2025
 
2026
- function filter_ReplaceInlineImage($content, &$email, $config) {
2027
  DebugEcho('filter_ReplaceInlineImage: start');
2028
  foreach ($email['inline'] as &$inlineImage) {
2029
  $template = $inlineImage['template'];
@@ -2055,7 +2056,6 @@ function filter_ReplaceImagePlaceHolders($content, &$email, $config, $post_id, $
2055
  DebugEcho("filter_ReplaceImagePlaceHolders: images in post: " . count($images));
2056
  DebugDump($images);
2057
 
2058
- $pics = "";
2059
  $i = 0;
2060
 
2061
  foreach ($email['attachment'] as &$attachment) {
@@ -2078,6 +2078,7 @@ function filter_ReplaceImagePlaceHolders($content, &$email, $config, $post_id, $
2078
  DebugEcho("filter_ReplaceImagePlaceHolders: Found $img_placeholder_temp0");
2079
  $caption = '';
2080
  $img_placeholder_temp = $img_placeholder_temp0;
 
2081
  if (preg_match("/$img_placeholder_temp caption=(.*?)#/i", $content, $matches)) {
2082
  //DebugDump($matches);
2083
  $caption = trim($matches[1]);
@@ -3017,6 +3018,11 @@ function postie_test_config() {
3017
  <h2>Connect to Mail Host</h2>
3018
 
3019
  <?php
 
 
 
 
 
3020
  if (!$config['mail_server'] || !$config['mail_server_port'] || !$config['mail_userid']) {
3021
  EchoError("FAIL - server settings not complete");
3022
  } else {
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1518084 2016-10-19 19:43:15Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
68
  DebugEcho("TMP dir: " . get_temp_dir(), $force_display);
69
  DebugEcho("Postie is in " . plugin_dir_path(__FILE__), $force_display);
70
 
71
+ if (function_exists('curl_version')) {
72
+ $cv = curl_version();
73
+ DebugEcho("cURL version: " . $cv['version'], $force_display);
74
+ }
75
  if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
76
  DebugEcho("Alternate cron is enabled", $force_display);
77
  }
154
  do_action('postie_log_debug', $v);
155
  }
156
 
157
+ function tag_Date(&$content, $message_date) {
158
  //don't apply any offset here as it is accounted for later
159
  $html = LoadDOM($content);
160
  if ($html !== false) {
202
 
203
  function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $config) {
204
 
205
+ $matches = [];
206
  $addimages = !($config['custom_image_field'] || $config['auto_gallery'] || preg_match("/\[gallery[^\[]*\]/", $content, $matches));
207
  $fiid = -1;
208
 
209
  DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
210
  $html = '';
211
+ if (!$config['include_featured_image']) {
212
  $fiid = get_post_thumbnail_id($post_id);
213
  }
214
 
324
  DebugEcho("post excerpt: $content");
325
  }
326
 
327
+ $postAuthorDetails = getPostAuthorDetails($mimeDecodedEmail);
328
  if ($fulldebug) {
329
  DebugEcho("post author: $content");
330
  }
459
 
460
  //handle inline images after linkify
461
  if ('plain' == $config['prefer_text_type']) {
462
+ $content = filter_ReplaceInlineImage($content, $mimeDecodedEmail);
463
  if ($fulldebug) {
464
  DebugEcho("post filter_ReplaceInlineImage: $content");
465
  }
618
  * Otherwise we get them from the headers
619
  */
620
 
621
+ function getPostAuthorDetails($mimeDecodedEmail) {
622
 
623
  $theEmail = $mimeDecodedEmail['headers']['from']['mailbox'] . '@' . $mimeDecodedEmail['headers']['from']['host'];
624
 
689
  return $id;
690
  }
691
 
 
 
 
 
692
  /**
693
  * This handles actually showing the form. Called by WordPress
694
  */
2024
  return $content;
2025
  }
2026
 
2027
+ function filter_ReplaceInlineImage($content, &$email) {
2028
  DebugEcho('filter_ReplaceInlineImage: start');
2029
  foreach ($email['inline'] as &$inlineImage) {
2030
  $template = $inlineImage['template'];
2056
  DebugEcho("filter_ReplaceImagePlaceHolders: images in post: " . count($images));
2057
  DebugDump($images);
2058
 
 
2059
  $i = 0;
2060
 
2061
  foreach ($email['attachment'] as &$attachment) {
2078
  DebugEcho("filter_ReplaceImagePlaceHolders: Found $img_placeholder_temp0");
2079
  $caption = '';
2080
  $img_placeholder_temp = $img_placeholder_temp0;
2081
+ $matches = [];
2082
  if (preg_match("/$img_placeholder_temp caption=(.*?)#/i", $content, $matches)) {
2083
  //DebugDump($matches);
2084
  $caption = trim($matches[1]);
3018
  <h2>Connect to Mail Host</h2>
3019
 
3020
  <?php
3021
+ DebugEcho("Postie connection: " . $config['input_connection'], true);
3022
+ DebugEcho("Postie protocol: " . $config['input_protocol'], true);
3023
+ DebugEcho("Postie server: " . $config['mail_server'], true);
3024
+ DebugEcho("Postie port: " . $config['mail_server_port'], true);
3025
+
3026
  if (!$config['mail_server'] || !$config['mail_server_port'] || !$config['mail_userid']) {
3027
  EchoError("FAIL - server settings not complete");
3028
  } else {
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.5
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1517493 2016-10-18 17:30:07Z 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.5');
53
  define("POSTIE_ROOT", dirname(__FILE__));
54
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
55
 
@@ -71,18 +71,11 @@ register_activation_hook(__FILE__, 'activate_postie');
71
  register_activation_hook(__FILE__, 'postie_cron');
72
  register_deactivation_hook(__FILE__, 'postie_decron');
73
 
74
- if (isset($_GET["postie_read_me"])) {
75
- include_once(ABSPATH . "wp-admin/admin.php");
76
- include(ABSPATH . 'wp-admin/admin-header.php');
77
- postie_ShowReadMe();
78
- include(ABSPATH . 'wp-admin/admin-footer.php');
79
- }
80
  //Add Menu Configuration
81
  if (is_admin()) {
82
  if (function_exists('load_plugin_textdomain')) {
83
 
84
  function postie_load_domain() {
85
- $plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
86
  load_plugin_textdomain('postie', false, dirname(plugin_basename(__FILE__)) . '/languages/');
87
  }
88
 
@@ -246,6 +239,17 @@ function postie_warnings() {
246
  add_action('admin_notices', 'postie_iconv_warning');
247
  }
248
 
 
 
 
 
 
 
 
 
 
 
 
249
  if (function_exists('curl_version')) {
250
  $cv = curl_version();
251
  } else {
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.6
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1518084 2016-10-19 19:43:15Z 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.6');
53
  define("POSTIE_ROOT", dirname(__FILE__));
54
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
55
 
71
  register_activation_hook(__FILE__, 'postie_cron');
72
  register_deactivation_hook(__FILE__, 'postie_decron');
73
 
 
 
 
 
 
 
74
  //Add Menu Configuration
75
  if (is_admin()) {
76
  if (function_exists('load_plugin_textdomain')) {
77
 
78
  function postie_load_domain() {
 
79
  load_plugin_textdomain('postie', false, dirname(plugin_basename(__FILE__)) . '/languages/');
80
  }
81
 
239
  add_action('admin_notices', 'postie_iconv_warning');
240
  }
241
 
242
+ if (!fCore::checkVersion('5.3.0')) {
243
+
244
+ function postie_php_warning() {
245
+ echo "<div id='postie-lst-warning' class='error'><p><strong>";
246
+ _e("Warning! Postie requires that PHP be verion 5.3 or higher. You have version " . phpversion(), 'postie');
247
+ echo "</strong></p></div>";
248
+ }
249
+
250
+ add_action('admin_notices', 'postie_php_warning');
251
+ }
252
+
253
  if (function_exists('curl_version')) {
254
  $cv = curl_version();
255
  } else {
postieIMAP.php DELETED
@@ -1,219 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @author Dirk Elmendorf
5
- * @style Compliant
6
- * @testframework Compliant
7
- * @package Postie
8
- * @copyright Copyright 2005 Dirk Elmendorf
9
- */
10
-
11
- /**
12
- * This class handles the details of an IMAP connection
13
- *
14
- * @author Dirk Elmendorf
15
- * @package Postie
16
- */
17
- class PostieIMAP {
18
-
19
- var $_connected;
20
- var $_protocol;
21
- var $_ssl;
22
- var $_self_cert;
23
- var $_tls_on;
24
- var $_connection;
25
- var $_mailbox;
26
-
27
- function PostieIMAP($protocol = "imap", $ssl_on = false, $self_cert = true) {
28
- $this->_connected = false;
29
- $this->_tls_on = false;
30
- $this->_protocol = strtolower($protocol);
31
- $this->_ssl = $ssl_on;
32
- $this->_self_cert = $self_cert;
33
- }
34
-
35
- /**
36
- * call this to turn on TLS
37
- */
38
- function TLSOn() {
39
- $this->_tls_on = true;
40
- DebugEcho($this->_protocol . ": TLS enabled");
41
- }
42
-
43
- /**
44
- * call this if you want to verify the cert
45
- */
46
- function RealCert() {
47
- $this->self_cert = false;
48
- }
49
-
50
- /**
51
- * Shows if the object is actually connected
52
- * @return boolean
53
- */
54
- function isConnected() {
55
- return($this->_connected);
56
- }
57
-
58
- /**
59
- * Opens a connection to the server
60
- * @return boolean
61
- */
62
- function connect($server, $port, $login, $password) {
63
- $option = "/service=" . $this->_protocol;
64
-
65
- if ($this->_ssl) {
66
- $option .= "/ssl";
67
- }
68
- if ($this->_tls_on) {
69
- $option .= "/tls";
70
- } else {
71
- $option .= "/notls";
72
- }
73
- if ($this->_self_cert) {
74
- $option .= "/novalidate-cert";
75
- }
76
- if (preg_match("/google|gmail/i", $server)) {
77
- //Fix from Jim Hodgson http://www.jimhodgson.com/2006/07/19/postie/
78
- DebugEcho($this->_protocol . ": using Google INBOX");
79
- $this->_mailbox = "{" . $server . ":" . $port . $option . "}INBOX";
80
- } else {
81
- $this->_mailbox = "{" . $server . ":" . $port . $option . "}";
82
- }
83
- DebugEcho($this->_protocol . ": connection string - {$this->_mailbox}");
84
- //Exchange connection, but requires PHP 5.3.2
85
- if (version_compare(phpversion(), '5.3.2', '<')) {
86
- $this->_connection = imap_open($this->_mailbox, $login, $password, OP_SILENT);
87
- } else {
88
- DebugEcho($this->_protocol . ": disabling GSSAPI");
89
- $this->_connection = imap_open($this->_mailbox, $login, $password, OP_SILENT, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));
90
- }
91
-
92
- if ($this->_connection) {
93
- $this->_connected = true;
94
- DebugEcho($this->_protocol . ": connected");
95
- } else {
96
- EchoError("imap_open failed: " . imap_last_error());
97
- }
98
- return $this->_connected;
99
- }
100
-
101
- /**
102
- * Returns a count of the number of messages
103
- * @return integer
104
- */
105
- function getNumberOfMessages() {
106
- $status = imap_status($this->_connection, $this->_mailbox, SA_ALL);
107
- DebugDump($status);
108
- if ($status) {
109
- return max($status->messages, imap_num_msg($this->_connection));
110
- } else {
111
- EchoError("Error imap_status did not return a value");
112
- //DebugDump($this);
113
- return 0;
114
- }
115
- }
116
-
117
- /**
118
- * Gets the raw email message from the server
119
- * @return string
120
- */
121
- function fetchEmail($index, $ignoreMailState) {
122
-
123
- $header_info = imap_headerinfo($this->_connection, $index);
124
- //DebugDump($header_info);
125
-
126
- if (true == $ignoreMailState || IsDebugMode() || $header_info->Recent == 'N' || $header_info->Unseen == 'U') {
127
- $email = imap_fetchheader($this->_connection, $index);
128
- $email .= imap_body($this->_connection, $index);
129
-
130
- return $email;
131
- } else {
132
- return 'already read';
133
- }
134
- }
135
-
136
- /**
137
- * Marks a message for deletion
138
- */
139
- function deleteMessage($index) {
140
- DebugEcho($this->_protocol . ": deleting message $index");
141
- imap_delete($this->_connection, $index);
142
- }
143
-
144
- /**
145
- * Handles purging any files that are marked for deletion
146
- */
147
- function expungeMessages() {
148
- DebugEcho($this->_protocol . ": expunge");
149
- imap_expunge($this->_connection);
150
- }
151
-
152
- /**
153
- * Handles disconnecting from the server
154
- */
155
- function disconnect() {
156
- DebugEcho($this->_protocol . ": closing connection");
157
- imap_close($this->_connection);
158
- $this->_connection = false;
159
- }
160
-
161
- /**
162
- * @return string
163
- */
164
- function error() {
165
- DebugDump(imap_errors());
166
- return(imap_last_error());
167
- }
168
-
169
- /**
170
- * Handles returning the right kind of object
171
- * @return PostieIMAP|PostieIMAPSSL|PostimePOP3SSL
172
- * @static
173
- */
174
- static function &Factory($protocol) {
175
- switch (strtolower($protocol)) {
176
- case "imap":
177
- $object = new PostieIMAP();
178
- break;
179
- case "imap-ssl":
180
- $object = new PostieIMAPSSL();
181
- break;
182
- case "pop3-ssl":
183
- $object = new PostiePOP3SSL();
184
- break;
185
- default:
186
- die("$protocol not supported");
187
- }
188
- return($object);
189
- }
190
-
191
- }
192
-
193
- /**
194
- * This class handles the details of an IMAP-SSL connection
195
- *
196
- * @author Dirk Elmendorf
197
- * @package Postie
198
- */
199
- class PostieIMAPSSL Extends PostieIMAP {
200
-
201
- function PostieIMAPSSL($protocol = "imap", $ssl_on = true, $self_cert = true) {
202
- PostieIMAP::PostieIMAP($protocol, $ssl_on, $self_cert);
203
- }
204
-
205
- }
206
-
207
- /**
208
- * This class handles the details of an POP3-SSL connection
209
- *
210
- * @author Dirk Elmendorf
211
- * @package Postie
212
- */
213
- class PostiePOP3SSL Extends PostieIMAP {
214
-
215
- function PostiePOP3SSL($protocol = "pop3", $ssl_on = true, $self_cert = true) {
216
- PostieIMAP::PostieIMAP($protocol, $ssl_on, $self_cert);
217
- }
218
-
219
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -240,6 +240,11 @@ 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.5 (2016-10-18)
244
  * Fix to check if cURL is installed before using
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.6
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.6 (2016-10-19)
244
+ * Fix bug where the featured image was not included even though config said it should be.
245
+ * Ensure Socket connections try to connect with TLS 1.0, 1.1 and 1.2 if SSL is specified.
246
+ * Additional logging to help diagnose cURL issue.
247
+
248
  = 1.8.5 (2016-10-18)
249
  * Fix to check if cURL is installed before using
250