Postie - Version 1.5.9

Version Description

(2013.05.18) = * Fixed a bug where valid users can post via email even though they don't have role permissions. * Fixed a bug where nice_name was being used in the settings screen even though user_login was needed. * Fixed the error message when the default poster is not valid. * Fixed bug where gallery short tag was getting set when non-image attachments were found.

Download this release

Release Info

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

Code changes from version 1.5.8 to 1.5.9

Files changed (7) hide show
  1. config_form.php +2 -2
  2. docs/Changes.txt +6 -0
  3. docs/Postie.txt +1 -1
  4. docs/TODO.txt +1 -5
  5. postie-functions.php +21 -17
  6. postie.php +3 -3
  7. readme.txt +7 -1
config_form.php CHANGED
@@ -301,10 +301,10 @@
301
  $adminusers = get_users('orderby=nicename&role=administrator');
302
  foreach ($adminusers as $user) {
303
  $selected = "";
304
- if ($user->user_nicename == $admin_username) {
305
  $selected = " selected='selected'";
306
  }
307
- echo "<option value='$user->user_nicename'$selected>$user->user_nicename</option>";
308
  }
309
  ?>
310
  </select>
301
  $adminusers = get_users('orderby=nicename&role=administrator');
302
  foreach ($adminusers as $user) {
303
  $selected = "";
304
+ if ($user->user_login == $admin_username) {
305
  $selected = " selected='selected'";
306
  }
307
+ echo "<option value='$user->user_login'$selected>$user->user_nicename ($user->user_login)</option>";
308
  }
309
  ?>
310
  </select>
docs/Changes.txt CHANGED
@@ -22,6 +22,12 @@ All script, style and body tags are stripped from html emails.
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
 
 
 
 
 
 
25
  = 1.5.8 (2013.05.14) =
26
  * Added additional default signature patterns.
27
  * Fixed a bug where attachments were not showing up if :start or :end were used.
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
25
+ = 1.5.9 (2013.05.18) =
26
+ * Fixed a bug where valid users can post via email even though they don't have role permissions.
27
+ * Fixed a bug where nice_name was being used in the settings screen even though user_login was needed.
28
+ * Fixed the error message when the default poster is not valid.
29
+ * Fixed bug where gallery short tag was getting set when non-image attachments were found.
30
+
31
  = 1.5.8 (2013.05.14) =
32
  * Added additional default signature patterns.
33
  * Fixed a bug where attachments were not showing up if :start or :end were used.
docs/Postie.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
- Stable tag: 1.5.8
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
+ Stable tag: 1.5.9
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
docs/TODO.txt CHANGED
@@ -1,19 +1,16 @@
1
  provide a location for custom icons. update docs about location.
2
  replace native imap MIME parser with flourish - http://flourishlib.com/docs/fMailbox
3
  automatically create category if it doesn't exist. new option to allow this feature?
4
- WP MU support
5
  Add setting for category detection. I.e. checkboxes for [], -- and : styles. Default to all on.
6
  Add setting to not remove category text from subject/title
7
  Make sure all failures are sent to admin (option?) failed attachments, etc.
8
  Comment not being created when subject contains category command []. I.e. listserv subject lines
9
- rework attachment logic. video files can come through as application/octect-stream. Mail parsing should separate attachments
10
- into buckets? i.e. video, image, other. Each gets processed differently. I.e. when gallery in turned on images don't get embedded
11
- but videos do.
12
  date: tag is being detected in body when not wanted
13
  Enhance #img# to specify the featured image
14
  Update tag_* and filter_* to handle HTML (per tag_Tags)
15
  "yoast" style admin sidebar - see clicky by yoast
16
  handle condition where only one of text/plain & text/html is supplied, but Preferred Text Type is set to the opposite.
 
17
 
18
  standardize tags
19
  fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
@@ -26,4 +23,3 @@ fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutor
26
  * Test for calling from the command line
27
  * Support userid/domain as a valid username
28
  * Make it possible to post without a script at all
29
- * TODO - non-image uploads get ignored in content when using autogallery - see replaceimageplaceholders
1
  provide a location for custom icons. update docs about location.
2
  replace native imap MIME parser with flourish - http://flourishlib.com/docs/fMailbox
3
  automatically create category if it doesn't exist. new option to allow this feature?
 
