Postie - Version 1.9.34

Version Description

(2019-05-15) = * Workaround for WP bug #39521 to correctly set image caption from image metadata

Download this release

Release Info

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

Code changes from version 1.9.33 to 1.9.34

docs/Changes.txt CHANGED
@@ -35,6 +35,9 @@ 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.33 (2019-04-29) =
39
  * Assign author to all media items
40
 
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.34 (2019-05-15) =
39
+ * Workaround for WP bug #39521 to correctly set image caption from image metadata
40
+
41
  = 1.9.33 (2019-04-29) =
42
  * Assign author to all media items
43
 
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.2
10
- Stable tag: 1.9.33
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.2
10
+ Stable tag: 1.9.34
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
lib/pSocketConnection.php CHANGED
@@ -59,7 +59,7 @@ class pSocketConnection extends pConnection {
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('The username and password provided were not accepted for the %1$s server %2$s on port %3$s. %4$s', strtoupper($this->type), $this->host, $this->port, print_r($response, true));
63
  }
64
  $this->write('SELECT "' . $this->mailbox . '"');
65
  } elseif ($this->type == 'pop3') {
@@ -114,7 +114,7 @@ class pSocketConnection extends pConnection {
114
  }
115
 
116
  if (!$authenticated) {
117
- throw new fValidationException('The username and password provided were not accepted for the %1$s server %2$s on port %3$s', strtoupper($this->type), $this->host, $this->port);
118
  }
119
  }
120
  }
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
  }
64
  $this->write('SELECT "' . $this->mailbox . '"');
65
  } elseif ($this->type == 'pop3') {
114
  }
115
 
116
  if (!$authenticated) {
117
+ throw new fValidationException('POP3 - 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));
118
  }
119
  }
120
  }
postie.class.php CHANGED
@@ -566,13 +566,32 @@ class Postie {
566
  $id = media_handle_sideload($file_array, $post_id);
567
 
568
  if (!is_wp_error($id)) {
569
- DebugEcho("media_handle_upload: changing owner to $poster");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  wp_update_post(array(
571
  'ID' => $id,
572
  'post_author' => $poster,
 
 
573
  ));
574
 
575
- $mediapath = get_attached_file($id);
576
  $file_array['tmp_name'] = $mediapath;
577
  DebugEcho("media_handle_upload: doing postie_file_added");
578
  do_action('postie_file_added', $post_id, $id, $file_array);
@@ -1507,7 +1526,9 @@ class Postie {
1507
  DebugEcho("validate_poster: logging in as {$user->user_login}");
1508
  wp_set_current_user($poster);
1509
  //wp_set_auth_cookie($poster);
1510
- do_action('wp_login', $user->user_login);
 
 
1511
  }
1512
  }
1513
  return $poster;
@@ -1518,10 +1539,11 @@ class Postie {
1518
  global $wpdb;
1519
 
1520
  DebugEcho("OS: " . php_uname(), $force_display);
1521
- DebugEcho("PHP Version: " . phpversion(), $force_display);
1522
  DebugEcho("PHP error_log: " . ini_get('error_log'), $force_display);
1523
  DebugEcho("PHP log_errors: " . (ini_get('log_errors') ? 'On' : 'Off'), $force_display);
1524
  DebugEcho("PHP get_temp_dir: " . get_temp_dir(), $force_display);
 
1525
  if (function_exists('curl_version')) {
1526
  $cv = curl_version();
1527
  DebugEcho("PHP cURL version: " . $cv['version'], $force_display);
566
  $id = media_handle_sideload($file_array, $post_id);
567
 
568
  if (!is_wp_error($id)) {
569
+ DebugEcho("media_handle_upload: changing post_author to $poster");
570
+
571
+ $mediapath = get_attached_file($id);
572
+
573
+ //TODO once WordPress is fixed this can be removed. https://core.trac.wordpress.org/ticket/39521
574
+ if (0 === strpos($attachment['mimetype'], 'image/') && $image_meta = wp_read_image_metadata($mediapath)) {
575
+ $title = '';
576
+ if (trim($image_meta['title']) && !is_numeric(sanitize_title($image_meta['title']))) {
577
+ $title = $image_meta['title'];
578
+ DebugEcho("media_handle_upload: changing post_title to $title");
579
+ }
580
+
581
+ $excerpt = '';
582
+ if (trim($image_meta['caption'])) {
583
+ $excerpt = $image_meta['caption'];
584
+ DebugEcho("media_handle_upload: changing post_excerpt to $excerpt");
585
+ }
586
+ }
587
+
588
  wp_update_post(array(
589
  'ID' => $id,
590
  'post_author' => $poster,
591
+ 'post_title' => $title,
592
+ 'post_excerpt' => $excerpt,
593
  ));
594
 
 
595
  $file_array['tmp_name'] = $mediapath;
596
  DebugEcho("media_handle_upload: doing postie_file_added");
597
  do_action('postie_file_added', $post_id, $id, $file_array);
1526
  DebugEcho("validate_poster: logging in as {$user->user_login}");
1527
  wp_set_current_user($poster);
1528
  //wp_set_auth_cookie($poster);
1529
+ do_action('wp_login', $user->user_login, $user);
1530
+ } else {
1531
+ DebugEcho("validate_poster: couldn't find $poster to force login");
1532
  }
1533
  }
1534
  return $poster;
1539
  global $wpdb;
1540
 
1541
  DebugEcho("OS: " . php_uname(), $force_display);
1542
+ DebugEcho("PHP version: " . phpversion(), $force_display);
1543
  DebugEcho("PHP error_log: " . ini_get('error_log'), $force_display);
1544
  DebugEcho("PHP log_errors: " . (ini_get('log_errors') ? 'On' : 'Off'), $force_display);
1545
  DebugEcho("PHP get_temp_dir: " . get_temp_dir(), $force_display);
1546
+ DebugEcho("PHP disable_functions: " . ini_get('disable_functions'), $force_display);
1547
  if (function_exists('curl_version')) {
1548
  $cv = curl_version();
1549
  DebugEcho("PHP cURL version: " . $cv['version'], $force_display);
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.33
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,14 +28,14 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 2077502 2019-04-30 04:08:22Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
- define('POSTIE_VERSION', '1.9.33');
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.34
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 2088761 2019-05-16 02:59:09Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
+ define('POSTIE_VERSION', '1.9.34');
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: 5.2
10
- Stable tag: 1.9.33
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -107,6 +107,9 @@ 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.33 (2019-04-29) =
111
  * Assign author to all media items
112
 
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 5.2
10
+ Stable tag: 1.9.34
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.34 (2019-05-15) =
111
+ * Workaround for WP bug #39521 to correctly set image caption from image metadata
112
+
113
  = 1.9.33 (2019-04-29) =
114
  * Assign author to all media items
115