Postie - Version 1.4.38

Version Description

(2013.03.12) = * Improved POP3 configuration test * Fixed bug where :start and :end were removing commands like tags: and date: before they got a chance to be processed

Download this release

Release Info

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

Code changes from version 1.4.37 to 1.4.38

Revision CHANGED
@@ -1,2 +0,0 @@
1
- Revision: 679961
2
- Last Changed Date: 2013-03-08 16:05:57 -0800 (Fri, 08 Mar 2013)
 
 
docs/Changes.txt CHANGED
@@ -10,6 +10,10 @@ All script, style and body tags are stripped from html emails.
10
  Attachments are now processed in the order they were attached.
11
 
12
  == CHANGELOG ==
 
 
 
 
13
  = 1.4.37 (2013.03.11) =
14
  * Fixed bug in tag handling
15
  * Fixed bug in category detection
10
  Attachments are now processed in the order they were attached.
11
 
12
  == CHANGELOG ==
13
+ = 1.4.38 (2013.03.12) =
14
+ * Improved POP3 configuration test
15
+ * Fixed bug where :start and :end were removing commands like tags: and date: before they got a chance to be processed
16
+
17
  = 1.4.37 (2013.03.11) =
18
  * Fixed bug in tag handling
19
  * Fixed bug in category detection
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.4.37
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.4.38
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 680123 2013-03-11 23:18:14Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -147,14 +147,6 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config) {
147
 
148
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
149
 
150
- filter_Start($content, $config);
151
- if ($fulldebug)
152
- DebugEcho("post start: $content");
153
-
154
- filter_End($content, $config);
155
- if ($fulldebug)
156
- DebugEcho("post end: $content");
157
-
158
  filter_RemoveSignature($content, $config);
159
  if ($fulldebug)
160
  DebugEcho("post sig: $content");
@@ -283,6 +275,15 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config) {
283
  if ($fulldebug)
284
  DebugEcho("post newline: $content");
285
 
 
 
 
 
 
 
 
 
 
286
  DebugEcho("excerpt: $post_excerpt");
287
 
288
  $details = array(
@@ -694,7 +695,7 @@ function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password
694
  $emails = array();
695
  $pop3 = new POP3();
696
 
697
- EchoInfo("Connecting to $server:$port ($protocol))");
698
 
699
  if ($pop3->connect($server, $port)) {
700
  $msg_count = $pop3->login($email, $password);
@@ -708,16 +709,30 @@ function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password
708
  EchoInfo("The Server said: $pop3->ERROR");
709
  $msg_count = 0;
710
  }
 
711
 
712
  // loop through messages
 
 
 
 
713
  for ($i = 1; $i <= $msg_count; $i++) {
714
- $emails[$i] = implode('', $pop3->get($i));
715
- if ($deleteMessages) {
716
- if (!$pop3->delete($i)) {
717
- EchoInfo('pop3 cannot delete message ' . $pop3->ERROR);
718
- $pop3->reset();
719
- exit;
 
 
 
 
 
 
 
720
  }
 
 
721
  }
722
  if ($maxemails != 0 && $i >= $maxemails) {
723
  DebugEcho("Max emails ($maxemails)");
@@ -1661,48 +1676,37 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
1661
  __("Missing a temporary folder."),
1662
  __("Failed to write file to disk."));
1663
 
1664
- // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
1665
- $test_form = true;
1666
- $test_size = true;
1667
-
1668
- // If you override this, you must provide $ext and $type!!!!
1669
- $test_type = true;
1670
- $mimes = false;
1671
-
1672
  // Install user overrides. Did we mention that this voids your warranty?
1673
  if (is_array($overrides))
1674
  extract($overrides, EXTR_OVERWRITE);
1675
 
1676
- // A correct form post will pass this test.
1677
- if ($test_form && (!isset($_POST['action']) || ($_POST['action'] != $action ) ))
1678
- return $upload_error_handler($file, __('Invalid form submission.'));
1679
-
1680
  // A successful upload will pass this test. It makes no sense to override this one.
1681
  if ($file['error'] > 0)
1682
  return $upload_error_handler($file, $upload_error_strings[$file['error']]);
1683
 
1684
  // A non-empty file will pass this test.
1685
- if ($test_size && !($file['size'] > 0 ))
1686
  return $upload_error_handler($file, __('File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.'));
1687
 
1688
  // A properly uploaded file will pass this test. There should be no reason to override this one.
1689
  if (!file_exists($file['tmp_name']))
1690
  return $upload_error_handler($file, __('Specified file failed upload test.'));
1691
  // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
1692
- if ($test_type) {
1693
- $wp_filetype = wp_check_filetype($file['name'], $mimes);
1694
 
1695
- extract($wp_filetype);
 
 
1696
 
1697
- if ((!$type || !$ext ) && !current_user_can('unfiltered_upload'))
1698
- return $upload_error_handler($file, __('File type does not meet security guidelines. Try another.'));
1699
 
1700
- if (!$ext)
1701
- $ext = ltrim(strrchr($file['name'], '.'), '.');
1702
 
1703
- if (!$type)
1704
- $type = $file['type'];
1705
- }
 
 
1706
 
1707
  // A writable uploads dir will pass this test. Again, there's no point overriding this one.
1708
  if (!( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ))
@@ -1737,7 +1741,7 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
1737
  }
1738
 
1739
  function filename_fix($filename) {
1740
- return str_replace ('%','',urlencode($filename));
1741
  }
1742
 
1743
  /**
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 680972 2013-03-13 04:33:01Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
147
 
148
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
149
 
 
 
 
 
 
 
 
 
150
  filter_RemoveSignature($content, $config);
151
  if ($fulldebug)
152
  DebugEcho("post sig: $content");
275
  if ($fulldebug)
276
  DebugEcho("post newline: $content");
277
 
278
+ filter_Start($content, $config);
279
+ if ($fulldebug)
280
+ DebugEcho("post start: $content");
281
+
282
+ filter_End($content, $config);
283
+ if ($fulldebug)
284
+ DebugEcho("post end: $content");
285
+
286
+
287
  DebugEcho("excerpt: $post_excerpt");
288
 
289
  $details = array(
695
  $emails = array();
696
  $pop3 = new POP3();
697
 
698
+ EchoInfo("Connecting to $server:$port ($protocol)");
699
 
700
  if ($pop3->connect($server, $port)) {
701
  $msg_count = $pop3->login($email, $password);
709
  EchoInfo("The Server said: $pop3->ERROR");
710
  $msg_count = 0;
711
  }
712
+ DebugEcho("message count: $msg_count");
713
 
714
  // loop through messages
715
+ //$msgs = $pop3->pop_list();
716
+ //DebugEcho("POP3MessageFetch: messages");
717
+ //DebugDump($msgs);
718
+
719
  for ($i = 1; $i <= $msg_count; $i++) {
720
+ $m = $pop3->get($i);
721
+ if ($m !== false) {
722
+ if (is_array($m)) {
723
+ $emails[$i] = implode('', $m);
724
+ if ($deleteMessages) {
725
+ if (!$pop3->delete($i)) {
726
+ EchoInfo('POP3MessageFetch: cannot delete message $i ' . $pop3->ERROR);
727
+ $pop3->reset();
728
+ exit;
729
+ }
730
+ }
731
+ } else {
732
+ DebugEcho("POP3MessageFetch: message $i not an array");
733
  }
734
+ } else {
735
+ EchoInfo("POP3MessageFetch: message $i $pop3->ERROR");
736
  }
737
  if ($maxemails != 0 && $i >= $maxemails) {
738
  DebugEcho("Max emails ($maxemails)");
1676
  __("Missing a temporary folder."),
1677
  __("Failed to write file to disk."));
1678
 
 
 
 
 
 
 
 
 
1679
  // Install user overrides. Did we mention that this voids your warranty?
1680
  if (is_array($overrides))
1681
  extract($overrides, EXTR_OVERWRITE);
1682
 
 
 
 
 
1683
  // A successful upload will pass this test. It makes no sense to override this one.
1684
  if ($file['error'] > 0)
1685
  return $upload_error_handler($file, $upload_error_strings[$file['error']]);
1686
 
1687
  // A non-empty file will pass this test.
1688
+ if (!($file['size'] > 0 ))
1689
  return $upload_error_handler($file, __('File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.'));
1690
 
1691
  // A properly uploaded file will pass this test. There should be no reason to override this one.
1692
  if (!file_exists($file['tmp_name']))
1693
  return $upload_error_handler($file, __('Specified file failed upload test.'));
1694
  // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
 
 
1695
 
1696
+ $wp_filetype = wp_check_filetype($file['name']);
1697
+ DebugEcho("postie_handle_upload: detected file type for " . $file['name']);
1698
+ DebugDump($wp_filetype);
1699
 
1700
+ extract($wp_filetype);
 
1701
 
1702
+ if ((!$type || !$ext ) && !current_user_can('unfiltered_upload'))
1703
+ return $upload_error_handler($file, __('File type does not meet security guidelines. Try another.'));
1704
 
1705
+ if (!$ext)
1706
+ $ext = ltrim(strrchr($file['name'], '.'), '.');
1707
+
1708
+ if (!$type)
1709
+ $type = $file['type'];
1710
 
1711
  // A writable uploads dir will pass this test. Again, there's no point overriding this one.
1712
  if (!( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ))
1741
  }
1742
 
1743
  function filename_fix($filename) {
1744
+ return str_replace('%', '', urlencode($filename));
1745
  }
1746
 
1747
  /**
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.4.37
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
@@ -27,7 +27,7 @@
27
  */
28
 
29
  /*
30
- $Id: postie.php 680123 2013-03-11 23:18:14Z WayneAllen $
31
  */
32
 
33
  define("POSTIE_ROOT", dirname(__FILE__));
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.4.38
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 680972 2013-03-13 04:33:01Z WayneAllen $
31
  */
32
 
33
  define("POSTIE_ROOT", dirname(__FILE__));
postie_test.php CHANGED
@@ -44,7 +44,7 @@ $images = array("Test.png", "Test.jpg", "Test.gif");
44
  } else {
45
  EchoInfo("Warning! Postie requires that iconv be enabled.");
46
  }
47
-
48
  if (function_exists('imap_mime_header_decode')) {
49
  EchoInfo("imap: installed");
50
  } else {
@@ -75,7 +75,7 @@ $images = array("Test.png", "Test.jpg", "Test.gif");
75
  } else {
76
  DebugEcho("checking");
77
  }
78
-
79
  switch (strtolower($config["input_protocol"])) {
80
  case 'imap':
81
  case 'imap-ssl':
@@ -98,11 +98,20 @@ $images = array("Test.png", "Test.jpg", "Test.gif");
98
  default:
99
  require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
100
  $pop3 = &new POP3();
 
101
  if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
102
  EchoInfo("Unable to connect. The server said:");
103
  EchoInfo($pop3->ERROR);
104
  } else {
105
  EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
 
 
 
 
 
 
 
 
106
  }
107
  break;
108
  }
