Postie - Version 1.8.24

Version Description

(2017-01-20) = * Fix bug where debug output was displaying plaintext passwords. * Fix bug where categories specified with a colon required a space after the colon. * Postie now works off blog time rather than GMT. * Fix bug where oEmbed::get_provider() is not available on WP versions prior to 4.0.

Download this release

Release Info

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

Code changes from version 1.8.23 to 1.8.24

config_form_server.php CHANGED
@@ -57,7 +57,12 @@
57
  <tr>
58
  <th scope="row"><?php _e('Postie Time Correction', 'postie') ?></th>
59
  <td><input style="width: 70px;" name='postie-settings[time_offset]' type="number" step="0.5" id='postie-settings-time_offset' size="2" value="<?php echo esc_attr($time_offset); ?>" />
60
- <?php _e('hours', 'postie') ?>
 
 
 
 
 
61
  <p class='description'><?php _e("Should be the same as your normal offset, but this lets you adjust it in cases where that doesn't work.", 'postie'); ?></p>
62
  </td>
63
  </tr>
@@ -162,8 +167,8 @@
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>
57
  <tr>
58
  <th scope="row"><?php _e('Postie Time Correction', 'postie') ?></th>
59
  <td><input style="width: 70px;" name='postie-settings[time_offset]' type="number" step="0.5" id='postie-settings-time_offset' size="2" value="<?php echo esc_attr($time_offset); ?>" />
60
+ <?php
61
+ _e('hours', 'postie');
62
+ if (empty(get_option('timezone_string'))) {
63
+ ?><div class="notice notice-warning"><p>You have not set the blog time zone. You can do so on the <a href="<?php echo admin_url('options-general.php') ?>">General Settings page</a>. Note you may need to update the "Postie Time Correction" setting once you have done so.</p></div><?php
64
+ }
65
+ ?>
66
  <p class='description'><?php _e("Should be the same as your normal offset, but this lets you adjust it in cases where that doesn't work.", 'postie'); ?></p>
67
  </td>
68
  </tr>
167
  <?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')); ?>
168
  <?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')); ?>
169
 
170
+ <?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')); ?>
171
+ <?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')); ?>
172
 
173
  </table>
174
  </div>
docs/Changes.txt CHANGED
@@ -1,5 +1,8 @@
1
  == Upgrade Notice ==
2
 
 
 
 
3
  = 1.8.0 =
4
  The php-imap library has been replaced with logic based on Flourish fMailbox et al, there are some differences in the structure of the mail header array. This affects the
5
  postie_filter_email3 and postie_post_before filters.
@@ -32,7 +35,13 @@ 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.23 (future) =
 
 
 
 
 
 
36
  * Fix bug where long subject lines are missing a space.
37
  * Fix bug where {CAPTION} placeholder not being removed if no caption.
38
 
1
  == Upgrade Notice ==
2
 
3
+ = 1.8.23 =
4
+ Postie now respects the blog timezone, this may require you to change the "Postie Time Correction" setting.
5
+
6
  = 1.8.0 =
7
  The php-imap library has been replaced with logic based on Flourish fMailbox et al, there are some differences in the structure of the mail header array. This affects the
8
  postie_filter_email3 and postie_post_before filters.
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.8.24 (2017-01-20) =
39
+ * Fix bug where debug output was displaying plaintext passwords.
40
+ * Fix bug where categories specified with a colon required a space after the colon.
41
+ * Postie now works off blog time rather than GMT.
42
+ * Fix bug where oEmbed::get_provider() is not available on WP versions prior to 4.0.
43
+
44
+ = 1.8.23 (2017-01-12) =
45
  * Fix bug where long subject lines are missing a space.
46
  * Fix bug where {CAPTION} placeholder not being removed if no caption.
47
 
docs/Postie.txt CHANGED
@@ -5,8 +5,8 @@ Author URI: http://allens-home.com/
5
  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
9
- Stable tag: 1.8.23
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
5
  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.1
9
+ Stable tag: 1.8.24
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
lib/fCore.php CHANGED
@@ -428,7 +428,7 @@ class fCore {
428
  }
429
 
430
  $uname = php_uname('s');
431
- DebugEcho("checkOS: $uname");
432
 
433
  if (stripos($uname, 'linux') !== FALSE) {
434
  return in_array('linux', $oses);
428
  }
429
 
430
  $uname = php_uname('s');
431
+ //DebugEcho("checkOS: $uname");
432
 
