Postie - Version 1.7.18

Version Description

(2015-10-13) = * Fix bug where linkify was messing up CID reference

Download this release

Release Info

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

Code changes from version 1.7.17 to 1.7.18

Files changed (5) hide show
  1. docs/Changes.txt +3 -0
  2. docs/Postie.txt +1 -1
  3. postie-functions.php +134 -134
  4. postie.php +3 -3
  5. readme.txt +4 -1
docs/Changes.txt CHANGED
@@ -27,6 +27,9 @@ All script, style and body tags are stripped from html emails.
27
  Attachments are now processed in the order they were attached.
28
 
29
  == CHANGELOG ==
 
 
 
30
  = 1.7.17 (2015-10-12) =
31
  * New action, postie_log_error
32
  * New action, postie_log_debug
27
  Attachments are now processed in the order they were attached.
28
 
29
  == CHANGELOG ==
30
+ = 1.7.18 (2015-10-13) =
31
+ * Fix bug where linkify was messing up CID reference
32
+
33
  = 1.7.17 (2015-10-12) =
34
  * New action, postie_log_error
35
  * New action, postie_log_debug
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.3.1
9
- Stable tag: 1.7.17
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.3.1
9
+ Stable tag: 1.7.18
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1264439 2015-10-12 21:21:59Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -296,6 +296,12 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
296
  DebugEcho("post status: $content");
297
  }
298
 
 
 
 
 
 
 