4
  Add setting for category detection. I.e. checkboxes for [], -- and : styles. Default to all on.
5
  Add setting to not remove category text from subject/title
6
  Make sure all failures are sent to admin (option?) failed attachments, etc.
7
  Comment not being created when subject contains category command []. I.e. listserv subject lines
 
 
 
8
  date: tag is being detected in body when not wanted
9
  Enhance #img# to specify the featured image
10
  Update tag_* and filter_* to handle HTML (per tag_Tags)
11
  "yoast" style admin sidebar - see clicky by yoast
12
  handle condition where only one of text/plain & text/html is supplied, but Preferred Text Type is set to the opposite.
13
+ gallery logic dosen't handle both images and non-images
14
 
15
  standardize tags
16
  fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
23
  * Test for calling from the command line
24
  * Support userid/domain as a valid username
25
  * Make it possible to post without a script at all
 
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 713262 2013-05-15 05:08:09Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -301,16 +301,16 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
301
  if ($fulldebug)
302
  DebugEcho("post end: $content");
303
 
304
- filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config);
305
  if ($fulldebug)
306
  DebugEcho("post body img: $content");
307
 
308
  if ($post_excerpt) {
309
- filter_ReplaceImagePlaceHolders($post_excerpt, $attachments["html"], $config);
310
  if ($fulldebug)
311
  DebugEcho("post excerpt img: $content");
312
  }
313
-
314
  DebugEcho("excerpt: $post_excerpt");
315
 