433
  if (stripos($uname, 'linux') !== FALSE) {
434
  return in_array('linux', $oses);
lib/pSocketConnection.php CHANGED
@@ -65,9 +65,7 @@ class pSocketConnection extends pConnection {
65
  $response = $this->read(1);
66
  if (isset($response[0])) {
67
  if ($response[0][0] == '-') {
68
- throw new fConnectivityException(
69
- 'There was an error connecting to the POP3 server %1$s on port %2$s', $this->host, $this->port
70
- );
71
  }
72
  preg_match('#<[^@]+@[^>]+>#', $response[0], $match);
73
  }
@@ -128,7 +126,11 @@ class pSocketConnection extends pConnection {
128
  $command .= "\r\n";
129
  }
130
 
131
- DebugEcho("socket write: '$command'");
 
 
 
 
132
 
133
  $res = fwrite($this->socket, $command);
134
  if ($res == 1) {
65
  $response = $this->read(1);
66
  if (isset($response[0])) {
67
  if ($response[0][0] == '-') {
68
+ throw new fConnectivityException('There was an error connecting to the POP3 server %1$s on port %2$s', $this->host, $this->port);
 
 
69
  }
70
  preg_match('#<[^@]+@[^>]+>#', $response[0], $match);
71
  }
126
  $command .= "\r\n";
127
  }
128
 
129
+ if ((strpos($command, ' LOGIN') === false) & (strpos($command, 'APOP ') === false )) {
130
+ DebugEcho("socket write: " . trim($command));
131
+ } else {
132
+ DebugEcho("socket write: (login)");
133
+ }
134
 
135
  $res = fwrite($this->socket, $command);
136
  if ($res == 1) {
lib_autolink.php CHANGED
@@ -177,7 +177,8 @@ class PostieAutolink {
177
  DebugEcho("autolink_do: link=$link_url");
178
 
179
  $skip = false;
180
- if (!empty($oembed)) {
 
181
  $provider = $oembed->get_provider($link_url, array('discover' => false));
182
  if (false !== $provider) {
183
  DebugEcho("autolink_do: provider=$provider");
177
  DebugEcho("autolink_do: link=$link_url");
178
 
179
  $skip = false;
180
+
181
+ if (!empty($oembed) && method_exists($oembed, 'get_provider')) {
182
  $provider = $oembed->get_provider($link_url, array('discover' => false));
183
  if (false !== $provider) {
184
  DebugEcho("autolink_do: provider=$provider");
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1573517 2017-01-12 18:46:44Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -63,7 +63,6 @@ function postie_environment($force_display = false) {
63
  DebugEcho("PHP Version: " . phpversion(), $force_display);
64
  DebugEcho("OS: " . php_uname(), $force_display);
65
  DebugEcho("POSTIE_DEBUG: " . (IsDebugMode() ? "On" : "Off"), $force_display);
66
- DebugEcho("Time: " . date('Y-m-d H:i:s', time()) . " GMT", $force_display);
67
  DebugEcho("Error log: " . ini_get('error_log'), $force_display);
68
  DebugEcho("TMP dir: " . get_temp_dir(), $force_display);
69
  DebugEcho("Postie is in " . plugin_dir_path(__FILE__), $force_display);
@@ -457,7 +456,7 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
457
  DebugEcho("Replies will not be processed as comments");
458
  }
459
 
460
- if ($delay != 0 && $post_status == 'publish') {
461
  $post_status = 'future';
462
  }
463
 
@@ -511,7 +510,7 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
511
  'user_ID' => $postAuthorDetails['user_ID'],
512
  'email_author' => $postAuthorDetails['email'],
513
  'post_date' => $post_date,
514
- 'post_date_gmt' => $post_date_gmt,
515
  'post_content' => $content,
516
  'post_title' => $subject,
517
  'post_type' => $post_type, /* Added by Raam Dev <raam@raamdev.com> */
@@ -1430,7 +1429,7 @@ function tag_Status(&$content, $currentstatus) {
1430
  }
1431
 
1432
  function tag_Delay(&$content, $message_date = NULL, $offset = 0) {
1433
- DebugEcho("tag_Delay: $content");
1434
  $delay = 0;
1435
  $matches = array();
1436
  if (preg_match("/delay:(-?[0-9dhm]+)/iu", $content, $matches) && trim($matches[1])) {
@@ -1455,30 +1454,23 @@ function tag_Delay(&$content, $message_date = NULL, $offset = 0) {
1455
  $content = preg_replace("/delay:$matches[1]/i", "", $content);
1456
  }
1457
  if (empty($message_date)) {
1458
- $dateInSeconds = time();
1459
  } else {
1460
- //look to see if the date string has extra timezone info, e.g.: Date: Fri, 15 Apr 2016 14:39:03 -0400 (GMT-04:00)
1461
- $i = strpos($message_date, '(');
1462
- if ($i > 0) {
1463
- DebugEcho("tag_Delay: found extra TZ info: $message_date");
1464
- $message_date = substr($message_date, 0, $i - 1);
1465
- DebugEcho("tag_Delay: new date: $message_date");
1466
- }
1467
  $dateInSeconds = strtotime($message_date);
1468
  }
1469
- DebugEcho("tag_Delay: pre: $dateInSeconds");
1470
- $dateInSeconds += $delay;
1471
- DebugEcho("tag_Delay: post: $dateInSeconds");
1472
 
1473
- $post_date = gmdate('Y-m-d H:i:s', $dateInSeconds + ($offset * 3600));
1474
- $post_date_gmt = gmdate('Y-m-d H:i:s', $dateInSeconds);
1475
- DebugEcho("tag_Delay: post date: $post_date / $post_date_gmt (gmt) / $delay");
 
 
1476
 
1477
- return array($post_date, $post_date_gmt, $delay);
1478
  }
1479
 
1480
  /**
1481
- * This function takes the content of the message - looks for a subject at the begining surrounded by # and then removes that from the content
1482
  */
1483
  function tag_Subject($content, $defaultTitle) {
1484
  DebugEcho("tag_Subject: Looking for subject in email body");
@@ -2261,7 +2253,7 @@ function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
2261
  }
2262
 
2263
  if ($config['category_colon']) {
2264
- if (preg_match('/(.+): (.*)/', $subject, $matches)) { // <category>:<Subject>
2265
  $category = lookup_category($matches[1], $category_match);
2266
  if (!empty($category)) {
2267
  $found = true;
@@ -3042,12 +3034,17 @@ function postie_test_config() {
3042
  postie_environment(true);
3043
  ?>
3044
 
3045
- <h2>Clock Tests</h2>
3046
  <p>This shows what time it would be if you posted right now</p>
3047
  <?php
3048
- $content = "";
3049
- $data = tag_Delay($content, null, $config['time_offset']);
3050
- DebugEcho("Post time: $data[0]", true);
 
 
 
 
 
3051
  ?>
3052
  <h2>Encoding</h2>
3053
  <?php
@@ -3073,8 +3070,6 @@ function postie_test_config() {
3073
 
3074
  if (!$config['mail_server'] || !$config['mail_server_port'] || !$config['mail_userid']) {
3075
  EchoError("FAIL - server settings not complete");
3076
- } else {
3077
- DebugEcho("checking", true);
3078
  }
3079
 
3080
  $conninfo = postie_get_conn_info($config);
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1576747 2017-01-17 18:44:28Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
63
  DebugEcho("PHP Version: " . phpversion(), $force_display);
64
  DebugEcho("OS: " . php_uname(), $force_display);
65
  DebugEcho("POSTIE_DEBUG: " . (IsDebugMode() ? "On" : "Off"), $force_display);
 
66
  DebugEcho("Error log: " . ini_get('error_log'), $force_display);
67
  DebugEcho("TMP dir: " . get_temp_dir(), $force_display);
68
  DebugEcho("Postie is in " . plugin_dir_path(__FILE__), $force_display);
456
  DebugEcho("Replies will not be processed as comments");
457
  }
458
 
459
+ if ($delay > 0 && $post_status == 'publish') {
460
  $post_status = 'future';
461
  }
462
 
510
  'user_ID' => $postAuthorDetails['user_ID'],
511
  'email_author' => $postAuthorDetails['email'],
512
  'post_date' => $post_date,
513
+ //'post_date_gmt' => $post_date_gmt,
514
  'post_content' => $content,
515
  'post_title' => $subject,
516
  'post_type' => $post_type, /* Added by Raam Dev <raam@raamdev.com> */
1429
  }
1430
 
1431
  function tag_Delay(&$content, $message_date = NULL, $offset = 0) {
1432
+ //DebugEcho("tag_Delay: $content");
1433
  $delay = 0;
1434
  $matches = array();
1435
  if (preg_match("/delay:(-?[0-9dhm]+)/iu", $content, $matches) && trim($matches[1])) {
1454
  $content = preg_replace("/delay:$matches[1]/i", "", $content);
1455
  }
1456
  if (empty($message_date)) {
1457
+ $dateInSeconds = current_time('timestamp');
1458
  } else {
 
 
 
 
 
 
 
1459
  $dateInSeconds = strtotime($message_date);
1460
  }
1461
+ $delayeddateInSeconds = $dateInSeconds + $delay;
 
 
1462
 
1463
+ $delayed_date = date('Y-m-d H:i:s', $delayeddateInSeconds);
1464
+ $corrected_date = date('Y-m-d H:i:s', $delayeddateInSeconds + ($offset * 3600));
1465
+ DebugEcho("tag_Delay: delay: $delay");
1466
+ DebugEcho("tag_Delay: delayed date: $delayed_date");
1467
+ DebugEcho("tag_Delay: delayed with offset: $corrected_date");
1468
 
1469
+ return array($corrected_date, $delayed_date, $delay);
1470
  }
1471
 
1472
  /**
1473
+ * This function takes the content of the message - looks for a subject at the beginning surrounded by # and then removes that from the content
1474
  */
1475
  function tag_Subject($content, $defaultTitle) {
1476
  DebugEcho("tag_Subject: Looking for subject in email body");
2253
  }
2254
 
2255
  if ($config['category_colon']) {
2256
+ if (preg_match('/(.+):\s?(.*)/', $subject, $matches)) { // <category>: <Subject>
2257
  $category = lookup_category($matches[1], $category_match);
2258
  if (!empty($category)) {
2259
  $found = true;
3034
  postie_environment(true);
3035
  ?>
3036
 
3037
+ <h2>Clock</h2>
3038
  <p>This shows what time it would be if you posted right now</p>
3039
  <?php
3040
+ $wptz = get_option('gmt_offset');
3041
+ $wptzs = get_option('timezone_string');
3042
+ DebugEcho("Wordpress timezone: $wptzs ($wptz)", true);
3043
+ DebugEcho("Current time: " . current_time('mysql'), true);
3044
+ DebugEcho("Current time (gmt): " . current_time('mysql', 1), true);
3045
+ DebugEcho("Postie time correction: {$config['time_offset']}", true);
3046
+ $offsetdate = strtotime(current_time('mysql')) + $config['time_offset'];
3047
+ DebugEcho("Post time: " . date('Y-m-d H:i:s', $offsetdate), true);
3048
  ?>
3049
  <h2>Encoding</h2>
3050
  <?php
3070
 
3071
  if (!$config['mail_server'] || !$config['mail_server_port'] || !$config['mail_userid']) {
3072
  EchoError("FAIL - server settings not complete");
 
 
3073
  }
3074
 
3075
  $conninfo = postie_get_conn_info($config);
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.23
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1573518 2017-01-12 18:47:59Z 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.23');
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.24
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1578921 2017-01-20 20:43:27Z 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.24');
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.7.1
9
- Stable tag: 1.8.23
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -207,6 +207,9 @@ More info at http://PostiePlugin.com/
207
  Please visit our FAQ page at <a href="http://postieplugin.com/faq/">http://postieplugin.com/faq/</a>
208
  == Upgrade Notice ==
209
 
 
 
 
210
  = 1.8.0 =
211
  The php-imap library has been replaced with logic based on Flourish fMailbox et al, there are some differences in the structure of the mail header array. This affects the
212
  postie_filter_email3 and postie_post_before filters.
@@ -239,6 +242,12 @@ All script, style and body tags are stripped from html emails.
239
  Attachments are now processed in the order they were attached.
240
 
241
  == CHANGELOG ==
 
 
 
 
 
 
242
  = 1.8.23 (2017-01-12) =
243
  * Fix bug where long subject lines are missing a space.
244
  * Fix bug where {CAPTION} placeholder not being removed if no caption.
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.7.1
9
+ Stable tag: 1.8.24
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
207
  Please visit our FAQ page at <a href="http://postieplugin.com/faq/">http://postieplugin.com/faq/</a>
208
  == Upgrade Notice ==
209
 
210
+ = 1.8.23 =
211
+ Postie now respects the blog timezone, this may require you to change the "Postie Time Correction" setting.
212
+
213
  = 1.8.0 =
214
  The php-imap library has been replaced with logic based on Flourish fMailbox et al, there are some differences in the structure of the mail header array. This affects the
215
  postie_filter_email3 and postie_post_before filters.
242
  Attachments are now processed in the order they were attached.
243
 
244
  == CHANGELOG ==
245
+ = 1.8.24 (2017-01-20) =
246
+ * Fix bug where debug output was displaying plaintext passwords.
247
+ * Fix bug where categories specified with a colon required a space after the colon.
248
+ * Postie now works off blog time rather than GMT.
249
+ * Fix bug where oEmbed::get_provider() is not available on WP versions prior to 4.0.
250
+
251
  = 1.8.23 (2017-01-12) =
252
  * Fix bug where long subject lines are missing a space.
253
  * Fix bug where {CAPTION} placeholder not being removed if no caption.