Postie - Version 1.9.46

Version Description

(2020-04-11) * escape IMAP password * fix logging in get_parent_postid * ensure any modification by shortcode are retained

Download this release

Release Info

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

Code changes from version 1.9.45 to 1.9.46

docs/Changes.txt CHANGED
@@ -35,6 +35,11 @@ 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.45 (2020-03-29) =
39
  * Fix email notification bug
40
 
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.46 (2020-04-11)
39
+ * escape IMAP password
40
+ * fix logging in get_parent_postid
41
+ * ensure any modification by shortcode are retained
42
+
43
  = 1.9.45 (2020-03-29) =
44
  * Fix email notification bug
45
 
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.4
10
- Stable tag: 1.9.45
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.4
10
+ Stable tag: 1.9.46
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
lib/pSocketConnection.php CHANGED
@@ -57,7 +57,7 @@ class pSocketConnection extends pConnection {
57
  } while ($res === 0);
58
  }
59
  }
60
- $response = $this->write('LOGIN ' . $this->username . ' ' . $this->password);
61
  if (!$response || !preg_match('#^[^ ]+\s+OK#', $response[count($response) - 1])) {
62
  throw new fValidationException('IMAP - Could not connect to %1$s server %2$s on port %3$s. %4$s', strtoupper($this->type), $this->host, $this->port, print_r($response, true));
63
  }
57
  } while ($res === 0);
58
  }
59
  }
60
+ $response = $this->write('LOGIN ' . $this->username . ' "' . $this->password . '"');
61
  if (!$response || !preg_match('#^[^ ]+\s+OK#', $response[count($response) - 1])) {
62
  throw new fValidationException('IMAP - Could not connect to %1$s server %2$s on port %3$s. %4$s', strtoupper($this->type), $this->host, $this->port, print_r($response, true));
63
  }
postie-message.php CHANGED
@@ -75,10 +75,14 @@ class PostieMessage {
75
  $replace = array('"', "'", "'", '"', '"', "'", '"');
76
  $content = str_replace($char, $replace, $content);
77
 
78
- $postie_post['post_content'] = do_shortcode($content);
 
 
79
 
80
  //restore the WP shortcodes
81
  $shortcode_tags = $tmpshortcode;
 
 
82
  }
83
 
84
  function preprocess() {
@@ -97,7 +101,7 @@ class PostieMessage {
97
  DebugDump($this->post_id->get_error_data());
98
  $this->email_error("preprocess: wp_insert_post failed creating placeholder", $this->post_id->get_error_message());
99
  }
100
- DebugEcho("preprocess: Done");
101
  }
102
 
103
  function process() {
@@ -128,9 +132,12 @@ class PostieMessage {
128
 
129
  $details = $this->create_post();
130
 
131
- $this->do_shortcodes('postie_register_shortcode_pre', $details);
 
 
 
132
 
133
- DebugEcho("process: filter: Before postie_post_before");
134
  $details = apply_filters('postie_post', $details);
135
  $details = apply_filters('postie_post_before', $details, $this->email['headers']);
136
  DebugEcho("process: filter: After postie_post_before");
@@ -272,7 +279,6 @@ class PostieMessage {
272
  } else {
273
  DebugEcho("validate_poster: $from is not user of blog " . get_current_blog_id());
274
  EchoError('Invalid sender: ' . htmlentities($from) . "! Not adding email!");
275
-
276
  }
277
  }
278
  }
@@ -1369,11 +1375,11 @@ class PostieMessage {
1369
  global $wpdb;
1370
 
1371
  $id = NULL;
1372
- DebugEcho("GetParentPostForReply: Looking for parent '$subject'");
1373
  // see if subject starts with Re:
1374
  $matches = array();
1375
  if (preg_match("/(^Re:)(.*)/iu", $subject, $matches)) {
1376
- DebugEcho("GetParentPostForReply: Re: detected");
1377
  $subject = trim($matches[2]);
1378
  // strip out category info into temporary variable
1379
  $tmpSubject = $subject;
@@ -1388,21 +1394,20 @@ class PostieMessage {
1388
  preg_match("/-(.[^-]*)$/", $tmpSubject, $tmpSubject_matches);
1389
  $tmpSubject = trim($tmpSubject_matches[1]);
1390
  }
1391
- DebugEcho("GetParentPostForReply: tmpSubject: $tmpSubject");
1392
  $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s AND post_status = 'publish' AND comment_status = 'open' AND post_type=%s ORDER BY post_date DESC";
1393
- if ($id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, $tmpSubject, $this->config[PostieConfigOptions::PostType]))) {
1394
- if (!empty($id)) {
1395
- DebugEcho("GetParentPostForReply: id: $id");
1396
- } else {
1397
- DebugEcho("GetParentPostForReply: No parent id found");
1398
- }
1399
  }