316
  $details = array(
@@ -1277,23 +1277,19 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
1277
  if (!empty($user_ID)) {
1278
  $user = new WP_User($user_ID);
1279
  if ($user->has_cap("post_via_postie")) {
 
1280
  $poster = $user_ID;
1281
  EchoInfo("posting as user $poster");
1282
  } else {
1283
- $user = get_user_by('login', $admin_username);
1284
- if ($user === false) {
1285
- EchoInfo("Your 'Admin username' setting '$admin_username' is not a valid WordPress user (1)");
1286
- $poster = 1;
1287
- } else {
1288
- $poster = $user->ID;
1289
- DebugEcho("posting as admin user $admin_username");
1290
- }
1291
  }
1292
- } elseif ($turn_authorization_off || isEmailAddressAuthorized($from, $authorized_addresses) || isEmailAddressAuthorized($resentFrom, $authorized_addresses)) {
 
1293
  DebugEcho("ValidatePoster: looking up default user $admin_username");
1294
  $user = get_user_by('login', $admin_username);
1295
  if ($user === false) {
1296
- EchoInfo("Your 'Admin username' setting '$admin_username' is not a valid WordPress user (2)");
1297
  $poster = 1;
1298
  } else {
1299
  $poster = $user->ID;
@@ -2240,14 +2236,22 @@ function filter_ReplaceImageCIDs(&$content, &$attachments, $config) {
2240
  * @param string - text of post
2241
  * @param array - array of HTML for images for post
2242
  */
2243
- function filter_ReplaceImagePlaceHolders(&$content, $attachments, $config) {
2244
  if (!$config['custom_image_field']) {
2245
  if (!$config['allow_html_in_body']) {
2246
  $content = html_entity_decode($content, ENT_QUOTES);
2247
  }
2248
 
2249
  $startIndex = $config['start_image_count_at_zero'] ? 0 : 1;
2250
- if (!empty($attachments) && $config['auto_gallery']) {
 
 
 
 
 
 
 
 
2251
  $imageTemplate = '[gallery]';
2252
  if ($config['images_append']) {
2253
  $content .= "\n$imageTemplate";
@@ -2659,7 +2663,7 @@ function config_GetDefaults() {
2659
  'selected_video1template' => 'simple_link',
2660
  'selected_video2template' => 'simple_link',
2661
  'shortcode' => false,
2662
- 'sig_pattern_list' => array('--\s?[\r\n]?','--\s','--', '---'),
2663
  'smtp' => array(),
2664
  'start_image_count_at_zero' => false,
2665
  'supported_file_types' => array('application'),
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 715036 2013-05-18 18:44:20Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
301
  if ($fulldebug)
302
  DebugEcho("post end: $content");
303
 
304
+ filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config, $id);
305
  if ($fulldebug)
306
  DebugEcho("post body img: $content");
307
 
308
  if ($post_excerpt) {
309
+ filter_ReplaceImagePlaceHolders($post_excerpt, $attachments["html"], $config, $id);
310
  if ($fulldebug)
311
  DebugEcho("post excerpt img: $content");
312
  }
313
+
314
  DebugEcho("excerpt: $post_excerpt");
315
 
316
  $details = array(
1277
  if (!empty($user_ID)) {
1278
  $user = new WP_User($user_ID);
1279
  if ($user->has_cap("post_via_postie")) {
1280
+ DebugEcho("$user_ID has 'post_via_postie' permissions");
1281
  $poster = $user_ID;
1282
  EchoInfo("posting as user $poster");
1283
  } else {
1284
+ DebugEcho("$user_ID does not have 'post_via_postie' permissions");
1285
+ $user_ID = "";
 
 
 
 
 
 
1286
  }
1287
+ }
1288
+ if ($turn_authorization_off || isEmailAddressAuthorized($from, $authorized_addresses) || isEmailAddressAuthorized($resentFrom, $authorized_addresses)) {
1289
  DebugEcho("ValidatePoster: looking up default user $admin_username");
1290
  $user = get_user_by('login', $admin_username);
1291
  if ($user === false) {
1292
+ EchoInfo("Your 'Default Poster' setting '$admin_username' is not a valid WordPress user (2)");
1293
  $poster = 1;
1294
  } else {
1295
  $poster = $user->ID;
2236
  * @param string - text of post
2237
  * @param array - array of HTML for images for post
2238
  */
2239
+ function filter_ReplaceImagePlaceHolders(&$content, $attachments, $config, $post_id) {
2240
  if (!$config['custom_image_field']) {
2241
  if (!$config['allow_html_in_body']) {
2242
  $content = html_entity_decode($content, ENT_QUOTES);
2243
  }
2244
 
2245
  $startIndex = $config['start_image_count_at_zero'] ? 0 : 1;
2246
+
2247
+ $images = get_posts(array(
2248
+ 'post_parent' => $post_id,
2249
+ 'post_type' => 'attachment',
2250
+ 'numberposts' => -1,
2251
+ 'post_mime_type' => 'image',));
2252
+ DebugEcho("images in post: ". count($images));
2253
+
2254
+ if ((count($images) > 0) && $config['auto_gallery']) {
2255
  $imageTemplate = '[gallery]';
2256
  if ($config['images_append']) {
2257
  $content .= "\n$imageTemplate";
2663
  'selected_video1template' => 'simple_link',
2664
  'selected_video2template' => 'simple_link',
2665
  'shortcode' => false,
2666
+ 'sig_pattern_list' => array('--\s?[\r\n]?', '--\s', '--', '---'),
2667
  'smtp' => array(),
2668
  'start_image_count_at_zero' => false,
2669
  'supported_file_types' => array('application'),
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
- Version: 1.5.8
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
@@ -27,10 +27,10 @@
27
  */
28
 
29
  /*
30
- $Id: postie.php 713262 2013-05-15 05:08:09Z WayneAllen $
31
  */
32
 
33
- define('POSTIE_VERSION', '1.5.8');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
+ Version: 1.5.9
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 715038 2013-05-18 18:46:28Z WayneAllen $
31
  */
32
 
33
+ define('POSTIE_VERSION', '1.5.9');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
- Stable tag: 1.5.8
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -445,6 +445,12 @@ All script, style and body tags are stripped from html emails.
445
  Attachments are now processed in the order they were attached.
446
 
447
  == CHANGELOG ==
 
 
 
 
 
 
448
  = 1.5.8 (2013.05.14) =
449
  * Added additional default signature patterns.
450
  * Fixed a bug where attachments were not showing up if :start or :end were used.
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
+ Stable tag: 1.5.9
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
445
  Attachments are now processed in the order they were attached.
446
 
447
  == CHANGELOG ==
448
+ = 1.5.9 (2013.05.18) =
449
+ * Fixed a bug where valid users can post via email even though they don't have role permissions.
450
+ * Fixed a bug where nice_name was being used in the settings screen even though user_login was needed.
451
+ * Fixed the error message when the default poster is not valid.
452
+ * Fixed bug where gallery short tag was getting set when non-image attachments were found.
453
+
454
  = 1.5.8 (2013.05.14) =
455
  * Added additional default signature patterns.
456
  * Fixed a bug where attachments were not showing up if :start or :end were used.