299
  if ($config['converturls']) {
300
  $content = filter_Videos($content, $config['shortcode']); //videos first so linkify doesn't mess with them
301
  if ($fulldebug) {
@@ -313,11 +319,6 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
313
  DebugEcho("post vodafone: $content");
314
  }
315
 
316
- filter_ReplaceImageCIDs($content, $attachments, $config);
317
- if ($fulldebug) {
318
- DebugEcho("post cid: $content");
319
- }
320
-
321
  $customImages = tag_CustomImageField($content, $attachments, $config);
322
  if ($fulldebug) {
323
  DebugEcho("post custom: $content");
@@ -3503,17 +3504,17 @@ function postie_test_config() {
3503
  ?>
3504
  <div class="wrap">
3505
  <h1>Postie Configuration Test</h1>
3506
- <?php
3507
- postie_environment();
3508
- ?>
3509
 
3510
  <h2>Clock Tests</h2>
3511
  <p>This shows what time it would be if you posted right now</p>
3512
- <?php
3513
- $content = "";
3514
- $data = tag_Delay($content, null, $config['time_offset']);
3515
- EchoInfo("Post time: $data[0]");
3516
- ?>
3517
  <h2>Encoding</h2>
3518
  <?php
3519
  EchoInfo("default_charset: " . ini_get('default_charset'));
@@ -3530,146 +3531,145 @@ function postie_test_config() {
3530
  ?>
3531
  <h2>Connect to Mail Host</h2>
3532
 
3533
- <?php
3534
- if (!$config['mail_server'] || !$config['mail_server_port'] || !$config['mail_userid']) {
3535
- EchoInfo("FAIL - server settings not complete");
3536
- } else {
3537
- DebugEcho("checking");
3538
- }
3539
 
3540
- switch (strtolower($config["input_protocol"])) {
3541
- case 'imap':
3542
- case 'imap-ssl':
3543
- case 'pop3-ssl':
3544
- if (!HasIMAPSupport()) {
3545
- EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
3546
- } else {
3547
- require_once("postieIMAP.php");
3548
- $mail_server = &PostieIMAP::Factory($config["input_protocol"]);
3549
- if ($config['email_tls']) {
3550
- $mail_server->TLSOn();
3551
- }
3552
- if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) {
3553
- EchoInfo("Unable to connect. The server said:");
3554
- EchoInfo($mail_server->error());
3555
  } else {
3556
- EchoInfo("Successful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
3557
- EchoInfo("# of waiting messages: " . $mail_server->getNumberOfMessages());
3558
- $mail_server->disconnect();
3559
- }
3560
- }
3561
- break;
3562
- case 'pop3':
3563
- default:
3564
- require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
3565
- $pop3 = new POP3();
3566
- if (defined('POSTIE_DEBUG')) {
3567
- $pop3->DEBUG = POSTIE_DEBUG;
3568
- }
3569
- if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
3570
- EchoInfo("Unable to connect. The server said:" . $pop3->ERROR);
3571
- } else {
3572
- EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
3573
- $msgs = $pop3->login($config["mail_userid"], $config["mail_password"]);
3574
- if ($msgs === false) {
3575
- //workaround for bug reported here Apr 12, 2013
3576
- //https://sourceforge.net/tracker/?func=detail&atid=100311&aid=3610701&group_id=311
3577
- //originally repoted here:
3578
- //https://core.trac.wordpress.org/ticket/10587
3579
- if (empty($pop3->ERROR)) {
3580
- EchoInfo("No waiting messages");
3581
  } else {
3582
- EchoInfo("Unable to login. The server said:" . $pop3->ERROR);
 
 
3583
  }
 
 
 
 
 
 
 
 
 
 
 
3584
  } else {
3585
- EchoInfo("# of waiting messages: $msgs");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3586
  }
3587
- $pop3->quit();
3588
- }
3589
- break;
3590
- }
3591
- ?>
3592
  </div>
3593
- <?php
3594
- }
3595
 
3596
- function postie_get_mail() {
3597
- require_once (plugin_dir_path(__FILE__) . 'mimedecode.php');
3598
- if (!function_exists('file_get_html')) {
3599
- require_once (plugin_dir_path(__FILE__) . 'simple_html_dom.php');
3600
- }
3601
 
3602
- $config = config_Read();
3603
- if (true == $config['postie_log_error'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
3604
- add_action('postie_log_error', 'postie_log_error');
3605
- }
3606
- if (true == $config['postie_log_debug'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
3607
- add_action('postie_log_debug', 'postie_log_debug');
3608
- }
3609
 
3610
- EchoInfo("Starting mail fetch");
3611
- postie_environment();
3612
- $wp_content_path = dirname(dirname(dirname(__FILE__)));
3613
- DebugEcho("wp_content_path: $wp_content_path");
3614
- if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
3615
- DebugEcho("found filterPostie.php in $wp_content_path");
3616
- include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
3617
- }
3618
 
3619
- if (has_filter('postie_post')) {
3620
- echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
3621
- }
3622
 
3623
- $test_email = null;
3624
- if (!array_key_exists('maxemails', $config)) {
3625
- $config['maxemails'] = 0;
3626
- }
3627
 
3628
- $emails = FetchMail($config['mail_server'], $config['mail_server_port'], $config['mail_userid'], $config['mail_password'], $config['input_protocol'], $config['time_offset'], $test_email, $config['delete_mail_after_processing'], $config['maxemails'], $config['email_tls']);
3629
- $message = 'Done.';
3630
 
3631
- EchoInfo(sprintf(__("There are %d messages to process", 'postie'), count($emails)));
3632
 
3633
- if (function_exists('memory_get_usage')) {
3634
- DebugEcho(__("memory at start of email processing:", 'postie') . memory_get_usage());
3635
- }
3636
 
3637
- DebugDump($config);
3638
 
3639
- //loop through messages
3640
- $message_number = 0;
3641
- foreach ($emails as $email) {
3642
- $message_number++;
3643
- DebugEcho("$message_number: ------------------------------------");
3644
- //sanity check to see if there is any info in the message
3645
- if ($email == NULL) {
3646
- $message = __('Dang, message is empty!', 'postie');
3647
- EchoInfo("$message_number: $message");
3648
- continue;
3649
- } else if (($config['ignore_mail_state'] == false) && ( $email == 'already read')) {
3650
- $message = __("Message is already marked 'read'.", 'postie');
3651
- EchoInfo("$message_number: $message");
3652
- continue;
3653
- }
3654
 
3655
- $mimeDecodedEmail = DecodeMIMEMail($email);
3656
 
3657
- DebugEmailOutput($email, $mimeDecodedEmail);
3658
 
3659
- //Check poster to see if a valid person
3660
- $poster = ValidatePoster($mimeDecodedEmail, $config);
3661
- if (!empty($poster)) {
3662
- PostEmail($poster, $mimeDecodedEmail, $config);
3663
- EchoInfo("$message_number: processed");
3664
- } else {
3665
- EchoInfo("Ignoring email - not authorized.");
3666
- }
3667
- flush();
3668
  }
3669
- EchoInfo("Mail fetch complete, $message_number emails");
 
 
3670
 
3671
- if (function_exists('memory_get_usage')) {
3672
- DebugEcho("memory at end of email processing:" . memory_get_usage());
3673
- }
3674
  }
3675
-
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1265241 2015-10-13 20:16:04Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
296
  DebugEcho("post status: $content");
297
  }
298
 
299
+ //handle CID before linkify
300
+ filter_ReplaceImageCIDs($content, $attachments, $config);
301
+ if ($fulldebug) {
302
+ DebugEcho("post cid: $content");
303
+ }
304
+
305
  if ($config['converturls']) {
306
  $content = filter_Videos($content, $config['shortcode']); //videos first so linkify doesn't mess with them
307
  if ($fulldebug) {
319
  DebugEcho("post vodafone: $content");
320
  }
321
 
 
 
 
 
 
322
  $customImages = tag_CustomImageField($content, $attachments, $config);
323
  if ($fulldebug) {
324
  DebugEcho("post custom: $content");
3504
  ?>
3505
  <div class="wrap">
3506
  <h1>Postie Configuration Test</h1>
3507
+ <?php
3508
+ postie_environment();
3509
+ ?>
3510
 
3511
  <h2>Clock Tests</h2>
3512
  <p>This shows what time it would be if you posted right now</p>
3513
+ <?php
3514
+ $content = "";
3515
+ $data = tag_Delay($content, null, $config['time_offset']);
3516
+ EchoInfo("Post time: $data[0]");
3517
+ ?>
3518
  <h2>Encoding</h2>
3519
  <?php
3520
  EchoInfo("default_charset: " . ini_get('default_charset'));
3531
  ?>
3532
  <h2>Connect to Mail Host</h2>
3533
 
3534
+ <?php
3535
+ if (!$config['mail_server'] || !$config['mail_server_port'] || !$config['mail_userid']) {
3536
+ EchoInfo("FAIL - server settings not complete");
3537
+ } else {
3538
+ DebugEcho("checking");
3539
+ }
3540
 
3541
+ switch (strtolower($config["input_protocol"])) {
3542
+ case 'imap':
3543
+ case 'imap-ssl':
3544
+ case 'pop3-ssl':
3545
+ if (!HasIMAPSupport()) {
3546
+ EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
 
 
 
 
 
 
 
 
 
3547
  } else {
3548
+ require_once("postieIMAP.php");
3549
+ $mail_server = &PostieIMAP::Factory($config["input_protocol"]);
3550
+ if ($config['email_tls']) {
3551
+ $mail_server->TLSOn();
3552
+ }
3553
+ if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) {
3554
+ EchoInfo("Unable to connect. The server said:");
3555
+ EchoInfo($mail_server->error());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3556
  } else {
3557
+ EchoInfo("Successful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
3558
+ EchoInfo("# of waiting messages: " . $mail_server->getNumberOfMessages());
3559
+ $mail_server->disconnect();
3560
  }
3561
+ }
3562
+ break;
3563
+ case 'pop3':
3564
+ default:
3565
+ require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
3566
+ $pop3 = new POP3();
3567
+ if (defined('POSTIE_DEBUG')) {
3568
+ $pop3->DEBUG = POSTIE_DEBUG;
3569
+ }
3570
+ if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
3571
+ EchoInfo("Unable to connect. The server said:" . $pop3->ERROR);
3572
  } else {
3573
+ EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
3574
+ $msgs = $pop3->login($config["mail_userid"], $config["mail_password"]);
3575
+ if ($msgs === false) {
3576
+ //workaround for bug reported here Apr 12, 2013
3577
+ //https://sourceforge.net/tracker/?func=detail&atid=100311&aid=3610701&group_id=311
3578
+ //originally repoted here:
3579
+ //https://core.trac.wordpress.org/ticket/10587
3580
+ if (empty($pop3->ERROR)) {
3581
+ EchoInfo("No waiting messages");
3582
+ } else {
3583
+ EchoInfo("Unable to login. The server said:" . $pop3->ERROR);
3584
+ }
3585
+ } else {
3586
+ EchoInfo("# of waiting messages: $msgs");
3587
+ }
3588
+ $pop3->quit();
3589
  }
3590
+ break;
3591
+ }
3592
+ ?>
 
 
3593
  </div>
3594
+ <?php
3595
+ }
3596
 
3597
+ function postie_get_mail() {
3598
+ require_once (plugin_dir_path(__FILE__) . 'mimedecode.php');
3599
+ if (!function_exists('file_get_html')) {
3600
+ require_once (plugin_dir_path(__FILE__) . 'simple_html_dom.php');
3601
+ }
3602
 
3603
+ $config = config_Read();
3604
+ if (true == $config['postie_log_error'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
3605
+ add_action('postie_log_error', 'postie_log_error');
3606
+ }
3607
+ if (true == $config['postie_log_debug'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
3608
+ add_action('postie_log_debug', 'postie_log_debug');
3609
+ }
3610
 
3611
+ EchoInfo("Starting mail fetch");
3612
+ postie_environment();
3613
+ $wp_content_path = dirname(dirname(dirname(__FILE__)));
3614
+ DebugEcho("wp_content_path: $wp_content_path");
3615
+ if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
3616
+ DebugEcho("found filterPostie.php in $wp_content_path");
3617
+ include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
3618
+ }
3619
 
3620
+ if (has_filter('postie_post')) {
3621
+ echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
3622
+ }
3623
 
3624
+ $test_email = null;
3625
+ if (!array_key_exists('maxemails', $config)) {
3626
+ $config['maxemails'] = 0;
3627
+ }
3628
 
3629
+ $emails = FetchMail($config['mail_server'], $config['mail_server_port'], $config['mail_userid'], $config['mail_password'], $config['input_protocol'], $config['time_offset'], $test_email, $config['delete_mail_after_processing'], $config['maxemails'], $config['email_tls']);
3630
+ $message = 'Done.';
3631
 
3632
+ EchoInfo(sprintf(__("There are %d messages to process", 'postie'), count($emails)));
3633
 
3634
+ if (function_exists('memory_get_usage')) {
3635
+ DebugEcho(__("memory at start of email processing:", 'postie') . memory_get_usage());
3636
+ }
3637
 
3638
+ DebugDump($config);
3639
 
3640
+ //loop through messages
3641
+ $message_number = 0;
3642
+ foreach ($emails as $email) {
3643
+ $message_number++;
3644
+ DebugEcho("$message_number: ------------------------------------");
3645
+ //sanity check to see if there is any info in the message
3646
+ if ($email == NULL) {
3647
+ $message = __('Dang, message is empty!', 'postie');
3648
+ EchoInfo("$message_number: $message");
3649
+ continue;
3650
+ } else if (($config['ignore_mail_state'] == false) && ( $email == 'already read')) {
3651
+ $message = __("Message is already marked 'read'.", 'postie');
3652
+ EchoInfo("$message_number: $message");
3653
+ continue;
3654
+ }
3655
 
3656
+ $mimeDecodedEmail = DecodeMIMEMail($email);
3657
 
3658
+ DebugEmailOutput($email, $mimeDecodedEmail);
3659
 
3660
+ //Check poster to see if a valid person
3661
+ $poster = ValidatePoster($mimeDecodedEmail, $config);
3662
+ if (!empty($poster)) {
3663
+ PostEmail($poster, $mimeDecodedEmail, $config);
3664
+ EchoInfo("$message_number: processed");
3665
+ } else {
3666
+ EchoInfo("Ignoring email - not authorized.");
 
 
3667
  }
3668
+ flush();
3669
+ }
3670
+ EchoInfo("Mail fetch complete, $message_number emails");
3671
 
3672
+ if (function_exists('memory_get_usage')) {
3673
+ DebugEcho("memory at end of email processing:" . memory_get_usage());
 
3674
  }
3675
+ }
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Signifigantly upgrades the Post by Email features of Word Press.
7
- Version: 1.7.17
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,12 +28,12 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1264467 2015-10-12 21:56:58Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
35
 
36
- define('POSTIE_VERSION', '1.7.17');
37
  define("POSTIE_ROOT", dirname(__FILE__));
38
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
39
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Signifigantly upgrades the Post by Email features of Word Press.
7
+ Version: 1.7.18
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1265241 2015-10-13 20:16:04Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
35
 
36
+ define('POSTIE_VERSION', '1.7.18');
37
  define("POSTIE_ROOT", dirname(__FILE__));
38
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
39
 
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.3.1
9
- Stable tag: 1.7.17
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -235,6 +235,9 @@ All script, style and body tags are stripped from html emails.
235
  Attachments are now processed in the order they were attached.
236
 
237
  == CHANGELOG ==
 
 
 
238
  = 1.7.17 (2015-10-12) =
239
  * New action, postie_log_error
240
  * New action, postie_log_debug
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.3.1
9
+ Stable tag: 1.7.18
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
235
  Attachments are now processed in the order they were attached.
236
 
237
  == CHANGELOG ==
238
+ = 1.7.18 (2015-10-13) =
239
+ * Fix bug where linkify was messing up CID reference
240
+
241
  = 1.7.17 (2015-10-12) =
242
  * New action, postie_log_error
243
  * New action, postie_log_debug