Postie - Version 1.5.12

Version Description

(2013.06.08) = * Added full paths to includes in config_form due to some hosts having include_path set in a way that breaks Postie. * Added some checks for emails that aren't correctly formatted (AirMail/WinLink) * Consolidated environmental checks * Added logic for Debian location of wp-config.php

Download this release

Release Info

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

Code changes from version 1.5.11 to 1.5.12

Files changed (8) hide show
  1. config_form.php +10 -10
  2. docs/Changes.txt +6 -0
  3. docs/Postie.txt +1 -1
  4. get_mail.php +4 -5
  5. postie-functions.php +92 -24
  6. postie.php +3 -3
  7. postie_test.php +1 -46
  8. readme.txt +7 -1
config_form.php CHANGED
@@ -34,12 +34,12 @@
34
  $message = 1;
35
  break;
36
  case "test":
37
- include('postie_test.php');
38
  exit;
39
  break;
40
  case "runpostie":
41
  EchoInfo("Checking for mail manually");
42
- include('get_mail.php');
43
  exit;
44
  break;
45
  case "runpostie-debug":
@@ -47,7 +47,7 @@
47
  if (!defined('POSTIE_DEBUG')) {
48
  define('POSTIE_DEBUG', true);
49
  }
50
- include('get_mail.php');
51
  exit;
52
  break;
53
  default:
@@ -511,7 +511,7 @@
511
  onchange="changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate',
512
  'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg');" >
513
  <?php
514
- include('templates/image_templates.php');
515
  $styleOptions = $imageTemplates;
516
  $selected = $selected_imagetemplate;
