Version Description
(2018-07-12) = * log functions that use Postie filters * remove empty tags
Download this release
Release Info
Developer | WayneAllen |
Plugin | Postie |
Version | 1.9.24 |
Comparing to | |
See all releases |
Code changes from version 1.9.23 to 1.9.24
- docs/Changes.txt +4 -0
- docs/Postie.txt +1 -1
- postie-tags.php +1 -1
- postie.class.php +57 -19
- postie.php +3 -3
- readme.txt +5 -1
docs/Changes.txt
CHANGED
@@ -35,6 +35,10 @@ 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.23 (2018-05-28) =
|
39 |
* Fix issue when attachment doesn't conform to MIME standard
|
40 |
|
35 |
Attachments are now processed in the order they were attached.
|
36 |
|
37 |
== CHANGELOG ==
|
38 |
+
= 1.9.24 (2018-07-12) =
|
39 |
+
* log functions that use Postie filters
|
40 |
+
* remove empty tags
|
41 |
+
|
42 |
= 1.9.23 (2018-05-28) =
|
43 |
* Fix issue when attachment doesn't conform to MIME standard
|
44 |
|
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: 4.9
|
10 |
-
Stable tag: 1.9.
|
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: 4.9
|
10 |
+
Stable tag: 1.9.24
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
postie-tags.php
CHANGED
@@ -448,7 +448,7 @@ function tag_Tags(&$content, $config) {
|
|
448 |
if (!empty($matches[1])) {
|
449 |
DebugEcho("tag_Tags: Found tags: $matches[1]");
|
450 |
$content = str_replace($matches[0], "", $content);
|
451 |
-
$post_tags = array_merge($post_tags, preg_split("/,\s*/", trim($matches[1])));
|
452 |
}
|
453 |
}
|
454 |
}
|
448 |
if (!empty($matches[1])) {
|
449 |
DebugEcho("tag_Tags: Found tags: $matches[1]");
|
450 |
$content = str_replace($matches[0], "", $content);
|
451 |
+
$post_tags = array_merge($post_tags, array_filter(preg_split("/,\s*/", trim($matches[1]))));
|
452 |
}
|
453 |
}
|
454 |
}
|
postie.class.php
CHANGED
@@ -50,8 +50,6 @@ class Postie {
|
|
50 |
DebugEcho("doing postie_session_start");
|
51 |
do_action('postie_session_start');
|
52 |
|
53 |
-
$this->postie_environment();
|
54 |
-
|
55 |
$wp_content_path = dirname(dirname(dirname(__FILE__)));
|
56 |
DebugEcho("wp_content_path: $wp_content_path");
|
57 |
if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . 'filterPostie.php')) {
|
@@ -59,6 +57,8 @@ class Postie {
|
|
59 |
include_once ($wp_content_path . DIRECTORY_SEPARATOR . 'filterPostie.php');
|
60 |
}
|
61 |
|
|
|
|
|
62 |
if (function_exists('memory_get_usage')) {
|
63 |
DebugEcho(__("memory at start of email processing: ", 'postie') . memory_get_usage());
|
64 |
}
|
@@ -839,8 +839,9 @@ class Postie {
|
|
839 |
|
840 |
function save_post($details, $isReply) {
|
841 |
$post_ID = 0;
|
842 |
-
$details['post_content'] = str_replace('\\', '\\\\', $details['post_content'])
|
843 |
if (!$isReply) {
|
|
|
844 |
$post_ID = wp_insert_post($details, true);
|
845 |
if (is_wp_error($post_ID)) {
|
846 |
EchoError("PostToDB Error: " . $post_ID->get_error_message());
|
@@ -851,8 +852,11 @@ class Postie {
|
|
851 |
$this->notify_error("Failed to create {$details['post_type']}: {$details['post_title']}", "Error: " . $post_ID->get_error_message() . "\n\n" . $details['post_content']);
|
852 |
|
853 |
$post_ID = null;
|
|
|
|
|
854 |
}
|
855 |
} else {
|
|
|
856 |
$comment = array(
|
857 |
'comment_author' => $details['comment_author'],
|
858 |
'comment_post_ID' => $details['ID'],
|
@@ -1220,7 +1224,9 @@ class Postie {
|
|
1220 |
// then it should be removed
|
1221 |
if (!$is_reply) {
|
1222 |
wp_delete_post($post_id);
|
1223 |
-
DebugEcho("postie_post filter cleared the post, not saving. deleted $post_id");
|
|
|
|
|
1224 |
}
|
1225 |
} else {
|
1226 |
$postid = $this->save_post($details, $is_reply);
|
@@ -1235,6 +1241,7 @@ class Postie {
|
|
1235 |
}
|
1236 |
}
|
1237 |
|
|
|
1238 |
$this->email_notify($mimeDecodedEmail, $recipients, $postid);
|
1239 |
|
1240 |
if ($this->is_debugmode()) {
|
@@ -1380,7 +1387,7 @@ class Postie {
|
|
1380 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('from', $mimeDecodedEmail['headers'])) {
|
1381 |
$from = $mimeDecodedEmail['headers']['from']['mailbox'] . '@' . $mimeDecodedEmail['headers']['from']['host'];
|
1382 |
$from = apply_filters('postie_filter_email', $from);
|
1383 |
-
DebugEcho("
|
1384 |
|
1385 |
$toEmail = '';
|
1386 |
if (isset($mimeDecodedEmail['headers']['to'])) {
|
@@ -1393,15 +1400,15 @@ class Postie {
|
|
1393 |
}
|
1394 |
|
1395 |
$from = apply_filters("postie_filter_email2", $from, $toEmail, $replytoEmail);
|
1396 |
-
DebugEcho("
|
1397 |
} else {
|
1398 |
-
DebugEcho("No 'from' header found");
|
1399 |
DebugDump($mimeDecodedEmail['headers']);
|
1400 |
}
|
1401 |
|
1402 |
if (array_key_exists("headers", $mimeDecodedEmail)) {
|
1403 |
$from = apply_filters("postie_filter_email3", $from, $mimeDecodedEmail['headers']);
|
1404 |
-
DebugEcho("
|
1405 |
}
|
1406 |
|
1407 |
$resentFrom = "";
|
@@ -1412,13 +1419,13 @@ class Postie {
|
|
1412 |
//See if the email address is one of the special authorized ones
|
1413 |
$user_ID = '';
|
1414 |
if (!empty($from)) {
|
1415 |
-
DebugEcho("Confirming Access For $from ");
|
1416 |
$user = get_user_by('email', $from);
|
1417 |
if ($user !== false) {
|
1418 |
if (is_user_member_of_blog($user->ID)) {
|
1419 |
$user_ID = $user->ID;
|
1420 |
} else {
|
1421 |
-
DebugEcho("$from is not user of blog " . get_current_blog_id());
|
1422 |
}
|
1423 |
}
|
1424 |
}
|
@@ -1426,31 +1433,31 @@ class Postie {
|
|
1426 |
if (!empty($user_ID)) {
|
1427 |
$user = new WP_User($user_ID);
|
1428 |
if ($user->has_cap("post_via_postie")) {
|
1429 |
-
DebugEcho("$user_ID has 'post_via_postie' permissions");
|
1430 |
$poster = $user_ID;
|
1431 |
|
1432 |
-
DebugEcho("
|
1433 |
$poster = apply_filters("postie_author", $poster);
|
1434 |
-
DebugEcho("
|
1435 |
} else {
|
1436 |
-
DebugEcho("$user_ID does not have 'post_via_postie' permissions");
|
1437 |
$user_ID = "";
|
1438 |
}
|
1439 |
}
|
1440 |
|
1441 |
if (empty($user_ID) && ($config['turn_authorization_off'] || $this->is_email_authorized($from, $config['authorized_addresses']) || $this->is_email_authorized($resentFrom, $config['authorized_addresses']))) {
|
1442 |
-
DebugEcho("
|
1443 |
$user = get_user_by('login', $config['admin_username']);
|
1444 |
if ($user === false) {
|
1445 |
EchoError("Your 'Default Poster' setting '" . $config['admin_username'] . "' is not a valid WordPress user (2)");
|
1446 |
$poster = 1;
|
1447 |
} else {
|
1448 |
$poster = $user->ID;
|
1449 |
-
DebugEcho("
|
1450 |
$poster = apply_filters("postie_author", $poster);
|
1451 |
-
DebugEcho("
|
1452 |
}
|
1453 |
-
DebugEcho("
|
1454 |
}
|
1455 |
|
1456 |
if (!$poster) {
|
@@ -1466,7 +1473,7 @@ class Postie {
|
|
1466 |
if ($config['force_user_login'] == true) {
|
1467 |
$user = get_user_by('id', $poster);
|
1468 |
if ($user) {
|
1469 |
-
DebugEcho("logging in as {$user->user_login}");
|
1470 |
wp_set_current_user($poster);
|
1471 |
//wp_set_auth_cookie($poster);
|
1472 |
do_action('wp_login', $user->user_login);
|
@@ -1600,6 +1607,37 @@ class Postie {
|
|
1600 |
DebugEcho("Postie is in " . plugin_dir_path(__FILE__), $force_display);
|
1601 |
DebugEcho("Postie Version: " . POSTIE_VERSION, $force_display);
|
1602 |
DebugEcho("POSTIE_DEBUG: " . ($this->is_debugmode() ? 'On' : 'Off'), $force_display);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1603 |
}
|
1604 |
|
1605 |
function is_debugmode() {
|
50 |
DebugEcho("doing postie_session_start");
|
51 |
do_action('postie_session_start');
|
52 |
|
|
|
|
|
53 |
$wp_content_path = dirname(dirname(dirname(__FILE__)));
|
54 |
DebugEcho("wp_content_path: $wp_content_path");
|
55 |
if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . 'filterPostie.php')) {
|
57 |
include_once ($wp_content_path . DIRECTORY_SEPARATOR . 'filterPostie.php');
|
58 |
}
|
59 |
|
60 |
+
$this->postie_environment();
|
61 |
+
|
62 |
if (function_exists('memory_get_usage')) {
|
63 |
DebugEcho(__("memory at start of email processing: ", 'postie') . memory_get_usage());
|
64 |
}
|
839 |
|
840 |
function save_post($details, $isReply) {
|
841 |
$post_ID = 0;
|
842 |
+
$details['post_content'] = str_replace('\\', '\\\\', $details['post_content']); //replace all backslashs with double backslashes since WP will remove single backslash
|
843 |
if (!$isReply) {
|
844 |
+
DebugEcho("postie_save_post: about to insert post");
|
845 |
$post_ID = wp_insert_post($details, true);
|
846 |
if (is_wp_error($post_ID)) {
|
847 |
EchoError("PostToDB Error: " . $post_ID->get_error_message());
|
852 |
$this->notify_error("Failed to create {$details['post_type']}: {$details['post_title']}", "Error: " . $post_ID->get_error_message() . "\n\n" . $details['post_content']);
|
853 |
|
854 |
$post_ID = null;
|
855 |
+
} else {
|
856 |
+
DebugEcho("postie_save_post: post inserted");
|
857 |
}
|
858 |
} else {
|
859 |
+
DebugEcho("postie_save_post: inserting comment");
|
860 |
$comment = array(
|
861 |
'comment_author' => $details['comment_author'],
|
862 |
'comment_post_ID' => $details['ID'],
|
1224 |
// then it should be removed
|
1225 |
if (!$is_reply) {
|
1226 |
wp_delete_post($post_id);
|
1227 |
+
DebugEcho("post_email: postie_post filter cleared the post, not saving. deleted $post_id");
|
1228 |
+
} else {
|
1229 |
+
DebugEcho("post_email: postie_post ended up with no post array.");
|
1230 |
}
|
1231 |
} else {
|
1232 |
$postid = $this->save_post($details, $is_reply);
|
1241 |
}
|
1242 |
}
|
1243 |
|
1244 |
+
DebugEcho("post_email: sending notifications");
|
1245 |
$this->email_notify($mimeDecodedEmail, $recipients, $postid);
|
1246 |
|
1247 |
if ($this->is_debugmode()) {
|
1387 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('from', $mimeDecodedEmail['headers'])) {
|
1388 |
$from = $mimeDecodedEmail['headers']['from']['mailbox'] . '@' . $mimeDecodedEmail['headers']['from']['host'];
|
1389 |
$from = apply_filters('postie_filter_email', $from);
|
1390 |
+
DebugEcho("validate_poster: post postie_filter_email $from");
|
1391 |
|
1392 |
$toEmail = '';
|
1393 |
if (isset($mimeDecodedEmail['headers']['to'])) {
|
1400 |
}
|
1401 |
|
1402 |
$from = apply_filters("postie_filter_email2", $from, $toEmail, $replytoEmail);
|
1403 |
+
DebugEcho("validate_poster: post postie_filter_email2 $from");
|
1404 |
} else {
|
1405 |
+
DebugEcho("validate_poster: No 'from' header found");
|
1406 |
DebugDump($mimeDecodedEmail['headers']);
|
1407 |
}
|
1408 |
|
1409 |
if (array_key_exists("headers", $mimeDecodedEmail)) {
|
1410 |
$from = apply_filters("postie_filter_email3", $from, $mimeDecodedEmail['headers']);
|
1411 |
+
DebugEcho("validate_poster: post postie_filter_email3 $from");
|
1412 |
}
|
1413 |
|
1414 |
$resentFrom = "";
|
1419 |
//See if the email address is one of the special authorized ones
|
1420 |
$user_ID = '';
|
1421 |
if (!empty($from)) {
|
1422 |
+
DebugEcho("validate_poster: Confirming Access For $from ");
|
1423 |
$user = get_user_by('email', $from);
|
1424 |
if ($user !== false) {
|
1425 |
if (is_user_member_of_blog($user->ID)) {
|
1426 |
$user_ID = $user->ID;
|
1427 |
} else {
|
1428 |
+
DebugEcho("validate_poster: $from is not user of blog " . get_current_blog_id());
|
1429 |
}
|
1430 |
}
|
1431 |
}
|
1433 |
if (!empty($user_ID)) {
|
1434 |
$user = new WP_User($user_ID);
|
1435 |
if ($user->has_cap("post_via_postie")) {
|
1436 |
+
DebugEcho("validate_poster: $user_ID has 'post_via_postie' permissions");
|
1437 |
$poster = $user_ID;
|
1438 |
|
1439 |
+
DebugEcho("validate_poster: pre postie_author $poster");
|
1440 |
$poster = apply_filters("postie_author", $poster);
|
1441 |
+
DebugEcho("validate_poster: post postie_author $poster");
|
1442 |
} else {
|
1443 |
+
DebugEcho("validate_poster $user_ID does not have 'post_via_postie' permissions");
|
1444 |
$user_ID = "";
|
1445 |
}
|
1446 |
}
|
1447 |
|
1448 |
if (empty($user_ID) && ($config['turn_authorization_off'] || $this->is_email_authorized($from, $config['authorized_addresses']) || $this->is_email_authorized($resentFrom, $config['authorized_addresses']))) {
|
1449 |
+
DebugEcho("validate_poster: looking up default user " . $config['admin_username']);
|
1450 |
$user = get_user_by('login', $config['admin_username']);
|
1451 |
if ($user === false) {
|
1452 |
EchoError("Your 'Default Poster' setting '" . $config['admin_username'] . "' is not a valid WordPress user (2)");
|
1453 |
$poster = 1;
|
1454 |
} else {
|
1455 |
$poster = $user->ID;
|
1456 |
+
DebugEcho("validate_poster: pre postie_author (default) $poster");
|
1457 |
$poster = apply_filters("postie_author", $poster);
|
1458 |
+
DebugEcho("validate_poster: post postie_author (default) $poster");
|
1459 |
}
|
1460 |
+
DebugEcho("validate_poster: found user '$poster'");
|
1461 |
}
|
1462 |
|
1463 |
if (!$poster) {
|
1473 |
if ($config['force_user_login'] == true) {
|
1474 |
$user = get_user_by('id', $poster);
|
1475 |
if ($user) {
|
1476 |
+
DebugEcho("validate_poster: logging in as {$user->user_login}");
|
1477 |
wp_set_current_user($poster);
|
1478 |
//wp_set_auth_cookie($poster);
|
1479 |
do_action('wp_login', $user->user_login);
|
1607 |
DebugEcho("Postie is in " . plugin_dir_path(__FILE__), $force_display);
|
1608 |
DebugEcho("Postie Version: " . POSTIE_VERSION, $force_display);
|
1609 |
DebugEcho("POSTIE_DEBUG: " . ($this->is_debugmode() ? 'On' : 'Off'), $force_display);
|
1610 |
+
|
1611 |
+
$this->show_filters_for('postie_filter_email');
|
1612 |
+
$this->show_filters_for('postie_filter_email2');
|
1613 |
+
$this->show_filters_for('postie_filter_email3');
|
1614 |
+
$this->show_filters_for('postie_author');
|
1615 |
+
$this->show_filters_for('postie_post_before');
|
1616 |
+
$this->show_filters_for('postie_post_after');
|
1617 |
+
$this->show_filters_for('postie_file_added');
|
1618 |
+
$this->show_filters_for('postie_gallery');
|
1619 |
+
$this->show_filters_for('postie_comment_before');
|
1620 |
+
$this->show_filters_for('postie_comment_after');
|
1621 |
+
$this->show_filters_for('postie_category_default');
|
1622 |
+
$this->show_filters_for('postie_log_debug');
|
1623 |
+
$this->show_filters_for('postie_log_error');
|
1624 |
+
$this->show_filters_for('postie_session_start');
|
1625 |
+
$this->show_filters_for('postie_session_end');
|
1626 |
+
$this->show_filters_for('postie_preconnect');
|
1627 |
+
$this->show_filters_for('postie_post_pre');
|
1628 |
+
$this->show_filters_for('postie_email_reject_recipients');
|
1629 |
+
$this->show_filters_for('postie_email_notify_recipients');
|
1630 |
+
$this->show_filters_for('postie_email_reject_subject');
|
1631 |
+
$this->show_filters_for('postie_email_notify_subject');
|
1632 |
+
$this->show_filters_for('postie_email_reject_body');
|
1633 |
+
$this->show_filters_for('postie_place_media');
|
1634 |
+
$this->show_filters_for('postie_place_media_before');
|
1635 |
+
$this->show_filters_for('postie_place_media_after');
|
1636 |
+
$this->show_filters_for('postie_raw');
|
1637 |
+
$this->show_filters_for('postie_bare_link');
|
1638 |
+
$this->show_filters_for('postie_category');
|
1639 |
+
$this->show_filters_for('postie_file_added_pre');
|
1640 |
+
$this->show_filters_for('postie_include_attachment');
|
1641 |
}
|
1642 |
|
1643 |
function is_debugmode() {
|
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.
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL3
|
@@ -28,14 +28,14 @@
|
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
-
$Id: postie.php
|
32 |
*/
|
33 |
|
34 |
if (!defined('WPINC')) {
|
35 |
die; // Exit if accessed directly
|
36 |
}
|
37 |
|
38 |
-
define('POSTIE_VERSION', '1.9.
|
39 |
define('POSTIE_ROOT', dirname(__FILE__));
|
40 |
define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
41 |
|
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.24
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL3
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
+
$Id: postie.php 1908297 2018-07-12 15:10:42Z WayneAllen $
|
32 |
*/
|
33 |
|
34 |
if (!defined('WPINC')) {
|
35 |
die; // Exit if accessed directly
|
36 |
}
|
37 |
|
38 |
+
define('POSTIE_VERSION', '1.9.24');
|
39 |
define('POSTIE_ROOT', dirname(__FILE__));
|
40 |
define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
41 |
|
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: 4.9
|
10 |
-
Stable tag: 1.9.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -107,6 +107,10 @@ 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.23 (2018-05-28) =
|
111 |
* Fix issue when attachment doesn't conform to MIME standard
|
112 |
|
7 |
Requires PHP: 5.3
|
8 |
Requires at least: 4.0
|
9 |
Tested up to: 4.9
|
10 |
+
Stable tag: 1.9.24
|
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.24 (2018-07-12) =
|
111 |
+
* log functions that use Postie filters
|
112 |
+
* remove empty tags
|
113 |
+
|
114 |
= 1.9.23 (2018-05-28) =
|
115 |
* Fix issue when attachment doesn't conform to MIME standard
|
116 |
|