44
  } else {
45
  EchoInfo("Warning! Postie requires that iconv be enabled.");
46
  }
47
+
48
  if (function_exists('imap_mime_header_decode')) {
49
  EchoInfo("imap: installed");
50
  } else {
75
  } else {
76
  DebugEcho("checking");
77
  }
78
+
79
  switch (strtolower($config["input_protocol"])) {
80
  case 'imap':
81
  case 'imap-ssl':
98
  default:
99
  require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
100
  $pop3 = &new POP3();
101
+ $pop3->DEBUG = true;
102
  if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
103
  EchoInfo("Unable to connect. The server said:");
104
  EchoInfo($pop3->ERROR);
105
  } else {
106
  EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
107
+ $msgs = $pop3->login($config["mail_userid"], $config["mail_password"]);
108
+ if ($msgs === false) {
109
+ EchoInfo("Unable to authenticate. The server said:");
110
+ EchoInfo($pop3->ERROR);
111
+ } else {
112
+ EchoInfo("# of waiting messages: $msgs");
113
+ }
114
+ $pop3->quit();
115
  }
116
  break;
117
  }
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.4.37
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -426,6 +426,10 @@ All script, style and body tags are stripped from html emails.
426
  Attachments are now processed in the order they were attached.
427
 
428
  == CHANGELOG ==
 
 
 
 