517
  foreach ($styleOptions as $key => $value) {
@@ -590,7 +590,7 @@
590
  <select name='video1templateselect' id='video1templateselect'
591
  onchange="changeStyle('video1TemplatePreview', 'postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4');" />
592
  <?php
593
- include('templates/video1_templates.php');
594
  $styleOptions = $video1Templates;
595
  $selected = $selected_video1template;
596
  foreach ($styleOptions as $key => $value) {
@@ -639,7 +639,7 @@
639
  onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
640
  'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv');" >
641
  <?php
642
- include('templates/video2_templates.php');
643
  $styleOptions = $video2Templates;
644
  $selected = $selected_video2template;
645
  foreach ($styleOptions as $key => $value) {
@@ -691,7 +691,7 @@
691
  onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
692
  'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);" >
693
  <?php
694
- include('templates/audio_templates.php');
695
  $styleOptions = $audioTemplates;
696
  $selected = $selected_audiotemplate;
697
  foreach ($styleOptions as $key => $value) {
@@ -798,7 +798,7 @@
798
  onchange="changeStyle('generalTemplatePreview', 'postie-settings-generaltemplate',
799
  'generaltemplateselect', 'postie-settings-selected_generaltemplate', 'interesting_document.doc', false);" >
800
  <?php
801
- include('templates/general_template.php');
802
  $styleOptions = $generalTemplates;
803
  $selected = $selected_generaltemplate;
804
  foreach ($styleOptions as $key => $value) {
@@ -836,10 +836,10 @@
836
  </table>
837
  </div>
838
  <div id="simpleTabs-content-7" class="simpleTabs-content">
839
- <?php include('readme.html'); ?>
840
  </div>
841
  <div id="simpleTabs-content-8" class="simpleTabs-content">
842
- <?php include('faq.html'); ?>
843
  </div>
844
 
845
  <p class="submit">
34
  $message = 1;
35
  break;
36
  case "test":
37
+ include(POSTIE_ROOT . '/postie_test.php');
38
  exit;
39
  break;
40
  case "runpostie":
41
  EchoInfo("Checking for mail manually");
42
+ include(POSTIE_ROOT . '/get_mail.php');
43
  exit;
44
  break;
45
  case "runpostie-debug":
47
  if (!defined('POSTIE_DEBUG')) {
48
  define('POSTIE_DEBUG', true);
49
  }
50
+ include(POSTIE_ROOT . '/get_mail.php');
51
  exit;
52
  break;
53
  default:
511
  onchange="changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate',
512
  'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg');" >
513
  <?php
514
+ include(POSTIE_ROOT . '/templates/image_templates.php');
515
  $styleOptions = $imageTemplates;
516
  $selected = $selected_imagetemplate;
517
  foreach ($styleOptions as $key => $value) {
590
  <select name='video1templateselect' id='video1templateselect'
591
  onchange="changeStyle('video1TemplatePreview', 'postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4');" />
592
  <?php
593
+ include(POSTIE_ROOT . '/templates/video1_templates.php');
594
  $styleOptions = $video1Templates;
595
  $selected = $selected_video1template;
596
  foreach ($styleOptions as $key => $value) {
639
  onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
640
  'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv');" >
641
  <?php
642
+ include(POSTIE_ROOT . '/templates/video2_templates.php');
643
  $styleOptions = $video2Templates;
644
  $selected = $selected_video2template;
645
  foreach ($styleOptions as $key => $value) {
691
  onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
692
  'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);" >
693
  <?php
694
+ include(POSTIE_ROOT . '/templates/audio_templates.php');
695
  $styleOptions = $audioTemplates;
696
  $selected = $selected_audiotemplate;
697
  foreach ($styleOptions as $key => $value) {
798
  onchange="changeStyle('generalTemplatePreview', 'postie-settings-generaltemplate',
799
  'generaltemplateselect', 'postie-settings-selected_generaltemplate', 'interesting_document.doc', false);" >
800
  <?php
801
+ include(POSTIE_ROOT . '/templates/general_template.php');
802
  $styleOptions = $generalTemplates;
803
  $selected = $selected_generaltemplate;
804
  foreach ($styleOptions as $key => $value) {
836
  </table>
837
  </div>
838
  <div id="simpleTabs-content-7" class="simpleTabs-content">
839
+ <?php include(POSTIE_ROOT . '/readme.html'); ?>
840
  </div>
841
  <div id="simpleTabs-content-8" class="simpleTabs-content">
842
+ <?php include(POSTIE_ROOT . '/faq.html'); ?>
843
  </div>
844
 
845
  <p class="submit">
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.11 (2013.06.02) =
26
  * Moved test files out of main repository to decrease plugin size
27
  * Fixed issue with readme file (Wordpress readme validator moved)
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
25
+ = 1.5.12 (2013.06.08) =
26
+ * Added full paths to includes in config_form due to some hosts having include_path set in a way that breaks Postie.
27
+ * Added some checks for emails that aren't correctly formatted (AirMail/WinLink)
28
+ * Consolidated environmental checks
29
+ * Added logic for Debian location of wp-config.php
30
+
31
  = 1.5.11 (2013.06.02) =
32
  * Moved test files out of main repository to decrease plugin size
33
  * Fixed issue with readme file (Wordpress readme validator moved)
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.11
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.12
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
get_mail.php CHANGED
@@ -3,9 +3,11 @@
3
  //support moving wp-config.php as described here http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php
4
  $wp_config_path = dirname(dirname(dirname(dirname(__FILE__))));
5
  if (file_exists($wp_config_path . DIRECTORY_SEPARATOR . "wp-config.php")) {
6
- include_once ($wp_config_path . DIRECTORY_SEPARATOR . "wp-config.php");
7
  } elseif (file_exists(dirname($wp_config_path) . DIRECTORY_SEPARATOR . "wp-config.php")) {
8
  include_once (dirname($wp_config_path)) . DIRECTORY_SEPARATOR . "wp-config.php";
 
 
9
  } else {
10
  die("wp-config.php could not be found.");
11
  }
@@ -16,9 +18,7 @@ if (!function_exists('file_get_html'))
16
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'simple_html_dom.php');
17
 
18
  EchoInfo("Starting mail fetch");
19
- EchoInfo("Postie Version: " . POSTIE_VERSION);
20
- EchoInfo("Debug mode: " . (IsDebugMode() ? "On" : "Off"));
21
- EchoInfo("Time: " . date('Y-m-d H:i:s', time()) . " GMT");
22
  $wp_content_path = dirname(dirname(dirname(__FILE__)));
23
  DebugEcho("wp_content_path: $wp_content_path");
24
  if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
@@ -40,7 +40,6 @@ EchoInfo(sprintf(__("There are %d messages to process", "postie"), count($emails
40
  if (function_exists('memory_get_usage'))
41
  DebugEcho(__("memory at start of e-mail processing:") . memory_get_usage());
42
 
43
- DebugEcho("Error log: " . ini_get('error_log'));
44
  DebugDump($config);
45
 
46
  //loop through messages
3
  //support moving wp-config.php as described here http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php
4
  $wp_config_path = dirname(dirname(dirname(dirname(__FILE__))));
5
  if (file_exists($wp_config_path . DIRECTORY_SEPARATOR . "wp-config.php")) {
6
+ include_once($wp_config_path . DIRECTORY_SEPARATOR . "wp-config.php");
7
  } elseif (file_exists(dirname($wp_config_path) . DIRECTORY_SEPARATOR . "wp-config.php")) {
8
  include_once (dirname($wp_config_path)) . DIRECTORY_SEPARATOR . "wp-config.php";
9
+ } elseif (file_exists('/usr/share/wordpress/wp-config.php')) {
10
+ include_once('/usr/share/wordpress/wp-config.php');
11
  } else {
12
  die("wp-config.php could not be found.");
13
  }
18
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'simple_html_dom.php');
19
 
20
  EchoInfo("Starting mail fetch");
21
+ postie_environment();
 
 
22
  $wp_content_path = dirname(dirname(dirname(__FILE__)));
23
  DebugEcho("wp_content_path: $wp_content_path");
24
  if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
40
  if (function_exists('memory_get_usage'))
41
  DebugEcho(__("memory at start of e-mail processing:") . memory_get_usage());
42
 
 
43
  DebugDump($config);
44
 
45
  //loop through messages
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 720921 2013-05-31 16:55:11Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -46,6 +46,57 @@ if (!function_exists('mb_str_replace')) {
46
 
47
  }
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  function postie_disable_revisions($restore = false) {
50
  global $_wp_post_type_features, $_postie_revisions;
51
 
@@ -867,17 +918,20 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
867
  //global $charset, $encoding;
868
  DebugEcho('----');
869
  $meta_return = '';
870
- DebugEcho("GetContent: primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary);
871
- DebugDump($part);
 
 
872
 
873
  DecodeBase64Part($part);
874
 
875
  //look for banned file names
876
  if (property_exists($part, 'ctype_parameters') && is_array($part->ctype_parameters) && array_key_exists('name', $part->ctype_parameters))
877
- if (isBannedFileName($part->ctype_parameters['name'], $banned_files_list))
878
  return NULL;
 
879
 
880
- if ($part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") {
881
  if (property_exists($part, 'disposition') && $part->disposition == "attachment") {
882
  //nothing
883
  } else {
@@ -890,7 +944,7 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
890
  }
891
  }
892
 
893
- if ($part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") {
894
  DebugEcho("multipart appledouble");
895
  $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body);
896
  filter_PreferedText($mimeDecodedEmail, $prefer_text_type);
@@ -911,8 +965,13 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
911
  DebugEcho("GetContent: file name '$filename'");
912
  DebugEcho("GetContent: extension '$fileext'");
913
 
914
- $mimetype_primary = strtolower($part->ctype_primary);
915
- $mimetype_secondary = strtolower($part->ctype_secondary);
 
 
 
 
 
916
 
917
  $typeinfo = wp_check_filetype($filename);
918
  //DebugDump($typeinfo);
@@ -1262,7 +1321,7 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
1262
  }
1263
 
1264
  $resentFrom = "";
1265
- if (property_exists($mimeDecodedEmail, "headers")&& array_key_exists('resent-from', $mimeDecodedEmail->headers)) {
1266
  $resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["resent-from"]));
1267
  }
1268
 
@@ -1655,12 +1714,16 @@ function postie_media_handle_upload($part, $post_id, $poster, $generate_thubnail
1655
  }
1656
 
1657
  //special case to deal with older png implementations
1658
- if (strtolower($part->ctype_secondary == 'x-png')) {
1659
- DebugEcho("postie_media_handle_upload: x-png found, renamed to png");
1660
- $part->ctype_secondary = 'png';
 
 
 
 
1661
  }
1662
 
1663
- $name = 'postie-media.' . $part->ctype_secondary;
1664
  if (property_exists($part, 'ctype_parameters') && is_array($part->ctype_parameters)) {
1665
  if (array_key_exists('name', $part->ctype_parameters) && $part->ctype_parameters['name'] != '') {
1666
  $name = $part->ctype_parameters['name'];
@@ -1860,33 +1923,38 @@ function filename_fix($filename) {
1860
  * @param object
1861
  */
1862
  function filter_PreferedText($mimeDecodedEmail, $preferTextType) {
1863
- DebugEcho("FilterTextParts: begin " . count($mimeDecodedEmail->parts));
1864
  $newParts = array();
1865
  $found = false;
1866
 
1867
  for ($i = 0; $i < count($mimeDecodedEmail->parts); $i++) {
1868
- DebugEcho("part: $i " . $mimeDecodedEmail->parts[$i]->ctype_primary . "/" . $mimeDecodedEmail->parts[$i]->ctype_secondary);
 
 
 
 
 
1869
  if (array_key_exists('disposition', $mimeDecodedEmail->parts[$i]) && $mimeDecodedEmail->parts[$i]->disposition == 'attachment') {
1870
- DebugEcho("attachment");
1871
  $newParts[] = $mimeDecodedEmail->parts[$i];
1872
  } else {
1873
  if ($mimeDecodedEmail->parts[$i]->ctype_primary == "text") {
1874
  $ctype = $mimeDecodedEmail->parts[$i]->ctype_secondary;
1875
  if ($ctype == 'html' || $ctype == 'plain') {
1876
- DebugEcho("checking prefered type");
1877
  if ($ctype == $preferTextType) {
1878
- DebugEcho("keeping: $ctype");
1879
  DebugEcho(substr($mimeDecodedEmail->parts[$i]->body, 0, 500));
1880
  $newParts[] = $mimeDecodedEmail->parts[$i];
1881
  } else {
1882
- DebugEcho("removing: $ctype");
1883
  }
1884
  } else {
1885
- DebugEcho("keeping: {$mimeDecodedEmail->parts[$i]->ctype_primary}");
1886
  $newParts[] = $mimeDecodedEmail->parts[$i];
1887
  }
1888
  } else {
1889
- DebugEcho("keeping: {$mimeDecodedEmail->parts[$i]->ctype_primary}");
1890
  $newParts[] = $mimeDecodedEmail->parts[$i];
1891
  }
1892
  }
@@ -1896,7 +1964,7 @@ function filter_PreferedText($mimeDecodedEmail, $preferTextType) {
1896
  DebugEcho(count($newParts) . " parts");
1897
  $mimeDecodedEmail->parts = $newParts;
1898
  }
1899
- DebugEcho("FilterTextParts: end");
1900
  }
1901
 
1902
  /**
@@ -2238,13 +2306,13 @@ function filter_ReplaceImagePlaceHolders(&$content, $attachments, $config, $post
2238
  }
2239
 
2240
  $startIndex = $config['start_image_count_at_zero'] ? 0 : 1;
2241
-
2242
  $images = get_posts(array(
2243
  'post_parent' => $post_id,
2244
  'post_type' => 'attachment',
2245
  'numberposts' => -1,
2246
  'post_mime_type' => 'image',));
2247
- DebugEcho("images in post: ". count($images));
2248
 
2249
  if ((count($images) > 0) && $config['auto_gallery']) {
2250
  $imageTemplate = '[gallery]';
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 724556 2013-06-09 01:11:57Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
46
 
47
  }
48
 
49
+ function postie_environment() {
50
+ EchoInfo("Postie Version: " . POSTIE_VERSION);
51
+ EchoInfo("WordPres Version: " . get_bloginfo('version'));
52
+ EchoInfo("Debug mode: " . (IsDebugMode() ? "On" : "Off"));
53
+ EchoInfo("Time: " . date('Y-m-d H:i:s', time()) . " GMT");
54
+ DebugEcho("Error log: " . ini_get('error_log'));
55
+
56
+ if (isMarkdownInstalled()) {
57
+ EchoInfo("You currently have the Markdown plugin installed. It will cause problems if you send in HTML email. Please turn it off if you intend to send email using HTML.");
58
+ }
59
+
60
+ if (!isPostieInCorrectDirectory()) {
61
+ EchoInfo("Warning! Postie expects to be in its own directory named postie.");
62
+ } else {
63
+ EchoInfo("Postie is in " . dirname(__FILE__));
64
+ }
65
+
66
+ if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
67
+ EchoInfo("Alternate cron is enabled");
68
+ }
69
+
70
+ if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) {
71
+ EchoInfo("WordPress cron is disabled. Postie will not run unless you have an external cron set up.");
72
+ }
73
+
74
+ EchoInfo("Cron: " . (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON === true ? "Of" : "On"));
75
+ EchoInfo("Alternate Cron: " . (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON === true ? "On" : "Off"));
76
+
77
+ if (defined('WP_CRON_LOCK_TIMEOUT') && WP_CRON_LOCK_TIMEOUT === true) {
78
+ EchoInfo("Cron lock timeout is:" . WP_CRON_LOCK_TIMEOUT);
79
+ }
80
+
81
+ if (HasIconvInstalled()) {
82
+ EchoInfo("iconv: installed");
83
+ } else {
84
+ EchoInfo("Warning! Postie requires that iconv be enabled.");
85
+ }
86
+
87
+ if (function_exists('imap_mime_header_decode')) {
88
+ EchoInfo("imap: installed");
89
+ } else {
90
+ EchoInfo("Warning! Postie requires that imap be enabled if you are using IMAP, IMAP-SSL or POP3-SSL.");
91
+ }
92
+
93
+ if (HasMbStringInstalled()) {
94
+ EchoInfo("mbstring: installed");
95
+ } else {
96
+ EchoInfo("Warning! Postie requires that mbstring be enabled.");
97
+ }
98
+ }
99
+
100
  function postie_disable_revisions($restore = false) {
101
  global $_wp_post_type_features, $_postie_revisions;
102
 
918
  //global $charset, $encoding;
919
  DebugEcho('----');
920
  $meta_return = '';
921
+ if (property_exists($part, "ctype_primary")) {
922
+ DebugEcho("GetContent: primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary);
923
+ //DebugDump($part);
924
+ }
925
 
926
  DecodeBase64Part($part);
927
 
928
  //look for banned file names
929
  if (property_exists($part, 'ctype_parameters') && is_array($part->ctype_parameters) && array_key_exists('name', $part->ctype_parameters))
930
+ if (isBannedFileName($part->ctype_parameters['name'], $banned_files_list)) {
931
  return NULL;
932
+ }
933
 
934
+ if (property_exists($part, "ctype_primary") && $part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") {
935
  if (property_exists($part, 'disposition') && $part->disposition == "attachment") {
936
  //nothing
937
  } else {
944
  }
945
  }
946
 
947
+ if (property_exists($part, "ctype_primary") && $part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") {
948
  DebugEcho("multipart appledouble");
949
  $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body);
950
  filter_PreferedText($mimeDecodedEmail, $prefer_text_type);
965
  DebugEcho("GetContent: file name '$filename'");
966
  DebugEcho("GetContent: extension '$fileext'");
967
 
968
+ $mimetype_primary = "";
969
+ $mimetype_secondary = "";
970
+
971
+ if (property_exists($part, "ctype_primary"))
972
+ $mimetype_primary = strtolower($part->ctype_primary);
973
+ if (property_exists($part, "ctype_secondary"))
974
+ $mimetype_secondary = strtolower($part->ctype_secondary);
975
 
976
  $typeinfo = wp_check_filetype($filename);
977
  //DebugDump($typeinfo);
1321
  }
1322
 
1323
  $resentFrom = "";
1324
+ if (property_exists($mimeDecodedEmail, "headers") && array_key_exists('resent-from', $mimeDecodedEmail->headers)) {
1325
  $resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["resent-from"]));
1326
  }
1327
 
1714
  }
1715
 
1716
  //special case to deal with older png implementations
1717
+ $namecs = "";
1718
+ if (property_exists($part, "ctype_secondary")) {
1719
+ $namecs = strtolower($part->ctype_secondary);
1720
+ if ($namecs == 'x-png') {
1721
+ DebugEcho("postie_media_handle_upload: x-png found, renamed to png");
1722
+ $part->ctype_secondary = 'png';
1723
+ }
1724
  }
1725
 
1726
+ $name = 'postie-media.' . $namecs;
1727
  if (property_exists($part, 'ctype_parameters') && is_array($part->ctype_parameters)) {
1728
  if (array_key_exists('name', $part->ctype_parameters) && $part->ctype_parameters['name'] != '') {
1729
  $name = $part->ctype_parameters['name'];
1923
  * @param object
1924
  */
1925
  function filter_PreferedText($mimeDecodedEmail, $preferTextType) {
1926
+ DebugEcho("filter_PreferedText: begin " . count($mimeDecodedEmail->parts));
1927
  $newParts = array();
1928
  $found = false;
1929
 
1930
  for ($i = 0; $i < count($mimeDecodedEmail->parts); $i++) {
1931
+ if (!property_exists($mimeDecodedEmail->parts[$i], "ctype_primary")) {
1932
+ DebugEcho("filter_PreferedText: missing ctype_primary");
1933
+ //DebugDump($mimeDecodedEmail->parts[$i]);
1934
+ } else {
1935
+ DebugEcho("filter_PreferedText: part: $i " . $mimeDecodedEmail->parts[$i]->ctype_primary . "/" . $mimeDecodedEmail->parts[$i]->ctype_secondary);
1936
+ }
1937
  if (array_key_exists('disposition', $mimeDecodedEmail->parts[$i]) && $mimeDecodedEmail->parts[$i]->disposition == 'attachment') {
1938
+ DebugEcho("filter_PreferedText: found disposition/attachment");
1939
  $newParts[] = $mimeDecodedEmail->parts[$i];
1940
  } else {
1941
  if ($mimeDecodedEmail->parts[$i]->ctype_primary == "text") {
1942
  $ctype = $mimeDecodedEmail->parts[$i]->ctype_secondary;
1943
  if ($ctype == 'html' || $ctype == 'plain') {
1944
+ DebugEcho("filter_PreferedText: checking prefered type");
1945
  if ($ctype == $preferTextType) {
1946
+ DebugEcho("filter_PreferedText: keeping: $ctype");
1947
  DebugEcho(substr($mimeDecodedEmail->parts[$i]->body, 0, 500));
1948
  $newParts[] = $mimeDecodedEmail->parts[$i];
1949
  } else {
1950
+ DebugEcho("filter_PreferedText: removing: $ctype");
1951
  }
1952
  } else {
1953
+ DebugEcho("filter_PreferedText: keeping: {$mimeDecodedEmail->parts[$i]->ctype_primary}");
1954
  $newParts[] = $mimeDecodedEmail->parts[$i];
1955
  }
1956
  } else {
1957
+ DebugEcho("filter_PreferedText: keeping: {$mimeDecodedEmail->parts[$i]->ctype_primary}");
1958
  $newParts[] = $mimeDecodedEmail->parts[$i];
1959
  }
1960
  }
1964
  DebugEcho(count($newParts) . " parts");
1965
  $mimeDecodedEmail->parts = $newParts;
1966
  }
1967
+ DebugEcho("filter_PreferedText: end");
1968
  }
1969
 
1970
  /**
2306
  }
2307
 
2308
  $startIndex = $config['start_image_count_at_zero'] ? 0 : 1;
2309
+
2310
  $images = get_posts(array(
2311
  'post_parent' => $post_id,
2312
  'post_type' => 'attachment',
2313
  'numberposts' => -1,
2314
  'post_mime_type' => 'image',));
2315
+ DebugEcho("images in post: " . count($images));
2316
 
2317
  if ((count($images) > 0) && $config['auto_gallery']) {
2318
  $imageTemplate = '[gallery]';
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.11
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 721846 2013-06-02 23:31:00Z WayneAllen $
31
  */
32
 
33
- define('POSTIE_VERSION', '1.5.11');
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.12
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 724558 2013-06-09 01:26:50Z WayneAllen $
31
  */
32
 
33
+ define('POSTIE_VERSION', '1.5.12');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
postie_test.php CHANGED
@@ -15,56 +15,11 @@ if (!current_user_can('manage_options')) {
15
  echo "<h2> Sorry only admin can run this file</h2>";
16
  exit();
17
  }
18
- DebugEcho("Error log: " . ini_get('error_log'));
19
  ?>
20
  <div class="wrap">
21
  <h1>Postie Configuration Test</h1>
22
  <?php
23
- if (isMarkdownInstalled()) {
24
- EchoInfo("You currently have the Markdown plugin installed. It will cause problems if you send in HTML email. Please turn it off if you intend to send email using HTML.");
25
- }
26
-
27
- if (!isPostieInCorrectDirectory()) {
28
- EchoInfo("Warning! Postie expects to be in its own directory named postie.");
29
- } else {
30
- EchoInfo("Postie is in " . dirname(__FILE__));
31
- }
32
- if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
33
- EchoInfo("Alternate cron is enabled");
34
- }
35
-
36
- if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) {
37
- EchoInfo("WordPress cron is disabled. Postie will not run unless you have an external cron set up.");
38
- }
39
-
40
- EchoInfo("Cron: " . (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON === true ? "Of" : "On"));
41
- EchoInfo("Alternate Cron: " . (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON === true ? "On" : "Off"));
42
-
43
- if (defined('WP_CRON_LOCK_TIMEOUT') && WP_CRON_LOCK_TIMEOUT === true) {
44
- EchoInfo("Cron lock timeout is:" . WP_CRON_LOCK_TIMEOUT);
45
- }
46
- ?>
47
-
48
- <br/>
49
- <h2>International support</h2>
50
- <?php
51
- if (HasIconvInstalled()) {
52
- EchoInfo("iconv: installed");
53
- } else {
54
- EchoInfo("Warning! Postie requires that iconv be enabled.");
55
- }
56
-
57
- if (function_exists('imap_mime_header_decode')) {
58
- EchoInfo("imap: installed");
59
- } else {
60
- EchoInfo("Warning! Postie requires that imap be enabled if you are using IMAP, IMAP-SSL or POP3-SSL.");
61
- }
62
-
63
- if (HasMbStringInstalled()) {
64
- EchoInfo("mbstring: installed");
65
- } else {
66
- EchoInfo("Warning! Postie requires that mbstring be enabled.");
67
- }
68
  ?>
69
 
70
  <h2>Clock Tests</h2>
15
  echo "<h2> Sorry only admin can run this file</h2>";
16
  exit();
17
  }
 
18
  ?>
19
  <div class="wrap">
20
  <h1>Postie Configuration Test</h1>
21
  <?php
22
+ postie_environment();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  ?>
24
 
25
  <h2>Clock Tests</h2>
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.11
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.11 (2013.06.02) =
449
  * Moved test files out of main repository to decrease plugin size
450
  * Fixed issue with readme file (Wordpress readme validator moved)
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
+ Stable tag: 1.5.12
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.12 (2013.06.08) =
449
+ * Added full paths to includes in config_form due to some hosts having include_path set in a way that breaks Postie.
450
+ * Added some checks for emails that aren't correctly formatted (AirMail/WinLink)
451
+ * Consolidated environmental checks
452
+ * Added logic for Debian location of wp-config.php
453
+
454
  = 1.5.11 (2013.06.02) =
455
  * Moved test files out of main repository to decrease plugin size
456
  * Fixed issue with readme file (Wordpress readme validator moved)