Version Description
(2017-03-13) = * New setting "Remove matched categories" allows category specifiers to remain in post title. * New filter postie_cleanhtml to determine if Postie should clean up the html or if some other AddOn will do it. * Specifically call out public methods
Download this release
Release Info
Developer | WayneAllen |
Plugin | Postie |
Version | 1.8.33 |
Comparing to | |
See all releases |
Code changes from version 1.8.32 to 1.8.33
- config_form_message.php +1 -0
- docs/Changes.txt +5 -0
- docs/Postie.txt +1 -1
- docs/TODO.txt +0 -8
- postie-api.php +36 -0
- postie-functions.php +138 -147
- postie.php +4 -3
- readme.txt +6 -2
config_form_message.php
CHANGED
@@ -27,6 +27,7 @@
|
|
27 |
echo BuildBooleanSelect(__("Use colon to match category", 'postie'), "postie-settings[category_colon]", $category_colon);
|
28 |
echo BuildBooleanSelect(__("Use dash to match category", 'postie'), "postie-settings[category_dash]", $category_dash);
|
29 |
echo BuildBooleanSelect(__("Use square bracket to match category", 'postie'), "postie-settings[category_bracket]", $category_bracket, __('See the following article for more information <a href="http://postieplugin.com/faq/override-post-categories/" target="_blank">http://postieplugin.com/faq/override-post-categories/</a>', 'postie'));
|
|
|
30 |
?>
|
31 |
|
32 |
<tr valign="top">
|
27 |
echo BuildBooleanSelect(__("Use colon to match category", 'postie'), "postie-settings[category_colon]", $category_colon);
|
28 |
echo BuildBooleanSelect(__("Use dash to match category", 'postie'), "postie-settings[category_dash]", $category_dash);
|
29 |
echo BuildBooleanSelect(__("Use square bracket to match category", 'postie'), "postie-settings[category_bracket]", $category_bracket, __('See the following article for more information <a href="http://postieplugin.com/faq/override-post-categories/" target="_blank">http://postieplugin.com/faq/override-post-categories/</a>', 'postie'));
|
30 |
+
echo BuildBooleanSelect(__("Remove matched categories", 'postie'), "postie-settings[category_remove]", $category_remove,__('Typically you want any categories specified on the subject line removed from the post title.'));
|
31 |
?>
|
32 |
|
33 |
<tr valign="top">
|
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.8.32 (2017-03-07) =
|
39 |
* Ensure password not in logs for POP3.
|
40 |
* Additional POP3 header checks.
|
35 |
Attachments are now processed in the order they were attached.
|
36 |
|
37 |
== CHANGELOG ==
|
38 |
+
= 1.8.33 (2017-03-13) =
|
39 |
+
* New setting "Remove matched categories" allows category specifiers to remain in post title.
|
40 |
+
* New filter postie_cleanhtml to determine if Postie should clean up the html or if some other AddOn will do it.
|
41 |
+
* Specifically call out public methods
|
42 |
+
|
43 |
= 1.8.32 (2017-03-07) =
|
44 |
* Ensure password not in logs for POP3.
|
45 |
* Additional POP3 header checks.
|
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.7.3
|
9 |
-
Stable tag: 1.8.
|
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.7.3
|
9 |
+
Stable tag: 1.8.33
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
docs/TODO.txt
CHANGED
@@ -6,11 +6,6 @@ Header/footer stripper - user provides "selector" (xpath) to identify header/foo
|
|
6 |
CSS Inliner - use one of the online services to convert class styled html to inline styles. https://www.google.com/search?q=css+inline+tool&oq=css+inline+tool
|
7 |
Email notifications - use postie_email_* filters and some new settings panels along with some templating. User can select which post status fire the email.
|
8 |
Configurable message for "post confirmation" - variable substitution, by post status
|
9 |
-
Free addon to send logs to support
|
10 |
-
|
11 |
-
Automatic updates for AddOns:
|
12 |
-
https://github.com/seedprod/sellwp-updater
|
13 |
-
http://code.tutsplus.com/series/create-a-license-controlled-theme-and-plugin-update-system--cms-760
|
14 |
|
15 |
Bugs
|
16 |
#img# caption feature not working
|
@@ -18,7 +13,6 @@ plugin conflict - Image Rotation Fixer/Image Rotation Repair
|
|
18 |
Comment not being created when subject contains category command []. I.e. listserv subject lines
|
19 |
|
20 |
Other
|
21 |
-
Use media_handle_upload() to add attachments
|
22 |
Process single email at a time and don't delete unless successful
|
23 |
Add default comment status (like post status) wp_set_comment_status
|
24 |
provide a location for custom icons. update docs about location.
|
@@ -27,7 +21,6 @@ Make sure all failures are sent to admin (option?) failed attachments, etc.
|
|
27 |
fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
28 |
check multiple email accounts
|
29 |
allow other roles access to manual check like "Roles That Can Post"
|
30 |
-
Add setting to not remove category text from subject/title
|
31 |
Test server port combination by opening a socket connection to see if any service responds. (via ajax call)
|
32 |
send email notice when attachments are rejected.
|
33 |
For IMAP mailboxes allow the user to choose the folder.
|
@@ -36,7 +29,6 @@ Change successful post message to take post status into account (i.e. draft real
|
|
36 |
Verify that WP is honoring the wp_set_current_user() call. I.e. if the user is not an "author" role can they publish?
|
37 |
Add Message-ID header value to custom field (postie_message_id?) to both posts and comments.
|
38 |
Use In-Reply-To header value as a better way to detect replies
|
39 |
-
automatically create category if it doesn't exist. new option to allow this feature?
|
40 |
date: tag is being detected in body when not wanted
|
41 |
Update tag_* and filter_* to handle HTML (per tag_Tags)
|
42 |
dynamically determine video size (height/width) - https://code.google.com/p/phpvideotoolkit/
|
6 |
CSS Inliner - use one of the online services to convert class styled html to inline styles. https://www.google.com/search?q=css+inline+tool&oq=css+inline+tool
|
7 |
Email notifications - use postie_email_* filters and some new settings panels along with some templating. User can select which post status fire the email.
|
8 |
Configurable message for "post confirmation" - variable substitution, by post status
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
Bugs
|
11 |
#img# caption feature not working
|
13 |
Comment not being created when subject contains category command []. I.e. listserv subject lines
|
14 |
|
15 |
Other
|
|
|
16 |
Process single email at a time and don't delete unless successful
|
17 |
Add default comment status (like post status) wp_set_comment_status
|
18 |
provide a location for custom icons. update docs about location.
|
21 |
fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
22 |
check multiple email accounts
|
23 |
allow other roles access to manual check like "Roles That Can Post"
|
|
|
24 |
Test server port combination by opening a socket connection to see if any service responds. (via ajax call)
|
25 |
send email notice when attachments are rejected.
|
26 |
For IMAP mailboxes allow the user to choose the folder.
|
29 |
Verify that WP is honoring the wp_set_current_user() call. I.e. if the user is not an "author" role can they publish?
|
30 |
Add Message-ID header value to custom field (postie_message_id?) to both posts and comments.
|
31 |
Use In-Reply-To header value as a better way to detect replies
|
|
|
32 |
date: tag is being detected in body when not wanted
|
33 |
Update tag_* and filter_* to handle HTML (per tag_Tags)
|
34 |
dynamically determine video size (height/width) - https://code.google.com/p/phpvideotoolkit/
|
postie-api.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* These are the only official public methods for accessing postie functionality
|
5 |
+
*/
|
6 |
+
|
7 |
+
function lookup_taxonomy($termid) {
|
8 |
+
return postie_lookup_taxonomy_name($termid);
|
9 |
+
}
|
10 |
+
|
11 |
+
function lookup_category($trial_category, $category_match) {
|
12 |
+
return postie_lookup_category_id($trial_category, $category_match);
|
13 |
+
}
|
14 |
+
|
15 |
+
function RemoveExtraCharactersInEmailAddress($address) {
|
16 |
+
return postie_RemoveExtraCharactersInEmailAddress($address);
|
17 |
+
}
|
18 |
+
|
19 |
+
function EchoError($v) {
|
20 |
+
postie_log_error($v);
|
21 |
+
do_action('postie_log_debug', $v);
|
22 |
+
}
|
23 |
+
|
24 |
+
function DebugDump($v) {
|
25 |
+
if (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG) {
|
26 |
+
postie_log_onscreen(print_r($v, true));
|
27 |
+
}
|
28 |
+
do_action('postie_log_debug', print_r($v, true));
|
29 |
+
}
|
30 |
+
|
31 |
+
function DebugEcho($v, $force = false) {
|
32 |
+
if ($force || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
|
33 |
+
postie_log_onscreen($v);
|
34 |
+
}
|
35 |
+
do_action('postie_log_debug', $v);
|
36 |
+
}
|
postie-functions.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
$Id: postie-functions.php
|
4 |
*/
|
5 |
|
6 |
class PostiePostModifiers {
|
@@ -134,25 +134,6 @@ function postie_log_debug($data) {
|
|
134 |
error_log("Postie [debug]: $data");
|
135 |
}
|
136 |
|
137 |
-
function EchoError($v) {
|
138 |
-
postie_log_error($v);
|
139 |
-
do_action('postie_log_debug', $v);
|
140 |
-
}
|
141 |
-
|
142 |
-
function DebugDump($v) {
|
143 |
-
if (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG) {
|
144 |
-
postie_log_onscreen(print_r($v, true));
|
145 |
-
}
|
146 |
-
do_action('postie_log_debug', print_r($v, true));
|
147 |
-
}
|
148 |
-
|
149 |
-
function DebugEcho($v, $force = false) {
|
150 |
-
if ($force || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
|
151 |
-
postie_log_onscreen($v);
|
152 |
-
}
|
153 |
-
do_action('postie_log_debug', $v);
|
154 |
-
}
|
155 |
-
|
156 |
function tag_Date(&$content, $message_date) {
|
157 |
//don't apply any offset here as it is accounted for later
|
158 |
$html = LoadDOM($content);
|
@@ -782,7 +763,10 @@ function postie_getemails($type, $server, $port, $email, $password, $protocol, $
|
|
782 |
$email = $mailbox->fetchMessage($uid);
|
783 |
|
784 |
if (!empty($email['html'])) {
|
|
|
785 |
$email['html'] = filter_CleanHtml($email['html']);
|
|
|
|
|
786 |
}
|
787 |
|
788 |
$emails[] = $email;
|
@@ -1111,19 +1095,24 @@ function postie_save_attachment(&$attachment, $post_id, $poster, $config) {
|
|
1111 |
function filter_CleanHtml($content) {
|
1112 |
$html = str_get_html($content);
|
1113 |
if ($html) {
|
1114 |
-
DebugEcho("filter_CleanHtml:
|
1115 |
-
|
1116 |
-
DebugEcho("filter_CleanHtml:
|
1117 |
-
$
|
1118 |
-
|
1119 |
-
|
|
|
|
|
1120 |
|
1121 |
-
|
1122 |
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
|
|
|
|
|
|
1127 |
}
|
1128 |
} else {
|
1129 |
DebugEcho("filter_CleanHtml: No HTML found");
|
@@ -1168,7 +1157,7 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
|
|
1168 |
|
1169 |
$resentFrom = "";
|
1170 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('resent-from', $mimeDecodedEmail['headers'])) {
|
1171 |
-
$resentFrom =
|
1172 |
}
|
1173 |
|
1174 |
//See if the email address is one of the special authorized ones
|
@@ -1665,7 +1654,7 @@ function isEmailAddressAuthorized($address, $authorized) {
|
|
1665 |
* @param string
|
1666 |
* @return string
|
1667 |
*/
|
1668 |
-
function
|
1669 |
$matches = array();
|
1670 |
if (preg_match('/^[^<>]+<([^<> ()]+)>$/', $address, $matches)) {
|
1671 |
$address = $matches[1];
|
@@ -2087,7 +2076,7 @@ function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
|
|
2087 |
|
2088 |
DebugEcho("tag_Categories: looking up: $defaultCategoryId");
|
2089 |
$defaultcat_name = '';
|
2090 |
-
$defaultcat = get_term_by('id', $defaultCategoryId,
|
2091 |
if (false !== $defaultcat) {
|
2092 |
$defaultcat_name = $defaultcat->name;
|
2093 |
DebugEcho("tag_Categories: default: $defaultcat_name");
|
@@ -2097,12 +2086,12 @@ function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
|
|
2097 |
$trial_category = apply_filters('postie_category', trim($match), $category_match, $defaultcat_name);
|
2098 |
DebugEcho("tag_Categories: post filter: $trial_category");
|
2099 |
|
2100 |
-
$categoryid =
|
2101 |
if (!empty($categoryid)) {
|
2102 |
$found = true;
|
2103 |
$subject = str_replace($matches[0][$i], '', $subject);
|
2104 |
DebugEcho("tag_Categories: subject: $subject");
|
2105 |
-
$tax =
|
2106 |
if ('category' == $tax) {
|
2107 |
$post_categories[] = $categoryid;
|
2108 |
} else {
|
@@ -2114,7 +2103,7 @@ function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
|
|
2114 |
}
|
2115 |
}
|
2116 |
}
|
2117 |
-
if (!$found) {
|
2118 |
DebugEcho("tag_Categories: using default: $defaultCategoryId");
|
2119 |
$post_categories[] = $defaultCategoryId;
|
2120 |
$subject = $original_subject;
|
@@ -2123,7 +2112,7 @@ function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
|
|
2123 |
return $post_categories;
|
2124 |
}
|
2125 |
|
2126 |
-
function
|
2127 |
global $wpdb;
|
2128 |
$tax_sql = 'SELECT taxonomy FROM ' . $wpdb->term_taxonomy . ' WHERE term_id = ' . $termid;
|
2129 |
$tax = $wpdb->get_var($tax_sql);
|
@@ -2131,7 +2120,7 @@ function lookup_taxonomy_name($termid) {
|
|
2131 |
return $tax;
|
2132 |
}
|
2133 |
|
2134 |
-
function
|
2135 |
global $wpdb;
|
2136 |
DebugEcho("lookup_category: $trial_category");
|
2137 |
|
@@ -2399,7 +2388,8 @@ function config_GetDefaults() {
|
|
2399 |
'category_colon' => true,
|
2400 |
'category_dash' => true,
|
2401 |
'category_bracket' => true,
|
2402 |
-
'prefer_text_convert' => true
|
|
|
2403 |
);
|
2404 |
}
|
2405 |
|
@@ -2848,22 +2838,22 @@ function postie_test_config() {
|
|
2848 |
?>
|
2849 |
<div class="wrap">
|
2850 |
<h1>Postie Configuration Test</h1>
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
|
2855 |
<h2>Clock</h2>
|
2856 |
<p>This shows what time it would be if you posted right now</p>
|
2857 |
-
|
2858 |
-
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
<h2>Encoding</h2>
|
2868 |
<?php
|
2869 |
$default_charset = ini_get('default_charset');
|
@@ -2964,119 +2954,120 @@ function postie_test_config() {
|
|
2964 |
}
|
2965 |
?>
|
2966 |
</div>
|
2967 |
-
|
2968 |
-
}
|
2969 |
-
|
2970 |
-
function postie_get_conn_info($config) {
|
2971 |
-
$conninfo = array();
|
2972 |
-
$conninfo['mail_server'] = $config['mail_server'];
|
2973 |
-
$conninfo['mail_port'] = $config['mail_server_port'];
|
2974 |
-
$conninfo['mail_user'] = $config['mail_userid'];
|
2975 |
-
$conninfo['mail_password'] = $config['mail_password'];
|
2976 |
-
$conninfo['mail_protocol'] = $config['input_protocol'];
|
2977 |
-
$conninfo['mail_tls'] = $config['email_tls'];
|
2978 |
-
$conninfo['email_delete_after_processing'] = $config['delete_mail_after_processing'];
|
2979 |
-
$conninfo['email_max'] = $config['maxemails'];
|
2980 |
-
$conninfo['email_ignore_state'] = $config['ignore_mail_state'];
|
2981 |
-
|
2982 |
-
return apply_filters('postie_preconnect', $conninfo);
|
2983 |
-
}
|
2984 |
-
|
2985 |
-
function postie_get_mail() {
|
2986 |
-
if (!function_exists('file_get_html')) {
|
2987 |
-
require_once (plugin_dir_path(__FILE__) . 'simple_html_dom.php');
|
2988 |
}
|
2989 |
|
2990 |
-
$config
|
2991 |
-
|
2992 |
-
|
2993 |
-
|
2994 |
-
|
2995 |
-
|
2996 |
-
|
2997 |
-
|
2998 |
-
|
|
|
|
|
|
|
|
|
2999 |
}
|
3000 |
|
3001 |
-
|
3002 |
-
|
|
|
|
|
3003 |
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
3009 |
-
|
3010 |
-
|
|
|
|
|
|
|
3011 |
|
3012 |
-
|
3013 |
-
DebugEcho(
|
3014 |
-
}
|
3015 |
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
|
|
|
|
|
|
|
|
3019 |
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
|
3024 |
-
|
|
|
|
|
3025 |
|
3026 |
-
|
|
|
|
|
3027 |
|
3028 |
-
|
3029 |
|
3030 |
-
|
3031 |
|
3032 |
-
|
3033 |
-
$tmp_config = $config;
|
3034 |
-
unset($tmp_config['mail_password']);
|
3035 |
-
DebugDump($tmp_config);
|
3036 |
|
3037 |
-
|
3038 |
-
$message_number = 0;
|
3039 |
-
foreach ($emails as $email) {
|
3040 |
-
$message_number++;
|
3041 |
-
DebugEcho("$message_number: ------------------------------------");
|
3042 |
-
//DebugDump($email);
|
3043 |
-
//sanity check to see if there is any info in the message
|
3044 |
-
if ($email == NULL) {
|
3045 |
-
$message = __('Dang, message is empty!', 'postie');
|
3046 |
-
EchoError("$message_number: $message");
|
3047 |
-
continue;
|
3048 |
-
} else if ($email == 'already read') {
|
3049 |
-
$message = __("Message is already marked 'read'.", 'postie');
|
3050 |
-
DebugEcho("$message_number: $message");
|
3051 |
-
continue;
|
3052 |
-
}
|
3053 |
|
|
|
3054 |
$tmp_config = $config;
|
3055 |
-
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3059 |
}
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3063 |
}
|
3064 |
-
}
|
3065 |
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
|
3071 |
-
|
3072 |
-
|
|
|
|
|
3073 |
}
|
3074 |
-
|
3075 |
-
|
3076 |
-
DebugEcho("Mail fetch complete, $message_number emails");
|
3077 |
-
do_action('postie_session_end');
|
3078 |
|
3079 |
-
|
3080 |
-
|
|
|
3081 |
}
|
3082 |
-
|
1 |
<?php
|
2 |
/*
|
3 |
+
$Id: postie-functions.php 1613697 2017-03-13 23:03:26Z WayneAllen $
|
4 |
*/
|
5 |
|
6 |
class PostiePostModifiers {
|
134 |
error_log("Postie [debug]: $data");
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
function tag_Date(&$content, $message_date) {
|
138 |
//don't apply any offset here as it is accounted for later
|
139 |
$html = LoadDOM($content);
|
763 |
$email = $mailbox->fetchMessage($uid);
|
764 |
|
765 |
if (!empty($email['html'])) {
|
766 |
+
DebugEcho("postie_getemails: html");
|
767 |
$email['html'] = filter_CleanHtml($email['html']);
|
768 |
+
} else {
|
769 |
+
DebugEcho("postie_getemails: no html");
|
770 |
}
|
771 |
|
772 |
$emails[] = $email;
|
1095 |
function filter_CleanHtml($content) {
|
1096 |
$html = str_get_html($content);
|
1097 |
if ($html) {
|
1098 |
+
DebugEcho("filter_CleanHtml: checking filter postie_cleanhtml");
|
1099 |
+
if (apply_filters('postie_cleanhtml', true)) {
|
1100 |
+
DebugEcho("filter_CleanHtml: Looking for invalid tags");
|
1101 |
+
foreach ($html->find('script, style, head') as $node) {
|
1102 |
+
DebugEcho("filter_CleanHtml: Removing: " . $node->outertext);
|
1103 |
+
$node->outertext = '';
|
1104 |
+
}
|
1105 |
+
DebugEcho("filter_CleanHtml: " . $html->save());
|
1106 |
|
1107 |
+
$html->load($html->save());
|
1108 |
|
1109 |
+
$b = $html->find('body');
|
1110 |
+
if ($b) {
|
1111 |
+
DebugEcho("filter_CleanHtml: replacing body with div");
|
1112 |
+
$content = "<div>" . $b[0]->innertext . "</div>\n";
|
1113 |
+
}
|
1114 |
+
} else {
|
1115 |
+
DebugEcho("filter_CleanHtml: skipping clean html due to filter");
|
1116 |
}
|
1117 |
} else {
|
1118 |
DebugEcho("filter_CleanHtml: No HTML found");
|
1157 |
|
1158 |
$resentFrom = "";
|
1159 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('resent-from', $mimeDecodedEmail['headers'])) {
|
1160 |
+
$resentFrom = postie_RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail['headers']['resent-from']));
|
1161 |
}
|
1162 |
|
1163 |
//See if the email address is one of the special authorized ones
|
1654 |
* @param string
|
1655 |
* @return string
|
1656 |
*/
|
1657 |
+
function postie_RemoveExtraCharactersInEmailAddress($address) {
|
1658 |
$matches = array();
|
1659 |
if (preg_match('/^[^<>]+<([^<> ()]+)>$/', $address, $matches)) {
|
1660 |
$address = $matches[1];
|
2076 |
|
2077 |
DebugEcho("tag_Categories: looking up: $defaultCategoryId");
|
2078 |
$defaultcat_name = '';
|
2079 |
+
$defaultcat = get_term_by('id', $defaultCategoryId, postie_lookup_taxonomy_name($defaultCategoryId));
|
2080 |
if (false !== $defaultcat) {
|
2081 |
$defaultcat_name = $defaultcat->name;
|
2082 |
DebugEcho("tag_Categories: default: $defaultcat_name");
|
2086 |
$trial_category = apply_filters('postie_category', trim($match), $category_match, $defaultcat_name);
|
2087 |
DebugEcho("tag_Categories: post filter: $trial_category");
|
2088 |
|
2089 |
+
$categoryid = postie_lookup_category_id($trial_category, $category_match);
|
2090 |
if (!empty($categoryid)) {
|
2091 |
$found = true;
|
2092 |
$subject = str_replace($matches[0][$i], '', $subject);
|
2093 |
DebugEcho("tag_Categories: subject: $subject");
|
2094 |
+
$tax = postie_lookup_taxonomy_name($categoryid);
|
2095 |
if ('category' == $tax) {
|
2096 |
$post_categories[] = $categoryid;
|
2097 |
} else {
|
2103 |
}
|
2104 |
}
|
2105 |
}
|
2106 |
+
if (!$found || !$config['category_remove']) {
|
2107 |
DebugEcho("tag_Categories: using default: $defaultCategoryId");
|
2108 |
$post_categories[] = $defaultCategoryId;
|
2109 |
$subject = $original_subject;
|
2112 |
return $post_categories;
|
2113 |
}
|
2114 |
|
2115 |
+
function postie_lookup_taxonomy_name($termid) {
|
2116 |
global $wpdb;
|
2117 |
$tax_sql = 'SELECT taxonomy FROM ' . $wpdb->term_taxonomy . ' WHERE term_id = ' . $termid;
|
2118 |
$tax = $wpdb->get_var($tax_sql);
|
2120 |
return $tax;
|
2121 |
}
|
2122 |
|
2123 |
+
function postie_lookup_category_id($trial_category, $category_match = true) {
|
2124 |
global $wpdb;
|
2125 |
DebugEcho("lookup_category: $trial_category");
|
2126 |
|
2388 |
'category_colon' => true,
|
2389 |
'category_dash' => true,
|
2390 |
'category_bracket' => true,
|
2391 |
+
'prefer_text_convert' => true,
|
2392 |
+
'category_remove' => true
|
2393 |
);
|
2394 |
}
|
2395 |
|
2838 |
?>
|
2839 |
<div class="wrap">
|
2840 |
<h1>Postie Configuration Test</h1>
|
2841 |
+
<?php
|
2842 |
+
postie_environment(true);
|
2843 |
+
?>
|
2844 |
|
2845 |
<h2>Clock</h2>
|
2846 |
<p>This shows what time it would be if you posted right now</p>
|
2847 |
+
<?php
|
2848 |
+
$wptz = get_option('gmt_offset');
|
2849 |
+
$wptzs = get_option('timezone_string');
|
2850 |
+
DebugEcho("Wordpress timezone: $wptzs ($wptz)", true);
|
2851 |
+
DebugEcho("Current time: " . current_time('mysql'), true);
|
2852 |
+
DebugEcho("Current time (gmt): " . current_time('mysql', 1), true);
|
2853 |
+
DebugEcho("Postie time correction: {$config['time_offset']}", true);
|
2854 |
+
$offsetdate = strtotime(current_time('mysql')) + $config['time_offset'];
|
2855 |
+
DebugEcho("Post time: " . date('Y-m-d H:i:s', $offsetdate), true);
|
2856 |
+
?>
|
2857 |
<h2>Encoding</h2>
|
2858 |
<?php
|
2859 |
$default_charset = ini_get('default_charset');
|
2954 |
}
|
2955 |
?>
|
2956 |
</div>
|
2957 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2958 |
}
|
2959 |
|
2960 |
+
function postie_get_conn_info($config) {
|
2961 |
+
$conninfo = array();
|
2962 |
+
$conninfo['mail_server'] = $config['mail_server'];
|
2963 |
+
$conninfo['mail_port'] = $config['mail_server_port'];
|
2964 |
+
$conninfo['mail_user'] = $config['mail_userid'];
|
2965 |
+
$conninfo['mail_password'] = $config['mail_password'];
|
2966 |
+
$conninfo['mail_protocol'] = $config['input_protocol'];
|
2967 |
+
$conninfo['mail_tls'] = $config['email_tls'];
|
2968 |
+
$conninfo['email_delete_after_processing'] = $config['delete_mail_after_processing'];
|
2969 |
+
$conninfo['email_max'] = $config['maxemails'];
|
2970 |
+
$conninfo['email_ignore_state'] = $config['ignore_mail_state'];
|
2971 |
+
|
2972 |
+
return apply_filters('postie_preconnect', $conninfo);
|
2973 |
}
|
2974 |
|
2975 |
+
function postie_get_mail() {
|
2976 |
+
if (!function_exists('file_get_html')) {
|
2977 |
+
require_once (plugin_dir_path(__FILE__) . 'simple_html_dom.php');
|
2978 |
+
}
|
2979 |
|
2980 |
+
$config = config_Read();
|
2981 |
+
if (true == $config['postie_log_error'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
|
2982 |
+
add_action('postie_log_error', 'postie_log_error');
|
2983 |
+
}
|
2984 |
+
if (true == $config['postie_log_debug'] && !defined('POSTIE_DEBUG')) {
|
2985 |
+
define('POSTIE_DEBUG', true);
|
2986 |
+
}
|
2987 |
+
if (true == $config['postie_log_debug'] || (defined('POSTIE_DEBUG') && true == POSTIE_DEBUG)) {
|
2988 |
+
add_action('postie_log_debug', 'postie_log_debug');
|
2989 |
+
}
|
2990 |
|
2991 |
+
do_action('postie_session_start');
|
2992 |
+
DebugEcho("Starting mail fetch");
|
|
|
2993 |
|
2994 |
+
postie_environment();
|
2995 |
+
$wp_content_path = dirname(dirname(dirname(__FILE__)));
|
2996 |
+
DebugEcho("wp_content_path: $wp_content_path");
|
2997 |
+
if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
|
2998 |
+
DebugEcho("found filterPostie.php in $wp_content_path");
|
2999 |
+
include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
|
3000 |
+
}
|
3001 |
|
3002 |
+
if (function_exists('memory_get_usage')) {
|
3003 |
+
DebugEcho(__("memory at start of email processing: ", 'postie') . memory_get_usage());
|
3004 |
+
}
|
3005 |
|
3006 |
+
if (has_filter('postie_post')) {
|
3007 |
+
echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
|
3008 |
+
}
|
3009 |
|
3010 |
+
if (!array_key_exists('maxemails', $config)) {
|
3011 |
+
$config['maxemails'] = 0;
|
3012 |
+
}
|
3013 |
|
3014 |
+
$conninfo = postie_get_conn_info($config);
|
3015 |
|
3016 |
+
$emails = postie_fetch_mail($conninfo['mail_server'], $conninfo['mail_port'], $conninfo['mail_user'], $conninfo['mail_password'], $conninfo['mail_protocol'], $conninfo['email_delete_after_processing'], $conninfo['email_max'], $config['input_connection']);
|
3017 |
|
3018 |
+
$message = 'Done.';
|
|
|
|
|
|
|
3019 |
|
3020 |
+
DebugEcho(sprintf(__("There are %d messages to process", 'postie'), count($emails)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3021 |
|
3022 |
+
//don't output the password
|
3023 |
$tmp_config = $config;
|
3024 |
+
unset($tmp_config['mail_password']);
|
3025 |
+
DebugDump($tmp_config);
|
3026 |
+
|
3027 |
+
//loop through messages
|
3028 |
+
$message_number = 0;
|
3029 |
+
foreach ($emails as $email) {
|
3030 |
+
$message_number++;
|
3031 |
+
DebugEcho("$message_number: ------------------------------------");
|
3032 |
+
//DebugDump($email);
|
3033 |
+
//sanity check to see if there is any info in the message
|
3034 |
+
if ($email == NULL) {
|
3035 |
+
$message = __('Dang, message is empty!', 'postie');
|
3036 |
+
EchoError("$message_number: $message");
|
3037 |
+
continue;
|
3038 |
+
} else if ($email == 'already read') {
|
3039 |
+
$message = __("Message is already marked 'read'.", 'postie');
|
3040 |
+
DebugEcho("$message_number: $message");
|
3041 |
+
continue;
|
3042 |
}
|
3043 |
+
|
3044 |
+
$tmp_config = $config;
|
3045 |
+
if ($config['prefer_text_convert']) {
|
3046 |
+
if ($config['prefer_text_type'] == 'plain' && trim($email['text']) == '' && trim($email['html']) != '') {
|
3047 |
+
DebugEcho("postie_get_mail: switching to html");
|
3048 |
+
$tmp_config['prefer_text_type'] = 'html';
|
3049 |
+
}
|
3050 |
+
if ($config['prefer_text_type'] == 'html' && trim($email['html']) == '' && trim($email['text']) != '') {
|
3051 |
+
DebugEcho("postie_get_mail: switching to plain");
|
3052 |
+
$tmp_config['prefer_text_type'] = 'plain';
|
3053 |
+
}
|
3054 |
}
|
|
|
3055 |
|
3056 |
+
//Check poster to see if a valid person
|
3057 |
+
$poster = ValidatePoster($email, $tmp_config);
|
3058 |
+
if (!empty($poster)) {
|
3059 |
+
PostEmail($poster, $email, $tmp_config);
|
3060 |
+
DebugEcho("$message_number: processed");
|
3061 |
+
} else {
|
3062 |
+
EchoError("Ignoring email - not authorized.");
|
3063 |
+
}
|
3064 |
+
flush();
|
3065 |
}
|
3066 |
+
DebugEcho("Mail fetch complete, $message_number emails");
|
3067 |
+
do_action('postie_session_end');
|
|
|
|
|
3068 |
|
3069 |
+
if (function_exists('memory_get_usage')) {
|
3070 |
+
DebugEcho("memory at end of email processing:" . memory_get_usage());
|
3071 |
+
}
|
3072 |
}
|
3073 |
+
|
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.
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL2
|
@@ -28,7 +28,7 @@
|
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
-
$Id: postie.php
|
32 |
*/
|
33 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
|
34 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
|
@@ -48,8 +48,9 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/pImapMailServer.php"
|
|
48 |
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.
|
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.33
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL2
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
+
$Id: postie.php 1613697 2017-03-13 23:03:26Z WayneAllen $
|
32 |
*/
|
33 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
|
34 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
|
48 |
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 |
+
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-api.php");
|
52 |
|
53 |
+
define('POSTIE_VERSION', '1.8.33');
|
54 |
define("POSTIE_ROOT", dirname(__FILE__));
|
55 |
define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
56 |
|
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.3
|
9 |
-
Stable tag: 1.8.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -242,6 +242,11 @@ All script, style and body tags are stripped from html emails.
|
|
242 |
Attachments are now processed in the order they were attached.
|
243 |
|
244 |
== CHANGELOG ==
|
|
|
|
|
|
|
|
|
|
|
245 |
= 1.8.32 (2017-03-07) =
|
246 |
* Ensure password not in logs for POP3.
|
247 |
* Additional POP3 header checks.
|
@@ -1480,4 +1485,3 @@ plugin. And the rest is history :)
|
|
1480 |
*
|
1481 |
= 0.1 - 2004-06 =
|
1482 |
* First release
|
1483 |
-
|
6 |
Tags: e-mail, email, post-by-email
|
7 |
Requires at least: 3.3.0
|
8 |
Tested up to: 4.7.3
|
9 |
+
Stable tag: 1.8.33
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
242 |
Attachments are now processed in the order they were attached.
|
243 |
|
244 |
== CHANGELOG ==
|
245 |
+
= 1.8.33 (2017-03-13) =
|
246 |
+
* New setting "Remove matched categories" allows category specifiers to remain in post title.
|
247 |
+
* New filter postie_cleanhtml to determine if Postie should clean up the html or if some other AddOn will do it.
|
248 |
+
* Specifically call out public methods
|
249 |
+
|
250 |
= 1.8.32 (2017-03-07) =
|
251 |
* Ensure password not in logs for POP3.
|
252 |
* Additional POP3 header checks.
|
1485 |
*
|
1486 |
= 0.1 - 2004-06 =
|
1487 |
* First release
|
|