1400
  } else {
1401
- DebugEcho("GetParentPostForReply: No parent found");
1402
  }
1403
 
1404
  $id = apply_filters('postie_parent_post', $id, $this->email);
1405
- DebugEcho("GetParentPostForReply: After postie_parent_post: $id");
1406
 
1407
  return $id;
1408
  }
75
  $replace = array('"', "'", "'", '"', '"', "'", '"');
76
  $content = str_replace($char, $replace, $content);
77
 
78
+ $newcontent = do_shortcode($content);
79
+ $details = $postie_post; // need to copy values back in case a shortcode modified them
80
+ $details['post_content'] = $newcontent;
81
 
82
  //restore the WP shortcodes
83
  $shortcode_tags = $tmpshortcode;
84
+
85
+ return $details;
86
  }
87
 
88
  function preprocess() {
101
  DebugDump($this->post_id->get_error_data());
102
  $this->email_error("preprocess: wp_insert_post failed creating placeholder", $this->post_id->get_error_message());
103
  }
104
+ DebugEcho('preprocess: Done');
105
  }
106
 
107
  function process() {
132
 
133
  $details = $this->create_post();
134
 
135
+ DebugEcho('process: shortcodes: Before postie_register_shortcode_pre');
136
+ $details = $this->do_shortcodes('postie_register_shortcode_pre', $details);
137
+ DebugEcho("process: shortcodes: After postie_register_shortcode_pre");
138
+ DebugDump($details);
139
 
140
+ DebugEcho('process: filter: Before postie_post_before');
141
  $details = apply_filters('postie_post', $details);
142
  $details = apply_filters('postie_post_before', $details, $this->email['headers']);
143
  DebugEcho("process: filter: After postie_post_before");
279
  } else {
280
  DebugEcho("validate_poster: $from is not user of blog " . get_current_blog_id());
281
  EchoError('Invalid sender: ' . htmlentities($from) . "! Not adding email!");
 
282
  }
283
  }
284
  }
1375
  global $wpdb;
1376
 
1377
  $id = NULL;
1378
+ DebugEcho("get_parent_postid: Looking for parent '$subject'");
1379
  // see if subject starts with Re:
1380
  $matches = array();
1381
  if (preg_match("/(^Re:)(.*)/iu", $subject, $matches)) {
1382
+ DebugEcho("get_parent_postid: Re: detected");
1383
  $subject = trim($matches[2]);
1384
  // strip out category info into temporary variable
1385
  $tmpSubject = $subject;
1394
  preg_match("/-(.[^-]*)$/", $tmpSubject, $tmpSubject_matches);
1395
  $tmpSubject = trim($tmpSubject_matches[1]);
1396
  }
1397
+ DebugEcho("get_parent_postid: tmpSubject: $tmpSubject");
1398
  $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s AND post_status = 'publish' AND comment_status = 'open' AND post_type=%s ORDER BY post_date DESC";
1399
+ $id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, $tmpSubject, $this->config[PostieConfigOptions::PostType]));
1400
+ if (empty($id)) {
1401
+ DebugEcho("get_parent_postid: No parent id found");
1402
+ } else {
1403
+ DebugEcho("get_parent_postid: id: $id");
 
1404
  }
1405
  } else {
1406
+ DebugEcho("get_parent_postid: No parent found");
1407
  }
1408
 
1409
  $id = apply_filters('postie_parent_post', $id, $this->email);
1410
+ DebugEcho("get_parent_postid: After postie_parent_post: $id");
1411
 
1412
  return $id;
1413
  }
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.45
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 2270347 2020-03-29 19:37:06Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
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.46
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 2281637 2020-04-11 19:22:50Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
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.4
10
- Stable tag: 1.9.45
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -107,6 +107,11 @@ 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.45 (2020-03-29) =
111
  * Fix email notification bug
112
 
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 5.4
10
+ Stable tag: 1.9.46
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.46 (2020-04-11)
111
+ * escape IMAP password
112
+ * fix logging in get_parent_postid
113
+ * ensure any modification by shortcode are retained
114
+
115
  = 1.9.45 (2020-03-29) =
116
  * Fix email notification bug
117