429
  = 1.4.37 (2013.03.11) =
430
  * Fixed bug in tag handling
431
  * Fixed bug in category detection
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
+ Stable tag: 1.4.38
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
426
  Attachments are now processed in the order they were attached.
427
 
428
  == CHANGELOG ==
429
+ = 1.4.38 (2013.03.12) =
430
+ * Improved POP3 configuration test
431
+ * Fixed bug where :start and :end were removing commands like tags: and date: before they got a chance to be processed
432
+
433
  = 1.4.37 (2013.03.11) =
434
  * Fixed bug in tag handling
435
  * Fixed bug in category detection
test/inlineimageTest.php CHANGED
@@ -57,7 +57,6 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
57
  $config['convertnewline'] = true;
58
 
59
  $post = $this->process_file("data/linebreaks.var", $config);
60
- echo $post['post_content'];
61
  $this->assertEquals("Test<br />\nEen stuck TekstEen stuck TekstEen stuck TekstEen stuck Tekst<br />\nEen stuck TekstEen stuck Tekst<br />\n<br />\nEen stuck TekstEen stuck Tekst<br />\n", $post['post_content']);
62
  }
63
 
57
  $config['convertnewline'] = true;
58
 
59
  $post = $this->process_file("data/linebreaks.var", $config);
 
60
  $this->assertEquals("Test<br />\nEen stuck TekstEen stuck TekstEen stuck TekstEen stuck Tekst<br />\nEen stuck TekstEen stuck Tekst<br />\n<br />\nEen stuck TekstEen stuck Tekst<br />\n", $post['post_content']);
61
  }
62
 
util/wp-i18n/t/test_not-gettexted.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Tests for not-gettexted.php
4
  *
@@ -6,43 +7,44 @@
6
  * @package wordpress-i18n
7
  * @subpackage tools
8
  */
9
- error_reporting( E_ALL );
10
  require_once 'PHPUnit/Framework.php';
11
- require_once dirname( __FILE__ ) '/../not-gettexted.php';
12
 
13
  class Test_Not_Gettexted extends PHPUnit_Framework_TestCase {
14
-
15
- function __construct() {
16
- $this->ng = new NotGettexted;
17
- }
18
-
19
- function test_make_string_aggregator() {
20
- global $baba;
21
- $f = $this->ng->make_string_aggregator( 'baba', 'baba.php' );
22
- call_user_func( $f, 'x', 'y', 'z' );
23
- call_user_func( $f, 'a', 'b', 'c' );
24
- $this->assertEquals( array( array( 'x', 'y', 'baba.php', 'z'), array( 'a', 'b', 'baba.php', 'c' ) ), $baba );
25
- }
26
 
27
- function test_walk() {
28
- $code = '
 
 
 
 
 
 
 
 
 
 
 
 
29
  <?php
30
  $s = 8;
31
  echo /* WP_I18N_GUGU*/ "yes" /* /WP_I18N_UGU */;
32
  if ($x == "18181") { wp_die(sprintf(/*WP_I18N_DIE*/\'We died %d times!\'/*WP_I18N_DIE*/)); }
33
  ?>';
34
- $tokens = token_get_all($code);
35
- $this->assertEquals( '', $this->ng->walk_tokens( $tokens, array(&$this->ng, 'ignore_token'), array(&$this->ng, 'ignore_token') ) );
36
- $this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'ignore_token') ) );
37
- $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token') ) );
38
- $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token') ) );
39
- }
 
 
 
 
 
 
 
 
40
 
41
- function test_replace() {
42
- # copy to a new file, so that we don't corrupt the old one
43
- copy( 'data/not-gettexted-0.php', 'data/not-gettexted-0-work.php' );
44
- $this->ng->command_replace( 'data/not-gettexted-0.mo', 'data/not-gettexted-0-work.php' );
45
- $this->assertEquals( file_get_contents( 'data/not-gettexted-0-result.php' ), file_get_contents( 'data/not-gettexted-0-work.php' ) );
46
- unlink( 'data/not-gettexted-0-work.php' );
47
- }
48
  }
1
  <?php
2
+
3
  /**
4
  * Tests for not-gettexted.php
5
  *
7
  * @package wordpress-i18n
8
  * @subpackage tools
9
  */
10
+ error_reporting(E_ALL);
11
  require_once 'PHPUnit/Framework.php';
12
+ require_once dirname(__FILE__) . '/../not-gettexted.php';
13
 
14
  class Test_Not_Gettexted extends PHPUnit_Framework_TestCase {
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ function __construct() {
17
+ $this->ng = new NotGettexted;
18
+ }
19
+
20
+ function test_make_string_aggregator() {
21
+ global $baba;
22
+ $f = $this->ng->make_string_aggregator('baba', 'baba.php');
23
+ call_user_func($f, 'x', 'y', 'z');
24
+ call_user_func($f, 'a', 'b', 'c');
25
+ $this->assertEquals(array(array('x', 'y', 'baba.php', 'z'), array('a', 'b', 'baba.php', 'c')), $baba);
26
+ }
27
+
28
+ function test_walk() {
29
+ $code = '
30
  <?php
31
  $s = 8;
32
  echo /* WP_I18N_GUGU*/ "yes" /* /WP_I18N_UGU */;
33
  if ($x == "18181") { wp_die(sprintf(/*WP_I18N_DIE*/\'We died %d times!\'/*WP_I18N_DIE*/)); }
34
  ?>';
35
+ $tokens = token_get_all($code);
36
+ $this->assertEquals('', $this->ng->walk_tokens($tokens, array(&$this->ng, 'ignore_token'), array(&$this->ng, 'ignore_token')));
37
+ $this->assertEquals('"yes"\'We died %d times!\'', $this->ng->walk_tokens($tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'ignore_token')));
38
+ $this->assertEquals($code, $this->ng->walk_tokens($tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token')));
39
+ $this->assertEquals($code, $this->ng->walk_tokens($tokens, array(&$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token')));
40
+ }
41
+
42
+ function test_replace() {
43
+ # copy to a new file, so that we don't corrupt the old one
44
+ copy('data/not-gettexted-0.php', 'data/not-gettexted-0-work.php');
45
+ $this->ng->command_replace('data/not-gettexted-0.mo', 'data/not-gettexted-0-work.php');
46
+ $this->assertEquals(file_get_contents('data/not-gettexted-0-result.php'), file_get_contents('data/not-gettexted-0-work.php'));
47
+ unlink('data/not-gettexted-0-work.php');
48
+ }
49
 
 
 
 
 
 
 
 
50
  }